@microsoft/applicationinsights-core-js 2.8.0-beta.2203-03 → 2.8.0-beta.2203-06

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 (100) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +129 -26
  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 +1667 -177
  7. package/dist/applicationinsights-core-js.api.md +62 -8
  8. package/dist/applicationinsights-core-js.d.ts +121 -7
  9. package/dist/applicationinsights-core-js.js +129 -26
  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 +124 -10
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +29 -10
  16. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  17. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +30 -2
  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 +2 -12
  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 +56 -5
  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 +3 -2
  45. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
  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 +2 -2
  72. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  73. package/package.json +1 -1
  74. package/src/JavaScriptSDK/BaseCore.ts +44 -9
  75. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +54 -2
  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 +3 -1
  81. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +71 -8
  82. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +3 -1
  83. package/src/JavaScriptSDK/UnloadHandlerContainer.ts +3 -1
  84. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
  85. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +11 -6
  86. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +25 -2
  87. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +12 -1
  88. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
  89. package/types/JavaScriptSDK/BaseCore.d.ts +11 -2
  90. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +17 -1
  91. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
  92. package/types/JavaScriptSDK/EventHelpers.d.ts +4 -2
  93. package/types/JavaScriptSDK/HelperFuncs.d.ts +2 -1
  94. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +9 -1
  95. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
  96. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +5 -0
  97. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +23 -2
  98. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +11 -1
  99. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
  100. package/types/applicationinsights-core-js.d.ts +5 -2
@@ -12,7 +12,7 @@ import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights
12
12
  import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
13
13
 
14
14
  // @public
15
- export function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
15
+ export function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
16
16
 
17
17
  // @public
18
18
  export function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
@@ -102,7 +102,8 @@ export class BaseCore implements IAppInsightsCore {
102
102
  stopPollingInternalLogs(): void;
103
103
  // (undocumented)
104
104
  track(telemetryItem: ITelemetryItem): void;
105
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
105
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
106
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
106
107
  }
107
108
 
108
109
  // @public
@@ -112,8 +113,8 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
112
113
  protected _addUnloadCb(handler: UnloadHandler): void;
113
114
  core: IAppInsightsCore;
114
115
  diagLog: (itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger;
115
- // Warning: (ae-forgotten-export) The symbol "IProcessTelemetryUnloadContext" needs to be exported by the entry point applicationinsights-core-js.d.ts
116
116
  protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
117
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
117
118
  protected _getTelCtx: (currentCtx?: IProcessTelemetryContext) => IProcessTelemetryContext;
118
119
  // (undocumented)
119
120
  identifier: string;
@@ -128,6 +129,7 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
128
129
  protected setInitialized: (isInitialized: boolean) => void;
129
130
  setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
130
131
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
132
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
131
133
  // (undocumented)
132
134
  version?: string;
133
135
  }
@@ -505,6 +507,21 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
505
507
  unload(isAsync?: boolean, unloadComplete?: () => void): void;
506
508
  }
507
509
 
510
+ // @public (undocumented)
511
+ export interface IBaseProcessingContext {
512
+ core: () => IAppInsightsCore;
513
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
514
+ diagLog: () => IDiagnosticLogger;
515
+ getCfg: () => IConfiguration;
516
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
517
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
518
+ getNext: () => ITelemetryPluginChain;
519
+ hasNext: () => boolean;
520
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
521
+ onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
522
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
523
+ }
524
+
508
525
  // @public
509
526
  export interface IChannelControls extends ITelemetryPlugin {
510
527
  flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
@@ -691,6 +708,7 @@ export interface IInstrumentHooks {
691
708
  export interface IInstrumentHooksCallbacks {
692
709
  fnErr?: InstrumentorHooksCallback;
693
710
  hkErr?: InstrumentorHooksCallback;
711
+ ns?: string | string[];
694
712
  req?: InstrumentorHooksCallback;
695
713
  rsp?: InstrumentorHooksCallback;
696
714
  }
@@ -872,14 +890,24 @@ export interface IPlugin {
872
890
  readonly version?: string;
873
891
  }
874
892
 
875
- // Warning: (ae-forgotten-export) The symbol "IBaseProcessingContext" needs to be exported by the entry point applicationinsights-core-js.d.ts
876
- //
877
893
  // @public
878
894
  export interface IProcessTelemetryContext extends IBaseProcessingContext {
879
895
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
880
896
  processNext: (env: ITelemetryItem) => boolean | void;
881
897
  }
882
898
 
899
+ // @public
900
+ export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
901
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
902
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
903
+ }
904
+
905
+ // @public
906
+ export interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
907
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
908
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
909
+ }
910
+
883
911
  // @public (undocumented)
884
912
  export interface _IRegisteredEvents {
885
913
  // (undocumented)
@@ -1003,12 +1031,17 @@ export interface ITelemetryUnloadState {
1003
1031
  flushComplete?: boolean;
1004
1032
  // (undocumented)
1005
1033
  isAsync: boolean;
1006
- // Warning: (ae-forgotten-export) The symbol "TelemetryUnloadReason" needs to be exported by the entry point applicationinsights-core-js.d.ts
1007
- //
1008
1034
  // (undocumented)
1009
1035
  reason: TelemetryUnloadReason;
1010
1036
  }
1011
1037
 
1038
+ // @public (undocumented)
1039
+ export interface ITelemetryUpdateState {
1040
+ added?: IPlugin[];
1041
+ reason: TelemetryUpdateReason;
1042
+ removed?: IPlugin[];
1043
+ }
1044
+
1012
1045
  // @public (undocumented)
1013
1046
  export interface IUnloadHandlerContainer {
1014
1047
  // (undocumented)
@@ -1069,7 +1102,10 @@ export { objCreate }
1069
1102
  export function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
1070
1103
 
1071
1104
  // @public
1072
- export 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;
1105
+ export function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
1106
+
1107
+ // @public (undocumented)
1108
+ export 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;
1073
1109
 
1074
1110
  // @public
1075
1111
  export function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
@@ -1236,9 +1272,27 @@ export interface Tags {
1236
1272
  // @public (undocumented)
1237
1273
  export type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
1238
1274
 
1275
+ // @public
1276
+ export const enum TelemetryUnloadReason {
1277
+ ManualTeardown = 0,
1278
+ PluginReplace = 2,
1279
+ PluginUnload = 1,
1280
+ SdkUnload = 50
1281
+ }
1282
+
1283
+ // @public
1284
+ export const enum TelemetryUpdateReason {
1285
+ PluginAdded = 16,
1286
+ PluginRemoved = 32,
1287
+ Unknown = 0
1288
+ }
1289
+
1239
1290
  // @public (undocumented)
1240
1291
  export function throwError(message: string): never;
1241
1292
 
1293
+ // @public
1294
+ export function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
1295
+
1242
1296
  // @public
1243
1297
  export function toISOString(date: Date): string;
1244
1298
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-03
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -18,9 +18,11 @@ declare namespace ApplicationInsights {
18
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
19
  * applications to remove their own events
20
20
  * @param target - The EventTarget that has registered events
21
- * @param evtName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
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
22
24
  */
23
- function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
25
+ function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
24
26
 
25
27
  /**
26
28
  * Trys to add an event handler for the specified event to the window, body and document
@@ -197,7 +199,7 @@ declare namespace ApplicationInsights {
197
199
  * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
198
200
  * to successfully remove any global references or they may just be completing the unload process asynchronously.
199
201
  */
200
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
202
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
201
203
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
202
204
  addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
203
205
  /**
@@ -210,6 +212,13 @@ declare namespace ApplicationInsights {
210
212
  */
211
213
  addUnloadCb(handler: UnloadHandler): void;
212
214
  protected releaseQueue(): void;
215
+ /**
216
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
217
+ * @param updateCtx - The plugin update context
218
+ * @param updateState - The Update State
219
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
220
+ */
221
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
213
222
  }
214
223
 
215
224
  /**
@@ -266,6 +275,14 @@ declare namespace ApplicationInsights {
266
275
  * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
267
276
  */
268
277
  protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
278
+ /**
279
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
280
+ * @param updateCtx - This is the context that should be used during updating.
281
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
282
+ * @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.
283
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
284
+ */
285
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
269
286
  constructor();
270
287
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
271
288
  /**
@@ -278,6 +295,13 @@ declare namespace ApplicationInsights {
278
295
  */
279
296
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
280
297
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
298
+ /**
299
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
300
+ * @param updateCtx - This is the context that should be used during updating.
301
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
302
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
303
+ */
304
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
281
305
  /**
282
306
  * Add an unload handler that will be called when the SDK is being unloaded
283
307
  * @param handler - the handler
@@ -1504,6 +1528,11 @@ declare namespace ApplicationInsights {
1504
1528
  * You must always supply the error callback
1505
1529
  */
1506
1530
  interface IInstrumentHooksCallbacks {
1531
+ /**
1532
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1533
+ * identify the source of the instrumented hooks
1534
+ */
1535
+ ns?: string | string[];
1507
1536
  /**
1508
1537
  * The hook callback to call before the original function is called
1509
1538
  */
@@ -1918,8 +1947,8 @@ declare namespace ApplicationInsights {
1918
1947
  }
1919
1948
 
1920
1949
  /**
1921
- * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1922
- * between multiple AppInsights instances
1950
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
1951
+ * or the SDK is being unloaded.
1923
1952
  */
1924
1953
  interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1925
1954
  /**
@@ -1938,6 +1967,27 @@ declare namespace ApplicationInsights {
1938
1967
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
1939
1968
  }
1940
1969
 
1970
+ /**
1971
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
1972
+ * for when plugins are added, removed or the configuration was changed.
1973
+ */
1974
+ interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
1975
+ /**
1976
+ * This Plugin has finished unloading, so unload the next one
1977
+ * @param updateState - The update State
1978
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1979
+ */
1980
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
1981
+ /**
1982
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1983
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1984
+ * then the current execution order will be copied.
1985
+ * @param startAt - The plugin to start processing from, if missing from the execution
1986
+ * order then the next plugin will be NOT set.
1987
+ */
1988
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
1989
+ }
1990
+
1941
1991
  interface _IRegisteredEvents {
1942
1992
  name: string;
1943
1993
  handler: any;
@@ -2142,6 +2192,15 @@ declare namespace ApplicationInsights {
2142
2192
  * to later plugins (vs appending items to the telemetry item)
2143
2193
  */
2144
2194
  processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2195
+ /**
2196
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
2197
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2198
+ * the configuration has bee updated.
2199
+ * @param updateCtx - This is the context that should be used during updating.
2200
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2201
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2202
+ */
2203
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2145
2204
  }
2146
2205
 
2147
2206
  interface ITelemetryUnloadState {
@@ -2150,6 +2209,27 @@ declare namespace ApplicationInsights {
2150
2209
  flushComplete?: boolean;
2151
2210
  }
2152
2211
 
2212
+ interface ITelemetryUpdateState {
2213
+ /**
2214
+ * Identifies the reason for the update notification, this is a bitwise numeric value
2215
+ */
2216
+ reason: TelemetryUpdateReason;
2217
+ /**
2218
+ * If this is a configuration update this was the previous configuration that was used
2219
+ */
2220
+ /**
2221
+ * If this is a configuration update is the new configuration that is being used
2222
+ */
2223
+ /**
2224
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2225
+ */
2226
+ added?: IPlugin[];
2227
+ /**
2228
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2229
+ */
2230
+ removed?: IPlugin[];
2231
+ }
2232
+
2153
2233
  interface IUnloadHandlerContainer {
2154
2234
  add: (handler: UnloadHandler) => void;
2155
2235
  run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
@@ -2276,7 +2356,9 @@ declare namespace ApplicationInsights {
2276
2356
  * @param obj5 - object to merge.
2277
2357
  * @returns The extended first object.
2278
2358
  */
2279
- 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;
2359
+ function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
2360
+
2361
+ 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;
2280
2362
 
2281
2363
  /**
2282
2364
  * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
@@ -2689,8 +2771,40 @@ declare namespace ApplicationInsights {
2689
2771
  SdkUnload = 50
2690
2772
  }
2691
2773
 
2774
+ /**
2775
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2776
+ */
2777
+ const enum TelemetryUpdateReason {
2778
+ /**
2779
+ * Unknown.
2780
+ */
2781
+ Unknown = 0,
2782
+ /**
2783
+ * The configuration has ben updated or changed
2784
+ */
2785
+ /**
2786
+ * One or more plugins have been added
2787
+ */
2788
+ PluginAdded = 16,
2789
+ /**
2790
+ * One or more plugins have been removed
2791
+ */
2792
+ PluginRemoved = 32
2793
+ }
2794
+
2692
2795
  function throwError(message: string): never;
2693
2796
 
2797
+ /**
2798
+ * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
2799
+ * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
2800
+ * support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
2801
+ * the code.
2802
+ * @param logger - The Diagnostic Logger instance to use.
2803
+ * @param severity {LoggingSeverity} - The severity of the log message
2804
+ * @param message {_InternalLogMessage} - The log message.
2805
+ */
2806
+ function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
2807
+
2694
2808
  /**
2695
2809
  * Convert a date to I.S.O. format in IE8
2696
2810
  */