@microsoft/applicationinsights-core-js 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02
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 +945 -479
- 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 +3904 -877
- package/dist/applicationinsights-core-js.api.md +264 -30
- package/dist/applicationinsights-core-js.d.ts +410 -89
- package/dist/applicationinsights-core-js.js +945 -479
- 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 +410 -89
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +66 -23
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +44 -5
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +105 -73
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +6 -122
- 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 +12 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +8 -7
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +472 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +32 -59
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +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 +8 -11
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +184 -110
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +3 -2
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +32 -13
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +4 -6
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +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.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -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/applicationinsights-core-js.js +8 -4
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +80 -24
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +76 -5
- package/src/JavaScriptSDK/ChannelController.ts +107 -61
- package/src/JavaScriptSDK/CookieMgr.ts +4 -4
- package/src/JavaScriptSDK/CoreUtils.ts +6 -143
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +12 -11
- package/src/JavaScriptSDK/EnvUtils.ts +7 -6
- package/src/JavaScriptSDK/EventHelpers.ts +542 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +35 -54
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +7 -11
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +237 -124
- package/src/JavaScriptSDK/RandomHelper.ts +2 -1
- package/src/JavaScriptSDK/TelemetryHelpers.ts +47 -15
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +5 -15
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +20 -0
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +9 -2
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +55 -16
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +16 -9
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/types/JavaScriptSDK/BaseCore.d.ts +4 -0
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +20 -1
- package/types/JavaScriptSDK/ChannelController.d.ts +4 -0
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -42
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +152 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +8 -17
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +10 -3
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +8 -0
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -7
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +17 -0
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +9 -2
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +49 -14
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +15 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/applicationinsights-core-js.d.ts +6 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -14,39 +14,59 @@ 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 evtName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
22
|
+
*/
|
|
23
|
+
function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
|
|
24
|
+
|
|
17
25
|
/**
|
|
18
26
|
* Trys to add an event handler for the specified event to the window, body and document
|
|
19
27
|
* @param eventName {string} - The name of the event
|
|
20
28
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
29
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
21
30
|
* @return {boolean} - true if the handler was successfully added
|
|
22
31
|
*/
|
|
23
|
-
function addEventHandler(eventName: string, callback: any): boolean;
|
|
32
|
+
function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
|
|
24
33
|
|
|
25
34
|
/**
|
|
26
35
|
* Bind the listener to the array of events
|
|
27
36
|
* @param events An string array of event names to bind the listener to
|
|
28
37
|
* @param listener The event callback to call when the event is triggered
|
|
29
38
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
39
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
30
40
|
* @returns true - when at least one of the events was registered otherwise false
|
|
31
41
|
*/
|
|
32
|
-
function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
|
|
42
|
+
function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
|
-
* Listen to the pagehide and visibility changing to 'hidden' events
|
|
45
|
+
* Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
|
|
46
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
47
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
36
48
|
* @param listener - The event callback to call when a page hide event is triggered
|
|
37
49
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
50
|
+
* @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
|
|
51
|
+
* based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
52
|
+
* so that only the matching "removePageHideEventListener" can remove these events.
|
|
38
53
|
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
39
54
|
* @returns true - when at least one of the events was registered otherwise false
|
|
40
55
|
*/
|
|
41
|
-
function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
56
|
+
function addPageHideEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
42
57
|
|
|
43
58
|
/**
|
|
44
|
-
* Listen to the pageshow and visibility changing to 'visible' events
|
|
59
|
+
* Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
|
|
60
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
61
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
45
62
|
* @param listener - The event callback to call when a page is show event is triggered
|
|
46
63
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
64
|
+
* @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
|
|
65
|
+
* identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
66
|
+
* so that only the matching "removePageShowEventListener" can remove these events.
|
|
47
67
|
* @returns true - when at least one of the events was registered otherwise false
|
|
48
68
|
*/
|
|
49
|
-
function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
69
|
+
function addPageShowEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
50
70
|
|
|
51
71
|
/**
|
|
52
72
|
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
@@ -56,9 +76,10 @@ declare namespace ApplicationInsights {
|
|
|
56
76
|
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
57
77
|
* @param listener - The event callback to call when a page unload event is triggered
|
|
58
78
|
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
79
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
59
80
|
* @returns true - when at least one of the events was registered otherwise false
|
|
60
81
|
*/
|
|
61
|
-
function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
82
|
+
function addPageUnloadEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
62
83
|
|
|
63
84
|
class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
64
85
|
constructor();
|
|
@@ -111,7 +132,7 @@ declare namespace ApplicationInsights {
|
|
|
111
132
|
/**
|
|
112
133
|
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
113
134
|
* @param obj Object to add the event too.
|
|
114
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
135
|
+
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
|
|
115
136
|
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
116
137
|
* @param useCapture [Optional] Defaults to false
|
|
117
138
|
* @returns True if the function was bound successfully to the event, otherwise false
|
|
@@ -169,6 +190,10 @@ declare namespace ApplicationInsights {
|
|
|
169
190
|
*/
|
|
170
191
|
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
171
192
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
193
|
+
/**
|
|
194
|
+
* Returns the unique event namespace that should be used
|
|
195
|
+
*/
|
|
196
|
+
evtNamespace(): string;
|
|
172
197
|
protected releaseQueue(): void;
|
|
173
198
|
}
|
|
174
199
|
|
|
@@ -217,8 +242,26 @@ declare namespace ApplicationInsights {
|
|
|
217
242
|
* Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
|
|
218
243
|
*/
|
|
219
244
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
245
|
+
/**
|
|
246
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
247
|
+
* finishes it's removal.
|
|
248
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
249
|
+
* @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.
|
|
250
|
+
* @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.
|
|
251
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
252
|
+
*/
|
|
253
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
220
254
|
constructor();
|
|
221
255
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
256
|
+
/**
|
|
257
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
258
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
259
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
260
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
261
|
+
* @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.
|
|
262
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
263
|
+
*/
|
|
264
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
222
265
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
223
266
|
/**
|
|
224
267
|
* Add this hook so that it is automatically removed during unloading
|
|
@@ -250,6 +293,13 @@ declare namespace ApplicationInsights {
|
|
|
250
293
|
|
|
251
294
|
function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
252
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Create an enum style object which has both the key => value and value => key mappings
|
|
298
|
+
* @param values - The values to populate on the new object
|
|
299
|
+
* @returns
|
|
300
|
+
*/
|
|
301
|
+
function createEnumStyle<T>(values: T): T;
|
|
302
|
+
|
|
253
303
|
/**
|
|
254
304
|
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
255
305
|
* @param plugins - The plugin instances that will be executed
|
|
@@ -258,6 +308,8 @@ declare namespace ApplicationInsights {
|
|
|
258
308
|
*/
|
|
259
309
|
function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
260
310
|
|
|
311
|
+
function createUniqueNamespace(name: string, includeVersion?: boolean): string;
|
|
312
|
+
|
|
261
313
|
/**
|
|
262
314
|
* 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)
|
|
263
315
|
* https://caniuse.com/#search=Date.now
|
|
@@ -274,8 +326,11 @@ declare namespace ApplicationInsights {
|
|
|
274
326
|
/**
|
|
275
327
|
* Removes an event handler for the specified event
|
|
276
328
|
* @param Object to remove the event from
|
|
277
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
278
|
-
*
|
|
329
|
+
* @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
330
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
331
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
332
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
333
|
+
* otherwise this will only remove events with this specific handler.
|
|
279
334
|
* @param useCapture [Optional] Defaults to false
|
|
280
335
|
*/
|
|
281
336
|
function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
@@ -356,8 +411,131 @@ declare namespace ApplicationInsights {
|
|
|
356
411
|
*/
|
|
357
412
|
function dumpObj(object: any): string;
|
|
358
413
|
|
|
414
|
+
const enum _eInternalMessageId {
|
|
415
|
+
BrowserDoesNotSupportLocalStorage = 0,
|
|
416
|
+
BrowserCannotReadLocalStorage = 1,
|
|
417
|
+
BrowserCannotReadSessionStorage = 2,
|
|
418
|
+
BrowserCannotWriteLocalStorage = 3,
|
|
419
|
+
BrowserCannotWriteSessionStorage = 4,
|
|
420
|
+
BrowserFailedRemovalFromLocalStorage = 5,
|
|
421
|
+
BrowserFailedRemovalFromSessionStorage = 6,
|
|
422
|
+
CannotSendEmptyTelemetry = 7,
|
|
423
|
+
ClientPerformanceMathError = 8,
|
|
424
|
+
ErrorParsingAISessionCookie = 9,
|
|
425
|
+
ErrorPVCalc = 10,
|
|
426
|
+
ExceptionWhileLoggingError = 11,
|
|
427
|
+
FailedAddingTelemetryToBuffer = 12,
|
|
428
|
+
FailedMonitorAjaxAbort = 13,
|
|
429
|
+
FailedMonitorAjaxDur = 14,
|
|
430
|
+
FailedMonitorAjaxOpen = 15,
|
|
431
|
+
FailedMonitorAjaxRSC = 16,
|
|
432
|
+
FailedMonitorAjaxSend = 17,
|
|
433
|
+
FailedMonitorAjaxGetCorrelationHeader = 18,
|
|
434
|
+
FailedToAddHandlerForOnBeforeUnload = 19,
|
|
435
|
+
FailedToSendQueuedTelemetry = 20,
|
|
436
|
+
FailedToReportDataLoss = 21,
|
|
437
|
+
FlushFailed = 22,
|
|
438
|
+
MessageLimitPerPVExceeded = 23,
|
|
439
|
+
MissingRequiredFieldSpecification = 24,
|
|
440
|
+
NavigationTimingNotSupported = 25,
|
|
441
|
+
OnError = 26,
|
|
442
|
+
SessionRenewalDateIsZero = 27,
|
|
443
|
+
SenderNotInitialized = 28,
|
|
444
|
+
StartTrackEventFailed = 29,
|
|
445
|
+
StopTrackEventFailed = 30,
|
|
446
|
+
StartTrackFailed = 31,
|
|
447
|
+
StopTrackFailed = 32,
|
|
448
|
+
TelemetrySampledAndNotSent = 33,
|
|
449
|
+
TrackEventFailed = 34,
|
|
450
|
+
TrackExceptionFailed = 35,
|
|
451
|
+
TrackMetricFailed = 36,
|
|
452
|
+
TrackPVFailed = 37,
|
|
453
|
+
TrackPVFailedCalc = 38,
|
|
454
|
+
TrackTraceFailed = 39,
|
|
455
|
+
TransmissionFailed = 40,
|
|
456
|
+
FailedToSetStorageBuffer = 41,
|
|
457
|
+
FailedToRestoreStorageBuffer = 42,
|
|
458
|
+
InvalidBackendResponse = 43,
|
|
459
|
+
FailedToFixDepricatedValues = 44,
|
|
460
|
+
InvalidDurationValue = 45,
|
|
461
|
+
TelemetryEnvelopeInvalid = 46,
|
|
462
|
+
CreateEnvelopeError = 47,
|
|
463
|
+
CannotSerializeObject = 48,
|
|
464
|
+
CannotSerializeObjectNonSerializable = 49,
|
|
465
|
+
CircularReferenceDetected = 50,
|
|
466
|
+
ClearAuthContextFailed = 51,
|
|
467
|
+
ExceptionTruncated = 52,
|
|
468
|
+
IllegalCharsInName = 53,
|
|
469
|
+
ItemNotInArray = 54,
|
|
470
|
+
MaxAjaxPerPVExceeded = 55,
|
|
471
|
+
MessageTruncated = 56,
|
|
472
|
+
NameTooLong = 57,
|
|
473
|
+
SampleRateOutOfRange = 58,
|
|
474
|
+
SetAuthContextFailed = 59,
|
|
475
|
+
SetAuthContextFailedAccountName = 60,
|
|
476
|
+
StringValueTooLong = 61,
|
|
477
|
+
StartCalledMoreThanOnce = 62,
|
|
478
|
+
StopCalledWithoutStart = 63,
|
|
479
|
+
TelemetryInitializerFailed = 64,
|
|
480
|
+
TrackArgumentsNotSpecified = 65,
|
|
481
|
+
UrlTooLong = 66,
|
|
482
|
+
SessionStorageBufferFull = 67,
|
|
483
|
+
CannotAccessCookie = 68,
|
|
484
|
+
IdTooLong = 69,
|
|
485
|
+
InvalidEvent = 70,
|
|
486
|
+
FailedMonitorAjaxSetRequestHeader = 71,
|
|
487
|
+
SendBrowserInfoOnUserInit = 72,
|
|
488
|
+
PluginException = 73,
|
|
489
|
+
NotificationException = 74,
|
|
490
|
+
SnippetScriptLoadFailure = 99,
|
|
491
|
+
InvalidInstrumentationKey = 100,
|
|
492
|
+
CannotParseAiBlobValue = 101,
|
|
493
|
+
InvalidContentBlob = 102,
|
|
494
|
+
TrackPageActionEventFailed = 103,
|
|
495
|
+
FailedAddingCustomDefinedRequestContext = 104,
|
|
496
|
+
InMemoryStorageBufferFull = 105
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const enum eLoggingSeverity {
|
|
500
|
+
/**
|
|
501
|
+
* Error will be sent as internal telemetry
|
|
502
|
+
*/
|
|
503
|
+
CRITICAL = 1,
|
|
504
|
+
/**
|
|
505
|
+
* Error will NOT be sent as internal telemetry, and will only be shown in browser console
|
|
506
|
+
*/
|
|
507
|
+
WARNING = 2
|
|
508
|
+
}
|
|
509
|
+
|
|
359
510
|
const EventHelper: IEventHelper;
|
|
360
511
|
|
|
512
|
+
/**
|
|
513
|
+
* Removes an event handler for the specified event
|
|
514
|
+
* @param Object to remove the event from
|
|
515
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
516
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
517
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
518
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
519
|
+
* otherwise this will only remove events with this specific handler.
|
|
520
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
521
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
522
|
+
* @param useCapture [Optional] Defaults to false
|
|
523
|
+
*/
|
|
524
|
+
function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): void;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
528
|
+
* @param obj Object to add the event too.
|
|
529
|
+
* @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
|
|
530
|
+
* namespaces "click" "click.mynamespace" in addition to specific namespaces.
|
|
531
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
532
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
533
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
534
|
+
* @param useCapture [Optional] Defaults to false
|
|
535
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
536
|
+
*/
|
|
537
|
+
function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): boolean;
|
|
538
|
+
|
|
361
539
|
/**
|
|
362
540
|
* The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
|
|
363
541
|
*/
|
|
@@ -608,6 +786,71 @@ declare namespace ApplicationInsights {
|
|
|
608
786
|
* @param pluginIdentifier
|
|
609
787
|
*/
|
|
610
788
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
789
|
+
/**
|
|
790
|
+
* Returns the unique event namespace that should be used when registering events
|
|
791
|
+
*/
|
|
792
|
+
evtNamespace(): string;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
interface IBaseProcessingContext {
|
|
796
|
+
/**
|
|
797
|
+
* The current core instance for the request
|
|
798
|
+
*/
|
|
799
|
+
core: () => IAppInsightsCore;
|
|
800
|
+
/**
|
|
801
|
+
* THe current diagnostic logger for the request
|
|
802
|
+
*/
|
|
803
|
+
diagLog: () => IDiagnosticLogger;
|
|
804
|
+
/**
|
|
805
|
+
* Gets the current core config instance
|
|
806
|
+
*/
|
|
807
|
+
getCfg: () => IConfiguration;
|
|
808
|
+
/**
|
|
809
|
+
* Gets the named extension config
|
|
810
|
+
*/
|
|
811
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
812
|
+
/**
|
|
813
|
+
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
814
|
+
* default value is returned
|
|
815
|
+
* @param identifier The named extension identifier
|
|
816
|
+
* @param field The config field name
|
|
817
|
+
* @param defaultValue The default value to return if no defined config exists
|
|
818
|
+
*/
|
|
819
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
820
|
+
/**
|
|
821
|
+
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
822
|
+
* required if there is a nextPlugin
|
|
823
|
+
*/
|
|
824
|
+
hasNext: () => boolean;
|
|
825
|
+
/**
|
|
826
|
+
* Returns the next configured plugin proxy
|
|
827
|
+
*/
|
|
828
|
+
getNext: () => ITelemetryPluginChain;
|
|
829
|
+
/**
|
|
830
|
+
* Helper to set the next plugin proxy
|
|
831
|
+
*/
|
|
832
|
+
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
833
|
+
/**
|
|
834
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
835
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
836
|
+
* @param callback - The function call for each plugin in the context chain
|
|
837
|
+
*/
|
|
838
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
839
|
+
/**
|
|
840
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
841
|
+
* @param onComplete - The onComplete to call
|
|
842
|
+
* @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
|
|
843
|
+
* @param args - Any additional arguments to pass to the onComplete function
|
|
844
|
+
*/
|
|
845
|
+
onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
|
|
846
|
+
/**
|
|
847
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
848
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
849
|
+
* then the current execution order will be copied.
|
|
850
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
851
|
+
* order then the next plugin will be NOT set.
|
|
852
|
+
*/
|
|
853
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
|
|
611
854
|
}
|
|
612
855
|
|
|
613
856
|
/**
|
|
@@ -623,9 +866,14 @@ declare namespace ApplicationInsights {
|
|
|
623
866
|
*/
|
|
624
867
|
resume(): void;
|
|
625
868
|
/**
|
|
626
|
-
* Tear down
|
|
869
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
870
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
871
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
872
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
873
|
+
* @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.
|
|
874
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
627
875
|
*/
|
|
628
|
-
teardown()
|
|
876
|
+
teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
629
877
|
/**
|
|
630
878
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
631
879
|
* @param async - send data asynchronously when true
|
|
@@ -994,7 +1242,7 @@ declare namespace ApplicationInsights {
|
|
|
994
1242
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
995
1243
|
* @return {boolean} - true if the handler was successfully added
|
|
996
1244
|
*/
|
|
997
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
1245
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
998
1246
|
/**
|
|
999
1247
|
* 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)
|
|
1000
1248
|
* https://caniuse.com/#search=Date.now
|
|
@@ -1230,6 +1478,19 @@ declare namespace ApplicationInsights {
|
|
|
1230
1478
|
|
|
1231
1479
|
interface ILoadedPlugin<T extends IPlugin> {
|
|
1232
1480
|
plugin: T;
|
|
1481
|
+
/**
|
|
1482
|
+
* Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
|
|
1483
|
+
* via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
|
|
1484
|
+
* @returns boolean = true if the plugin is in a state where it is operational.
|
|
1485
|
+
*/
|
|
1486
|
+
isEnabled: () => boolean;
|
|
1487
|
+
/**
|
|
1488
|
+
* You can optionally enable / disable a plugin from processing events.
|
|
1489
|
+
* Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
|
|
1490
|
+
* as the plugin must also have been successfully initialized and not had it's `teardown` method called
|
|
1491
|
+
* (unless it's also been re-initialized)
|
|
1492
|
+
*/
|
|
1493
|
+
setEnabled: (isEnabled: boolean) => void;
|
|
1233
1494
|
}
|
|
1234
1495
|
|
|
1235
1496
|
/**
|
|
@@ -1448,7 +1709,7 @@ declare namespace ApplicationInsights {
|
|
|
1448
1709
|
InMemoryStorageBufferFull: number;
|
|
1449
1710
|
};
|
|
1450
1711
|
|
|
1451
|
-
type _InternalMessageId = number |
|
|
1712
|
+
type _InternalMessageId = number | _eInternalMessageId;
|
|
1452
1713
|
|
|
1453
1714
|
/**
|
|
1454
1715
|
* This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
|
|
@@ -1569,10 +1830,14 @@ declare namespace ApplicationInsights {
|
|
|
1569
1830
|
*/
|
|
1570
1831
|
isInitialized?: () => boolean;
|
|
1571
1832
|
/**
|
|
1572
|
-
* Tear down the plugin and remove any hooked value, the plugin should
|
|
1573
|
-
* therefore
|
|
1833
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1834
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
1835
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
1836
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
1837
|
+
* @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.
|
|
1838
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
1574
1839
|
*/
|
|
1575
|
-
teardown?: () => void;
|
|
1840
|
+
teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
1576
1841
|
/**
|
|
1577
1842
|
* Extension name
|
|
1578
1843
|
*/
|
|
@@ -1587,67 +1852,47 @@ declare namespace ApplicationInsights {
|
|
|
1587
1852
|
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1588
1853
|
* between multiple AppInsights instances
|
|
1589
1854
|
*/
|
|
1590
|
-
interface IProcessTelemetryContext {
|
|
1591
|
-
/**
|
|
1592
|
-
* The current core instance for the request
|
|
1593
|
-
*/
|
|
1594
|
-
core: () => IAppInsightsCore;
|
|
1595
|
-
/**
|
|
1596
|
-
* THe current diagnostic logger for the request
|
|
1597
|
-
*/
|
|
1598
|
-
diagLog: () => IDiagnosticLogger;
|
|
1599
|
-
/**
|
|
1600
|
-
* Gets the current core config instance
|
|
1601
|
-
*/
|
|
1602
|
-
getCfg: () => IConfiguration;
|
|
1603
|
-
/**
|
|
1604
|
-
* Gets the named extension config
|
|
1605
|
-
*/
|
|
1606
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
1607
|
-
/**
|
|
1608
|
-
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
1609
|
-
* default value is returned
|
|
1610
|
-
* @param identifier The named extension identifier
|
|
1611
|
-
* @param field The config field name
|
|
1612
|
-
* @param defaultValue The default value to return if no defined config exists
|
|
1613
|
-
*/
|
|
1614
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
1615
|
-
/**
|
|
1616
|
-
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
1617
|
-
* required if there is a nextPlugin
|
|
1618
|
-
*/
|
|
1619
|
-
hasNext: () => boolean;
|
|
1620
|
-
/**
|
|
1621
|
-
* Returns the next configured plugin proxy
|
|
1622
|
-
*/
|
|
1623
|
-
getNext: () => ITelemetryPluginChain;
|
|
1624
|
-
/**
|
|
1625
|
-
* Helper to set the next plugin proxy
|
|
1626
|
-
*/
|
|
1627
|
-
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
1855
|
+
interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
1628
1856
|
/**
|
|
1629
1857
|
* Call back for telemetry processing before it it is sent
|
|
1630
1858
|
* @param env - This is the current event being reported
|
|
1859
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1631
1860
|
*/
|
|
1632
|
-
processNext: (env: ITelemetryItem) => void;
|
|
1861
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
1633
1862
|
/**
|
|
1634
|
-
*
|
|
1635
|
-
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
1636
|
-
* @param callback - The function call for each plugin in the context chain
|
|
1637
|
-
*/
|
|
1638
|
-
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
1639
|
-
/**
|
|
1640
|
-
* Create a new context using the core and config from the current instance
|
|
1863
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1641
1864
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1642
1865
|
* then the current execution order will be copied.
|
|
1643
1866
|
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1644
1867
|
* order then the next plugin will be NOT set.
|
|
1645
1868
|
*/
|
|
1646
1869
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1874
|
+
* between multiple AppInsights instances
|
|
1875
|
+
*/
|
|
1876
|
+
interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1647
1877
|
/**
|
|
1648
|
-
*
|
|
1878
|
+
* This Plugin has finished unloading, so unload the next one
|
|
1879
|
+
* @param uploadState - The state of the unload process
|
|
1880
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1649
1881
|
*/
|
|
1650
|
-
|
|
1882
|
+
processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
|
|
1883
|
+
/**
|
|
1884
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1885
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1886
|
+
* then the current execution order will be copied.
|
|
1887
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1888
|
+
* order then the next plugin will be NOT set.
|
|
1889
|
+
*/
|
|
1890
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
interface _IRegisteredEvents {
|
|
1894
|
+
name: string;
|
|
1895
|
+
handler: any;
|
|
1651
1896
|
}
|
|
1652
1897
|
|
|
1653
1898
|
/**
|
|
@@ -1806,15 +2051,7 @@ declare namespace ApplicationInsights {
|
|
|
1806
2051
|
/**
|
|
1807
2052
|
* Configuration provided to SDK core
|
|
1808
2053
|
*/
|
|
1809
|
-
interface ITelemetryPlugin extends IPlugin {
|
|
1810
|
-
/**
|
|
1811
|
-
* Call back for telemetry processing before it it is sent
|
|
1812
|
-
* @param env - This is the current event being reported
|
|
1813
|
-
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
1814
|
-
* can optionally use this to access the current core instance or define / pass additional information
|
|
1815
|
-
* to later plugins (vs appending items to the telemetry item)
|
|
1816
|
-
*/
|
|
1817
|
-
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2054
|
+
interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
|
|
1818
2055
|
/**
|
|
1819
2056
|
* Set next extension for telemetry processing, this is not optional as plugins should use the
|
|
1820
2057
|
* processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
|
|
@@ -1830,7 +2067,7 @@ declare namespace ApplicationInsights {
|
|
|
1830
2067
|
/**
|
|
1831
2068
|
* Configuration provided to SDK core
|
|
1832
2069
|
*/
|
|
1833
|
-
interface ITelemetryPluginChain {
|
|
2070
|
+
interface ITelemetryPluginChain extends ITelemetryProcessor {
|
|
1834
2071
|
/**
|
|
1835
2072
|
* Returns the underlying plugin that is being proxied for the processTelemetry call
|
|
1836
2073
|
*/
|
|
@@ -1839,6 +2076,16 @@ declare namespace ApplicationInsights {
|
|
|
1839
2076
|
* Returns the next plugin
|
|
1840
2077
|
*/
|
|
1841
2078
|
getNext: () => ITelemetryPluginChain;
|
|
2079
|
+
/**
|
|
2080
|
+
* This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
|
|
2081
|
+
* call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
|
|
2082
|
+
* @param unloadCtx - The unload context to use for this call.
|
|
2083
|
+
* @param unloadState - The details of the unload operation
|
|
2084
|
+
*/
|
|
2085
|
+
unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
interface ITelemetryProcessor {
|
|
1842
2089
|
/**
|
|
1843
2090
|
* Call back for telemetry processing before it it is sent
|
|
1844
2091
|
* @param env - This is the current event being reported
|
|
@@ -1846,7 +2093,13 @@ declare namespace ApplicationInsights {
|
|
|
1846
2093
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
1847
2094
|
* to later plugins (vs appending items to the telemetry item)
|
|
1848
2095
|
*/
|
|
1849
|
-
processTelemetry: (env: ITelemetryItem, itemCtx
|
|
2096
|
+
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
interface ITelemetryUnloadState {
|
|
2100
|
+
reason: TelemetryUnloadReason;
|
|
2101
|
+
isAsync: boolean;
|
|
2102
|
+
flushComplete?: boolean;
|
|
1850
2103
|
}
|
|
1851
2104
|
|
|
1852
2105
|
/**
|
|
@@ -1861,16 +2114,14 @@ declare namespace ApplicationInsights {
|
|
|
1861
2114
|
*/
|
|
1862
2115
|
function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
1863
2116
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
WARNING = 2
|
|
1873
|
-
}
|
|
2117
|
+
const LoggingSeverity: {
|
|
2118
|
+
CRITICAL: number;
|
|
2119
|
+
WARNING: number;
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
type LoggingSeverity = number | eLoggingSeverity;
|
|
2123
|
+
|
|
2124
|
+
function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
|
|
1874
2125
|
|
|
1875
2126
|
const MinChannelPriorty: number;
|
|
1876
2127
|
|
|
@@ -1962,6 +2213,18 @@ declare namespace ApplicationInsights {
|
|
|
1962
2213
|
*/
|
|
1963
2214
|
function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
1964
2215
|
|
|
2216
|
+
/**
|
|
2217
|
+
* Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
|
|
2218
|
+
* It will NOT merge inherited or non-enumerable properties.
|
|
2219
|
+
* @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
|
|
2220
|
+
* @param obj2 - object to merge.
|
|
2221
|
+
* @param obj3 - object to merge.
|
|
2222
|
+
* @param obj4 - object to merge.
|
|
2223
|
+
* @param obj5 - object to merge.
|
|
2224
|
+
* @returns The extended first object.
|
|
2225
|
+
*/
|
|
2226
|
+
function objExtend<T1, T2, T3, T4, T5, T6>(obj?: boolean | T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
|
|
2227
|
+
|
|
1965
2228
|
/**
|
|
1966
2229
|
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
|
1967
2230
|
* performance optimization to avoid the creation of a new array for large objects
|
|
@@ -2108,8 +2371,9 @@ declare namespace ApplicationInsights {
|
|
|
2108
2371
|
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
2109
2372
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
2110
2373
|
* to later plugins (vs appending items to the telemetry item)
|
|
2374
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
2111
2375
|
*/
|
|
2112
|
-
processNext: (env: ITelemetryItem) => void;
|
|
2376
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
2113
2377
|
/**
|
|
2114
2378
|
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
2115
2379
|
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
@@ -2117,7 +2381,6 @@ declare namespace ApplicationInsights {
|
|
|
2117
2381
|
*/
|
|
2118
2382
|
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
2119
2383
|
/**
|
|
2120
|
-
/**
|
|
2121
2384
|
* Create a new context using the core and config from the current instance
|
|
2122
2385
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
2123
2386
|
* then the current execution order will be copied.
|
|
@@ -2155,6 +2418,17 @@ declare namespace ApplicationInsights {
|
|
|
2155
2418
|
*/
|
|
2156
2419
|
function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
2157
2420
|
|
|
2421
|
+
function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
2425
|
+
*
|
|
2426
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
2427
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2428
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
2429
|
+
*/
|
|
2430
|
+
function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
|
|
2431
|
+
|
|
2158
2432
|
/**
|
|
2159
2433
|
* generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
|
|
2160
2434
|
* @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
|
|
@@ -2168,6 +2442,43 @@ declare namespace ApplicationInsights {
|
|
|
2168
2442
|
*/
|
|
2169
2443
|
function randomValue(maxValue: number): number;
|
|
2170
2444
|
|
|
2445
|
+
/**
|
|
2446
|
+
* Trys to remove event handler(s) for the specified event/namespace to the window, body and document
|
|
2447
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
2448
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
2449
|
+
* @param callback {any} - - The callback function that needs to be removed from the given event, when using a
|
|
2450
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
2451
|
+
* otherwise this will only remove events with this specific handler.
|
|
2452
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2453
|
+
*/
|
|
2454
|
+
function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): void;
|
|
2455
|
+
|
|
2456
|
+
/**
|
|
2457
|
+
* Remove the listener from the array of events
|
|
2458
|
+
* @param events An string array of event names to bind the listener to
|
|
2459
|
+
* @param listener The event callback to call when the event is triggered
|
|
2460
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2461
|
+
*/
|
|
2462
|
+
function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
|
|
2466
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
|
|
2467
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
2468
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
2469
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
2470
|
+
*/
|
|
2471
|
+
function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
2475
|
+
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
2476
|
+
* @param listener - The specific event callback to to be removed
|
|
2477
|
+
* @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
|
|
2478
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
2479
|
+
*/
|
|
2480
|
+
function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2481
|
+
|
|
2171
2482
|
/**
|
|
2172
2483
|
* Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
|
|
2173
2484
|
* associated with the configuration or a legacy default.
|
|
@@ -2299,6 +2610,16 @@ declare namespace ApplicationInsights {
|
|
|
2299
2610
|
|
|
2300
2611
|
type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
2301
2612
|
|
|
2613
|
+
/**
|
|
2614
|
+
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
2615
|
+
*/
|
|
2616
|
+
const enum TelemetryUnloadReason {
|
|
2617
|
+
/**
|
|
2618
|
+
* Teardown has been called without any context.
|
|
2619
|
+
*/
|
|
2620
|
+
ManualTeardown = 0
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2302
2623
|
function throwError(message: string): never;
|
|
2303
2624
|
|
|
2304
2625
|
/**
|