@microsoft/applicationinsights-core-js 2.8.0-beta.2203-04 → 2.8.0-beta.2203-07
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.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +147 -33
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +1832 -94
- package/dist/applicationinsights-core-js.api.md +70 -12
- package/dist/applicationinsights-core-js.d.ts +167 -11
- package/dist/applicationinsights-core-js.js +147 -33
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +170 -14
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +41 -17
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +31 -3
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +15 -2
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -2
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +14 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +18 -13
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +2 -12
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +56 -5
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -2
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +3 -2
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +3 -3
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +82 -17
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +55 -3
- package/src/JavaScriptSDK/ChannelController.ts +20 -1
- package/src/JavaScriptSDK/CookieMgr.ts +3 -1
- package/src/JavaScriptSDK/DiagnosticLogger.ts +14 -0
- package/src/JavaScriptSDK/EventHelpers.ts +18 -12
- package/src/JavaScriptSDK/HelperFuncs.ts +3 -1
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +71 -8
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +3 -1
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +3 -1
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +22 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +11 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +25 -2
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +12 -1
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/types/JavaScriptSDK/BaseCore.d.ts +32 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +17 -1
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +4 -2
- package/types/JavaScriptSDK/HelperFuncs.d.ts +2 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +9 -1
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +20 -4
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +5 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +23 -2
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +11 -1
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/applicationinsights-core-js.d.ts +6 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-07
|
|
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
|
|
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,
|
|
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
|
|
@@ -202,10 +204,20 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
202
204
|
* approach is to create a new instance and initialize that instance.
|
|
203
205
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
204
206
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
207
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
208
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
209
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
205
210
|
*/
|
|
206
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
211
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
207
212
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
208
|
-
|
|
213
|
+
/**
|
|
214
|
+
* Add a new plugin to the installation
|
|
215
|
+
* @param plugin - The new plugin to add
|
|
216
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
217
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
218
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
219
|
+
*/
|
|
220
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
209
221
|
/**
|
|
210
222
|
* Returns the unique event namespace that should be used
|
|
211
223
|
*/
|
|
@@ -215,7 +227,23 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
215
227
|
* @param handler - the handler
|
|
216
228
|
*/
|
|
217
229
|
addUnloadCb(handler: UnloadHandler): void;
|
|
230
|
+
/**
|
|
231
|
+
* Flush and send any batched / cached data immediately
|
|
232
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
233
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
234
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
235
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
236
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
237
|
+
*/
|
|
238
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
|
|
218
239
|
protected releaseQueue(): void;
|
|
240
|
+
/**
|
|
241
|
+
* Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
|
|
242
|
+
* @param updateCtx - The plugin update context
|
|
243
|
+
* @param updateState - The Update State
|
|
244
|
+
* @returns boolean - True means the extension class will call updateState otherwise the Core will
|
|
245
|
+
*/
|
|
246
|
+
protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
219
247
|
}
|
|
220
248
|
|
|
221
249
|
/**
|
|
@@ -272,6 +300,14 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
272
300
|
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
273
301
|
*/
|
|
274
302
|
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
|
|
305
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
306
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
307
|
+
* @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.
|
|
308
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
309
|
+
*/
|
|
310
|
+
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
275
311
|
constructor();
|
|
276
312
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
277
313
|
/**
|
|
@@ -284,6 +320,13 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
284
320
|
*/
|
|
285
321
|
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
286
322
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
323
|
+
/**
|
|
324
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings.
|
|
325
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
326
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
327
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
328
|
+
*/
|
|
329
|
+
update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
287
330
|
/**
|
|
288
331
|
* Add an unload handler that will be called when the SDK is being unloaded
|
|
289
332
|
* @param handler - the handler
|
|
@@ -820,8 +863,11 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
820
863
|
* approach is to create a new instance and initialize that instance.
|
|
821
864
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
822
865
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
866
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
867
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
868
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
823
869
|
*/
|
|
824
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
870
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
825
871
|
/**
|
|
826
872
|
* Find and return the (first) plugin with the specified identifier if present
|
|
827
873
|
* @param pluginIdentifier
|
|
@@ -830,10 +876,11 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
830
876
|
/**
|
|
831
877
|
* Add a new plugin to the installation
|
|
832
878
|
* @param plugin - The new plugin to add
|
|
833
|
-
* @param replaceExisting - should any existing plugin be replaced
|
|
879
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
834
880
|
* @param doAsync - Should the add be performed asynchronously
|
|
881
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
835
882
|
*/
|
|
836
|
-
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting
|
|
883
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
837
884
|
/**
|
|
838
885
|
* Returns the unique event namespace that should be used when registering events
|
|
839
886
|
*/
|
|
@@ -843,9 +890,19 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
843
890
|
* @param handler - the handler
|
|
844
891
|
*/
|
|
845
892
|
addUnloadCb(handler: UnloadHandler): void;
|
|
893
|
+
/**
|
|
894
|
+
* Flush and send any batched / cached data immediately
|
|
895
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
896
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
897
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
898
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
899
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
900
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
901
|
+
*/
|
|
902
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
846
903
|
}
|
|
847
904
|
|
|
848
|
-
declare interface IBaseProcessingContext {
|
|
905
|
+
export declare interface IBaseProcessingContext {
|
|
849
906
|
/**
|
|
850
907
|
* The current core instance for the request
|
|
851
908
|
*/
|
|
@@ -1510,6 +1567,11 @@ export declare interface IInstrumentHooks {
|
|
|
1510
1567
|
* You must always supply the error callback
|
|
1511
1568
|
*/
|
|
1512
1569
|
export declare interface IInstrumentHooksCallbacks {
|
|
1570
|
+
/**
|
|
1571
|
+
* [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
|
|
1572
|
+
* identify the source of the instrumented hooks
|
|
1573
|
+
*/
|
|
1574
|
+
ns?: string | string[];
|
|
1513
1575
|
/**
|
|
1514
1576
|
* The hook callback to call before the original function is called
|
|
1515
1577
|
*/
|
|
@@ -1924,10 +1986,10 @@ export declare interface IProcessTelemetryContext extends IBaseProcessingContext
|
|
|
1924
1986
|
}
|
|
1925
1987
|
|
|
1926
1988
|
/**
|
|
1927
|
-
* The current context for the current call to
|
|
1928
|
-
*
|
|
1989
|
+
* The current context for the current call to teardown() implementations, used to support when plugins are being removed
|
|
1990
|
+
* or the SDK is being unloaded.
|
|
1929
1991
|
*/
|
|
1930
|
-
declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1992
|
+
export declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1931
1993
|
/**
|
|
1932
1994
|
* This Plugin has finished unloading, so unload the next one
|
|
1933
1995
|
* @param uploadState - The state of the unload process
|
|
@@ -1944,6 +2006,27 @@ declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext
|
|
|
1944
2006
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
1945
2007
|
}
|
|
1946
2008
|
|
|
2009
|
+
/**
|
|
2010
|
+
* The current context for the current call to the plugin update() implementations, used to support the notifications
|
|
2011
|
+
* for when plugins are added, removed or the configuration was changed.
|
|
2012
|
+
*/
|
|
2013
|
+
export declare interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
|
|
2014
|
+
/**
|
|
2015
|
+
* This Plugin has finished unloading, so unload the next one
|
|
2016
|
+
* @param updateState - The update State
|
|
2017
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
2018
|
+
*/
|
|
2019
|
+
processNext: (updateState: ITelemetryUpdateState) => boolean | void;
|
|
2020
|
+
/**
|
|
2021
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
2022
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
2023
|
+
* then the current execution order will be copied.
|
|
2024
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
2025
|
+
* order then the next plugin will be NOT set.
|
|
2026
|
+
*/
|
|
2027
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
1947
2030
|
export declare interface _IRegisteredEvents {
|
|
1948
2031
|
name: string;
|
|
1949
2032
|
handler: any;
|
|
@@ -2148,6 +2231,15 @@ declare interface ITelemetryProcessor {
|
|
|
2148
2231
|
* to later plugins (vs appending items to the telemetry item)
|
|
2149
2232
|
*/
|
|
2150
2233
|
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2234
|
+
/**
|
|
2235
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings or
|
|
2236
|
+
* plugins. If implemented this method will be called whenever a plugin is added or removed and if
|
|
2237
|
+
* the configuration has bee updated.
|
|
2238
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
2239
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
2240
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
2241
|
+
*/
|
|
2242
|
+
update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
|
|
2151
2243
|
}
|
|
2152
2244
|
|
|
2153
2245
|
export declare interface ITelemetryUnloadState {
|
|
@@ -2156,6 +2248,27 @@ export declare interface ITelemetryUnloadState {
|
|
|
2156
2248
|
flushComplete?: boolean;
|
|
2157
2249
|
}
|
|
2158
2250
|
|
|
2251
|
+
export declare interface ITelemetryUpdateState {
|
|
2252
|
+
/**
|
|
2253
|
+
* Identifies the reason for the update notification, this is a bitwise numeric value
|
|
2254
|
+
*/
|
|
2255
|
+
reason: TelemetryUpdateReason;
|
|
2256
|
+
/**
|
|
2257
|
+
* If this is a configuration update this was the previous configuration that was used
|
|
2258
|
+
*/
|
|
2259
|
+
/**
|
|
2260
|
+
* If this is a configuration update is the new configuration that is being used
|
|
2261
|
+
*/
|
|
2262
|
+
/**
|
|
2263
|
+
* This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
|
|
2264
|
+
*/
|
|
2265
|
+
added?: IPlugin[];
|
|
2266
|
+
/**
|
|
2267
|
+
* This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
|
|
2268
|
+
*/
|
|
2269
|
+
removed?: IPlugin[];
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2159
2272
|
export declare interface IUnloadHandlerContainer {
|
|
2160
2273
|
add: (handler: UnloadHandler) => void;
|
|
2161
2274
|
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
@@ -2282,7 +2395,9 @@ export declare function objDefineAccessors<T>(target: any, prop: string, getProp
|
|
|
2282
2395
|
* @param obj5 - object to merge.
|
|
2283
2396
|
* @returns The extended first object.
|
|
2284
2397
|
*/
|
|
2285
|
-
export declare function objExtend<
|
|
2398
|
+
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;
|
|
2399
|
+
|
|
2400
|
+
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;
|
|
2286
2401
|
|
|
2287
2402
|
/**
|
|
2288
2403
|
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
|
@@ -2529,6 +2644,15 @@ export declare function removeEventListeners(events: string[], listener: any, ev
|
|
|
2529
2644
|
*/
|
|
2530
2645
|
export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2531
2646
|
|
|
2647
|
+
/**
|
|
2648
|
+
* Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
|
|
2649
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
|
|
2650
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
2651
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
2652
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
2653
|
+
*/
|
|
2654
|
+
export declare function removePageShowEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2655
|
+
|
|
2532
2656
|
/**
|
|
2533
2657
|
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
2534
2658
|
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
@@ -2676,7 +2800,7 @@ export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(it
|
|
|
2676
2800
|
/**
|
|
2677
2801
|
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
2678
2802
|
*/
|
|
2679
|
-
declare const enum TelemetryUnloadReason {
|
|
2803
|
+
export declare const enum TelemetryUnloadReason {
|
|
2680
2804
|
/**
|
|
2681
2805
|
* Teardown has been called without any context.
|
|
2682
2806
|
*/
|
|
@@ -2695,8 +2819,40 @@ declare const enum TelemetryUnloadReason {
|
|
|
2695
2819
|
SdkUnload = 50
|
|
2696
2820
|
}
|
|
2697
2821
|
|
|
2822
|
+
/**
|
|
2823
|
+
* The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
|
|
2824
|
+
*/
|
|
2825
|
+
export declare const enum TelemetryUpdateReason {
|
|
2826
|
+
/**
|
|
2827
|
+
* Unknown.
|
|
2828
|
+
*/
|
|
2829
|
+
Unknown = 0,
|
|
2830
|
+
/**
|
|
2831
|
+
* The configuration has ben updated or changed
|
|
2832
|
+
*/
|
|
2833
|
+
/**
|
|
2834
|
+
* One or more plugins have been added
|
|
2835
|
+
*/
|
|
2836
|
+
PluginAdded = 16,
|
|
2837
|
+
/**
|
|
2838
|
+
* One or more plugins have been removed
|
|
2839
|
+
*/
|
|
2840
|
+
PluginRemoved = 32
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2698
2843
|
export declare function throwError(message: string): never;
|
|
2699
2844
|
|
|
2845
|
+
/**
|
|
2846
|
+
* This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
|
|
2847
|
+
* debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
|
|
2848
|
+
* support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
|
|
2849
|
+
* the code.
|
|
2850
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
2851
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
2852
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
2853
|
+
*/
|
|
2854
|
+
export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
2855
|
+
|
|
2700
2856
|
/**
|
|
2701
2857
|
* Convert a date to I.S.O. format in IE8
|
|
2702
2858
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-07
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-07
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights-shims";
|
|
9
9
|
import { objCreateFn } from "@microsoft/applicationinsights-shims";
|
|
10
10
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
11
|
-
import { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createTelemetryProxyChain } from "./ProcessTelemetryContext";
|
|
11
|
+
import { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from "./ProcessTelemetryContext";
|
|
12
12
|
import { initializePlugins, sortPlugins, _getPluginState } from "./TelemetryHelpers";
|
|
13
13
|
import { getGblPerfMgr, PerfManager } from "./PerfManager";
|
|
14
14
|
import { createCookieMgr } from "./CookieMgr";
|
|
15
15
|
import { arrForEach, isNullOrUndefined, toISOString, getSetValue, setValue, throwError, isNotTruthy, isFunction, objFreeze, proxyFunctionAs, proxyFunctions } from "./HelperFuncs";
|
|
16
16
|
import { strExtensionConfig, strIKey } from "./Constants";
|
|
17
|
-
import { DiagnosticLogger, _InternalLogMessage } from "./DiagnosticLogger";
|
|
17
|
+
import { DiagnosticLogger, _InternalLogMessage, _throwInternal } from "./DiagnosticLogger";
|
|
18
18
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
19
19
|
import { ChannelControllerPriority, createChannelControllerPlugin, createChannelQueues } from "./ChannelController";
|
|
20
20
|
import { TelemetryInitializerPlugin } from "./TelemetryInitializerPlugin";
|
|
@@ -143,8 +143,8 @@ var BaseCore = /** @class */ (function () {
|
|
|
143
143
|
_configExtensions = [];
|
|
144
144
|
_configExtensions.push.apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), config.extensions, false));
|
|
145
145
|
_channelConfig = (config || {}).channels;
|
|
146
|
-
_initPluginChain(config);
|
|
147
|
-
if (
|
|
146
|
+
_initPluginChain(config, null);
|
|
147
|
+
if (!_channelQueue || _channelQueue.length === 0) {
|
|
148
148
|
throwError("No channels available");
|
|
149
149
|
}
|
|
150
150
|
_isInitialized = true;
|
|
@@ -295,16 +295,12 @@ var BaseCore = /** @class */ (function () {
|
|
|
295
295
|
// Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state
|
|
296
296
|
processUnloadCtx.processNext(unloadState);
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
_doUnload(true);
|
|
298
|
+
if (!_flushChannels(isAsync, _doUnload, 6 /* SdkUnload */, cbTimeout)) {
|
|
299
|
+
_doUnload(false);
|
|
303
300
|
}
|
|
304
301
|
};
|
|
305
302
|
_self.getPlugin = _getPlugin;
|
|
306
303
|
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
307
|
-
if (isAsync === void 0) { isAsync = true; }
|
|
308
304
|
if (!plugin) {
|
|
309
305
|
addCb && addCb(false);
|
|
310
306
|
_logOrThrowError(strValidationError);
|
|
@@ -316,24 +312,30 @@ var BaseCore = /** @class */ (function () {
|
|
|
316
312
|
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
317
313
|
return;
|
|
318
314
|
}
|
|
315
|
+
var updateState = {
|
|
316
|
+
reason: 16 /* PluginAdded */
|
|
317
|
+
};
|
|
319
318
|
function _addPlugin(removed) {
|
|
320
319
|
_configExtensions.push(plugin);
|
|
320
|
+
updateState.added = [plugin];
|
|
321
321
|
// Re-Initialize the plugin chain
|
|
322
|
-
_initPluginChain(_self.config);
|
|
322
|
+
_initPluginChain(_self.config, updateState);
|
|
323
323
|
addCb && addCb(true);
|
|
324
324
|
}
|
|
325
325
|
if (existingPlugin) {
|
|
326
|
-
var
|
|
326
|
+
var removedPlugins_1 = [existingPlugin.plugin];
|
|
327
327
|
var unloadState = {
|
|
328
328
|
reason: 2 /* PluginReplace */,
|
|
329
329
|
isAsync: isAsync
|
|
330
330
|
};
|
|
331
|
-
_removePlugins(
|
|
331
|
+
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
332
332
|
if (!removed) {
|
|
333
333
|
// Previous plugin was successfully removed or was not installed
|
|
334
334
|
addCb && addCb(false);
|
|
335
335
|
}
|
|
336
336
|
else {
|
|
337
|
+
updateState.removed = removedPlugins_1;
|
|
338
|
+
updateState.reason |= 32 /* PluginRemoved */;
|
|
337
339
|
_addPlugin(true);
|
|
338
340
|
}
|
|
339
341
|
});
|
|
@@ -345,6 +347,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
345
347
|
_self.evtNamespace = function () {
|
|
346
348
|
return _evtNamespace;
|
|
347
349
|
};
|
|
350
|
+
_self.flush = _flushChannels;
|
|
348
351
|
// Create the addUnloadCb
|
|
349
352
|
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
350
353
|
function _initDefaults() {
|
|
@@ -374,7 +377,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
374
377
|
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
375
378
|
}
|
|
376
379
|
// Initialize or Re-initialize the plugins
|
|
377
|
-
function _initPluginChain(config) {
|
|
380
|
+
function _initPluginChain(config, updateState) {
|
|
378
381
|
// Extension validation
|
|
379
382
|
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
380
383
|
_coreExtensions = theExtensions.core;
|
|
@@ -411,6 +414,9 @@ var BaseCore = /** @class */ (function () {
|
|
|
411
414
|
initializePlugins(_createTelCtx(), allExtensions);
|
|
412
415
|
// Now reset the extensions to just those being managed by Basecore
|
|
413
416
|
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
417
|
+
if (updateState) {
|
|
418
|
+
_doUpdate(updateState);
|
|
419
|
+
}
|
|
414
420
|
}
|
|
415
421
|
function _getPlugin(pluginIdentifier) {
|
|
416
422
|
var theExt = null;
|
|
@@ -445,7 +451,10 @@ var BaseCore = /** @class */ (function () {
|
|
|
445
451
|
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
446
452
|
if (removed) {
|
|
447
453
|
// Re-Initialize the plugin chain
|
|
448
|
-
_initPluginChain(_self.config
|
|
454
|
+
_initPluginChain(_self.config, {
|
|
455
|
+
reason: 32 /* PluginRemoved */,
|
|
456
|
+
removed: pluginsToRemove
|
|
457
|
+
});
|
|
449
458
|
}
|
|
450
459
|
removeCb && removeCb(removed);
|
|
451
460
|
});
|
|
@@ -524,6 +533,13 @@ var BaseCore = /** @class */ (function () {
|
|
|
524
533
|
queue.length = 0;
|
|
525
534
|
}
|
|
526
535
|
}
|
|
536
|
+
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
537
|
+
if (_channelControl) {
|
|
538
|
+
return _channelControl.flush(isAsync, callBack, sendReason || 6 /* SdkUnload */, cbTimeout);
|
|
539
|
+
}
|
|
540
|
+
callBack && callBack(false);
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
527
543
|
function _initDebugListener(config) {
|
|
528
544
|
if (config.disableDbgExt === true && _debugListener) {
|
|
529
545
|
// Remove any previously loaded debug listener
|
|
@@ -549,11 +565,17 @@ var BaseCore = /** @class */ (function () {
|
|
|
549
565
|
var extConfig = getSetValue(config, strExtensionConfig);
|
|
550
566
|
extConfig.NotificationManager = _notificationManager;
|
|
551
567
|
}
|
|
568
|
+
function _doUpdate(updateState) {
|
|
569
|
+
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
|
|
570
|
+
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
571
|
+
updateCtx.processNext(updateState);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
552
574
|
function _logOrThrowError(message) {
|
|
553
575
|
var logger = _self.logger;
|
|
554
576
|
if (logger) {
|
|
555
577
|
// there should always be a logger
|
|
556
|
-
logger
|
|
578
|
+
_throwInternal(logger, 2 /* WARNING */, 73 /* PluginException */, message);
|
|
557
579
|
}
|
|
558
580
|
else {
|
|
559
581
|
throwError(message);
|
|
@@ -581,7 +603,9 @@ var BaseCore = /** @class */ (function () {
|
|
|
581
603
|
// Removed Stub for BaseCore.prototype.addPlugin.
|
|
582
604
|
// Removed Stub for BaseCore.prototype.evtNamespace.
|
|
583
605
|
// Removed Stub for BaseCore.prototype.addUnloadCb.
|
|
606
|
+
// Removed Stub for BaseCore.prototype.flush.
|
|
584
607
|
// Removed Stub for BaseCore.prototype.releaseQueue.
|
|
608
|
+
// Removed Stub for BaseCore.prototype._updateHook.
|
|
585
609
|
return BaseCore;
|
|
586
610
|
}());
|
|
587
611
|
export { BaseCore };
|