@microsoft/applicationinsights-core-js 2.7.5-nightly.2204-03 → 2.7.6

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 (160) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +774 -1973
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.api.json +9840 -16439
  7. package/dist/applicationinsights-core-js.api.md +48 -425
  8. package/dist/applicationinsights-core-js.d.ts +123 -784
  9. package/dist/applicationinsights-core-js.js +774 -1973
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +123 -784
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +69 -3
  15. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseCore.js +99 -496
  17. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +21 -120
  19. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  20. package/dist-esm/JavaScriptSDK/ChannelController.js +87 -202
  21. package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  23. package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
  24. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  25. package/dist-esm/JavaScriptSDK/CoreUtils.js +148 -7
  26. package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
  27. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  28. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +14 -27
  29. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  30. package/dist-esm/JavaScriptSDK/EnvUtils.js +12 -13
  31. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  32. package/dist-esm/JavaScriptSDK/HelperFuncs.js +86 -89
  33. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  34. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -3
  35. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  36. package/dist-esm/JavaScriptSDK/NotificationManager.js +42 -37
  37. package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
  38. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  39. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +119 -430
  40. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  41. package/dist-esm/JavaScriptSDK/RandomHelper.js +4 -30
  42. package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
  43. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +14 -60
  44. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  45. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +76 -0
  46. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +1 -0
  47. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +96 -90
  49. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  50. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +2 -1
  52. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
  53. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  54. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  56. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +2 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
  68. package/dist-esm/applicationinsights-core-js.js +7 -12
  69. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  70. package/package.json +67 -70
  71. package/src/JavaScriptSDK/AppInsightsCore.ts +101 -2
  72. package/src/JavaScriptSDK/BaseCore.ts +120 -696
  73. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +31 -205
  74. package/src/JavaScriptSDK/ChannelController.ts +103 -242
  75. package/src/JavaScriptSDK/CookieMgr.ts +5 -7
  76. package/src/JavaScriptSDK/CoreUtils.ts +172 -8
  77. package/src/JavaScriptSDK/DiagnosticLogger.ts +14 -29
  78. package/src/JavaScriptSDK/EnvUtils.ts +12 -13
  79. package/src/JavaScriptSDK/HelperFuncs.ts +97 -123
  80. package/src/JavaScriptSDK/InstrumentHooks.ts +2 -4
  81. package/src/JavaScriptSDK/NotificationManager.ts +37 -34
  82. package/src/JavaScriptSDK/PerfManager.ts +7 -4
  83. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +134 -543
  84. package/src/JavaScriptSDK/RandomHelper.ts +3 -35
  85. package/src/JavaScriptSDK/TelemetryHelpers.ts +21 -83
  86. package/src/JavaScriptSDK/TelemetryPluginChain.ts +120 -0
  87. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +87 -184
  88. package/src/JavaScriptSDK.Enums/SendRequestReason.ts +0 -5
  89. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +2 -82
  90. package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +5 -16
  91. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +6 -16
  92. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +14 -94
  93. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +10 -28
  94. package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +11 -9
  95. package/types/JavaScriptSDK/AppInsightsCore.d.ts +21 -0
  96. package/types/JavaScriptSDK/BaseCore.d.ts +3 -81
  97. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +10 -53
  98. package/types/JavaScriptSDK/ChannelController.d.ts +17 -16
  99. package/types/JavaScriptSDK/CoreUtils.d.ts +48 -1
  100. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +0 -10
  101. package/types/JavaScriptSDK/HelperFuncs.d.ts +32 -33
  102. package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
  103. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +6 -69
  104. package/types/JavaScriptSDK/RandomHelper.d.ts +0 -6
  105. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +3 -23
  106. package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +32 -0
  107. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +2 -91
  108. package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +0 -4
  109. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +1 -72
  110. package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +5 -16
  111. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +0 -9
  112. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +11 -82
  113. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +8 -25
  114. package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +10 -9
  115. package/types/applicationinsights-core-js.d.ts +9 -18
  116. package/types/tsdoc-metadata.json +1 -1
  117. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +0 -93
  118. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +0 -1
  119. package/dist-esm/JavaScriptSDK/EventHelpers.js +0 -477
  120. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +0 -1
  121. package/dist-esm/JavaScriptSDK/InternalConstants.js +0 -28
  122. package/dist-esm/JavaScriptSDK/InternalConstants.js.map +0 -1
  123. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +0 -81
  124. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +0 -1
  125. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +0 -33
  126. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +0 -1
  127. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +0 -8
  128. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +0 -1
  129. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +0 -8
  130. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +0 -1
  131. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +0 -6
  132. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +0 -1
  133. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +0 -8
  134. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +0 -1
  135. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +0 -8
  136. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +0 -1
  137. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +0 -6
  138. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +0 -1
  139. package/src/JavaScriptSDK/DataCacheHelper.ts +0 -106
  140. package/src/JavaScriptSDK/EventHelpers.ts +0 -550
  141. package/src/JavaScriptSDK/InternalConstants.ts +0 -26
  142. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +0 -111
  143. package/src/JavaScriptSDK/UnloadHandlerContainer.ts +0 -46
  144. package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +0 -27
  145. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +0 -27
  146. package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +0 -16
  147. package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +0 -10
  148. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +0 -34
  149. package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +0 -17
  150. package/types/JavaScriptSDK/DataCacheHelper.d.ts +0 -13
  151. package/types/JavaScriptSDK/EventHelpers.d.ts +0 -154
  152. package/types/JavaScriptSDK/InternalConstants.d.ts +0 -20
  153. package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -16
  154. package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +0 -11
  155. package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +0 -21
  156. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +0 -20
  157. package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +0 -13
  158. package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +0 -6
  159. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +0 -22
  160. package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +0 -13
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.7.5-nightly.2204-03
2
+ * Microsoft Application Insights Core Javascript SDK, 2.7.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -14,61 +14,39 @@ declare namespace ApplicationInsights {
14
14
  import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights-shims';
15
15
  import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
16
16
 
17
- /**
18
- * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
19
- * applications to remove their own events
20
- * @param target - The EventTarget that has registered events
21
- * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
22
- * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
23
- * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
24
- */
25
- function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
26
-
27
17
  /**
28
18
  * Trys to add an event handler for the specified event to the window, body and document
29
19
  * @param eventName {string} - The name of the event
30
20
  * @param callback {any} - The callback function that needs to be executed for the given event
31
- * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
32
21
  * @return {boolean} - true if the handler was successfully added
33
22
  */
34
- function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
23
+ function addEventHandler(eventName: string, callback: any): boolean;
35
24
 
36
25
  /**
37
26
  * Bind the listener to the array of events
38
27
  * @param events An string array of event names to bind the listener to
39
28
  * @param listener The event callback to call when the event is triggered
40
29
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
41
- * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
42
30
  * @returns true - when at least one of the events was registered otherwise false
43
31
  */
44
- function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
32
+ function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
45
33
 
46
34
  /**
47
- * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
48
- * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
49
- * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
35
+ * Listen to the pagehide and visibility changing to 'hidden' events
50
36
  * @param listener - The event callback to call when a page hide event is triggered
51
37
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
52
- * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
53
- * based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
54
- * so that only the matching "removePageHideEventListener" can remove these events.
55
38
  * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
56
39
  * @returns true - when at least one of the events was registered otherwise false
57
40
  */
58
- function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
41
+ function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
59
42
 
60
43
  /**
61
- * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
62
- * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
63
- * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
44
+ * Listen to the pageshow and visibility changing to 'visible' events
64
45
  * @param listener - The event callback to call when a page is show event is triggered
65
46
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
66
- * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
67
- * identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
68
- * so that only the matching "removePageShowEventListener" can remove these events.
69
47
  * @returns true - when at least one of the events was registered otherwise false
70
48
  */
71
- function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
49
+ function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
72
50
 
73
51
  /**
74
52
  * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
@@ -78,15 +56,34 @@ declare namespace ApplicationInsights {
78
56
  * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
79
57
  * @param listener - The event callback to call when a page unload event is triggered
80
58
  * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
81
- * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
82
59
  * @returns true - when at least one of the events was registered otherwise false
83
60
  */
84
- function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
61
+ function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
85
62
 
86
63
  class AppInsightsCore extends BaseCore implements IAppInsightsCore {
87
64
  constructor();
88
65
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
89
66
  track(telemetryItem: ITelemetryItem): void;
67
+ /**
68
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
69
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
70
+ * called.
71
+ * @param {INotificationListener} listener - An INotificationListener object.
72
+ */
73
+ addNotificationListener(listener: INotificationListener): void;
74
+ /**
75
+ * Removes all instances of the listener.
76
+ * @param {INotificationListener} listener - INotificationListener to remove.
77
+ */
78
+ removeNotificationListener(listener: INotificationListener): void;
79
+ /**
80
+ * Periodically check logger.queue for
81
+ */
82
+ pollInternalLogs(eventName?: string): number;
83
+ /**
84
+ * Periodically check logger.queue for
85
+ */
86
+ stopPollingInternalLogs(): void;
90
87
  }
91
88
 
92
89
  function areCookiesSupported(logger?: IDiagnosticLogger): any;
@@ -99,7 +96,7 @@ declare namespace ApplicationInsights {
99
96
  * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
100
97
  * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
101
98
  */
102
- function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
99
+ function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
103
100
 
104
101
  /**
105
102
  * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
@@ -134,7 +131,7 @@ declare namespace ApplicationInsights {
134
131
  /**
135
132
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
136
133
  * @param obj Object to add the event too.
137
- * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
134
+ * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
138
135
  * @param handlerRef Pointer that specifies the function to call when event fires
139
136
  * @param useCapture [Optional] Defaults to false
140
137
  * @returns True if the function was bound successfully to the event, otherwise false
@@ -153,18 +150,6 @@ declare namespace ApplicationInsights {
153
150
  track(telemetryItem: ITelemetryItem): void;
154
151
  getProcessTelContext(): IProcessTelemetryContext;
155
152
  getNotifyMgr(): INotificationManager;
156
- /**
157
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
158
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
159
- * called.
160
- * @param {INotificationListener} listener - An INotificationListener object.
161
- */
162
- addNotificationListener(listener: INotificationListener): void;
163
- /**
164
- * Removes all instances of the listener.
165
- * @param {INotificationListener} listener - INotificationListener to remove.
166
- */
167
- removeNotificationListener(listener: INotificationListener): void;
168
153
  /**
169
154
  * Get the current cookie manager for this instance
170
155
  */
@@ -177,67 +162,7 @@ declare namespace ApplicationInsights {
177
162
  getPerfMgr(): IPerfManager;
178
163
  setPerfMgr(perfMgr: IPerfManager): void;
179
164
  eventCnt(): number;
180
- /**
181
- * Periodically check logger.queue for
182
- */
183
- pollInternalLogs(eventName?: string): number;
184
- /**
185
- * Periodically check logger.queue for
186
- */
187
- stopPollingInternalLogs(): void;
188
- /**
189
- * Add a telemetry processor to decorate or drop telemetry events.
190
- * @param telemetryInitializer - The Telemetry Initializer function
191
- * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
192
- */
193
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
194
- /**
195
- * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
196
- * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
197
- * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
198
- * approach is to create a new instance and initialize that instance.
199
- * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
200
- * to successfully remove any global references or they may just be completing the unload process asynchronously.
201
- * @param isAsync - Can the unload be performed asynchronously (default)
202
- * @param unloadComplete - An optional callback that will be called once the unload has completed
203
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
204
- */
205
- unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
206
- getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
207
- /**
208
- * Add a new plugin to the installation
209
- * @param plugin - The new plugin to add
210
- * @param replaceExisting - should any existing plugin be replaced, default is false
211
- * @param doAsync - Should the add be performed asynchronously
212
- * @param addCb - [Optional] callback to call after the plugin has been added
213
- */
214
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
215
- /**
216
- * Returns the unique event namespace that should be used
217
- */
218
- evtNamespace(): string;
219
- /**
220
- * Add an unload handler that will be called when the SDK is being unloaded
221
- * @param handler - the handler
222
- */
223
- addUnloadCb(handler: UnloadHandler): void;
224
- /**
225
- * Flush and send any batched / cached data immediately
226
- * @param async - send data asynchronously when true (defaults to true)
227
- * @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.
228
- * If the caller doesn't return true the caller should assume that it may never be called.
229
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
230
- * @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
231
- */
232
- flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
233
165
  protected releaseQueue(): void;
234
- /**
235
- * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
236
- * @param updateCtx - The plugin update context
237
- * @param updateState - The Update State
238
- * @returns boolean - True means the extension class will call updateState otherwise the Core will
239
- */
240
- protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
241
166
  }
242
167
 
243
168
  /**
@@ -246,13 +171,6 @@ declare namespace ApplicationInsights {
246
171
  * implementation so that new default implementations can be added without breaking all plugins.
247
172
  */
248
173
  abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
249
- identifier: string;
250
- version?: string;
251
- /**
252
- * Holds the core instance that was used during initialization
253
- */
254
- core: IAppInsightsCore;
255
- priority: number;
256
174
  /**
257
175
  * Call back for telemetry processing before it it is sent
258
176
  * @param env - This is the current event being reported
@@ -274,6 +192,13 @@ declare namespace ApplicationInsights {
274
192
  * Returns whether the plugin has been initialized
275
193
  */
276
194
  isInitialized: () => boolean;
195
+ identifier: string;
196
+ version?: string;
197
+ /**
198
+ * Holds the core instance that was used during initialization
199
+ */
200
+ core: IAppInsightsCore;
201
+ priority: number;
277
202
  /**
278
203
  * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
279
204
  * returns that value (helps with minification for callers), otherwise it will return the configured
@@ -286,51 +211,12 @@ declare namespace ApplicationInsights {
286
211
  */
287
212
  protected setInitialized: (isInitialized: boolean) => void;
288
213
  /**
289
- * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
290
- * finishes it's removal.
291
- * @param unloadCtx - This is the context that should be used during unloading.
292
- * @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.
293
- * @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.
294
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
214
+ * Internal helper to initialize the instance
295
215
  */
296
- protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
297
- /**
298
- * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
299
- * @param updateCtx - This is the context that should be used during updating.
300
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
301
- * @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.
302
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
303
- */
304
- protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
216
+ private _baseTelInit;
305
217
  constructor();
306
218
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
307
- /**
308
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
309
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
310
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
311
- * @param unloadCtx - This is the context that should be used during unloading.
312
- * @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.
313
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
314
- */
315
- teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
316
219
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
317
- /**
318
- * The the plugin should re-evaluate configuration and update any cached configuration settings.
319
- * @param updateCtx - This is the context that should be used during updating.
320
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
321
- * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
322
- */
323
- update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
324
- /**
325
- * Add an unload handler that will be called when the SDK is being unloaded
326
- * @param handler - the handler
327
- */
328
- protected _addUnloadCb(handler: UnloadHandler): void;
329
- /**
330
- * Add this hook so that it is automatically removed during unloading
331
- * @param hooks - The single hook or an array of IInstrumentHook objects
332
- */
333
- protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
334
220
  }
335
221
 
336
222
  /**
@@ -356,29 +242,6 @@ declare namespace ApplicationInsights {
356
242
 
357
243
  function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
358
244
 
359
- /**
360
- * Create an enum style object which has both the key => value and value => key mappings
361
- * @param values - The values to populate on the new object
362
- * @returns
363
- */
364
- function createEnumStyle<T>(values: T): T;
365
-
366
- /**
367
- * Creates a new Telemetry Item context with the current config, core and plugin execution chain
368
- * @param plugins - The plugin instances that will be executed
369
- * @param config - The current config
370
- * @param core - The current core instance
371
- * @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
372
- */
373
- function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
374
-
375
- function createUniqueNamespace(name: string, includeVersion?: boolean): string;
376
-
377
- function createUnloadHandlerContainer(): {
378
- add: (handler: UnloadHandler) => void;
379
- run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
380
- };
381
-
382
245
  /**
383
246
  * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
384
247
  * https://caniuse.com/#search=Date.now
@@ -395,11 +258,8 @@ declare namespace ApplicationInsights {
395
258
  /**
396
259
  * Removes an event handler for the specified event
397
260
  * @param Object to remove the event from
398
- * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
399
- * such as "click", "click.mynamespace" or ".mynamespace"
400
- * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
401
- * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
402
- * otherwise this will only remove events with this specific handler.
261
+ * @param eventNameWithoutOn {string} - The name of the event
262
+ * @param handlerRef {any} - The callback function that needs to be executed for the given event
403
263
  * @param useCapture [Optional] Defaults to false
404
264
  */
405
265
  function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
@@ -480,131 +340,8 @@ declare namespace ApplicationInsights {
480
340
  */
481
341
  function dumpObj(object: any): string;
482
342
 
483
- const enum _eInternalMessageId {
484
- BrowserDoesNotSupportLocalStorage = 0,
485
- BrowserCannotReadLocalStorage = 1,
486
- BrowserCannotReadSessionStorage = 2,
487
- BrowserCannotWriteLocalStorage = 3,
488
- BrowserCannotWriteSessionStorage = 4,
489
- BrowserFailedRemovalFromLocalStorage = 5,
490
- BrowserFailedRemovalFromSessionStorage = 6,
491
- CannotSendEmptyTelemetry = 7,
492
- ClientPerformanceMathError = 8,
493
- ErrorParsingAISessionCookie = 9,
494
- ErrorPVCalc = 10,
495
- ExceptionWhileLoggingError = 11,
496
- FailedAddingTelemetryToBuffer = 12,
497
- FailedMonitorAjaxAbort = 13,
498
- FailedMonitorAjaxDur = 14,
499
- FailedMonitorAjaxOpen = 15,
500
- FailedMonitorAjaxRSC = 16,
501
- FailedMonitorAjaxSend = 17,
502
- FailedMonitorAjaxGetCorrelationHeader = 18,
503
- FailedToAddHandlerForOnBeforeUnload = 19,
504
- FailedToSendQueuedTelemetry = 20,
505
- FailedToReportDataLoss = 21,
506
- FlushFailed = 22,
507
- MessageLimitPerPVExceeded = 23,
508
- MissingRequiredFieldSpecification = 24,
509
- NavigationTimingNotSupported = 25,
510
- OnError = 26,
511
- SessionRenewalDateIsZero = 27,
512
- SenderNotInitialized = 28,
513
- StartTrackEventFailed = 29,
514
- StopTrackEventFailed = 30,
515
- StartTrackFailed = 31,
516
- StopTrackFailed = 32,
517
- TelemetrySampledAndNotSent = 33,
518
- TrackEventFailed = 34,
519
- TrackExceptionFailed = 35,
520
- TrackMetricFailed = 36,
521
- TrackPVFailed = 37,
522
- TrackPVFailedCalc = 38,
523
- TrackTraceFailed = 39,
524
- TransmissionFailed = 40,
525
- FailedToSetStorageBuffer = 41,
526
- FailedToRestoreStorageBuffer = 42,
527
- InvalidBackendResponse = 43,
528
- FailedToFixDepricatedValues = 44,
529
- InvalidDurationValue = 45,
530
- TelemetryEnvelopeInvalid = 46,
531
- CreateEnvelopeError = 47,
532
- CannotSerializeObject = 48,
533
- CannotSerializeObjectNonSerializable = 49,
534
- CircularReferenceDetected = 50,
535
- ClearAuthContextFailed = 51,
536
- ExceptionTruncated = 52,
537
- IllegalCharsInName = 53,
538
- ItemNotInArray = 54,
539
- MaxAjaxPerPVExceeded = 55,
540
- MessageTruncated = 56,
541
- NameTooLong = 57,
542
- SampleRateOutOfRange = 58,
543
- SetAuthContextFailed = 59,
544
- SetAuthContextFailedAccountName = 60,
545
- StringValueTooLong = 61,
546
- StartCalledMoreThanOnce = 62,
547
- StopCalledWithoutStart = 63,
548
- TelemetryInitializerFailed = 64,
549
- TrackArgumentsNotSpecified = 65,
550
- UrlTooLong = 66,
551
- SessionStorageBufferFull = 67,
552
- CannotAccessCookie = 68,
553
- IdTooLong = 69,
554
- InvalidEvent = 70,
555
- FailedMonitorAjaxSetRequestHeader = 71,
556
- SendBrowserInfoOnUserInit = 72,
557
- PluginException = 73,
558
- NotificationException = 74,
559
- SnippetScriptLoadFailure = 99,
560
- InvalidInstrumentationKey = 100,
561
- CannotParseAiBlobValue = 101,
562
- InvalidContentBlob = 102,
563
- TrackPageActionEventFailed = 103,
564
- FailedAddingCustomDefinedRequestContext = 104,
565
- InMemoryStorageBufferFull = 105
566
- }
567
-
568
- const enum eLoggingSeverity {
569
- /**
570
- * Error will be sent as internal telemetry
571
- */
572
- CRITICAL = 1,
573
- /**
574
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
575
- */
576
- WARNING = 2
577
- }
578
-
579
343
  const EventHelper: IEventHelper;
580
344
 
581
- /**
582
- * Removes an event handler for the specified event
583
- * @param Object to remove the event from
584
- * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
585
- * such as "click", "click.mynamespace" or ".mynamespace"
586
- * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
587
- * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
588
- * otherwise this will only remove events with this specific handler.
589
- * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
590
- * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
591
- * @param useCapture [Optional] Defaults to false
592
- */
593
- function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
594
-
595
- /**
596
- * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
597
- * @param obj Object to add the event too.
598
- * @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
599
- * namespaces "click" "click.mynamespace" in addition to specific namespaces.
600
- * @param handlerRef Pointer that specifies the function to call when event fires
601
- * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
602
- * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
603
- * @param useCapture [Optional] Defaults to false
604
- * @returns True if the function was bound successfully to the event, otherwise false
605
- */
606
- function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
607
-
608
345
  /**
609
346
  * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
610
347
  */
@@ -674,12 +411,6 @@ declare namespace ApplicationInsights {
674
411
  */
675
412
  function getExceptionName(object: any): string;
676
413
 
677
- const enum GetExtCfgMergeType {
678
- None = 0,
679
- MergeDefaultOnly = 1,
680
- MergeDefaultFromRootOrDefault = 2
681
- }
682
-
683
414
  /**
684
415
  * Get the current global performance manager that will be used with no performance manager is supplied.
685
416
  * @returns - The current default manager
@@ -838,123 +569,12 @@ declare namespace ApplicationInsights {
838
569
  * @param {INotificationListener} listener - INotificationListener to remove.
839
570
  */
840
571
  removeNotificationListener?(listener: INotificationListener): void;
841
- /**
842
- * Add a telemetry processor to decorate or drop telemetry events.
843
- * @param telemetryInitializer - The Telemetry Initializer function
844
- * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
845
- */
846
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
847
572
  pollInternalLogs?(eventName?: string): number;
848
573
  stopPollingInternalLogs?(): void;
849
574
  /**
850
575
  * Return a new instance of the IProcessTelemetryContext for processing events
851
576
  */
852
577
  getProcessTelContext(): IProcessTelemetryContext;
853
- /**
854
- * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
855
- * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
856
- * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
857
- * approach is to create a new instance and initialize that instance.
858
- * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
859
- * to successfully remove any global references or they may just be completing the unload process asynchronously.
860
- * @param isAsync - Can the unload be performed asynchronously (default)
861
- * @param unloadComplete - An optional callback that will be called once the unload has completed
862
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
863
- */
864
- unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
865
- /**
866
- * Find and return the (first) plugin with the specified identifier if present
867
- * @param pluginIdentifier
868
- */
869
- getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
870
- /**
871
- * Add a new plugin to the installation
872
- * @param plugin - The new plugin to add
873
- * @param replaceExisting - should any existing plugin be replaced, default is false
874
- * @param doAsync - Should the add be performed asynchronously
875
- * @param addCb - [Optional] callback to call after the plugin has been added
876
- */
877
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
878
- /**
879
- * Returns the unique event namespace that should be used when registering events
880
- */
881
- evtNamespace(): string;
882
- /**
883
- * Add a handler that will be called when the SDK is being unloaded
884
- * @param handler - the handler
885
- */
886
- addUnloadCb(handler: UnloadHandler): void;
887
- /**
888
- * Flush and send any batched / cached data immediately
889
- * @param async - send data asynchronously when true (defaults to true)
890
- * @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.
891
- * If the caller doesn't return true the caller should assume that it may never be called.
892
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
893
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
894
- * @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
895
- */
896
- flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
897
- }
898
-
899
- interface IBaseProcessingContext {
900
- /**
901
- * The current core instance for the request
902
- */
903
- core: () => IAppInsightsCore;
904
- /**
905
- * THe current diagnostic logger for the request
906
- */
907
- diagLog: () => IDiagnosticLogger;
908
- /**
909
- * Gets the current core config instance
910
- */
911
- getCfg: () => IConfiguration;
912
- /**
913
- * Gets the named extension config
914
- */
915
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
916
- /**
917
- * Gets the named config from either the named identifier extension or core config if neither exist then the
918
- * default value is returned
919
- * @param identifier The named extension identifier
920
- * @param field The config field name
921
- * @param defaultValue The default value to return if no defined config exists
922
- */
923
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
924
- /**
925
- * Helper to allow plugins to check and possibly shortcut executing code only
926
- * required if there is a nextPlugin
927
- */
928
- hasNext: () => boolean;
929
- /**
930
- * Returns the next configured plugin proxy
931
- */
932
- getNext: () => ITelemetryPluginChain;
933
- /**
934
- * Helper to set the next plugin proxy
935
- */
936
- setNext: (nextCtx: ITelemetryPluginChain) => void;
937
- /**
938
- * Synchronously iterate over the context chain running the callback for each plugin, once
939
- * every plugin has been executed via the callback, any associated onComplete will be called.
940
- * @param callback - The function call for each plugin in the context chain
941
- */
942
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
943
- /**
944
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
945
- * @param onComplete - The onComplete to call
946
- * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
947
- * @param args - Any additional arguments to pass to the onComplete function
948
- */
949
- onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
950
- /**
951
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
952
- * @param plugins - The execution order to process the plugins, if null or not supplied
953
- * then the current execution order will be copied.
954
- * @param startAt - The plugin to start processing from, if missing from the execution
955
- * order then the next plugin will be NOT set.
956
- */
957
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
958
578
  }
959
579
 
960
580
  /**
@@ -970,23 +590,15 @@ declare namespace ApplicationInsights {
970
590
  */
971
591
  resume(): void;
972
592
  /**
973
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
974
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
975
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
976
- * @param unloadCtx - This is the context that should be used during unloading.
977
- * @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.
978
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
593
+ * Tear down transmission pipeline
979
594
  */
980
- teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
595
+ teardown(): void;
981
596
  /**
982
597
  * Flush to send data immediately; channel should default to sending data asynchronously
983
- * @param async - send data asynchronously when true
984
- * @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.
985
- * If the caller doesn't return true the caller should assume that it may never be called.
986
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
987
- * @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
598
+ * @param async: send data asynchronously when true
599
+ * @param callBack: if specified, notify caller when send is complete
988
600
  */
989
- flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
601
+ flush(async: boolean, callBack?: () => void): void;
990
602
  }
991
603
 
992
604
  /**
@@ -1346,7 +958,7 @@ declare namespace ApplicationInsights {
1346
958
  * @param callback {any} - The callback function that needs to be executed for the given event
1347
959
  * @return {boolean} - true if the handler was successfully added
1348
960
  */
1349
- addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
961
+ addEventHandler: (eventName: string, callback: any) => boolean;
1350
962
  /**
1351
963
  * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
1352
964
  * https://caniuse.com/#search=Date.now
@@ -1531,10 +1143,6 @@ declare namespace ApplicationInsights {
1531
1143
  * The error (exception) which occurred while executing the original method
1532
1144
  */
1533
1145
  err?: Error;
1534
- /**
1535
- * The Event object from (window.event) at the start of the original call
1536
- */
1537
- evt?: Event;
1538
1146
  }
1539
1147
 
1540
1148
  /**
@@ -1561,11 +1169,6 @@ declare namespace ApplicationInsights {
1561
1169
  * You must always supply the error callback
1562
1170
  */
1563
1171
  interface IInstrumentHooksCallbacks {
1564
- /**
1565
- * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1566
- * identify the source of the instrumented hooks
1567
- */
1568
- ns?: string | string[];
1569
1172
  /**
1570
1173
  * The hook callback to call before the original function is called
1571
1174
  */
@@ -1585,24 +1188,6 @@ declare namespace ApplicationInsights {
1585
1188
  fnErr?: InstrumentorHooksCallback;
1586
1189
  }
1587
1190
 
1588
- interface ILoadedPlugin<T extends IPlugin> {
1589
- plugin: T;
1590
- /**
1591
- * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1592
- * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1593
- * @returns boolean = true if the plugin is in a state where it is operational.
1594
- */
1595
- isEnabled: () => boolean;
1596
- /**
1597
- * You can optionally enable / disable a plugin from processing events.
1598
- * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1599
- * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1600
- * (unless it's also been re-initialized)
1601
- */
1602
- setEnabled: (isEnabled: boolean) => void;
1603
- remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1604
- }
1605
-
1606
1191
  /**
1607
1192
  * Initialize the queue of plugins
1608
1193
  * @param plugins - The array of plugins to initialize and setting of the next plugin
@@ -1610,7 +1195,7 @@ declare namespace ApplicationInsights {
1610
1195
  * @param core THe current core instance
1611
1196
  * @param extensions The extensions
1612
1197
  */
1613
- function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
1198
+ function initializePlugins(processContext: ProcessTelemetryContext, extensions: IPlugin[]): void;
1614
1199
 
1615
1200
  /**
1616
1201
  * An interface used for the notification listener.
@@ -1819,7 +1404,7 @@ declare namespace ApplicationInsights {
1819
1404
  InMemoryStorageBufferFull: number;
1820
1405
  };
1821
1406
 
1822
- type _InternalMessageId = number | _eInternalMessageId;
1407
+ type _InternalMessageId = number | typeof _InternalMessageId;
1823
1408
 
1824
1409
  /**
1825
1410
  * This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
@@ -1940,14 +1525,10 @@ declare namespace ApplicationInsights {
1940
1525
  */
1941
1526
  isInitialized?: () => boolean;
1942
1527
  /**
1943
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
1944
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
1945
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
1946
- * @param unloadCtx - This is the context that should be used during unloading.
1947
- * @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.
1948
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1528
+ * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
1529
+ * therefore can be re-initialized after being torn down.
1949
1530
  */
1950
- teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1531
+ teardown?: () => void;
1951
1532
  /**
1952
1533
  * Extension name
1953
1534
  */
@@ -1962,73 +1543,61 @@ declare namespace ApplicationInsights {
1962
1543
  * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1963
1544
  * between multiple AppInsights instances
1964
1545
  */
1965
- interface IProcessTelemetryContext extends IBaseProcessingContext {
1546
+ interface IProcessTelemetryContext {
1966
1547
  /**
1967
- * Call back for telemetry processing before it it is sent
1968
- * @param env - This is the current event being reported
1969
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1548
+ * The current core instance for the request
1970
1549
  */
1971
- processNext: (env: ITelemetryItem) => boolean | void;
1550
+ core: () => IAppInsightsCore;
1972
1551
  /**
1973
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
1974
- * @param plugins - The execution order to process the plugins, if null or not supplied
1975
- * then the current execution order will be copied.
1976
- * @param startAt - The plugin to start processing from, if missing from the execution
1977
- * order then the next plugin will be NOT set.
1552
+ * THe current diagnostic logger for the request
1978
1553
  */
1979
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
1980
- }
1981
-
1982
- /**
1983
- * The current context for the current call to teardown() implementations, used to support when plugins are being removed
1984
- * or the SDK is being unloaded.
1985
- */
1986
- interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1554
+ diagLog: () => IDiagnosticLogger;
1987
1555
  /**
1988
- * This Plugin has finished unloading, so unload the next one
1989
- * @param uploadState - The state of the unload process
1990
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1556
+ * Gets the current core config instance
1991
1557
  */
1992
- processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
1558
+ getCfg: () => IConfiguration;
1993
1559
  /**
1994
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
1995
- * @param plugins - The execution order to process the plugins, if null or not supplied
1996
- * then the current execution order will be copied.
1997
- * @param startAt - The plugin to start processing from, if missing from the execution
1998
- * order then the next plugin will be NOT set.
1560
+ * Gets the named extension config
1999
1561
  */
2000
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
2001
- }
2002
-
2003
- /**
2004
- * The current context for the current call to the plugin update() implementations, used to support the notifications
2005
- * for when plugins are added, removed or the configuration was changed.
2006
- */
2007
- interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
1562
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
1563
+ /**
1564
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
1565
+ * default value is returned
1566
+ * @param identifier The named extension identifier
1567
+ * @param field The config field name
1568
+ * @param defaultValue The default value to return if no defined config exists
1569
+ */
1570
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
1571
+ /**
1572
+ * Helper to allow plugins to check and possibly shortcut executing code only
1573
+ * required if there is a nextPlugin
1574
+ */
1575
+ hasNext: () => boolean;
1576
+ /**
1577
+ * Returns the next configured plugin proxy
1578
+ */
1579
+ getNext: () => ITelemetryPluginChain;
2008
1580
  /**
2009
- * This Plugin has finished unloading, so unload the next one
2010
- * @param updateState - The update State
2011
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1581
+ * Helper to set the next plugin proxy
1582
+ */
1583
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
1584
+ /**
1585
+ * Call back for telemetry processing before it it is sent
1586
+ * @param env - This is the current event being reported
2012
1587
  */
2013
- processNext: (updateState: ITelemetryUpdateState) => boolean | void;
1588
+ processNext: (env: ITelemetryItem) => void;
2014
1589
  /**
2015
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
1590
+ * Create a new context using the core and config from the current instance
2016
1591
  * @param plugins - The execution order to process the plugins, if null or not supplied
2017
1592
  * then the current execution order will be copied.
2018
1593
  * @param startAt - The plugin to start processing from, if missing from the execution
2019
1594
  * order then the next plugin will be NOT set.
2020
1595
  */
2021
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
2022
- }
2023
-
2024
- interface _IRegisteredEvents {
2025
- name: string;
2026
- handler: any;
1596
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2027
1597
  }
2028
1598
 
2029
1599
  /**
2030
- * Check if an object is of type Array with optional generic T, the generic type is not validated
2031
- * and exists to help with TypeScript validation only.
1600
+ * Check if an object is of type Array
2032
1601
  */
2033
1602
  let isArray: <T = any>(obj: any) => obj is Array<T>;
2034
1603
 
@@ -2069,13 +1638,13 @@ declare namespace ApplicationInsights {
2069
1638
  */
2070
1639
  function isIE(): boolean;
2071
1640
 
2072
- function isNotNullOrUndefined<T>(value: T): value is T;
1641
+ function isNotNullOrUndefined(value: any): boolean;
2073
1642
 
2074
1643
  function isNotTruthy(value: any): boolean;
2075
1644
 
2076
- function isNotUndefined<T>(value: T): value is T;
1645
+ function isNotUndefined(value: any): boolean;
2077
1646
 
2078
- function isNullOrUndefined(value: any): value is null | undefined;
1647
+ function isNullOrUndefined(value: any): boolean;
2079
1648
 
2080
1649
  /**
2081
1650
  * Checks if the type of value is a number.
@@ -2084,7 +1653,7 @@ declare namespace ApplicationInsights {
2084
1653
  */
2085
1654
  function isNumber(value: any): value is number;
2086
1655
 
2087
- function isObject<T>(value: T): value is T;
1656
+ function isObject(value: any): boolean;
2088
1657
 
2089
1658
  /**
2090
1659
  * Returns whether the environment is reporting that we are running in a React Native Environment
@@ -2112,7 +1681,7 @@ declare namespace ApplicationInsights {
2112
1681
 
2113
1682
  function isTypeof(value: any, theType: string): boolean;
2114
1683
 
2115
- function isUndefined(value: any): value is undefined;
1684
+ function isUndefined(value: any): boolean;
2116
1685
 
2117
1686
  /**
2118
1687
  * Checks if XMLHttpRequest is supported
@@ -2120,19 +1689,6 @@ declare namespace ApplicationInsights {
2120
1689
  */
2121
1690
  function isXhrSupported(): boolean;
2122
1691
 
2123
- interface ITelemetryInitializerContainer {
2124
- /**
2125
- * Add a telemetry processor to decorate or drop telemetry events.
2126
- * @param telemetryInitializer - The Telemetry Initializer function
2127
- * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
2128
- */
2129
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
2130
- }
2131
-
2132
- interface ITelemetryInitializerHandler {
2133
- remove(): void;
2134
- }
2135
-
2136
1692
  /**
2137
1693
  * Telemety item supported in Core
2138
1694
  */
@@ -2182,7 +1738,15 @@ declare namespace ApplicationInsights {
2182
1738
  /**
2183
1739
  * Configuration provided to SDK core
2184
1740
  */
2185
- interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
1741
+ interface ITelemetryPlugin extends IPlugin {
1742
+ /**
1743
+ * Call back for telemetry processing before it it is sent
1744
+ * @param env - This is the current event being reported
1745
+ * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
1746
+ * can optionally use this to access the current core instance or define / pass additional information
1747
+ * to later plugins (vs appending items to the telemetry item)
1748
+ */
1749
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2186
1750
  /**
2187
1751
  * Set next extension for telemetry processing, this is not optional as plugins should use the
2188
1752
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -2198,7 +1762,7 @@ declare namespace ApplicationInsights {
2198
1762
  /**
2199
1763
  * Configuration provided to SDK core
2200
1764
  */
2201
- interface ITelemetryPluginChain extends ITelemetryProcessor {
1765
+ interface ITelemetryPluginChain {
2202
1766
  /**
2203
1767
  * Returns the underlying plugin that is being proxied for the processTelemetry call
2204
1768
  */
@@ -2207,16 +1771,6 @@ declare namespace ApplicationInsights {
2207
1771
  * Returns the next plugin
2208
1772
  */
2209
1773
  getNext: () => ITelemetryPluginChain;
2210
- /**
2211
- * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2212
- * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2213
- * @param unloadCtx - The unload context to use for this call.
2214
- * @param unloadState - The details of the unload operation
2215
- */
2216
- unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2217
- }
2218
-
2219
- interface ITelemetryProcessor {
2220
1774
  /**
2221
1775
  * Call back for telemetry processing before it it is sent
2222
1776
  * @param env - This is the current event being reported
@@ -2224,60 +1778,7 @@ declare namespace ApplicationInsights {
2224
1778
  * can optionally use this to access the current core instance or define / pass additional information
2225
1779
  * to later plugins (vs appending items to the telemetry item)
2226
1780
  */
2227
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2228
- /**
2229
- * The the plugin should re-evaluate configuration and update any cached configuration settings or
2230
- * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2231
- * the configuration has bee updated.
2232
- * @param updateCtx - This is the context that should be used during updating.
2233
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2234
- * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2235
- */
2236
- update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2237
- }
2238
-
2239
- interface ITelemetryUnloadState {
2240
- reason: TelemetryUnloadReason;
2241
- isAsync: boolean;
2242
- flushComplete?: boolean;
2243
- }
2244
-
2245
- interface ITelemetryUpdateState {
2246
- /**
2247
- * Identifies the reason for the update notification, this is a bitwise numeric value
2248
- */
2249
- reason: TelemetryUpdateReason;
2250
- /**
2251
- * If this is a configuration update this was the previous configuration that was used
2252
- */
2253
- /**
2254
- * If this is a configuration update is the new configuration that is being used
2255
- */
2256
- /**
2257
- * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2258
- */
2259
- added?: IPlugin[];
2260
- /**
2261
- * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2262
- */
2263
- removed?: IPlugin[];
2264
- }
2265
-
2266
- interface IUnloadableComponent {
2267
- /**
2268
- * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
2269
- * finishes it's removal.
2270
- * @param unloadCtx - This is the context that should be used during unloading.
2271
- * @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.
2272
- * @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.
2273
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
2274
- */
2275
- _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
2276
- }
2277
-
2278
- interface IUnloadHandlerContainer {
2279
- add: (handler: UnloadHandler) => void;
2280
- run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
1781
+ processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
2281
1782
  }
2282
1783
 
2283
1784
  /**
@@ -2292,14 +1793,16 @@ declare namespace ApplicationInsights {
2292
1793
  */
2293
1794
  function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
2294
1795
 
2295
- const LoggingSeverity: {
2296
- CRITICAL: number;
2297
- WARNING: number;
2298
- };
2299
-
2300
- type LoggingSeverity = number | eLoggingSeverity;
2301
-
2302
- function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
1796
+ enum LoggingSeverity {
1797
+ /**
1798
+ * Error will be sent as internal telemetry
1799
+ */
1800
+ CRITICAL = 1,
1801
+ /**
1802
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
1803
+ */
1804
+ WARNING = 2
1805
+ }
2303
1806
 
2304
1807
  const MinChannelPriorty: number;
2305
1808
 
@@ -2391,27 +1894,13 @@ declare namespace ApplicationInsights {
2391
1894
  */
2392
1895
  function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
2393
1896
 
2394
- /**
2395
- * Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
2396
- * It will NOT merge inherited or non-enumerable properties.
2397
- * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
2398
- * @param obj2 - object to merge.
2399
- * @param obj3 - object to merge.
2400
- * @param obj4 - object to merge.
2401
- * @param obj5 - object to merge.
2402
- * @returns The extended first object.
2403
- */
2404
- function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
2405
-
2406
- 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;
2407
-
2408
1897
  /**
2409
1898
  * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
2410
1899
  * performance optimization to avoid the creation of a new array for large objects
2411
1900
  * @param target The target object to find and process the keys
2412
1901
  * @param callbackfn The function to call with the details
2413
1902
  */
2414
- function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
1903
+ function objForEachKey(target: any, callbackfn: (name: string, value: any) => void): void;
2415
1904
 
2416
1905
  const objFreeze: <T>(value: T) => T;
2417
1906
 
@@ -2425,8 +1914,6 @@ declare namespace ApplicationInsights {
2425
1914
 
2426
1915
  const objSeal: <T>(value: T) => T;
2427
1916
 
2428
- function objToString(obj: any): any;
2429
-
2430
1917
  /**
2431
1918
  * A helper function to assist with JIT performance for objects that have properties added / removed dynamically
2432
1919
  * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
@@ -2482,7 +1969,7 @@ declare namespace ApplicationInsights {
2482
1969
  * Defined as private so it can be visualized via the DebugPlugin
2483
1970
  */
2484
1971
  private ctx;
2485
- constructor(manager?: INotificationManager);
1972
+ constructor(manager: INotificationManager);
2486
1973
  /**
2487
1974
  * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
2488
1975
  * want to monitor this source event.
@@ -2515,17 +2002,13 @@ declare namespace ApplicationInsights {
2515
2002
  */
2516
2003
  function perfNow(): number;
2517
2004
 
2518
- /**
2519
- * This class will be removed!
2520
- * @deprecated use createProcessTelemetryContext() instead
2521
- */
2522
2005
  class ProcessTelemetryContext implements IProcessTelemetryContext {
2523
2006
  /**
2524
2007
  * Gets the current core config instance
2525
2008
  */
2526
2009
  getCfg: () => IConfiguration;
2527
2010
  getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
2528
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
2011
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
2529
2012
  /**
2530
2013
  * Returns the IAppInsightsCore instance for the current request
2531
2014
  */
@@ -2553,34 +2036,19 @@ declare namespace ApplicationInsights {
2553
2036
  * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
2554
2037
  * can optionally use this to access the current core instance or define / pass additional information
2555
2038
  * to later plugins (vs appending items to the telemetry item)
2556
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2557
- */
2558
- processNext: (env: ITelemetryItem) => boolean | void;
2559
- /**
2560
- * Synchronously iterate over the context chain running the callback for each plugin, once
2561
- * every plugin has been executed via the callback, any associated onComplete will be called.
2562
- * @param callback - The function call for each plugin in the context chain
2563
2039
  */
2564
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
2040
+ processNext: (env: ITelemetryItem) => void;
2565
2041
  /**
2566
2042
  * Create a new context using the core and config from the current instance
2567
- * @param plugins - The execution order to process the plugins, if null or not supplied
2568
- * then the current execution order will be copied.
2569
- * @param startAt - The plugin to start processing from, if missing from the execution
2570
- * order then the next plugin will be NOT set.
2571
2043
  */
2572
2044
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2573
- /**
2574
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
2575
- */
2576
- onComplete: (onComplete: () => void) => void;
2577
2045
  /**
2578
2046
  * Creates a new Telemetry Item context with the current config, core and plugin execution chain
2579
2047
  * @param plugins - The plugin instances that will be executed
2580
2048
  * @param config - The current config
2581
2049
  * @param core - The current core instance
2582
2050
  */
2583
- constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
2051
+ constructor(plugins: IPlugin[] | ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
2584
2052
  }
2585
2053
 
2586
2054
  /**
@@ -2597,19 +2065,9 @@ declare namespace ApplicationInsights {
2597
2065
  * @param target - The target object to be assigned with the source properties and functions
2598
2066
  * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2599
2067
  * @param chkSet - An optional callback to determine whether a specific property/function should be proxied
2068
+ * @memberof Initialization
2600
2069
  */
2601
- function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
2602
-
2603
- function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
2604
-
2605
- /**
2606
- * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
2607
- *
2608
- * @param target - The target object to be assigned with the source properties and functions
2609
- * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2610
- * @param functionsToProxy - An array of function names that will be proxied on the target
2611
- */
2612
- function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
2070
+ function proxyAssign(target: any, source: any, chkSet?: (name: string, isFunc?: boolean, source?: any, target?: any) => boolean): any;
2613
2071
 
2614
2072
  /**
2615
2073
  * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
@@ -2624,52 +2082,6 @@ declare namespace ApplicationInsights {
2624
2082
  */
2625
2083
  function randomValue(maxValue: number): number;
2626
2084
 
2627
- /**
2628
- * Trys to remove event handler(s) for the specified event/namespace to the window, body and document
2629
- * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
2630
- * such as "click", "click.mynamespace" or ".mynamespace"
2631
- * @param callback {any} - - The callback function that needs to be removed from the given event, when using a
2632
- * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
2633
- * otherwise this will only remove events with this specific handler.
2634
- * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2635
- */
2636
- function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
2637
-
2638
- /**
2639
- * Remove the listener from the array of events
2640
- * @param events An string array of event names to bind the listener to
2641
- * @param listener The event callback to call when the event is triggered
2642
- * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2643
- */
2644
- function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
2645
-
2646
- /**
2647
- * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
2648
- * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
2649
- * as the remove ignores the listener argument for the 'visibilitychange' event.
2650
- * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2651
- * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2652
- */
2653
- function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2654
-
2655
- /**
2656
- * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
2657
- * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
2658
- * as the remove ignores the listener argument for the 'visibilitychange' event.
2659
- * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2660
- * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2661
- */
2662
- function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2663
-
2664
- /**
2665
- * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
2666
- * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
2667
- * @param listener - The specific event callback to to be removed
2668
- * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
2669
- * @returns true - when at least one of the events was registered otherwise false
2670
- */
2671
- function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
2672
-
2673
2085
  /**
2674
2086
  * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
2675
2087
  * associated with the configuration or a legacy default.
@@ -2713,10 +2125,6 @@ declare namespace ApplicationInsights {
2713
2125
  * The event(s) being sent as a retry
2714
2126
  */
2715
2127
  Retry = 5,
2716
- /**
2717
- * The SDK is unloading
2718
- */
2719
- SdkUnload = 6,
2720
2128
  /**
2721
2129
  * Maximum batch size would be exceeded
2722
2130
  */
@@ -2755,9 +2163,9 @@ declare namespace ApplicationInsights {
2755
2163
  * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
2756
2164
  * @returns The existing or new value, depending what was set
2757
2165
  */
2758
- 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];
2166
+ function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
2759
2167
 
2760
- function sortPlugins<T = IPlugin>(plugins: T[]): T[];
2168
+ function sortPlugins(plugins: IPlugin[]): IPlugin[];
2761
2169
 
2762
2170
  /**
2763
2171
  * A simple wrapper (for minification support) to check if the value contains the search string.
@@ -2803,64 +2211,8 @@ declare namespace ApplicationInsights {
2803
2211
  [key: string]: any;
2804
2212
  }
2805
2213
 
2806
- type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2807
-
2808
- /**
2809
- * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2810
- */
2811
- const enum TelemetryUnloadReason {
2812
- /**
2813
- * Teardown has been called without any context.
2814
- */
2815
- ManualTeardown = 0,
2816
- /**
2817
- * Just this plugin is being removed
2818
- */
2819
- PluginUnload = 1,
2820
- /**
2821
- * This instance of the plugin is being removed and replaced
2822
- */
2823
- PluginReplace = 2,
2824
- /**
2825
- * The entire SDK is being unloaded
2826
- */
2827
- SdkUnload = 50
2828
- }
2829
-
2830
- /**
2831
- * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2832
- */
2833
- const enum TelemetryUpdateReason {
2834
- /**
2835
- * Unknown.
2836
- */
2837
- Unknown = 0,
2838
- /**
2839
- * The configuration has ben updated or changed
2840
- */
2841
- /**
2842
- * One or more plugins have been added
2843
- */
2844
- PluginAdded = 16,
2845
- /**
2846
- * One or more plugins have been removed
2847
- */
2848
- PluginRemoved = 32
2849
- }
2850
-
2851
2214
  function throwError(message: string): never;
2852
2215
 
2853
- /**
2854
- * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
2855
- * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
2856
- * support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
2857
- * the code.
2858
- * @param logger - The Diagnostic Logger instance to use.
2859
- * @param severity {LoggingSeverity} - The severity of the log message
2860
- * @param message {_InternalLogMessage} - The log message.
2861
- */
2862
- function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
2863
-
2864
2216
  /**
2865
2217
  * Convert a date to I.S.O. format in IE8
2866
2218
  */
@@ -2870,19 +2222,6 @@ declare namespace ApplicationInsights {
2870
2222
 
2871
2223
  const Undefined = "undefined";
2872
2224
 
2873
- /**
2874
- * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any
2875
- * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.
2876
- * @param components - The components you want to unload
2877
- * @param unloadCtx - This is the context that should be used during unloading.
2878
- * @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.
2879
- * @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.
2880
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
2881
- */
2882
- function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
2883
-
2884
- type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2885
-
2886
2225
  function useXDomainRequest(): boolean | undefined;
2887
2226
 
2888
2227