@microsoft/applicationinsights-core-js 3.0.0-beta.2210-01 → 3.0.0-beta.2210-03

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 (178) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +1249 -675
  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 +3680 -1694
  7. package/dist/applicationinsights-core-js.api.md +126 -46
  8. package/dist/applicationinsights-core-js.d.ts +327 -124
  9. package/dist/applicationinsights-core-js.js +1249 -675
  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 +327 -124
  14. package/dist-esm/Config/ConfigDefaults.js +114 -0
  15. package/dist-esm/Config/ConfigDefaults.js.map +1 -0
  16. package/dist-esm/Config/DynamicConfig.js +129 -0
  17. package/dist-esm/Config/DynamicConfig.js.map +1 -0
  18. package/dist-esm/Config/DynamicProperty.js +139 -0
  19. package/dist-esm/Config/DynamicProperty.js.map +1 -0
  20. package/dist-esm/Config/DynamicState.js +109 -0
  21. package/dist-esm/Config/DynamicState.js.map +1 -0
  22. package/dist-esm/Config/DynamicSupport.js +57 -0
  23. package/dist-esm/Config/DynamicSupport.js.map +1 -0
  24. package/dist-esm/Config/IConfigDefaults.js +8 -0
  25. package/dist-esm/Config/IConfigDefaults.js.map +1 -0
  26. package/dist-esm/Config/IDynamicConfigHandler.js +8 -0
  27. package/dist-esm/Config/IDynamicConfigHandler.js.map +1 -0
  28. package/dist-esm/Config/IDynamicPropertyHandler.js +8 -0
  29. package/dist-esm/Config/IDynamicPropertyHandler.js.map +1 -0
  30. package/dist-esm/Config/IDynamicWatcher.js +8 -0
  31. package/dist-esm/Config/IDynamicWatcher.js.map +1 -0
  32. package/dist-esm/Config/_IDynamicConfigHandlerState.js +6 -0
  33. package/dist-esm/Config/_IDynamicConfigHandlerState.js.map +1 -0
  34. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +808 -23
  35. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  36. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +22 -18
  37. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  38. package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
  39. package/dist-esm/JavaScriptSDK/CookieMgr.js +78 -38
  40. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  41. package/dist-esm/JavaScriptSDK/CoreUtils.js +6 -5
  42. package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
  43. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +10 -8
  44. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  45. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  46. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +40 -23
  47. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  48. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -115
  49. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  50. package/dist-esm/JavaScriptSDK/EventHelpers.js +30 -29
  51. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
  52. package/dist-esm/JavaScriptSDK/HelperFuncs.js +19 -34
  53. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  54. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  55. package/dist-esm/JavaScriptSDK/InternalConstants.js +5 -1
  56. package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -1
  57. package/dist-esm/JavaScriptSDK/NotificationManager.js +18 -11
  58. package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
  59. package/dist-esm/JavaScriptSDK/PerfManager.js +2 -3
  60. package/dist-esm/JavaScriptSDK/PerfManager.js.map +1 -1
  61. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +62 -53
  62. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  63. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  64. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +8 -10
  65. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  66. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -4
  67. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
  68. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  69. package/dist-esm/JavaScriptSDK/W3cTraceParent.js +12 -10
  70. package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -1
  71. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -2
  72. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -1
  73. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +2 -107
  75. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  76. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  77. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  78. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  79. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  80. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  81. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  82. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  83. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  84. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  85. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  86. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  87. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  88. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  89. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  90. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  91. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  92. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  93. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  94. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  95. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  96. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  97. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  98. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  99. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +8 -0
  100. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js.map +1 -0
  101. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +3 -1
  102. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -1
  103. package/dist-esm/__DynamicConstants.js +26 -23
  104. package/dist-esm/__DynamicConstants.js.map +1 -1
  105. package/dist-esm/applicationinsights-core-js.js +6 -4
  106. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  107. package/package.json +2 -2
  108. package/src/JavaScriptSDK/AppInsightsCore.ts +1156 -16
  109. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +25 -17
  110. package/src/JavaScriptSDK/CookieMgr.ts +88 -41
  111. package/src/JavaScriptSDK/CoreUtils.ts +4 -3
  112. package/src/JavaScriptSDK/DiagnosticLogger.ts +45 -23
  113. package/src/JavaScriptSDK/EnvUtils.ts +0 -133
  114. package/src/JavaScriptSDK/EventHelpers.ts +29 -28
  115. package/src/JavaScriptSDK/HelperFuncs.ts +22 -39
  116. package/src/JavaScriptSDK/InternalConstants.ts +5 -0
  117. package/src/JavaScriptSDK/NotificationManager.ts +25 -14
  118. package/src/JavaScriptSDK/PerfManager.ts +2 -2
  119. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +73 -56
  120. package/src/JavaScriptSDK/TelemetryHelpers.ts +8 -9
  121. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +2 -2
  122. package/src/JavaScriptSDK/W3cTraceParent.ts +7 -6
  123. package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +0 -1
  124. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +9 -108
  125. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +1 -1
  126. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +28 -3
  127. package/src/JavaScriptSDK.Interfaces/ICookieMgr.ts +8 -0
  128. package/src/JavaScriptSDK.Interfaces/IDiagnosticLogger.ts +14 -7
  129. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +3 -1
  130. package/src/JavaScriptSDK.Interfaces/INotificationListener.ts +5 -5
  131. package/src/JavaScriptSDK.Interfaces/INotificationManager.ts +8 -8
  132. package/src/JavaScriptSDK.Interfaces/IPerfManager.ts +3 -3
  133. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +10 -9
  134. package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +2 -1
  135. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +15 -5
  136. package/src/JavaScriptSDK.Interfaces/IUnloadHook.ts +22 -0
  137. package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +3 -3
  138. package/tsconfig.json +3 -2
  139. package/types/Config/ConfigDefaults.d.ts +10 -0
  140. package/types/Config/DynamicConfig.d.ts +23 -0
  141. package/types/Config/DynamicProperty.d.ts +3 -0
  142. package/types/Config/DynamicState.d.ts +3 -0
  143. package/types/Config/DynamicSupport.d.ts +15 -0
  144. package/types/Config/IConfigDefaults.d.ts +42 -0
  145. package/types/Config/IDynamicConfigHandler.d.ts +46 -0
  146. package/types/Config/IDynamicPropertyHandler.d.ts +11 -0
  147. package/types/Config/IDynamicWatcher.d.ts +28 -0
  148. package/types/Config/_IDynamicConfigHandlerState.d.ts +35 -0
  149. package/types/JavaScriptSDK/AppInsightsCore.d.ts +136 -4
  150. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +2 -2
  151. package/types/JavaScriptSDK/CookieMgr.d.ts +0 -10
  152. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +13 -11
  153. package/types/JavaScriptSDK/EventHelpers.d.ts +24 -24
  154. package/types/JavaScriptSDK/HelperFuncs.d.ts +13 -11
  155. package/types/JavaScriptSDK/InternalConstants.d.ts +4 -0
  156. package/types/JavaScriptSDK/NotificationManager.d.ts +7 -7
  157. package/types/JavaScriptSDK/PerfManager.d.ts +2 -2
  158. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +3 -2
  159. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +3 -3
  160. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +7 -5
  161. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +1 -0
  162. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +25 -3
  163. package/types/JavaScriptSDK.Interfaces/ICookieMgr.d.ts +6 -0
  164. package/types/JavaScriptSDK.Interfaces/IDiagnosticLogger.d.ts +13 -7
  165. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +2 -1
  166. package/types/JavaScriptSDK.Interfaces/INotificationListener.d.ts +5 -5
  167. package/types/JavaScriptSDK.Interfaces/INotificationManager.d.ts +8 -8
  168. package/types/JavaScriptSDK.Interfaces/IPerfManager.d.ts +3 -3
  169. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +5 -9
  170. package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +2 -1
  171. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +13 -2
  172. package/types/JavaScriptSDK.Interfaces/IUnloadHook.d.ts +18 -0
  173. package/types/__DynamicConstants.d.ts +18 -15
  174. package/types/applicationinsights-core-js.d.ts +11 -4
  175. package/dist-esm/JavaScriptSDK/BaseCore.js +0 -654
  176. package/dist-esm/JavaScriptSDK/BaseCore.js.map +0 -1
  177. package/src/JavaScriptSDK/BaseCore.ts +0 -948
  178. package/types/JavaScriptSDK/BaseCore.d.ts +0 -124
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2210-01
2
+ * Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2210-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -17,6 +17,7 @@ import { arrForEach } from '@nevware21/ts-utils';
17
17
  import { arrIndexOf } from '@nevware21/ts-utils';
18
18
  import { arrMap } from '@nevware21/ts-utils';
19
19
  import { arrReduce } from '@nevware21/ts-utils';
20
+ import { asString } from '@nevware21/ts-utils';
20
21
  import { objDeepFreeze as deepFreeze } from '@nevware21/ts-utils';
21
22
  import { dumpObj } from '@nevware21/ts-utils';
22
23
  import { EnumCls } from '@nevware21/ts-utils';
@@ -73,8 +74,8 @@ export declare function __getRegisteredEvents(target: any, eventName?: string, e
73
74
 
74
75
  /**
75
76
  * Trys to add an event handler for the specified event to the window, body and document
76
- * @param eventName {string} - The name of the event
77
- * @param callback {any} - The callback function that needs to be executed for the given event
77
+ * @param eventName - {string} - The name of the event
78
+ * @param callback - {any} - The callback function that needs to be executed for the given event
78
79
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
79
80
  * @return {boolean} - true if the handler was successfully added
80
81
  */
@@ -82,8 +83,8 @@ export declare function addEventHandler(eventName: string, callback: any, evtNam
82
83
 
83
84
  /**
84
85
  * Bind the listener to the array of events
85
- * @param events An string array of event names to bind the listener to
86
- * @param listener The event callback to call when the event is triggered
86
+ * @param events - An string array of event names to bind the listener to
87
+ * @param listener - The event callback to call when the event is triggered
87
88
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
88
89
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
89
90
  * @returns true - when at least one of the events was registered otherwise false
@@ -130,33 +131,7 @@ export declare function addPageShowEventListener(listener: any, excludeEvents?:
130
131
  */
131
132
  export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
132
133
 
133
- export declare class AppInsightsCore extends BaseCore implements IAppInsightsCore {
134
- constructor();
135
- initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
136
- track(telemetryItem: ITelemetryItem): void;
137
- }
138
-
139
- export declare function areCookiesSupported(logger?: IDiagnosticLogger): any;
140
-
141
- export { arrForEach }
142
-
143
- export { arrIndexOf }
144
-
145
- export { arrMap }
146
-
147
- export { arrReduce }
148
-
149
- /**
150
- * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
151
- * @param obj Object to add the event too.
152
- * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
153
- * @param handlerRef Pointer that specifies the function to call when event fires
154
- * @param useCapture [Optional] Defaults to false
155
- * @returns True if the function was bound successfully to the event, otherwise false
156
- */
157
- export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
158
-
159
- export declare class BaseCore implements IAppInsightsCore {
134
+ export declare class AppInsightsCore implements IAppInsightsCore {
160
135
  static defaultConfig: IConfiguration;
161
136
  config: IConfiguration;
162
137
  logger: IDiagnosticLogger;
@@ -172,12 +147,12 @@ export declare class BaseCore implements IAppInsightsCore {
172
147
  * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
173
148
  * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
174
149
  * called.
175
- * @param {INotificationListener} listener - An INotificationListener object.
150
+ * @param listener - An INotificationListener object.
176
151
  */
177
152
  addNotificationListener(listener: INotificationListener): void;
178
153
  /**
179
154
  * Removes all instances of the listener.
180
- * @param {INotificationListener} listener - INotificationListener to remove.
155
+ * @param listener - INotificationListener to remove.
181
156
  */
182
157
  removeNotificationListener(listener: INotificationListener): void;
183
158
  /**
@@ -205,7 +180,7 @@ export declare class BaseCore implements IAppInsightsCore {
205
180
  * @param telemetryInitializer - The Telemetry Initializer function
206
181
  * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
207
182
  */
208
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
183
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
209
184
  /**
210
185
  * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
211
186
  * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
@@ -227,6 +202,12 @@ export declare class BaseCore implements IAppInsightsCore {
227
202
  * @param addCb - [Optional] callback to call after the plugin has been added
228
203
  */
229
204
  addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
205
+ /**
206
+ * Update the configuration used and broadcast the changes to all loaded plugins
207
+ * @param newConfig - The new configuration is apply
208
+ * @param mergeExisting - Should the new configuration merge with the existing or just replace it. Default is to true.
209
+ */
210
+ updateCfg<T extends IConfiguration = IConfiguration>(newConfig: T, mergeExisting?: boolean): void;
230
211
  /**
231
212
  * Returns the unique event namespace that should be used
232
213
  */
@@ -254,6 +235,18 @@ export declare class BaseCore implements IAppInsightsCore {
254
235
  * Sets the current distributed trace context for this instance if available
255
236
  */
256
237
  setTraceCtx(newTracectx: IDistributedTraceContext): void;
238
+ /**
239
+ * Add this hook so that it is automatically removed during unloading
240
+ * @param hooks - The single hook or an array of IInstrumentHook objects
241
+ */
242
+ addUnloadHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
243
+ /**
244
+ * Watches and tracks changes for accesses to the current config, and if the accessed config changes the
245
+ * handler will be recalled.
246
+ * @param handler
247
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
248
+ */
249
+ onCfgChange<T extends IConfiguration = IConfiguration>(handler: WatcherFunction<T>): IUnloadHook;
257
250
  protected releaseQueue(): void;
258
251
  /**
259
252
  * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
@@ -264,6 +257,30 @@ export declare class BaseCore implements IAppInsightsCore {
264
257
  protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
265
258
  }
266
259
 
260
+ export declare function applyDefaults<C>(theConfig: C, defaultValues: IConfigDefaults<C>): C;
261
+
262
+ export declare function areCookiesSupported(logger?: IDiagnosticLogger): any;
263
+
264
+ export { arrForEach }
265
+
266
+ export { arrIndexOf }
267
+
268
+ export { arrMap }
269
+
270
+ export { arrReduce }
271
+
272
+ export { asString }
273
+
274
+ /**
275
+ * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
276
+ * @param obj - Object to add the event too.
277
+ * @param eventNameWithoutOn - String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
278
+ * @param handlerRef - Pointer that specifies the function to call when event fires
279
+ * @param useCapture - [Optional] Defaults to false
280
+ * @returns True if the function was bound successfully to the event, otherwise false
281
+ */
282
+ export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
283
+
267
284
  /**
268
285
  * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
269
286
  * can avoid implementation the same set of boiler plate code as well as provide a base
@@ -354,18 +371,27 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
354
371
  * Add this hook so that it is automatically removed during unloading
355
372
  * @param hooks - The single hook or an array of IInstrumentHook objects
356
373
  */
357
- protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
374
+ protected _addHook(hooks: IUnloadHook | IUnloadHook[] | ILegacyUnloadHook | ILegacyUnloadHook[]): void;
358
375
  }
359
376
 
360
377
  /**
361
378
  * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
362
379
  * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
363
- * @param defaults Simple helper
380
+ * @param defaults - Simple helper
364
381
  */
365
382
  export declare function createClassFromInterface<T>(defaults?: T): new () => T;
366
383
 
367
384
  export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
368
385
 
386
+ /**
387
+ * Create or return a dynamic version of the passed config, if it is not already dynamic
388
+ * @param config - The config to be converted into a dynamic config
389
+ * @param defaultConfig - The default values to apply on the config if the properties don't already exist
390
+ * @param inPlace - Should the config be converted in-place into a dynamic config or a new instance returned, defaults to true
391
+ * @returns The dynamic config handler for the config (whether new or existing)
392
+ */
393
+ export declare function createDynamicConfig<T extends IConfiguration>(config: T, defaultConfig?: IConfigDefaults<T>, logger?: IDiagnosticLogger, inPlace?: boolean): IDynamicConfigHandler<T>;
394
+
369
395
  /**
370
396
  * Create an enum style object which has both the key => value and value => key mappings
371
397
  * @param values - The values to populate on the new object
@@ -382,7 +408,7 @@ export declare const createEnumStyle: <E>(values: {
382
408
  * @param core - The current core instance
383
409
  * @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
384
410
  */
385
- export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
411
+ export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, cfg: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
386
412
 
387
413
  /**
388
414
  * Create a new ITraceParent instance using the provided values.
@@ -424,13 +450,13 @@ export { deepFreeze }
424
450
 
425
451
  /**
426
452
  * Removes an event handler for the specified event
427
- * @param Object to remove the event from
428
- * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
453
+ * @param Object - to remove the event from
454
+ * @param eventNameWithoutOn - {string} - The name of the event, with optional namespaces or just the namespaces,
429
455
  * such as "click", "click.mynamespace" or ".mynamespace"
430
- * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
456
+ * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a
431
457
  * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
432
458
  * otherwise this will only remove events with this specific handler.
433
- * @param useCapture [Optional] Defaults to false
459
+ * @param useCapture - [Optional] Defaults to false
434
460
  */
435
461
  export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
436
462
 
@@ -463,18 +489,18 @@ export declare class DiagnosticLogger implements IDiagnosticLogger {
463
489
  maxInternalMessageLimit(): number;
464
490
  /**
465
491
  * This method will throw exceptions in debug mode or attempt to log the error as a console warning.
466
- * @param severity {LoggingSeverity} - The severity of the log message
467
- * @param message {_InternalLogMessage} - The log message.
492
+ * @param severity - {LoggingSeverity} - The severity of the log message
493
+ * @param message - {_InternalLogMessage} - The log message.
468
494
  */
469
495
  throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
470
496
  /**
471
497
  * This will write a warning to the console if possible
472
- * @param message {string} - The warning message
498
+ * @param message - {string} - The warning message
473
499
  */
474
500
  warnToConsole(message: string): void;
475
501
  /**
476
502
  * This will write an error to the console if possible
477
- * @param message {string} - The warning message
503
+ * @param message - {string} - The warning message
478
504
  */
479
505
  errorToConsole(message: string): void;
480
506
  /**
@@ -483,10 +509,11 @@ export declare class DiagnosticLogger implements IDiagnosticLogger {
483
509
  resetInternalMessageCount(): void;
484
510
  /**
485
511
  * Logs a message to the internal queue.
486
- * @param severity {LoggingSeverity} - The severity of the log message
487
- * @param message {_InternalLogMessage} - The message to log.
512
+ * @param severity - {LoggingSeverity} - The severity of the log message
513
+ * @param message - {_InternalLogMessage} - The message to log.
488
514
  */
489
515
  logInternalMessage(severity: LoggingSeverity, message: _InternalLogMessage): void;
516
+ update(updateState: ITelemetryUpdateState): void;
490
517
  }
491
518
 
492
519
  /**
@@ -614,10 +641,16 @@ export declare const enum _eInternalMessageId {
614
641
  TrackPageActionEventFailed = 103,
615
642
  FailedAddingCustomDefinedRequestContext = 104,
616
643
  InMemoryStorageBufferFull = 105,
617
- InstrumentationKeyDeprecation = 106
644
+ InstrumentationKeyDeprecation = 106,
645
+ ConfigWatcherException = 107,
646
+ DynamicConfigException = 108
618
647
  }
619
648
 
620
649
  export declare const enum eLoggingSeverity {
650
+ /**
651
+ * No Logging will be enabled
652
+ */
653
+ DISABLED = 0,
621
654
  /**
622
655
  * Error will be sent as internal telemetry
623
656
  */
@@ -632,27 +665,27 @@ export declare type EnumValue<E = any> = EnumCls<E>;
632
665
 
633
666
  /**
634
667
  * Removes an event handler for the specified event
635
- * @param Object to remove the event from
636
- * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
668
+ * @param Object - to remove the event from
669
+ * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,
637
670
  * such as "click", "click.mynamespace" or ".mynamespace"
638
- * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
671
+ * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a
639
672
  * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
640
673
  * otherwise this will only remove events with this specific handler.
641
674
  * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
642
675
  * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
643
- * @param useCapture [Optional] Defaults to false
676
+ * @param useCapture - [Optional] Defaults to false
644
677
  */
645
678
  export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
646
679
 
647
680
  /**
648
681
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
649
- * @param obj Object to add the event too.
650
- * @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
682
+ * @param obj - Object to add the event too.
683
+ * @param eventName - String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
651
684
  * namespaces "click" "click.mynamespace" in addition to specific namespaces.
652
- * @param handlerRef Pointer that specifies the function to call when event fires
685
+ * @param handlerRef - Pointer that specifies the function to call when event fires
653
686
  * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
654
687
  * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
655
- * @param useCapture [Optional] Defaults to false
688
+ * @param useCapture - [Optional] Defaults to false
656
689
  * @returns True if the function was bound successfully to the event, otherwise false
657
690
  */
658
691
  export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
@@ -715,17 +748,19 @@ export declare function getDebugListener(config: IConfiguration): INotificationL
715
748
 
716
749
  export { getDocument }
717
750
 
751
+ /**
752
+ * @internal
753
+ * Get the dynamic config handler if the value is already dynamic
754
+ * @param value
755
+ * @returns
756
+ */
757
+ export declare function getDynamicConfigHandler<T>(value: T | IDynamicConfigHandler<T>): IDynamicConfigHandler<T> | null;
758
+
718
759
  /**
719
760
  * Returns the name of object if it's an Error. Otherwise, returns empty string.
720
761
  */
721
762
  export declare function getExceptionName(object: any): string;
722
763
 
723
- export declare const enum GetExtCfgMergeType {
724
- None = 0,
725
- MergeDefaultOnly = 1,
726
- MergeDefaultFromRootOrDefault = 2
727
- }
728
-
729
764
  /**
730
765
  * Get the current global performance manager that will be used with no performance manager is supplied.
731
766
  * @returns - The current default manager
@@ -829,12 +864,12 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
829
864
  * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
830
865
  * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
831
866
  * called.
832
- * @param {INotificationListener} listener - An INotificationListener object.
867
+ * @param listener - An INotificationListener object.
833
868
  */
834
869
  addNotificationListener?(listener: INotificationListener): void;
835
870
  /**
836
871
  * Removes all instances of the listener.
837
- * @param {INotificationListener} listener - INotificationListener to remove.
872
+ * @param listener - INotificationListener to remove.
838
873
  */
839
874
  removeNotificationListener?(listener: INotificationListener): void;
840
875
  /**
@@ -842,7 +877,7 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
842
877
  * @param telemetryInitializer - The Telemetry Initializer function
843
878
  * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
844
879
  */
845
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
880
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
846
881
  pollInternalLogs?(eventName?: string): number;
847
882
  stopPollingInternalLogs?(): void;
848
883
  /**
@@ -874,6 +909,14 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
874
909
  * @param addCb - [Optional] callback to call after the plugin has been added
875
910
  */
876
911
  addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
912
+ /**
913
+ * Update the configuration used and broadcast the changes to all loaded plugins, this does NOT support updating, adding or removing
914
+ * any the plugins (extensions or channels). It will notify each plugin (if supported) that the configuration has changed but it will
915
+ * not remove or add any new plugins, you need to call addPlugin or getPlugin(identifier).remove();
916
+ * @param newConfig - The new configuration is apply
917
+ * @param mergeExisting - Should the new configuration merge with the existing or just replace it. Default is to merge.
918
+ */
919
+ updateCfg<T extends IConfiguration = IConfiguration>(newConfig: T, mergeExisting?: boolean): void;
877
920
  /**
878
921
  * Returns the unique event namespace that should be used when registering events
879
922
  */
@@ -883,6 +926,11 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
883
926
  * @param handler - the handler
884
927
  */
885
928
  addUnloadCb(handler: UnloadHandler): void;
929
+ /**
930
+ * Add this hook so that it is automatically removed during unloading
931
+ * @param hooks - The single hook or an array of IInstrumentHook objects
932
+ */
933
+ addUnloadHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
886
934
  /**
887
935
  * Flush and send any batched / cached data immediately
888
936
  * @param async - send data asynchronously when true (defaults to true)
@@ -902,6 +950,13 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
902
950
  * Sets the current distributed trace context for this instance if available
903
951
  */
904
952
  setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
953
+ /**
954
+ * Watches and tracks changes for accesses to the current config, and if the accessed config changes the
955
+ * handler will be recalled.
956
+ * @param handler
957
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
958
+ */
959
+ onCfgChange<T extends IConfiguration = IConfiguration>(handler: WatcherFunction<T>): IUnloadHook;
905
960
  }
906
961
 
907
962
  export declare interface IBaseProcessingContext {
@@ -920,13 +975,13 @@ export declare interface IBaseProcessingContext {
920
975
  /**
921
976
  * Gets the named extension config
922
977
  */
923
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
978
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
924
979
  /**
925
980
  * Gets the named config from either the named identifier extension or core config if neither exist then the
926
981
  * default value is returned
927
- * @param identifier The named extension identifier
928
- * @param field The config field name
929
- * @param defaultValue The default value to return if no defined config exists
982
+ * @param identifier - The named extension identifier
983
+ * @param field - The config field name
984
+ * @param defaultValue - The default value to return if no defined config exists
930
985
  */
931
986
  getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
932
987
  /**
@@ -997,6 +1052,51 @@ export declare interface IChannelControls extends ITelemetryPlugin {
997
1052
  flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
998
1053
  }
999
1054
 
1055
+ /**
1056
+ * The type to identify whether the default value should be applied in preference to the provided value.
1057
+ */
1058
+ export declare type IConfigCheckFn<V> = (value: V) => boolean;
1059
+
1060
+ /**
1061
+ * The default values with a check function
1062
+ */
1063
+ export declare interface IConfigDefaultCheck<T, V, C extends IConfiguration = IConfiguration> {
1064
+ /**
1065
+ * Callback function to check if the user-supplied value is valid, if not the default will be applied
1066
+ */
1067
+ isVal?: IConfigCheckFn<V>;
1068
+ /**
1069
+ * Optional function to allow converting and setting of the default value
1070
+ */
1071
+ set?: IConfigSetFn<T, V>;
1072
+ /**
1073
+ * The default value to apply if the user-supplied value is not valid
1074
+ */
1075
+ v?: V;
1076
+ /**
1077
+ * The default fallback key if the main key is not present, this is the key value from the config
1078
+ */
1079
+ fb?: keyof T | keyof C | Array<keyof T | keyof C>;
1080
+ /**
1081
+ * Use this check to determine the default fallback, default only checked whether the property isDefined,
1082
+ * therefore `null`; `""` are considered to be valid values.
1083
+ */
1084
+ dfVal?: (value: any) => boolean;
1085
+ }
1086
+
1087
+ /**
1088
+ * The Type definition to define default values to be applied to the config
1089
+ * The value may be either the direct value or a ConfigDefaultCheck definition
1090
+ */
1091
+ export declare type IConfigDefaults<T, C extends IConfiguration = IConfiguration> = {
1092
+ [key in keyof T]: T[key] | IConfigDefaultCheck<T, T[key], C>;
1093
+ };
1094
+
1095
+ /**
1096
+ * The type which identifies the function use to validate the user supplied value
1097
+ */
1098
+ export declare type IConfigSetFn<T, V> = (value: any, defValue: V, theConfig: T) => V;
1099
+
1000
1100
  /**
1001
1101
  * Configuration provided to SDK core
1002
1102
  */
@@ -1178,6 +1278,11 @@ export declare interface ICookieMgr {
1178
1278
  * @returns - True if the cookie was marked for deletion otherwise false (Because cookie usage is not available)
1179
1279
  */
1180
1280
  purge(name: string, path?: string): boolean;
1281
+ /**
1282
+ * Optional Callback hook to allow the diagnostic logger to update it's configuration
1283
+ * @param updateState
1284
+ */
1285
+ update?(updateState: ITelemetryUpdateState): void;
1181
1286
  }
1182
1287
 
1183
1288
  /**
@@ -1271,20 +1376,20 @@ export declare interface IDiagnosticLogger {
1271
1376
  queue: _InternalLogMessage[];
1272
1377
  /**
1273
1378
  * This method will throw exceptions in debug mode or attempt to log the error as a console warning.
1274
- * @param severity {LoggingSeverity} - The severity of the log message
1275
- * @param message {_InternalLogMessage} - The log message.
1379
+ * @param severity - {LoggingSeverity} - The severity of the log message
1380
+ * @param message - {_InternalLogMessage} - The log message.
1276
1381
  */
1277
1382
  throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
1278
1383
  /**
1279
1384
  * This will write a warning to the console if possible
1280
- * @param message {string} - The warning message
1385
+ * @param message - {string} - The warning message
1281
1386
  */
1282
1387
  warnToConsole(message: string): void;
1283
1388
  /**
1284
1389
  * This will write an error to the console if possible.
1285
1390
  * Provided by the default DiagnosticLogger instance, and internally the SDK will fall back to warnToConsole, however,
1286
1391
  * direct callers MUST check for its existence on the logger as you can provide your own IDiagnosticLogger instance.
1287
- * @param message {string} - The error message
1392
+ * @param message - {string} - The error message
1288
1393
  */
1289
1394
  errorToConsole?(message: string): void;
1290
1395
  /**
@@ -1293,10 +1398,15 @@ export declare interface IDiagnosticLogger {
1293
1398
  resetInternalMessageCount(): void;
1294
1399
  /**
1295
1400
  * Logs a message to the internal queue.
1296
- * @param severity {LoggingSeverity} - The severity of the log message
1297
- * @param message {_InternalLogMessage} - The message to log.
1401
+ * @param severity - {LoggingSeverity} - The severity of the log message
1402
+ * @param message - {_InternalLogMessage} - The message to log.
1298
1403
  */
1299
1404
  logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
1405
+ /**
1406
+ * Optional Callback hook to allow the diagnostic logger to update it's configuration
1407
+ * @param updateState
1408
+ */
1409
+ update?(updateState: ITelemetryUpdateState): void;
1300
1410
  }
1301
1411
 
1302
1412
  export declare interface IDistributedTraceContext {
@@ -1343,6 +1453,50 @@ export declare interface IDistributedTraceContext {
1343
1453
  setTraceFlags(newValue?: number): void;
1344
1454
  }
1345
1455
 
1456
+ /**
1457
+ * This interface identifies the config which can track changes
1458
+ */
1459
+ export declare interface IDynamicConfigHandler<T extends IConfiguration> {
1460
+ /**
1461
+ * Unique Id for this config handler
1462
+ */
1463
+ readonly uid: string;
1464
+ /**
1465
+ * Link back to the configuration object that should be used to get/set values
1466
+ */
1467
+ cfg: T;
1468
+ /**
1469
+ * The logger instance to use to loger any issues
1470
+ */
1471
+ logger: IDiagnosticLogger;
1472
+ /**
1473
+ * Helper to call any listeners that are waiting to be notified
1474
+ */
1475
+ notify: () => void;
1476
+ /**
1477
+ * Watch and track changes for accesses to the current config anb
1478
+ */
1479
+ watch: (configHandler: WatcherFunction<T>) => IWatcherHandler<T>;
1480
+ /**
1481
+ * Set the value against the provided config/name with the value, the property
1482
+ * will be converted to be dynamic (if not already) as long as the provided config
1483
+ * is already a tracked dynamic object.
1484
+ * @throws TypeError if the provided config is not a monitored dynamic config
1485
+ */
1486
+ set: <C, V>(theConfig: C, name: string, value: V) => V;
1487
+ }
1488
+
1489
+ export declare interface IDynamicPropertyHandler<T> {
1490
+ /**
1491
+ * Identifies the name of the field that is handled by this handler
1492
+ */
1493
+ n: string;
1494
+ /**
1495
+ * The current collection is watcher handlers which should be called if the value changes
1496
+ */
1497
+ h: IWatcherHandler<T>[];
1498
+ }
1499
+
1346
1500
  export declare interface IInstrumentCallDetails {
1347
1501
  name: string;
1348
1502
  inst: any;
@@ -1377,7 +1531,7 @@ export declare interface IInstrumentCallDetails {
1377
1531
  /**
1378
1532
  * The holder of the specific instance callback
1379
1533
  */
1380
- export declare interface IInstrumentHook {
1534
+ export declare interface IInstrumentHook extends IUnloadHook {
1381
1535
  /** Unique Id for this callback on the hooked method */
1382
1536
  id: number;
1383
1537
  /** Holds the callbacks */
@@ -1422,6 +1576,16 @@ export declare interface IInstrumentHooksCallbacks {
1422
1576
  fnErr?: InstrumentorHooksCallback;
1423
1577
  }
1424
1578
 
1579
+ /**
1580
+ * An alternate interface which provides automatic removal during unloading of the component
1581
+ */
1582
+ export declare interface ILegacyUnloadHook {
1583
+ /**
1584
+ * Legacy Self remove the referenced component
1585
+ */
1586
+ remove: () => void;
1587
+ }
1588
+
1425
1589
  export declare interface ILoadedPlugin<T extends IPlugin> {
1426
1590
  plugin: T;
1427
1591
  /**
@@ -1443,9 +1607,9 @@ export declare interface ILoadedPlugin<T extends IPlugin> {
1443
1607
  /**
1444
1608
  * Initialize the queue of plugins
1445
1609
  * @param plugins - The array of plugins to initialize and setting of the next plugin
1446
- * @param config The current config for the instance
1447
- * @param core THe current core instance
1448
- * @param extensions The extensions
1610
+ * @param config - The current config for the instance
1611
+ * @param core - THe current core instance
1612
+ * @param extensions - The extensions
1449
1613
  */
1450
1614
  export declare function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
1451
1615
 
@@ -1456,20 +1620,20 @@ export declare function initializePlugins(processContext: IProcessTelemetryConte
1456
1620
  export declare interface INotificationListener {
1457
1621
  /**
1458
1622
  * [Optional] A function called when events are sent.
1459
- * @param {ITelemetryItem[]} events - The array of events that have been sent.
1623
+ * @param events - The array of events that have been sent.
1460
1624
  */
1461
1625
  eventsSent?: (events: ITelemetryItem[]) => void;
1462
1626
  /**
1463
1627
  * [Optional] A function called when events are discarded.
1464
- * @param {ITelemetryItem[]} events - The array of events that have been discarded.
1465
- * @param {number} reason - The reason for discarding the events. The EventsDiscardedReason
1628
+ * @param events - The array of events that have been discarded.
1629
+ * @param reason - The reason for discarding the events. The EventsDiscardedReason
1466
1630
  * constant should be used to check the different values.
1467
1631
  */
1468
1632
  eventsDiscarded?: (events: ITelemetryItem[], reason: number) => void;
1469
1633
  /**
1470
1634
  * [Optional] A function called when the events have been requested to be sent to the sever.
1471
- * @param {number} sendReason - The reason why the event batch is being sent.
1472
- * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1635
+ * @param sendReason - The reason why the event batch is being sent.
1636
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1473
1637
  */
1474
1638
  eventsSendRequest?: (sendReason: number, isAsync?: boolean) => void;
1475
1639
  /**
@@ -1487,36 +1651,36 @@ export declare interface INotificationManager {
1487
1651
  listeners: INotificationListener[];
1488
1652
  /**
1489
1653
  * Adds a notification listener.
1490
- * @param {INotificationListener} listener - The notification listener to be added.
1654
+ * @param listener - The notification listener to be added.
1491
1655
  */
1492
1656
  addNotificationListener(listener: INotificationListener): void;
1493
1657
  /**
1494
1658
  * Removes all instances of the listener.
1495
- * @param {INotificationListener} listener - AWTNotificationListener to remove.
1659
+ * @param listener - AWTNotificationListener to remove.
1496
1660
  */
1497
1661
  removeNotificationListener(listener: INotificationListener): void;
1498
1662
  /**
1499
1663
  * Notification for events sent.
1500
- * @param {ITelemetryItem[]} events - The array of events that have been sent.
1664
+ * @param events - The array of events that have been sent.
1501
1665
  */
1502
1666
  eventsSent(events: ITelemetryItem[]): void;
1503
1667
  /**
1504
1668
  * Notification for events being discarded.
1505
- * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.
1506
- * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
1669
+ * @param events - The array of events that have been discarded by the SDK.
1670
+ * @param reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
1507
1671
  * constant should be used to check the different values.
1508
1672
  */
1509
1673
  eventsDiscarded(events: ITelemetryItem[], reason: number): void;
1510
1674
  /**
1511
1675
  * [Optional] A function called when the events have been requested to be sent to the sever.
1512
- * @param {number} sendReason - The reason why the event batch is being sent.
1513
- * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1676
+ * @param sendReason - The reason why the event batch is being sent.
1677
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1514
1678
  */
1515
1679
  eventsSendRequest?(sendReason: number, isAsync: boolean): void;
1516
1680
  /**
1517
1681
  * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
1518
1682
  * the event can be displayed via the debug plugin extension.
1519
- * @param perfEvent
1683
+ * @param perfEvent - The perf event details
1520
1684
  */
1521
1685
  perfEvent?(perfEvent: IPerfEvent): void;
1522
1686
  }
@@ -1578,11 +1742,6 @@ export declare class _InternalLogMessage {
1578
1742
  constructor(msgId: _InternalMessageId, msg: string, isUserAct?: boolean, properties?: Object);
1579
1743
  }
1580
1744
 
1581
- /**
1582
- * Internal message ID. Please create a new one for every conceptually different message. Please keep alphabetically ordered
1583
- */
1584
- export declare const _InternalMessageId: EnumValue<typeof _eInternalMessageId>;
1585
-
1586
1745
  export declare type _InternalMessageId = number | _eInternalMessageId;
1587
1746
 
1588
1747
  /**
@@ -1650,14 +1809,14 @@ export declare interface IPerfManager {
1650
1809
  /**
1651
1810
  * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
1652
1811
  * want to monitor this source event.
1653
- * @param src The source name of the event
1812
+ * @param src - The source name of the event
1654
1813
  * @param payloadDetails - An optional callback function to fetch the payload details for the event.
1655
1814
  * @param isAsync - Is the event occurring from a async event
1656
1815
  */
1657
1816
  create(src: string, payloadDetails?: () => any, isAsync?: boolean): IPerfEvent | null | undefined;
1658
1817
  /**
1659
1818
  * Complete the perfEvent and fire any notifications.
1660
- * @param perfEvent Fire the event which will also complete the passed event
1819
+ * @param perfEvent - Fire the event which will also complete the passed event
1661
1820
  */
1662
1821
  fire(perfEvent: IPerfEvent): void;
1663
1822
  /**
@@ -1683,7 +1842,7 @@ export declare interface IPerfManagerProvider {
1683
1842
  getPerfMgr(): IPerfManager;
1684
1843
  /**
1685
1844
  * Set the current performance manager
1686
- * @param perfMgr The performance manager
1845
+ * @param perfMgr - The performance manager
1687
1846
  */
1688
1847
  setPerfMgr(perfMgr: IPerfManager): void;
1689
1848
  }
@@ -1900,7 +2059,7 @@ export declare interface ITelemetryInitializerContainer {
1900
2059
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
1901
2060
  }
1902
2061
 
1903
- export declare interface ITelemetryInitializerHandler {
2062
+ export declare interface ITelemetryInitializerHandler extends ILegacyUnloadHook {
1904
2063
  remove(): void;
1905
2064
  }
1906
2065
 
@@ -2018,12 +2177,22 @@ export declare interface ITelemetryUpdateState {
2018
2177
  * Identifies the reason for the update notification, this is a bitwise numeric value
2019
2178
  */
2020
2179
  reason: TelemetryUpdateReason;
2180
+ /**
2181
+ * This is a new active configuration that should be used
2182
+ */
2183
+ cfg?: IConfiguration;
2184
+ /**
2185
+ * The detected changes
2186
+ */
2187
+ oldCfg?: IConfiguration;
2021
2188
  /**
2022
2189
  * If this is a configuration update this was the previous configuration that was used
2023
2190
  */
2191
+ newConfig?: IConfiguration;
2024
2192
  /**
2025
- * If this is a configuration update is the new configuration that is being used
2193
+ * Was the new config requested to be merged with the existing config
2026
2194
  */
2195
+ merge?: boolean;
2027
2196
  /**
2028
2197
  * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2029
2198
  */
@@ -2084,6 +2253,26 @@ export declare interface IUnloadHandlerContainer {
2084
2253
  run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2085
2254
  }
2086
2255
 
2256
+ /**
2257
+ * An interface which provides automatic removal during unloading of the component
2258
+ */
2259
+ export declare interface IUnloadHook {
2260
+ /**
2261
+ * Self remove the referenced component
2262
+ */
2263
+ rm: () => void;
2264
+ }
2265
+
2266
+ export declare interface IWatchDetails<T extends IConfiguration> {
2267
+ cfg: T;
2268
+ hdlr: IDynamicConfigHandler<T>;
2269
+ }
2270
+
2271
+ export declare interface IWatcherHandler<T extends IConfiguration> extends IUnloadHook {
2272
+ fn: WatcherFunction<T>;
2273
+ rm: () => void;
2274
+ }
2275
+
2087
2276
  export declare const LoggingSeverity: EnumValue<typeof eLoggingSeverity>;
2088
2277
 
2089
2278
  export declare type LoggingSeverity = number | eLoggingSeverity;
@@ -2091,8 +2280,8 @@ export declare type LoggingSeverity = number | eLoggingSeverity;
2091
2280
  /**
2092
2281
  * Logs a message to the internal queue.
2093
2282
  * @param logger - The Diagnostic Logger instance to use.
2094
- * @param severity {LoggingSeverity} - The severity of the log message
2095
- * @param message {_InternalLogMessage} - The message to log.
2283
+ * @param severity - {LoggingSeverity} - The severity of the log message
2284
+ * @param message - {_InternalLogMessage} - The message to log.
2096
2285
  */
2097
2286
  export declare function _logInternalMessage(logger: IDiagnosticLogger, severity: LoggingSeverity, message: _InternalLogMessage): void;
2098
2287
 
@@ -2128,7 +2317,7 @@ export declare function newId(maxLength?: number): string;
2128
2317
  * normalizes the name so that it would. This method does not identify or change any keywords
2129
2318
  * meaning that if you pass in a known keyword the same value will be returned.
2130
2319
  * This is a simplified version
2131
- * @param name The name to validate
2320
+ * @param name - The name to validate
2132
2321
  */
2133
2322
  export declare function normalizeJsName(name: string): string;
2134
2323
 
@@ -2140,30 +2329,30 @@ export declare class NotificationManager implements INotificationManager {
2140
2329
  constructor(config?: IConfiguration);
2141
2330
  /**
2142
2331
  * Adds a notification listener.
2143
- * @param {INotificationListener} listener - The notification listener to be added.
2332
+ * @param listener - The notification listener to be added.
2144
2333
  */
2145
2334
  addNotificationListener(listener: INotificationListener): void;
2146
2335
  /**
2147
2336
  * Removes all instances of the listener.
2148
- * @param {INotificationListener} listener - AWTNotificationListener to remove.
2337
+ * @param listener - AWTNotificationListener to remove.
2149
2338
  */
2150
2339
  removeNotificationListener(listener: INotificationListener): void;
2151
2340
  /**
2152
2341
  * Notification for events sent.
2153
- * @param {ITelemetryItem[]} events - The array of events that have been sent.
2342
+ * @param events - The array of events that have been sent.
2154
2343
  */
2155
2344
  eventsSent(events: ITelemetryItem[]): void;
2156
2345
  /**
2157
2346
  * Notification for events being discarded.
2158
- * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.
2159
- * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
2347
+ * @param events - The array of events that have been discarded by the SDK.
2348
+ * @param reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
2160
2349
  * constant should be used to check the different values.
2161
2350
  */
2162
2351
  eventsDiscarded(events: ITelemetryItem[], reason: number): void;
2163
2352
  /**
2164
2353
  * [Optional] A function called when the events have been requested to be sent to the sever.
2165
- * @param {number} sendReason - The reason why the event batch is being sent.
2166
- * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
2354
+ * @param sendReason - The reason why the event batch is being sent.
2355
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
2167
2356
  */
2168
2357
  eventsSendRequest?(sendReason: number, isAsync: boolean): void;
2169
2358
  /**
@@ -2202,6 +2391,17 @@ export { objSeal }
2202
2391
 
2203
2392
  export { objToString }
2204
2393
 
2394
+ /**
2395
+ * Watch and track changes for accesses to the current config, the provided config MUST already be
2396
+ * a dynamic config or a child accessed via the dynamic config
2397
+ * @param config
2398
+ * @param configHandler
2399
+ * @param logger - The logger instance to use if there is no existing handler
2400
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
2401
+ * @throws TypeError if the provided config is not a dynamic config instance
2402
+ */
2403
+ export declare function onConfigChange<T>(config: T, configHandler: WatcherFunction<T>, logger?: IDiagnosticLogger): IWatcherHandler<T>;
2404
+
2205
2405
  /**
2206
2406
  * A helper function to assist with JIT performance for objects that have properties added / removed dynamically
2207
2407
  * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
@@ -2269,14 +2469,14 @@ export declare class PerfManager implements IPerfManager {
2269
2469
  /**
2270
2470
  * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
2271
2471
  * want to monitor this source event.
2272
- * @param src The source name of the event
2472
+ * @param src - The source name of the event
2273
2473
  * @param payloadDetails - An optional callback function to fetch the payload details for the event.
2274
2474
  * @param isAsync - Is the event occurring from a async event
2275
2475
  */
2276
2476
  create(src: string, payload?: any, isAsync?: boolean): IPerfEvent | null | undefined;
2277
2477
  /**
2278
2478
  * Complete the perfEvent and fire any notifications.
2279
- * @param perfEvent Fire the event which will also complete the passed event
2479
+ * @param perfEvent - Fire the event which will also complete the passed event
2280
2480
  */
2281
2481
  fire(perfEvent: IPerfEvent): void;
2282
2482
  /**
@@ -2307,7 +2507,7 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
2307
2507
  * Gets the current core config instance
2308
2508
  */
2309
2509
  getCfg: () => IConfiguration;
2310
- getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
2510
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
2311
2511
  getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
2312
2512
  /**
2313
2513
  * Returns the IAppInsightsCore instance for the current request
@@ -2419,9 +2619,9 @@ export declare function randomValue(maxValue: number): number;
2419
2619
 
2420
2620
  /**
2421
2621
  * Trys to remove event handler(s) for the specified event/namespace to the window, body and document
2422
- * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
2622
+ * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,
2423
2623
  * such as "click", "click.mynamespace" or ".mynamespace"
2424
- * @param callback {any} - - The callback function that needs to be removed from the given event, when using a
2624
+ * @param callback - {any} - - The callback function that needs to be removed from the given event, when using a
2425
2625
  * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
2426
2626
  * otherwise this will only remove events with this specific handler.
2427
2627
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
@@ -2430,8 +2630,8 @@ export declare function removeEventHandler(eventName: string, callback: any, evt
2430
2630
 
2431
2631
  /**
2432
2632
  * Remove the listener from the array of events
2433
- * @param events An string array of event names to bind the listener to
2434
- * @param listener The event callback to call when the event is triggered
2633
+ * @param events - An string array of event names to bind the listener to
2634
+ * @param listener - The event callback to call when the event is triggered
2435
2635
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2436
2636
  */
2437
2637
  export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
@@ -2606,6 +2806,7 @@ export declare const enum TelemetryUpdateReason {
2606
2806
  /**
2607
2807
  * The configuration has ben updated or changed
2608
2808
  */
2809
+ ConfigurationChanged = 1,
2609
2810
  /**
2610
2811
  * One or more plugins have been added
2611
2812
  */
@@ -2624,15 +2825,15 @@ export { throwError }
2624
2825
  * support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
2625
2826
  * the code.
2626
2827
  * @param logger - The Diagnostic Logger instance to use.
2627
- * @param severity {LoggingSeverity} - The severity of the log message
2628
- * @param message {_InternalLogMessage} - The log message.
2828
+ * @param severity - {LoggingSeverity} - The severity of the log message
2829
+ * @param message - {_InternalLogMessage} - The log message.
2629
2830
  */
2630
2831
  export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
2631
2832
 
2632
2833
  /**
2633
2834
  * Convert a date to I.S.O. format in IE8
2634
2835
  */
2635
- export declare function toISOString(date: Date): any;
2836
+ export declare function toISOString(date: Date): string;
2636
2837
 
2637
2838
  export declare function uaDisallowsSameSiteNone(userAgent: string): boolean;
2638
2839
 
@@ -2656,8 +2857,10 @@ export declare function useXDomainRequest(): boolean | undefined;
2656
2857
  /**
2657
2858
  * This is a helper method which will call warnToConsole on the passed logger with the provided message.
2658
2859
  * @param logger - The Diagnostic Logger instance to use.
2659
- * @param message {_InternalLogMessage} - The log message.
2860
+ * @param message - {_InternalLogMessage} - The log message.
2660
2861
  */
2661
2862
  export declare function _warnToConsole(logger: IDiagnosticLogger, message: string): void;
2662
2863
 
2864
+ export declare type WatcherFunction<T extends IConfiguration> = (details: IWatchDetails<T>) => void;
2865
+
2663
2866
  export { }