@microsoft/applicationinsights-core-js 2.8.0-beta.2203-02 → 2.8.0-beta.2203-05

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 (107) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +319 -29
  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 +2458 -250
  7. package/dist/applicationinsights-core-js.api.md +87 -7
  8. package/dist/applicationinsights-core-js.d.ts +192 -7
  9. package/dist/applicationinsights-core-js.js +319 -29
  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 +195 -10
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +205 -13
  16. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  17. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +37 -3
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  19. package/dist-esm/JavaScriptSDK/ChannelController.js +14 -2
  20. package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
  21. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  22. package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -2
  23. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  24. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  25. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +1 -1
  26. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  27. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +14 -1
  28. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  29. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  30. package/dist-esm/JavaScriptSDK/EventHelpers.js +18 -13
  31. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
  32. package/dist-esm/JavaScriptSDK/HelperFuncs.js +3 -13
  33. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  34. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  35. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  36. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  37. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  38. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +71 -6
  39. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  40. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  41. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  42. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -2
  43. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
  44. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
  45. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
  46. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
  51. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
  52. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +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/ITelemetryInitializers.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
  70. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
  71. package/dist-esm/applicationinsights-core-js.js +3 -2
  72. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  73. package/package.json +1 -1
  74. package/src/JavaScriptSDK/BaseCore.ts +272 -14
  75. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +70 -4
  76. package/src/JavaScriptSDK/ChannelController.ts +18 -1
  77. package/src/JavaScriptSDK/CookieMgr.ts +3 -1
  78. package/src/JavaScriptSDK/DiagnosticLogger.ts +14 -0
  79. package/src/JavaScriptSDK/EventHelpers.ts +18 -12
  80. package/src/JavaScriptSDK/HelperFuncs.ts +4 -2
  81. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +87 -10
  82. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +3 -1
  83. package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
  84. package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
  85. package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +3 -3
  86. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
  87. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +29 -2
  88. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +11 -6
  89. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +25 -2
  90. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +12 -1
  91. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
  92. package/types/JavaScriptSDK/BaseCore.d.ts +27 -2
  93. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +23 -1
  94. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
  95. package/types/JavaScriptSDK/EventHelpers.d.ts +4 -2
  96. package/types/JavaScriptSDK/HelperFuncs.d.ts +2 -1
  97. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +11 -1
  98. package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
  99. package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
  100. package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +13 -1
  101. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
  102. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +24 -1
  103. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +5 -0
  104. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +23 -2
  105. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +11 -1
  106. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
  107. package/types/applicationinsights-core-js.d.ts +6 -2
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-02
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -24,9 +24,11 @@ import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights
24
24
  * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
25
25
  * applications to remove their own events
26
26
  * @param target - The EventTarget that has registered events
27
- * @param evtName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
27
+ * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
28
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
29
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
28
30
  */
29
- export declare function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
31
+ export declare function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
30
32
 
31
33
  /**
32
34
  * Trys to add an event handler for the specified event to the window, body and document
@@ -195,12 +197,34 @@ export declare class BaseCore implements IAppInsightsCore {
195
197
  * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
196
198
  */
197
199
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
200
+ /**
201
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
202
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
203
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
204
+ * approach is to create a new instance and initialize that instance.
205
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
206
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
207
+ */
208
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
198
209
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
210
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
199
211
  /**
200
212
  * Returns the unique event namespace that should be used
201
213
  */
202
214
  evtNamespace(): string;
215
+ /**
216
+ * Add an unload handler that will be called when the SDK is being unloaded
217
+ * @param handler - the handler
218
+ */
219
+ addUnloadCb(handler: UnloadHandler): void;
203
220
  protected releaseQueue(): void;
221
+ /**
222
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
223
+ * @param updateCtx - The plugin update context
224
+ * @param updateState - The Update State
225
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
226
+ */
227
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
204
228
  }
205
229
 
206
230
  /**
@@ -257,6 +281,14 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
257
281
  * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
258
282
  */
259
283
  protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
284
+ /**
285
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
286
+ * @param updateCtx - This is the context that should be used during updating.
287
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
288
+ * @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.
289
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
290
+ */
291
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
260
292
  constructor();
261
293
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
262
294
  /**
@@ -269,6 +301,18 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
269
301
  */
270
302
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
271
303
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
304
+ /**
305
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
306
+ * @param updateCtx - This is the context that should be used during updating.
307
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
308
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
309
+ */
310
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
311
+ /**
312
+ * Add an unload handler that will be called when the SDK is being unloaded
313
+ * @param handler - the handler
314
+ */
315
+ protected _addUnloadCb(handler: UnloadHandler): void;
272
316
  /**
273
317
  * Add this hook so that it is automatically removed during unloading
274
318
  * @param hooks - The single hook or an array of IInstrumentHook objects
@@ -311,11 +355,17 @@ export declare function createEnumStyle<T>(values: T): T;
311
355
  * @param plugins - The plugin instances that will be executed
312
356
  * @param config - The current config
313
357
  * @param core - The current core instance
358
+ * @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
314
359
  */
315
360
  export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
316
361
 
317
362
  export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
318
363
 
364
+ export declare function createUnloadHandlerContainer(): {
365
+ add: (handler: UnloadHandler) => void;
366
+ run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
367
+ };
368
+
319
369
  /**
320
370
  * 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)
321
371
  * https://caniuse.com/#search=Date.now
@@ -787,18 +837,39 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
787
837
  * Return a new instance of the IProcessTelemetryContext for processing events
788
838
  */
789
839
  getProcessTelContext(): IProcessTelemetryContext;
840
+ /**
841
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
842
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
843
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
844
+ * approach is to create a new instance and initialize that instance.
845
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
846
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
847
+ */
848
+ unload(isAsync?: boolean, unloadComplete?: () => void): void;
790
849
  /**
791
850
  * Find and return the (first) plugin with the specified identifier if present
792
851
  * @param pluginIdentifier
793
852
  */
794
853
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
854
+ /**
855
+ * Add a new plugin to the installation
856
+ * @param plugin - The new plugin to add
857
+ * @param replaceExisting - should any existing plugin be replaced
858
+ * @param doAsync - Should the add be performed asynchronously
859
+ */
860
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
795
861
  /**
796
862
  * Returns the unique event namespace that should be used when registering events
797
863
  */
798
864
  evtNamespace(): string;
865
+ /**
866
+ * Add a handler that will be called when the SDK is being unloaded
867
+ * @param handler - the handler
868
+ */
869
+ addUnloadCb(handler: UnloadHandler): void;
799
870
  }
800
871
 
801
- declare interface IBaseProcessingContext {
872
+ export declare interface IBaseProcessingContext {
802
873
  /**
803
874
  * The current core instance for the request
804
875
  */
@@ -1463,6 +1534,11 @@ export declare interface IInstrumentHooks {
1463
1534
  * You must always supply the error callback
1464
1535
  */
1465
1536
  export declare interface IInstrumentHooksCallbacks {
1537
+ /**
1538
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1539
+ * identify the source of the instrumented hooks
1540
+ */
1541
+ ns?: string | string[];
1466
1542
  /**
1467
1543
  * The hook callback to call before the original function is called
1468
1544
  */
@@ -1497,6 +1573,7 @@ declare interface ILoadedPlugin<T extends IPlugin> {
1497
1573
  * (unless it's also been re-initialized)
1498
1574
  */
1499
1575
  setEnabled: (isEnabled: boolean) => void;
1576
+ remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1500
1577
  }
1501
1578
 
1502
1579
  /**
@@ -1876,10 +1953,10 @@ export declare interface IProcessTelemetryContext extends IBaseProcessingContext
1876
1953
  }
1877
1954
 
1878
1955
  /**
1879
- * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1880
- * between multiple AppInsights instances
1956
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
1957
+ * or the SDK is being unloaded.
1881
1958
  */
1882
- declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1959
+ export declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1883
1960
  /**
1884
1961
  * This Plugin has finished unloading, so unload the next one
1885
1962
  * @param uploadState - The state of the unload process
@@ -1896,6 +1973,27 @@ declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext
1896
1973
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
1897
1974
  }
1898
1975
 
1976
+ /**
1977
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
1978
+ * for when plugins are added, removed or the configuration was changed.
1979
+ */
1980
+ export declare interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
1981
+ /**
1982
+ * This Plugin has finished unloading, so unload the next one
1983
+ * @param updateState - The update State
1984
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1985
+ */
1986
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
1987
+ /**
1988
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1989
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1990
+ * then the current execution order will be copied.
1991
+ * @param startAt - The plugin to start processing from, if missing from the execution
1992
+ * order then the next plugin will be NOT set.
1993
+ */
1994
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
1995
+ }
1996
+
1899
1997
  export declare interface _IRegisteredEvents {
1900
1998
  name: string;
1901
1999
  handler: any;
@@ -2100,6 +2198,15 @@ declare interface ITelemetryProcessor {
2100
2198
  * to later plugins (vs appending items to the telemetry item)
2101
2199
  */
2102
2200
  processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2201
+ /**
2202
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
2203
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2204
+ * the configuration has bee updated.
2205
+ * @param updateCtx - This is the context that should be used during updating.
2206
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2207
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2208
+ */
2209
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2103
2210
  }
2104
2211
 
2105
2212
  export declare interface ITelemetryUnloadState {
@@ -2108,6 +2215,32 @@ export declare interface ITelemetryUnloadState {
2108
2215
  flushComplete?: boolean;
2109
2216
  }
2110
2217
 
2218
+ export declare interface ITelemetryUpdateState {
2219
+ /**
2220
+ * Identifies the reason for the update notification, this is a bitwise numeric value
2221
+ */
2222
+ reason: TelemetryUpdateReason;
2223
+ /**
2224
+ * If this is a configuration update this was the previous configuration that was used
2225
+ */
2226
+ /**
2227
+ * If this is a configuration update is the new configuration that is being used
2228
+ */
2229
+ /**
2230
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2231
+ */
2232
+ added?: IPlugin[];
2233
+ /**
2234
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2235
+ */
2236
+ removed?: IPlugin[];
2237
+ }
2238
+
2239
+ export declare interface IUnloadHandlerContainer {
2240
+ add: (handler: UnloadHandler) => void;
2241
+ run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2242
+ }
2243
+
2111
2244
  /**
2112
2245
  * Helper to support backward compatibility for users that use the legacy cookie handling functions and the use the internal
2113
2246
  * CoreUtils._canUseCookies global flag to enable/disable cookies usage.
@@ -2229,7 +2362,9 @@ export declare function objDefineAccessors<T>(target: any, prop: string, getProp
2229
2362
  * @param obj5 - object to merge.
2230
2363
  * @returns The extended first object.
2231
2364
  */
2232
- export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj?: boolean | T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
2365
+ export declare function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
2366
+
2367
+ export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
2233
2368
 
2234
2369
  /**
2235
2370
  * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
@@ -2528,6 +2663,10 @@ export declare const enum SendRequestReason {
2528
2663
  * The event(s) being sent as a retry
2529
2664
  */
2530
2665
  Retry = 5,
2666
+ /**
2667
+ * The SDK is unloading
2668
+ */
2669
+ SdkUnload = 6,
2531
2670
  /**
2532
2671
  * Maximum batch size would be exceeded
2533
2672
  */
@@ -2619,15 +2758,59 @@ export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(it
2619
2758
  /**
2620
2759
  * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2621
2760
  */
2622
- declare const enum TelemetryUnloadReason {
2761
+ export declare const enum TelemetryUnloadReason {
2623
2762
  /**
2624
2763
  * Teardown has been called without any context.
2625
2764
  */
2626
- ManualTeardown = 0
2765
+ ManualTeardown = 0,
2766
+ /**
2767
+ * Just this plugin is being removed
2768
+ */
2769
+ PluginUnload = 1,
2770
+ /**
2771
+ * This instance of the plugin is being removed and replaced
2772
+ */
2773
+ PluginReplace = 2,
2774
+ /**
2775
+ * The entire SDK is being unloaded
2776
+ */
2777
+ SdkUnload = 50
2778
+ }
2779
+
2780
+ /**
2781
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2782
+ */
2783
+ export declare const enum TelemetryUpdateReason {
2784
+ /**
2785
+ * Unknown.
2786
+ */
2787
+ Unknown = 0,
2788
+ /**
2789
+ * The configuration has ben updated or changed
2790
+ */
2791
+ /**
2792
+ * One or more plugins have been added
2793
+ */
2794
+ PluginAdded = 16,
2795
+ /**
2796
+ * One or more plugins have been removed
2797
+ */
2798
+ PluginRemoved = 32
2627
2799
  }
2628
2800
 
2629
2801
  export declare function throwError(message: string): never;
2630
2802
 
2803
+ /**
2804
+ * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
2805
+ * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
2806
+ * support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
2807
+ * the code.
2808
+ * @param logger - The Diagnostic Logger instance to use.
2809
+ * @param severity {LoggingSeverity} - The severity of the log message
2810
+ * @param message {_InternalLogMessage} - The log message.
2811
+ */
2812
+ export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
2813
+
2631
2814
  /**
2632
2815
  * Convert a date to I.S.O. format in IE8
2633
2816
  */
@@ -2637,6 +2820,8 @@ export declare function uaDisallowsSameSiteNone(userAgent: string): boolean;
2637
2820
 
2638
2821
  export declare const Undefined = "undefined";
2639
2822
 
2823
+ export declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2824
+
2640
2825
  export declare function useXDomainRequest(): boolean | undefined;
2641
2826
 
2642
2827
  export { }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-02
2
+ * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";