@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-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.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2440 -1199
- 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 +16710 -8876
- package/dist/applicationinsights-core-js.api.md +465 -140
- package/dist/applicationinsights-core-js.d.ts +856 -217
- package/dist/applicationinsights-core-js.js +2440 -1199
- 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 +856 -217
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -72
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +45 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +80 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +51 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +10 -9
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- 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 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +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 +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- 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 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +13 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +4 -105
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +114 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +56 -0
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +48 -8
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +183 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +23 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +37 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +34 -0
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +14 -9
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +89 -86
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +20 -10
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 2.8.0-nightly.
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 2.8.0-nightly.2204-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -14,39 +14,61 @@ declare namespace ApplicationInsights {
|
|
|
14
14
|
import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights-shims';
|
|
15
15
|
import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
|
|
19
|
+
* applications to remove their own events
|
|
20
|
+
* @param target - The EventTarget that has registered events
|
|
21
|
+
* @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
22
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
23
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
24
|
+
*/
|
|
25
|
+
function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* Trys to add an event handler for the specified event to the window, body and document
|
|
19
29
|
* @param eventName {string} - The name of the event
|
|
20
30
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
31
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
21
32
|
* @return {boolean} - true if the handler was successfully added
|
|
22
33
|
*/
|
|
23
|
-
function addEventHandler(eventName: string, callback: any): boolean;
|
|
34
|
+
function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
|
|
24
35
|
|
|
25
36
|
/**
|
|
26
37
|
* Bind the listener to the array of events
|
|
27
38
|
* @param events An string array of event names to bind the listener to
|
|
28
39
|
* @param listener The event callback to call when the event is triggered
|
|
29
40
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
41
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
30
42
|
* @returns true - when at least one of the events was registered otherwise false
|
|
31
43
|
*/
|
|
32
|
-
function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
|
|
44
|
+
function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
33
45
|
|
|
34
46
|
/**
|
|
35
|
-
* Listen to the pagehide and visibility changing to 'hidden' events
|
|
47
|
+
* Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
|
|
48
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
49
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
36
50
|
* @param listener - The event callback to call when a page hide event is triggered
|
|
37
51
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
52
|
+
* @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
|
|
53
|
+
* based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
54
|
+
* so that only the matching "removePageHideEventListener" can remove these events.
|
|
38
55
|
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
39
56
|
* @returns true - when at least one of the events was registered otherwise false
|
|
40
57
|
*/
|
|
41
|
-
function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
58
|
+
function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
42
59
|
|
|
43
60
|
/**
|
|
44
|
-
* Listen to the pageshow and visibility changing to 'visible' events
|
|
61
|
+
* Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
|
|
62
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
63
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
45
64
|
* @param listener - The event callback to call when a page is show event is triggered
|
|
46
65
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
66
|
+
* @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
|
|
67
|
+
* identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
68
|
+
* so that only the matching "removePageShowEventListener" can remove these events.
|
|
47
69
|
* @returns true - when at least one of the events was registered otherwise false
|
|
48
70
|
*/
|
|
49
|
-
function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
71
|
+
function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
50
72
|
|
|
51
73
|
/**
|
|
52
74
|
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
@@ -56,34 +78,15 @@ declare namespace ApplicationInsights {
|
|
|
56
78
|
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
57
79
|
* @param listener - The event callback to call when a page unload event is triggered
|
|
58
80
|
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
81
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
59
82
|
* @returns true - when at least one of the events was registered otherwise false
|
|
60
83
|
*/
|
|
61
|
-
function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
84
|
+
function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
62
85
|
|
|
63
86
|
class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
64
87
|
constructor();
|
|
65
88
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
66
89
|
track(telemetryItem: ITelemetryItem): void;
|
|
67
|
-
/**
|
|
68
|
-
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
69
|
-
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
70
|
-
* called.
|
|
71
|
-
* @param {INotificationListener} listener - An INotificationListener object.
|
|
72
|
-
*/
|
|
73
|
-
addNotificationListener(listener: INotificationListener): void;
|
|
74
|
-
/**
|
|
75
|
-
* Removes all instances of the listener.
|
|
76
|
-
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
77
|
-
*/
|
|
78
|
-
removeNotificationListener(listener: INotificationListener): void;
|
|
79
|
-
/**
|
|
80
|
-
* Periodically check logger.queue for
|
|
81
|
-
*/
|
|
82
|
-
pollInternalLogs(eventName?: string): number;
|
|
83
|
-
/**
|
|
84
|
-
* Periodically check logger.queue for
|
|
85
|
-
*/
|
|
86
|
-
stopPollingInternalLogs(): void;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
function areCookiesSupported(logger?: IDiagnosticLogger): any;
|
|
@@ -96,7 +99,7 @@ declare namespace ApplicationInsights {
|
|
|
96
99
|
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
|
|
97
100
|
* @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
98
101
|
*/
|
|
99
|
-
function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
102
|
+
function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
105
|
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
@@ -131,7 +134,7 @@ declare namespace ApplicationInsights {
|
|
|
131
134
|
/**
|
|
132
135
|
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
133
136
|
* @param obj Object to add the event too.
|
|
134
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
137
|
+
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
|
|
135
138
|
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
136
139
|
* @param useCapture [Optional] Defaults to false
|
|
137
140
|
* @returns True if the function was bound successfully to the event, otherwise false
|
|
@@ -150,6 +153,18 @@ declare namespace ApplicationInsights {
|
|
|
150
153
|
track(telemetryItem: ITelemetryItem): void;
|
|
151
154
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
152
155
|
getNotifyMgr(): INotificationManager;
|
|
156
|
+
/**
|
|
157
|
+
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
158
|
+
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
159
|
+
* called.
|
|
160
|
+
* @param {INotificationListener} listener - An INotificationListener object.
|
|
161
|
+
*/
|
|
162
|
+
addNotificationListener(listener: INotificationListener): void;
|
|
163
|
+
/**
|
|
164
|
+
* Removes all instances of the listener.
|
|
165
|
+
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
166
|
+
*/
|
|
167
|
+
removeNotificationListener(listener: INotificationListener): void;
|
|
153
168
|
/**
|
|
154
169
|
* Get the current cookie manager for this instance
|
|
155
170
|
*/
|
|
@@ -162,7 +177,67 @@ declare namespace ApplicationInsights {
|
|
|
162
177
|
getPerfMgr(): IPerfManager;
|
|
163
178
|
setPerfMgr(perfMgr: IPerfManager): void;
|
|
164
179
|
eventCnt(): number;
|
|
180
|
+
/**
|
|
181
|
+
* Periodically check logger.queue for
|
|
182
|
+
*/
|
|
183
|
+
pollInternalLogs(eventName?: string): number;
|
|
184
|
+
/**
|
|
185
|
+
* Periodically check logger.queue for
|
|
186
|
+
*/
|
|
187
|
+
stopPollingInternalLogs(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
190
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
191
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
192
|
+
*/
|
|
193
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
194
|
+
/**
|
|
195
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
196
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
197
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
198
|
+
* approach is to create a new instance and initialize that instance.
|
|
199
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
200
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
201
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
202
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
203
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
204
|
+
*/
|
|
205
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
206
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
207
|
+
/**
|
|
208
|
+
* Add a new plugin to the installation
|
|
209
|
+
* @param plugin - The new plugin to add
|
|
210
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
211
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
212
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
213
|
+
*/
|
|
214
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
215
|
+
/**
|
|
216
|
+
* Returns the unique event namespace that should be used
|
|
217
|
+
*/
|
|
218
|
+
evtNamespace(): string;
|
|
219
|
+
/**
|
|
220
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
221
|
+
* @param handler - the handler
|
|
222
|
+
*/
|
|
223
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
224
|
+
/**
|
|
225
|
+
* Flush and send any batched / cached data immediately
|
|
226
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
227
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
228
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
229
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
230
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
231
|
+
*/
|
|
232
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
|
|
165
233
|
protected releaseQueue(): void;
|
|
234
|
+
/**
|
|
235
|
+
* Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
|
|
236
|
+
* @param updateCtx - The plugin update context
|
|
237
|
+
* @param updateState - The Update State
|
|
238
|
+
* @returns boolean - True means the extension class will call updateState otherwise the Core will
|
|
239
|
+
*/
|
|
240
|
+
protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
166
241
|
}
|
|
167
242
|
|
|
168
243
|
/**
|
|
@@ -171,6 +246,13 @@ declare namespace ApplicationInsights {
|
|
|
171
246
|
* implementation so that new default implementations can be added without breaking all plugins.
|
|
172
247
|
*/
|
|
173
248
|
abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
249
|
+
identifier: string;
|
|
250
|
+
version?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Holds the core instance that was used during initialization
|
|
253
|
+
*/
|
|
254
|
+
core: IAppInsightsCore;
|
|
255
|
+
priority: number;
|
|
174
256
|
/**
|
|
175
257
|
* Call back for telemetry processing before it it is sent
|
|
176
258
|
* @param env - This is the current event being reported
|
|
@@ -192,13 +274,6 @@ declare namespace ApplicationInsights {
|
|
|
192
274
|
* Returns whether the plugin has been initialized
|
|
193
275
|
*/
|
|
194
276
|
isInitialized: () => boolean;
|
|
195
|
-
identifier: string;
|
|
196
|
-
version?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Holds the core instance that was used during initialization
|
|
199
|
-
*/
|
|
200
|
-
core: IAppInsightsCore;
|
|
201
|
-
priority: number;
|
|
202
277
|
/**
|
|
203
278
|
* Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
|
|
204
279
|
* returns that value (helps with minification for callers), otherwise it will return the configured
|
|
@@ -211,12 +286,51 @@ declare namespace ApplicationInsights {
|
|
|
211
286
|
*/
|
|
212
287
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
213
288
|
/**
|
|
214
|
-
*
|
|
289
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
290
|
+
* finishes it's removal.
|
|
291
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
292
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
293
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
|
|
294
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
215
295
|
*/
|
|
216
|
-
|
|
296
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
|
|
299
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
300
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
301
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
|
|
302
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
303
|
+
*/
|
|
304
|
+
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
217
305
|
constructor();
|
|
218
306
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
307
|
+
/**
|
|
308
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
309
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
310
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
311
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
312
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
313
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
314
|
+
*/
|
|
315
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
219
316
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
317
|
+
/**
|
|
318
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings.
|
|
319
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
320
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
321
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
322
|
+
*/
|
|
323
|
+
update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
326
|
+
* @param handler - the handler
|
|
327
|
+
*/
|
|
328
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
329
|
+
/**
|
|
330
|
+
* Add this hook so that it is automatically removed during unloading
|
|
331
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
332
|
+
*/
|
|
333
|
+
protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
|
|
220
334
|
}
|
|
221
335
|
|
|
222
336
|
/**
|
|
@@ -242,6 +356,53 @@ declare namespace ApplicationInsights {
|
|
|
242
356
|
|
|
243
357
|
function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
244
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Create a 2 index map that maps an enum's key as both the key and value, X["key"] => "key" and X[0] => "keyof 0".
|
|
361
|
+
* @param values - The values to populate on the new object
|
|
362
|
+
* @returns
|
|
363
|
+
*/
|
|
364
|
+
function createEnumMap<E, I = keyof E>(values: {
|
|
365
|
+
[key in keyof E]: E[keyof E];
|
|
366
|
+
}): EnumMap<E, I>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Create an enum style object which has both the key => value and value => key mappings
|
|
370
|
+
* @param values - The values to populate on the new object
|
|
371
|
+
* @returns
|
|
372
|
+
*/
|
|
373
|
+
function createEnumStyle<E>(values: {
|
|
374
|
+
[key in keyof E]: E[keyof E];
|
|
375
|
+
}): EnumValue<E>;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
379
|
+
* @param plugins - The plugin instances that will be executed
|
|
380
|
+
* @param config - The current config
|
|
381
|
+
* @param core - The current core instance
|
|
382
|
+
* @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
|
|
383
|
+
*/
|
|
384
|
+
function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
385
|
+
|
|
386
|
+
function createUniqueNamespace(name: string, includeVersion?: boolean): string;
|
|
387
|
+
|
|
388
|
+
function createUnloadHandlerContainer(): {
|
|
389
|
+
add: (handler: UnloadHandler) => void;
|
|
390
|
+
run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Create a 2 index map that maps an enum's key and value to the defined map value, X["key"] => mapValue and X[0] => mapValue.
|
|
395
|
+
* Generic values
|
|
396
|
+
* - E = the const enum type (typeof eRequestHeaders);
|
|
397
|
+
* - V = Identifies the valid values for the keys, this should include both the enum numeric and string key of the type. The
|
|
398
|
+
* resulting "Value" of each entry identifies the valid values withing the assignments.
|
|
399
|
+
* @param values - The values to populate on the new object
|
|
400
|
+
* @returns
|
|
401
|
+
*/
|
|
402
|
+
function createValueMap<E, V = E>(values: {
|
|
403
|
+
[key in keyof E]: [eValue: E[keyof E], mapValue: V[keyof V]];
|
|
404
|
+
}): V;
|
|
405
|
+
|
|
245
406
|
/**
|
|
246
407
|
* 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)
|
|
247
408
|
* https://caniuse.com/#search=Date.now
|
|
@@ -258,8 +419,11 @@ declare namespace ApplicationInsights {
|
|
|
258
419
|
/**
|
|
259
420
|
* Removes an event handler for the specified event
|
|
260
421
|
* @param Object to remove the event from
|
|
261
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
262
|
-
*
|
|
422
|
+
* @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
423
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
424
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
425
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
426
|
+
* otherwise this will only remove events with this specific handler.
|
|
263
427
|
* @param useCapture [Optional] Defaults to false
|
|
264
428
|
*/
|
|
265
429
|
function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
@@ -340,38 +504,176 @@ declare namespace ApplicationInsights {
|
|
|
340
504
|
*/
|
|
341
505
|
function dumpObj(object: any): string;
|
|
342
506
|
|
|
343
|
-
const EventHelper: IEventHelper;
|
|
344
|
-
|
|
345
507
|
/**
|
|
346
|
-
* The
|
|
508
|
+
* The eEventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
|
|
347
509
|
*/
|
|
348
|
-
const
|
|
510
|
+
const enum eEventsDiscardedReason {
|
|
349
511
|
/**
|
|
350
512
|
* Unknown.
|
|
351
513
|
*/
|
|
352
|
-
Unknown
|
|
514
|
+
Unknown = 0,
|
|
353
515
|
/**
|
|
354
516
|
* Status set to non-retryable.
|
|
355
517
|
*/
|
|
356
|
-
NonRetryableStatus
|
|
518
|
+
NonRetryableStatus = 1,
|
|
357
519
|
/**
|
|
358
520
|
* The event is invalid.
|
|
359
521
|
*/
|
|
360
|
-
InvalidEvent
|
|
522
|
+
InvalidEvent = 2,
|
|
361
523
|
/**
|
|
362
524
|
* The size of the event is too large.
|
|
363
525
|
*/
|
|
364
|
-
SizeLimitExceeded
|
|
526
|
+
SizeLimitExceeded = 3,
|
|
365
527
|
/**
|
|
366
528
|
* The server is not accepting events from this instrumentation key.
|
|
367
529
|
*/
|
|
368
|
-
KillSwitch
|
|
530
|
+
KillSwitch = 4,
|
|
369
531
|
/**
|
|
370
532
|
* The event queue is full.
|
|
371
533
|
*/
|
|
372
|
-
QueueFull
|
|
534
|
+
QueueFull = 5
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const enum _eInternalMessageId {
|
|
538
|
+
BrowserDoesNotSupportLocalStorage = 0,
|
|
539
|
+
BrowserCannotReadLocalStorage = 1,
|
|
540
|
+
BrowserCannotReadSessionStorage = 2,
|
|
541
|
+
BrowserCannotWriteLocalStorage = 3,
|
|
542
|
+
BrowserCannotWriteSessionStorage = 4,
|
|
543
|
+
BrowserFailedRemovalFromLocalStorage = 5,
|
|
544
|
+
BrowserFailedRemovalFromSessionStorage = 6,
|
|
545
|
+
CannotSendEmptyTelemetry = 7,
|
|
546
|
+
ClientPerformanceMathError = 8,
|
|
547
|
+
ErrorParsingAISessionCookie = 9,
|
|
548
|
+
ErrorPVCalc = 10,
|
|
549
|
+
ExceptionWhileLoggingError = 11,
|
|
550
|
+
FailedAddingTelemetryToBuffer = 12,
|
|
551
|
+
FailedMonitorAjaxAbort = 13,
|
|
552
|
+
FailedMonitorAjaxDur = 14,
|
|
553
|
+
FailedMonitorAjaxOpen = 15,
|
|
554
|
+
FailedMonitorAjaxRSC = 16,
|
|
555
|
+
FailedMonitorAjaxSend = 17,
|
|
556
|
+
FailedMonitorAjaxGetCorrelationHeader = 18,
|
|
557
|
+
FailedToAddHandlerForOnBeforeUnload = 19,
|
|
558
|
+
FailedToSendQueuedTelemetry = 20,
|
|
559
|
+
FailedToReportDataLoss = 21,
|
|
560
|
+
FlushFailed = 22,
|
|
561
|
+
MessageLimitPerPVExceeded = 23,
|
|
562
|
+
MissingRequiredFieldSpecification = 24,
|
|
563
|
+
NavigationTimingNotSupported = 25,
|
|
564
|
+
OnError = 26,
|
|
565
|
+
SessionRenewalDateIsZero = 27,
|
|
566
|
+
SenderNotInitialized = 28,
|
|
567
|
+
StartTrackEventFailed = 29,
|
|
568
|
+
StopTrackEventFailed = 30,
|
|
569
|
+
StartTrackFailed = 31,
|
|
570
|
+
StopTrackFailed = 32,
|
|
571
|
+
TelemetrySampledAndNotSent = 33,
|
|
572
|
+
TrackEventFailed = 34,
|
|
573
|
+
TrackExceptionFailed = 35,
|
|
574
|
+
TrackMetricFailed = 36,
|
|
575
|
+
TrackPVFailed = 37,
|
|
576
|
+
TrackPVFailedCalc = 38,
|
|
577
|
+
TrackTraceFailed = 39,
|
|
578
|
+
TransmissionFailed = 40,
|
|
579
|
+
FailedToSetStorageBuffer = 41,
|
|
580
|
+
FailedToRestoreStorageBuffer = 42,
|
|
581
|
+
InvalidBackendResponse = 43,
|
|
582
|
+
FailedToFixDepricatedValues = 44,
|
|
583
|
+
InvalidDurationValue = 45,
|
|
584
|
+
TelemetryEnvelopeInvalid = 46,
|
|
585
|
+
CreateEnvelopeError = 47,
|
|
586
|
+
CannotSerializeObject = 48,
|
|
587
|
+
CannotSerializeObjectNonSerializable = 49,
|
|
588
|
+
CircularReferenceDetected = 50,
|
|
589
|
+
ClearAuthContextFailed = 51,
|
|
590
|
+
ExceptionTruncated = 52,
|
|
591
|
+
IllegalCharsInName = 53,
|
|
592
|
+
ItemNotInArray = 54,
|
|
593
|
+
MaxAjaxPerPVExceeded = 55,
|
|
594
|
+
MessageTruncated = 56,
|
|
595
|
+
NameTooLong = 57,
|
|
596
|
+
SampleRateOutOfRange = 58,
|
|
597
|
+
SetAuthContextFailed = 59,
|
|
598
|
+
SetAuthContextFailedAccountName = 60,
|
|
599
|
+
StringValueTooLong = 61,
|
|
600
|
+
StartCalledMoreThanOnce = 62,
|
|
601
|
+
StopCalledWithoutStart = 63,
|
|
602
|
+
TelemetryInitializerFailed = 64,
|
|
603
|
+
TrackArgumentsNotSpecified = 65,
|
|
604
|
+
UrlTooLong = 66,
|
|
605
|
+
SessionStorageBufferFull = 67,
|
|
606
|
+
CannotAccessCookie = 68,
|
|
607
|
+
IdTooLong = 69,
|
|
608
|
+
InvalidEvent = 70,
|
|
609
|
+
FailedMonitorAjaxSetRequestHeader = 71,
|
|
610
|
+
SendBrowserInfoOnUserInit = 72,
|
|
611
|
+
PluginException = 73,
|
|
612
|
+
NotificationException = 74,
|
|
613
|
+
SnippetScriptLoadFailure = 99,
|
|
614
|
+
InvalidInstrumentationKey = 100,
|
|
615
|
+
CannotParseAiBlobValue = 101,
|
|
616
|
+
InvalidContentBlob = 102,
|
|
617
|
+
TrackPageActionEventFailed = 103,
|
|
618
|
+
FailedAddingCustomDefinedRequestContext = 104,
|
|
619
|
+
InMemoryStorageBufferFull = 105
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const enum eLoggingSeverity {
|
|
623
|
+
/**
|
|
624
|
+
* Error will be sent as internal telemetry
|
|
625
|
+
*/
|
|
626
|
+
CRITICAL = 1,
|
|
627
|
+
/**
|
|
628
|
+
* Error will NOT be sent as internal telemetry, and will only be shown in browser console
|
|
629
|
+
*/
|
|
630
|
+
WARNING = 2
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
type EnumMap<E = any, I = E> = {
|
|
634
|
+
readonly [key in keyof E extends string ? keyof E : never]: key extends string ? key : keyof E;
|
|
635
|
+
} & I;
|
|
636
|
+
|
|
637
|
+
type EnumValue<E = any> = {
|
|
638
|
+
readonly [key in keyof E]: E[key];
|
|
373
639
|
};
|
|
374
640
|
|
|
641
|
+
const EventHelper: IEventHelper;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Removes an event handler for the specified event
|
|
645
|
+
* @param Object to remove the event from
|
|
646
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
647
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
648
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
649
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
650
|
+
* otherwise this will only remove events with this specific handler.
|
|
651
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
652
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
653
|
+
* @param useCapture [Optional] Defaults to false
|
|
654
|
+
*/
|
|
655
|
+
function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
659
|
+
* @param obj Object to add the event too.
|
|
660
|
+
* @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
|
|
661
|
+
* namespaces "click" "click.mynamespace" in addition to specific namespaces.
|
|
662
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
663
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
664
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
665
|
+
* @param useCapture [Optional] Defaults to false
|
|
666
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
667
|
+
*/
|
|
668
|
+
function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
|
|
672
|
+
*/
|
|
673
|
+
const EventsDiscardedReason: EnumValue<typeof eEventsDiscardedReason>;
|
|
674
|
+
|
|
675
|
+
type EventsDiscardedReason = number | eEventsDiscardedReason;
|
|
676
|
+
|
|
375
677
|
/**
|
|
376
678
|
* generate W3C trace id
|
|
377
679
|
*/
|
|
@@ -411,6 +713,12 @@ declare namespace ApplicationInsights {
|
|
|
411
713
|
*/
|
|
412
714
|
function getExceptionName(object: any): string;
|
|
413
715
|
|
|
716
|
+
const enum GetExtCfgMergeType {
|
|
717
|
+
None = 0,
|
|
718
|
+
MergeDefaultOnly = 1,
|
|
719
|
+
MergeDefaultFromRootOrDefault = 2
|
|
720
|
+
}
|
|
721
|
+
|
|
414
722
|
/**
|
|
415
723
|
* Get the current global performance manager that will be used with no performance manager is supplied.
|
|
416
724
|
* @returns - The current default manager
|
|
@@ -569,12 +877,123 @@ declare namespace ApplicationInsights {
|
|
|
569
877
|
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
570
878
|
*/
|
|
571
879
|
removeNotificationListener?(listener: INotificationListener): void;
|
|
880
|
+
/**
|
|
881
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
882
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
883
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
884
|
+
*/
|
|
885
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
572
886
|
pollInternalLogs?(eventName?: string): number;
|
|
573
887
|
stopPollingInternalLogs?(): void;
|
|
574
888
|
/**
|
|
575
889
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
576
890
|
*/
|
|
577
891
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
892
|
+
/**
|
|
893
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
894
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
895
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
896
|
+
* approach is to create a new instance and initialize that instance.
|
|
897
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
898
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
899
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
900
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
901
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
902
|
+
*/
|
|
903
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
904
|
+
/**
|
|
905
|
+
* Find and return the (first) plugin with the specified identifier if present
|
|
906
|
+
* @param pluginIdentifier
|
|
907
|
+
*/
|
|
908
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
909
|
+
/**
|
|
910
|
+
* Add a new plugin to the installation
|
|
911
|
+
* @param plugin - The new plugin to add
|
|
912
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
913
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
914
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
915
|
+
*/
|
|
916
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
917
|
+
/**
|
|
918
|
+
* Returns the unique event namespace that should be used when registering events
|
|
919
|
+
*/
|
|
920
|
+
evtNamespace(): string;
|
|
921
|
+
/**
|
|
922
|
+
* Add a handler that will be called when the SDK is being unloaded
|
|
923
|
+
* @param handler - the handler
|
|
924
|
+
*/
|
|
925
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
926
|
+
/**
|
|
927
|
+
* Flush and send any batched / cached data immediately
|
|
928
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
929
|
+
* @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.
|
|
930
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
931
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
932
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
933
|
+
* @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
|
|
934
|
+
*/
|
|
935
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
interface IBaseProcessingContext {
|
|
939
|
+
/**
|
|
940
|
+
* The current core instance for the request
|
|
941
|
+
*/
|
|
942
|
+
core: () => IAppInsightsCore;
|
|
943
|
+
/**
|
|
944
|
+
* THe current diagnostic logger for the request
|
|
945
|
+
*/
|
|
946
|
+
diagLog: () => IDiagnosticLogger;
|
|
947
|
+
/**
|
|
948
|
+
* Gets the current core config instance
|
|
949
|
+
*/
|
|
950
|
+
getCfg: () => IConfiguration;
|
|
951
|
+
/**
|
|
952
|
+
* Gets the named extension config
|
|
953
|
+
*/
|
|
954
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
955
|
+
/**
|
|
956
|
+
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
957
|
+
* default value is returned
|
|
958
|
+
* @param identifier The named extension identifier
|
|
959
|
+
* @param field The config field name
|
|
960
|
+
* @param defaultValue The default value to return if no defined config exists
|
|
961
|
+
*/
|
|
962
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
963
|
+
/**
|
|
964
|
+
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
965
|
+
* required if there is a nextPlugin
|
|
966
|
+
*/
|
|
967
|
+
hasNext: () => boolean;
|
|
968
|
+
/**
|
|
969
|
+
* Returns the next configured plugin proxy
|
|
970
|
+
*/
|
|
971
|
+
getNext: () => ITelemetryPluginChain;
|
|
972
|
+
/**
|
|
973
|
+
* Helper to set the next plugin proxy
|
|
974
|
+
*/
|
|
975
|
+
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
976
|
+
/**
|
|
977
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
978
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
979
|
+
* @param callback - The function call for each plugin in the context chain
|
|
980
|
+
*/
|
|
981
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
982
|
+
/**
|
|
983
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
984
|
+
* @param onComplete - The onComplete to call
|
|
985
|
+
* @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
|
|
986
|
+
* @param args - Any additional arguments to pass to the onComplete function
|
|
987
|
+
*/
|
|
988
|
+
onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
|
|
989
|
+
/**
|
|
990
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
991
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
992
|
+
* then the current execution order will be copied.
|
|
993
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
994
|
+
* order then the next plugin will be NOT set.
|
|
995
|
+
*/
|
|
996
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
|
|
578
997
|
}
|
|
579
998
|
|
|
580
999
|
/**
|
|
@@ -590,15 +1009,23 @@ declare namespace ApplicationInsights {
|
|
|
590
1009
|
*/
|
|
591
1010
|
resume(): void;
|
|
592
1011
|
/**
|
|
593
|
-
* Tear down
|
|
1012
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1013
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
1014
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
1015
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
1016
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
1017
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
594
1018
|
*/
|
|
595
|
-
teardown()
|
|
1019
|
+
teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
596
1020
|
/**
|
|
597
1021
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
598
|
-
* @param async
|
|
599
|
-
* @param callBack
|
|
1022
|
+
* @param async - send data asynchronously when true
|
|
1023
|
+
* @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.
|
|
1024
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
1025
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
1026
|
+
* @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
|
|
600
1027
|
*/
|
|
601
|
-
flush(async: boolean, callBack?: () => void): void;
|
|
1028
|
+
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
602
1029
|
}
|
|
603
1030
|
|
|
604
1031
|
/**
|
|
@@ -958,7 +1385,7 @@ declare namespace ApplicationInsights {
|
|
|
958
1385
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
959
1386
|
* @return {boolean} - true if the handler was successfully added
|
|
960
1387
|
*/
|
|
961
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
1388
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
962
1389
|
/**
|
|
963
1390
|
* 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)
|
|
964
1391
|
* https://caniuse.com/#search=Date.now
|
|
@@ -1143,6 +1570,10 @@ declare namespace ApplicationInsights {
|
|
|
1143
1570
|
* The error (exception) which occurred while executing the original method
|
|
1144
1571
|
*/
|
|
1145
1572
|
err?: Error;
|
|
1573
|
+
/**
|
|
1574
|
+
* The Event object from (window.event) at the start of the original call
|
|
1575
|
+
*/
|
|
1576
|
+
evt?: Event;
|
|
1146
1577
|
}
|
|
1147
1578
|
|
|
1148
1579
|
/**
|
|
@@ -1169,6 +1600,11 @@ declare namespace ApplicationInsights {
|
|
|
1169
1600
|
* You must always supply the error callback
|
|
1170
1601
|
*/
|
|
1171
1602
|
interface IInstrumentHooksCallbacks {
|
|
1603
|
+
/**
|
|
1604
|
+
* [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
|
|
1605
|
+
* identify the source of the instrumented hooks
|
|
1606
|
+
*/
|
|
1607
|
+
ns?: string | string[];
|
|
1172
1608
|
/**
|
|
1173
1609
|
* The hook callback to call before the original function is called
|
|
1174
1610
|
*/
|
|
@@ -1188,6 +1624,24 @@ declare namespace ApplicationInsights {
|
|
|
1188
1624
|
fnErr?: InstrumentorHooksCallback;
|
|
1189
1625
|
}
|
|
1190
1626
|
|
|
1627
|
+
interface ILoadedPlugin<T extends IPlugin> {
|
|
1628
|
+
plugin: T;
|
|
1629
|
+
/**
|
|
1630
|
+
* Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
|
|
1631
|
+
* via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
|
|
1632
|
+
* @returns boolean = true if the plugin is in a state where it is operational.
|
|
1633
|
+
*/
|
|
1634
|
+
isEnabled: () => boolean;
|
|
1635
|
+
/**
|
|
1636
|
+
* You can optionally enable / disable a plugin from processing events.
|
|
1637
|
+
* Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
|
|
1638
|
+
* as the plugin must also have been successfully initialized and not had it's `teardown` method called
|
|
1639
|
+
* (unless it's also been re-initialized)
|
|
1640
|
+
*/
|
|
1641
|
+
setEnabled: (isEnabled: boolean) => void;
|
|
1642
|
+
remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1191
1645
|
/**
|
|
1192
1646
|
* Initialize the queue of plugins
|
|
1193
1647
|
* @param plugins - The array of plugins to initialize and setting of the next plugin
|
|
@@ -1195,7 +1649,7 @@ declare namespace ApplicationInsights {
|
|
|
1195
1649
|
* @param core THe current core instance
|
|
1196
1650
|
* @param extensions The extensions
|
|
1197
1651
|
*/
|
|
1198
|
-
function initializePlugins(processContext:
|
|
1652
|
+
function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
|
|
1199
1653
|
|
|
1200
1654
|
/**
|
|
1201
1655
|
* An interface used for the notification listener.
|
|
@@ -1319,92 +1773,9 @@ declare namespace ApplicationInsights {
|
|
|
1319
1773
|
/**
|
|
1320
1774
|
* Internal message ID. Please create a new one for every conceptually different message. Please keep alphabetically ordered
|
|
1321
1775
|
*/
|
|
1322
|
-
const _InternalMessageId:
|
|
1323
|
-
BrowserDoesNotSupportLocalStorage: number;
|
|
1324
|
-
BrowserCannotReadLocalStorage: number;
|
|
1325
|
-
BrowserCannotReadSessionStorage: number;
|
|
1326
|
-
BrowserCannotWriteLocalStorage: number;
|
|
1327
|
-
BrowserCannotWriteSessionStorage: number;
|
|
1328
|
-
BrowserFailedRemovalFromLocalStorage: number;
|
|
1329
|
-
BrowserFailedRemovalFromSessionStorage: number;
|
|
1330
|
-
CannotSendEmptyTelemetry: number;
|
|
1331
|
-
ClientPerformanceMathError: number;
|
|
1332
|
-
ErrorParsingAISessionCookie: number;
|
|
1333
|
-
ErrorPVCalc: number;
|
|
1334
|
-
ExceptionWhileLoggingError: number;
|
|
1335
|
-
FailedAddingTelemetryToBuffer: number;
|
|
1336
|
-
FailedMonitorAjaxAbort: number;
|
|
1337
|
-
FailedMonitorAjaxDur: number;
|
|
1338
|
-
FailedMonitorAjaxOpen: number;
|
|
1339
|
-
FailedMonitorAjaxRSC: number;
|
|
1340
|
-
FailedMonitorAjaxSend: number;
|
|
1341
|
-
FailedMonitorAjaxGetCorrelationHeader: number;
|
|
1342
|
-
FailedToAddHandlerForOnBeforeUnload: number;
|
|
1343
|
-
FailedToSendQueuedTelemetry: number;
|
|
1344
|
-
FailedToReportDataLoss: number;
|
|
1345
|
-
FlushFailed: number;
|
|
1346
|
-
MessageLimitPerPVExceeded: number;
|
|
1347
|
-
MissingRequiredFieldSpecification: number;
|
|
1348
|
-
NavigationTimingNotSupported: number;
|
|
1349
|
-
OnError: number;
|
|
1350
|
-
SessionRenewalDateIsZero: number;
|
|
1351
|
-
SenderNotInitialized: number;
|
|
1352
|
-
StartTrackEventFailed: number;
|
|
1353
|
-
StopTrackEventFailed: number;
|
|
1354
|
-
StartTrackFailed: number;
|
|
1355
|
-
StopTrackFailed: number;
|
|
1356
|
-
TelemetrySampledAndNotSent: number;
|
|
1357
|
-
TrackEventFailed: number;
|
|
1358
|
-
TrackExceptionFailed: number;
|
|
1359
|
-
TrackMetricFailed: number;
|
|
1360
|
-
TrackPVFailed: number;
|
|
1361
|
-
TrackPVFailedCalc: number;
|
|
1362
|
-
TrackTraceFailed: number;
|
|
1363
|
-
TransmissionFailed: number;
|
|
1364
|
-
FailedToSetStorageBuffer: number;
|
|
1365
|
-
FailedToRestoreStorageBuffer: number;
|
|
1366
|
-
InvalidBackendResponse: number;
|
|
1367
|
-
FailedToFixDepricatedValues: number;
|
|
1368
|
-
InvalidDurationValue: number;
|
|
1369
|
-
TelemetryEnvelopeInvalid: number;
|
|
1370
|
-
CreateEnvelopeError: number;
|
|
1371
|
-
CannotSerializeObject: number;
|
|
1372
|
-
CannotSerializeObjectNonSerializable: number;
|
|
1373
|
-
CircularReferenceDetected: number;
|
|
1374
|
-
ClearAuthContextFailed: number;
|
|
1375
|
-
ExceptionTruncated: number;
|
|
1376
|
-
IllegalCharsInName: number;
|
|
1377
|
-
ItemNotInArray: number;
|
|
1378
|
-
MaxAjaxPerPVExceeded: number;
|
|
1379
|
-
MessageTruncated: number;
|
|
1380
|
-
NameTooLong: number;
|
|
1381
|
-
SampleRateOutOfRange: number;
|
|
1382
|
-
SetAuthContextFailed: number;
|
|
1383
|
-
SetAuthContextFailedAccountName: number;
|
|
1384
|
-
StringValueTooLong: number;
|
|
1385
|
-
StartCalledMoreThanOnce: number;
|
|
1386
|
-
StopCalledWithoutStart: number;
|
|
1387
|
-
TelemetryInitializerFailed: number;
|
|
1388
|
-
TrackArgumentsNotSpecified: number;
|
|
1389
|
-
UrlTooLong: number;
|
|
1390
|
-
SessionStorageBufferFull: number;
|
|
1391
|
-
CannotAccessCookie: number;
|
|
1392
|
-
IdTooLong: number;
|
|
1393
|
-
InvalidEvent: number;
|
|
1394
|
-
FailedMonitorAjaxSetRequestHeader: number;
|
|
1395
|
-
SendBrowserInfoOnUserInit: number;
|
|
1396
|
-
PluginException: number;
|
|
1397
|
-
NotificationException: number;
|
|
1398
|
-
SnippetScriptLoadFailure: number;
|
|
1399
|
-
InvalidInstrumentationKey: number;
|
|
1400
|
-
CannotParseAiBlobValue: number;
|
|
1401
|
-
InvalidContentBlob: number;
|
|
1402
|
-
TrackPageActionEventFailed: number;
|
|
1403
|
-
FailedAddingCustomDefinedRequestContext: number;
|
|
1404
|
-
InMemoryStorageBufferFull: number;
|
|
1405
|
-
};
|
|
1776
|
+
const _InternalMessageId: EnumValue<typeof _eInternalMessageId>;
|
|
1406
1777
|
|
|
1407
|
-
type _InternalMessageId = number |
|
|
1778
|
+
type _InternalMessageId = number | _eInternalMessageId;
|
|
1408
1779
|
|
|
1409
1780
|
/**
|
|
1410
1781
|
* This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
|
|
@@ -1525,10 +1896,14 @@ declare namespace ApplicationInsights {
|
|
|
1525
1896
|
*/
|
|
1526
1897
|
isInitialized?: () => boolean;
|
|
1527
1898
|
/**
|
|
1528
|
-
* Tear down the plugin and remove any hooked value, the plugin should
|
|
1529
|
-
* therefore
|
|
1899
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1900
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
1901
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
1902
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
1903
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
1904
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
1530
1905
|
*/
|
|
1531
|
-
teardown?: () => void;
|
|
1906
|
+
teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
1532
1907
|
/**
|
|
1533
1908
|
* Extension name
|
|
1534
1909
|
*/
|
|
@@ -1543,61 +1918,73 @@ declare namespace ApplicationInsights {
|
|
|
1543
1918
|
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1544
1919
|
* between multiple AppInsights instances
|
|
1545
1920
|
*/
|
|
1546
|
-
interface IProcessTelemetryContext {
|
|
1547
|
-
/**
|
|
1548
|
-
* The current core instance for the request
|
|
1549
|
-
*/
|
|
1550
|
-
core: () => IAppInsightsCore;
|
|
1551
|
-
/**
|
|
1552
|
-
* THe current diagnostic logger for the request
|
|
1553
|
-
*/
|
|
1554
|
-
diagLog: () => IDiagnosticLogger;
|
|
1555
|
-
/**
|
|
1556
|
-
* Gets the current core config instance
|
|
1557
|
-
*/
|
|
1558
|
-
getCfg: () => IConfiguration;
|
|
1559
|
-
/**
|
|
1560
|
-
* Gets the named extension config
|
|
1561
|
-
*/
|
|
1562
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
1921
|
+
interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
1563
1922
|
/**
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1566
|
-
* @
|
|
1567
|
-
* @param field The config field name
|
|
1568
|
-
* @param defaultValue The default value to return if no defined config exists
|
|
1923
|
+
* Call back for telemetry processing before it it is sent
|
|
1924
|
+
* @param env - This is the current event being reported
|
|
1925
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1569
1926
|
*/
|
|
1570
|
-
|
|
1927
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
1571
1928
|
/**
|
|
1572
|
-
*
|
|
1573
|
-
*
|
|
1929
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1930
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1931
|
+
* then the current execution order will be copied.
|
|
1932
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1933
|
+
* order then the next plugin will be NOT set.
|
|
1574
1934
|
*/
|
|
1575
|
-
|
|
1935
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* The current context for the current call to teardown() implementations, used to support when plugins are being removed
|
|
1940
|
+
* or the SDK is being unloaded.
|
|
1941
|
+
*/
|
|
1942
|
+
interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1576
1943
|
/**
|
|
1577
|
-
*
|
|
1944
|
+
* This Plugin has finished unloading, so unload the next one
|
|
1945
|
+
* @param uploadState - The state of the unload process
|
|
1946
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1578
1947
|
*/
|
|
1579
|
-
|
|
1948
|
+
processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
|
|
1580
1949
|
/**
|
|
1581
|
-
*
|
|
1950
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1951
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1952
|
+
* then the current execution order will be copied.
|
|
1953
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1954
|
+
* order then the next plugin will be NOT set.
|
|
1582
1955
|
*/
|
|
1583
|
-
|
|
1956
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* The current context for the current call to the plugin update() implementations, used to support the notifications
|
|
1961
|
+
* for when plugins are added, removed or the configuration was changed.
|
|
1962
|
+
*/
|
|
1963
|
+
interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
|
|
1584
1964
|
/**
|
|
1585
|
-
*
|
|
1586
|
-
* @param
|
|
1965
|
+
* This Plugin has finished unloading, so unload the next one
|
|
1966
|
+
* @param updateState - The update State
|
|
1967
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1587
1968
|
*/
|
|
1588
|
-
processNext: (
|
|
1969
|
+
processNext: (updateState: ITelemetryUpdateState) => boolean | void;
|
|
1589
1970
|
/**
|
|
1590
|
-
* Create a new context using the core and config from the current instance
|
|
1971
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1591
1972
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1592
1973
|
* then the current execution order will be copied.
|
|
1593
1974
|
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1594
1975
|
* order then the next plugin will be NOT set.
|
|
1595
1976
|
*/
|
|
1596
|
-
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) =>
|
|
1977
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
interface _IRegisteredEvents {
|
|
1981
|
+
name: string;
|
|
1982
|
+
handler: any;
|
|
1597
1983
|
}
|
|
1598
1984
|
|
|
1599
1985
|
/**
|
|
1600
|
-
* Check if an object is of type Array
|
|
1986
|
+
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
1987
|
+
* and exists to help with TypeScript validation only.
|
|
1601
1988
|
*/
|
|
1602
1989
|
let isArray: <T = any>(obj: any) => obj is Array<T>;
|
|
1603
1990
|
|
|
@@ -1638,13 +2025,13 @@ declare namespace ApplicationInsights {
|
|
|
1638
2025
|
*/
|
|
1639
2026
|
function isIE(): boolean;
|
|
1640
2027
|
|
|
1641
|
-
function isNotNullOrUndefined(value:
|
|
2028
|
+
function isNotNullOrUndefined<T>(value: T): value is T;
|
|
1642
2029
|
|
|
1643
2030
|
function isNotTruthy(value: any): boolean;
|
|
1644
2031
|
|
|
1645
|
-
function isNotUndefined(value:
|
|
2032
|
+
function isNotUndefined<T>(value: T): value is T;
|
|
1646
2033
|
|
|
1647
|
-
function isNullOrUndefined(value: any):
|
|
2034
|
+
function isNullOrUndefined(value: any): value is null | undefined;
|
|
1648
2035
|
|
|
1649
2036
|
/**
|
|
1650
2037
|
* Checks if the type of value is a number.
|
|
@@ -1653,7 +2040,7 @@ declare namespace ApplicationInsights {
|
|
|
1653
2040
|
*/
|
|
1654
2041
|
function isNumber(value: any): value is number;
|
|
1655
2042
|
|
|
1656
|
-
function isObject(value:
|
|
2043
|
+
function isObject<T>(value: T): value is T;
|
|
1657
2044
|
|
|
1658
2045
|
/**
|
|
1659
2046
|
* Returns whether the environment is reporting that we are running in a React Native Environment
|
|
@@ -1681,7 +2068,7 @@ declare namespace ApplicationInsights {
|
|
|
1681
2068
|
|
|
1682
2069
|
function isTypeof(value: any, theType: string): boolean;
|
|
1683
2070
|
|
|
1684
|
-
function isUndefined(value: any):
|
|
2071
|
+
function isUndefined(value: any): value is undefined;
|
|
1685
2072
|
|
|
1686
2073
|
/**
|
|
1687
2074
|
* Checks if XMLHttpRequest is supported
|
|
@@ -1689,6 +2076,19 @@ declare namespace ApplicationInsights {
|
|
|
1689
2076
|
*/
|
|
1690
2077
|
function isXhrSupported(): boolean;
|
|
1691
2078
|
|
|
2079
|
+
interface ITelemetryInitializerContainer {
|
|
2080
|
+
/**
|
|
2081
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
2082
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
2083
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
2084
|
+
*/
|
|
2085
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
interface ITelemetryInitializerHandler {
|
|
2089
|
+
remove(): void;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1692
2092
|
/**
|
|
1693
2093
|
* Telemety item supported in Core
|
|
1694
2094
|
*/
|
|
@@ -1738,15 +2138,7 @@ declare namespace ApplicationInsights {
|
|
|
1738
2138
|
/**
|
|
1739
2139
|
* Configuration provided to SDK core
|
|
1740
2140
|
*/
|
|
1741
|
-
interface ITelemetryPlugin extends IPlugin {
|
|
1742
|
-
/**
|
|
1743
|
-
* Call back for telemetry processing before it it is sent
|
|
1744
|
-
* @param env - This is the current event being reported
|
|
1745
|
-
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
1746
|
-
* can optionally use this to access the current core instance or define / pass additional information
|
|
1747
|
-
* to later plugins (vs appending items to the telemetry item)
|
|
1748
|
-
*/
|
|
1749
|
-
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2141
|
+
interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
|
|
1750
2142
|
/**
|
|
1751
2143
|
* Set next extension for telemetry processing, this is not optional as plugins should use the
|
|
1752
2144
|
* processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
|
|
@@ -1762,7 +2154,7 @@ declare namespace ApplicationInsights {
|
|
|
1762
2154
|
/**
|
|
1763
2155
|
* Configuration provided to SDK core
|
|
1764
2156
|
*/
|
|
1765
|
-
interface ITelemetryPluginChain {
|
|
2157
|
+
interface ITelemetryPluginChain extends ITelemetryProcessor {
|
|
1766
2158
|
/**
|
|
1767
2159
|
* Returns the underlying plugin that is being proxied for the processTelemetry call
|
|
1768
2160
|
*/
|
|
@@ -1771,6 +2163,16 @@ declare namespace ApplicationInsights {
|
|
|
1771
2163
|
* Returns the next plugin
|
|
1772
2164
|
*/
|
|
1773
2165
|
getNext: () => ITelemetryPluginChain;
|
|
2166
|
+
/**
|
|
2167
|
+
* This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
|
|
2168
|
+
* call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
|
|
2169
|
+
* @param unloadCtx - The unload context to use for this call.
|
|
2170
|
+
* @param unloadState - The details of the unload operation
|
|
2171
|
+
*/
|
|
2172
|
+
unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
interface ITelemetryProcessor {
|
|
1774
2176
|
/**
|
|
1775
2177
|
* Call back for telemetry processing before it it is sent
|
|
1776
2178
|
* @param env - This is the current event being reported
|
|
@@ -1778,7 +2180,60 @@ declare namespace ApplicationInsights {
|
|
|
1778
2180
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
1779
2181
|
* to later plugins (vs appending items to the telemetry item)
|
|
1780
2182
|
*/
|
|
1781
|
-
processTelemetry: (env: ITelemetryItem, itemCtx
|
|
2183
|
+
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2184
|
+
/**
|
|
2185
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings or
|
|
2186
|
+
* plugins. If implemented this method will be called whenever a plugin is added or removed and if
|
|
2187
|
+
* the configuration has bee updated.
|
|
2188
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
2189
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
2190
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
2191
|
+
*/
|
|
2192
|
+
update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
interface ITelemetryUnloadState {
|
|
2196
|
+
reason: TelemetryUnloadReason;
|
|
2197
|
+
isAsync: boolean;
|
|
2198
|
+
flushComplete?: boolean;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
interface ITelemetryUpdateState {
|
|
2202
|
+
/**
|
|
2203
|
+
* Identifies the reason for the update notification, this is a bitwise numeric value
|
|
2204
|
+
*/
|
|
2205
|
+
reason: TelemetryUpdateReason;
|
|
2206
|
+
/**
|
|
2207
|
+
* If this is a configuration update this was the previous configuration that was used
|
|
2208
|
+
*/
|
|
2209
|
+
/**
|
|
2210
|
+
* If this is a configuration update is the new configuration that is being used
|
|
2211
|
+
*/
|
|
2212
|
+
/**
|
|
2213
|
+
* This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
|
|
2214
|
+
*/
|
|
2215
|
+
added?: IPlugin[];
|
|
2216
|
+
/**
|
|
2217
|
+
* This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
|
|
2218
|
+
*/
|
|
2219
|
+
removed?: IPlugin[];
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
interface IUnloadableComponent {
|
|
2223
|
+
/**
|
|
2224
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
2225
|
+
* finishes it's removal.
|
|
2226
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
2227
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
2228
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
|
|
2229
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
2230
|
+
*/
|
|
2231
|
+
_doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
interface IUnloadHandlerContainer {
|
|
2235
|
+
add: (handler: UnloadHandler) => void;
|
|
2236
|
+
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
1782
2237
|
}
|
|
1783
2238
|
|
|
1784
2239
|
/**
|
|
@@ -1793,16 +2248,19 @@ declare namespace ApplicationInsights {
|
|
|
1793
2248
|
*/
|
|
1794
2249
|
function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
1795
2250
|
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2251
|
+
const LoggingSeverity: EnumValue<typeof eLoggingSeverity>;
|
|
2252
|
+
|
|
2253
|
+
type LoggingSeverity = number | eLoggingSeverity;
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Logs a message to the internal queue.
|
|
2257
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
2258
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
2259
|
+
* @param message {_InternalLogMessage} - The message to log.
|
|
2260
|
+
*/
|
|
2261
|
+
function _logInternalMessage(logger: IDiagnosticLogger, severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
2262
|
+
|
|
2263
|
+
function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
|
|
1806
2264
|
|
|
1807
2265
|
const MinChannelPriorty: number;
|
|
1808
2266
|
|
|
@@ -1894,13 +2352,27 @@ declare namespace ApplicationInsights {
|
|
|
1894
2352
|
*/
|
|
1895
2353
|
function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
1896
2354
|
|
|
2355
|
+
/**
|
|
2356
|
+
* Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
|
|
2357
|
+
* It will NOT merge inherited or non-enumerable properties.
|
|
2358
|
+
* @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
|
|
2359
|
+
* @param obj2 - object to merge.
|
|
2360
|
+
* @param obj3 - object to merge.
|
|
2361
|
+
* @param obj4 - object to merge.
|
|
2362
|
+
* @param obj5 - object to merge.
|
|
2363
|
+
* @returns The extended first object.
|
|
2364
|
+
*/
|
|
2365
|
+
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
|
+
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;
|
|
2368
|
+
|
|
1897
2369
|
/**
|
|
1898
2370
|
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
|
1899
2371
|
* performance optimization to avoid the creation of a new array for large objects
|
|
1900
2372
|
* @param target The target object to find and process the keys
|
|
1901
2373
|
* @param callbackfn The function to call with the details
|
|
1902
2374
|
*/
|
|
1903
|
-
function objForEachKey(target:
|
|
2375
|
+
function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
|
|
1904
2376
|
|
|
1905
2377
|
const objFreeze: <T>(value: T) => T;
|
|
1906
2378
|
|
|
@@ -1914,6 +2386,8 @@ declare namespace ApplicationInsights {
|
|
|
1914
2386
|
|
|
1915
2387
|
const objSeal: <T>(value: T) => T;
|
|
1916
2388
|
|
|
2389
|
+
function objToString(obj: any): any;
|
|
2390
|
+
|
|
1917
2391
|
/**
|
|
1918
2392
|
* A helper function to assist with JIT performance for objects that have properties added / removed dynamically
|
|
1919
2393
|
* this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
|
|
@@ -1969,7 +2443,7 @@ declare namespace ApplicationInsights {
|
|
|
1969
2443
|
* Defined as private so it can be visualized via the DebugPlugin
|
|
1970
2444
|
*/
|
|
1971
2445
|
private ctx;
|
|
1972
|
-
constructor(manager
|
|
2446
|
+
constructor(manager?: INotificationManager);
|
|
1973
2447
|
/**
|
|
1974
2448
|
* Create a new event and start timing, the manager may return null/undefined to indicate that it does not
|
|
1975
2449
|
* want to monitor this source event.
|
|
@@ -2002,13 +2476,17 @@ declare namespace ApplicationInsights {
|
|
|
2002
2476
|
*/
|
|
2003
2477
|
function perfNow(): number;
|
|
2004
2478
|
|
|
2479
|
+
/**
|
|
2480
|
+
* This class will be removed!
|
|
2481
|
+
* @deprecated use createProcessTelemetryContext() instead
|
|
2482
|
+
*/
|
|
2005
2483
|
class ProcessTelemetryContext implements IProcessTelemetryContext {
|
|
2006
2484
|
/**
|
|
2007
2485
|
* Gets the current core config instance
|
|
2008
2486
|
*/
|
|
2009
2487
|
getCfg: () => IConfiguration;
|
|
2010
2488
|
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
2011
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
|
|
2489
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
2012
2490
|
/**
|
|
2013
2491
|
* Returns the IAppInsightsCore instance for the current request
|
|
2014
2492
|
*/
|
|
@@ -2036,19 +2514,34 @@ declare namespace ApplicationInsights {
|
|
|
2036
2514
|
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
2037
2515
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
2038
2516
|
* to later plugins (vs appending items to the telemetry item)
|
|
2517
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
2039
2518
|
*/
|
|
2040
|
-
processNext: (env: ITelemetryItem) => void;
|
|
2519
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
2520
|
+
/**
|
|
2521
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
2522
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
2523
|
+
* @param callback - The function call for each plugin in the context chain
|
|
2524
|
+
*/
|
|
2525
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
2041
2526
|
/**
|
|
2042
2527
|
* Create a new context using the core and config from the current instance
|
|
2528
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
2529
|
+
* then the current execution order will be copied.
|
|
2530
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
2531
|
+
* order then the next plugin will be NOT set.
|
|
2043
2532
|
*/
|
|
2044
2533
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
2534
|
+
/**
|
|
2535
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
2536
|
+
*/
|
|
2537
|
+
onComplete: (onComplete: () => void) => void;
|
|
2045
2538
|
/**
|
|
2046
2539
|
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
2047
2540
|
* @param plugins - The plugin instances that will be executed
|
|
2048
2541
|
* @param config - The current config
|
|
2049
2542
|
* @param core - The current core instance
|
|
2050
2543
|
*/
|
|
2051
|
-
constructor(
|
|
2544
|
+
constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
|
|
2052
2545
|
}
|
|
2053
2546
|
|
|
2054
2547
|
/**
|
|
@@ -2065,9 +2558,29 @@ declare namespace ApplicationInsights {
|
|
|
2065
2558
|
* @param target - The target object to be assigned with the source properties and functions
|
|
2066
2559
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2067
2560
|
* @param chkSet - An optional callback to determine whether a specific property/function should be proxied
|
|
2068
|
-
* @memberof Initialization
|
|
2069
2561
|
*/
|
|
2070
|
-
function proxyAssign(target:
|
|
2562
|
+
function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.
|
|
2566
|
+
*
|
|
2567
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
2568
|
+
* @param name - The function name that will be added on the target
|
|
2569
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2570
|
+
* @param theFunc - The function name on the source that will be proxied on the target
|
|
2571
|
+
* @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
|
|
2572
|
+
*/
|
|
2573
|
+
function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
|
|
2574
|
+
|
|
2575
|
+
/**
|
|
2576
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
2577
|
+
*
|
|
2578
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
2579
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2580
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
2581
|
+
* @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
|
|
2582
|
+
*/
|
|
2583
|
+
function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
|
|
2071
2584
|
|
|
2072
2585
|
/**
|
|
2073
2586
|
* generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
|
|
@@ -2082,6 +2595,52 @@ declare namespace ApplicationInsights {
|
|
|
2082
2595
|
*/
|
|
2083
2596
|
function randomValue(maxValue: number): number;
|
|
2084
2597
|
|
|
2598
|
+
/**
|
|
2599
|
+
* Trys to remove event handler(s) for the specified event/namespace to the window, body and document
|
|
2600
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
2601
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
2602
|
+
* @param callback {any} - - The callback function that needs to be removed from the given event, when using a
|
|
2603
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
2604
|
+
* otherwise this will only remove events with this specific handler.
|
|
2605
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2606
|
+
*/
|
|
2607
|
+
function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* Remove the listener from the array of events
|
|
2611
|
+
* @param events An string array of event names to bind the listener to
|
|
2612
|
+
* @param listener The event callback to call when the event is triggered
|
|
2613
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2614
|
+
*/
|
|
2615
|
+
function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
|
|
2619
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
|
|
2620
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
2621
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
2622
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
2623
|
+
*/
|
|
2624
|
+
function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
|
|
2628
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
|
|
2629
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
2630
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
2631
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
2632
|
+
*/
|
|
2633
|
+
function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
2637
|
+
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
2638
|
+
* @param listener - The specific event callback to to be removed
|
|
2639
|
+
* @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
|
|
2640
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
2641
|
+
*/
|
|
2642
|
+
function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2643
|
+
|
|
2085
2644
|
/**
|
|
2086
2645
|
* Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
|
|
2087
2646
|
* associated with the configuration or a legacy default.
|
|
@@ -2125,6 +2684,10 @@ declare namespace ApplicationInsights {
|
|
|
2125
2684
|
* The event(s) being sent as a retry
|
|
2126
2685
|
*/
|
|
2127
2686
|
Retry = 5,
|
|
2687
|
+
/**
|
|
2688
|
+
* The SDK is unloading
|
|
2689
|
+
*/
|
|
2690
|
+
SdkUnload = 6,
|
|
2128
2691
|
/**
|
|
2129
2692
|
* Maximum batch size would be exceeded
|
|
2130
2693
|
*/
|
|
@@ -2163,9 +2726,9 @@ declare namespace ApplicationInsights {
|
|
|
2163
2726
|
* @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
|
|
2164
2727
|
* @returns The existing or new value, depending what was set
|
|
2165
2728
|
*/
|
|
2166
|
-
function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
|
|
2729
|
+
function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
|
|
2167
2730
|
|
|
2168
|
-
function sortPlugins(plugins:
|
|
2731
|
+
function sortPlugins<T = IPlugin>(plugins: T[]): T[];
|
|
2169
2732
|
|
|
2170
2733
|
/**
|
|
2171
2734
|
* A simple wrapper (for minification support) to check if the value contains the search string.
|
|
@@ -2211,8 +2774,64 @@ declare namespace ApplicationInsights {
|
|
|
2211
2774
|
[key: string]: any;
|
|
2212
2775
|
}
|
|
2213
2776
|
|
|
2777
|
+
type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
2778
|
+
|
|
2779
|
+
/**
|
|
2780
|
+
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
2781
|
+
*/
|
|
2782
|
+
const enum TelemetryUnloadReason {
|
|
2783
|
+
/**
|
|
2784
|
+
* Teardown has been called without any context.
|
|
2785
|
+
*/
|
|
2786
|
+
ManualTeardown = 0,
|
|
2787
|
+
/**
|
|
2788
|
+
* Just this plugin is being removed
|
|
2789
|
+
*/
|
|
2790
|
+
PluginUnload = 1,
|
|
2791
|
+
/**
|
|
2792
|
+
* This instance of the plugin is being removed and replaced
|
|
2793
|
+
*/
|
|
2794
|
+
PluginReplace = 2,
|
|
2795
|
+
/**
|
|
2796
|
+
* The entire SDK is being unloaded
|
|
2797
|
+
*/
|
|
2798
|
+
SdkUnload = 50
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
/**
|
|
2802
|
+
* The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
|
|
2803
|
+
*/
|
|
2804
|
+
const enum TelemetryUpdateReason {
|
|
2805
|
+
/**
|
|
2806
|
+
* Unknown.
|
|
2807
|
+
*/
|
|
2808
|
+
Unknown = 0,
|
|
2809
|
+
/**
|
|
2810
|
+
* The configuration has ben updated or changed
|
|
2811
|
+
*/
|
|
2812
|
+
/**
|
|
2813
|
+
* One or more plugins have been added
|
|
2814
|
+
*/
|
|
2815
|
+
PluginAdded = 16,
|
|
2816
|
+
/**
|
|
2817
|
+
* One or more plugins have been removed
|
|
2818
|
+
*/
|
|
2819
|
+
PluginRemoved = 32
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2214
2822
|
function throwError(message: string): never;
|
|
2215
2823
|
|
|
2824
|
+
/**
|
|
2825
|
+
* This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
|
|
2826
|
+
* debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
|
|
2827
|
+
* support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
|
|
2828
|
+
* the code.
|
|
2829
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
2830
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
2831
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
2832
|
+
*/
|
|
2833
|
+
function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
2834
|
+
|
|
2216
2835
|
/**
|
|
2217
2836
|
* Convert a date to I.S.O. format in IE8
|
|
2218
2837
|
*/
|
|
@@ -2222,7 +2841,27 @@ declare namespace ApplicationInsights {
|
|
|
2222
2841
|
|
|
2223
2842
|
const Undefined = "undefined";
|
|
2224
2843
|
|
|
2844
|
+
/**
|
|
2845
|
+
* Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any
|
|
2846
|
+
* _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.
|
|
2847
|
+
* @param components - The components you want to unload
|
|
2848
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
2849
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
2850
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
|
|
2851
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
2852
|
+
*/
|
|
2853
|
+
function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
|
|
2854
|
+
|
|
2855
|
+
type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2856
|
+
|
|
2225
2857
|
function useXDomainRequest(): boolean | undefined;
|
|
2226
2858
|
|
|
2859
|
+
/**
|
|
2860
|
+
* This is a helper method which will call warnToConsole on the passed logger with the provided message.
|
|
2861
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
2862
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
2863
|
+
*/
|
|
2864
|
+
function _warnToConsole(logger: IDiagnosticLogger, message: string): void;
|
|
2865
|
+
|
|
2227
2866
|
|
|
2228
2867
|
}
|