@microsoft/applicationinsights-core-js 2.8.0-beta.2202-07 → 2.8.0-beta.2203-03
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 +1137 -484
- 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 +6529 -2784
- package/dist/applicationinsights-core-js.api.md +290 -30
- package/dist/applicationinsights-core-js.d.ts +481 -89
- package/dist/applicationinsights-core-js.js +1137 -484
- 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 +481 -89
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +248 -32
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +50 -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 +195 -107
- 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/UnloadHandlerContainer.js +32 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- 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 +9 -4
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +312 -33
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +90 -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 +248 -121
- package/src/JavaScriptSDK/RandomHelper.ts +2 -1
- package/src/JavaScriptSDK/TelemetryHelpers.ts +47 -15
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +5 -15
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +44 -0
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +49 -2
- 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 +21 -1
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +26 -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 +12 -3
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +8 -0
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -7
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +41 -1
- 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 +7 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -20,39 +20,59 @@ import { strShimObject as strObject } from '@microsoft/applicationinsights-shims
|
|
|
20
20
|
import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights-shims';
|
|
21
21
|
import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
|
|
25
|
+
* applications to remove their own events
|
|
26
|
+
* @param target - The EventTarget that has registered events
|
|
27
|
+
* @param evtName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
28
|
+
*/
|
|
29
|
+
export declare function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
|
|
30
|
+
|
|
23
31
|
/**
|
|
24
32
|
* Trys to add an event handler for the specified event to the window, body and document
|
|
25
33
|
* @param eventName {string} - The name of the event
|
|
26
34
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
35
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
27
36
|
* @return {boolean} - true if the handler was successfully added
|
|
28
37
|
*/
|
|
29
|
-
export declare function addEventHandler(eventName: string, callback: any): boolean;
|
|
38
|
+
export declare function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
|
|
30
39
|
|
|
31
40
|
/**
|
|
32
41
|
* Bind the listener to the array of events
|
|
33
42
|
* @param events An string array of event names to bind the listener to
|
|
34
43
|
* @param listener The event callback to call when the event is triggered
|
|
35
44
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
45
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
36
46
|
* @returns true - when at least one of the events was registered otherwise false
|
|
37
47
|
*/
|
|
38
|
-
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
|
|
48
|
+
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
39
49
|
|
|
40
50
|
/**
|
|
41
|
-
* Listen to the pagehide and visibility changing to 'hidden' events
|
|
51
|
+
* Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
|
|
52
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
53
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
42
54
|
* @param listener - The event callback to call when a page hide event is triggered
|
|
43
55
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
56
|
+
* @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
|
|
57
|
+
* based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
58
|
+
* so that only the matching "removePageHideEventListener" can remove these events.
|
|
44
59
|
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
45
60
|
* @returns true - when at least one of the events was registered otherwise false
|
|
46
61
|
*/
|
|
47
|
-
export declare function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
62
|
+
export declare function addPageHideEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
48
63
|
|
|
49
64
|
/**
|
|
50
|
-
* Listen to the pageshow and visibility changing to 'visible' events
|
|
65
|
+
* Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
|
|
66
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
67
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
51
68
|
* @param listener - The event callback to call when a page is show event is triggered
|
|
52
69
|
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
70
|
+
* @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
|
|
71
|
+
* identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
72
|
+
* so that only the matching "removePageShowEventListener" can remove these events.
|
|
53
73
|
* @returns true - when at least one of the events was registered otherwise false
|
|
54
74
|
*/
|
|
55
|
-
export declare function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
75
|
+
export declare function addPageShowEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
56
76
|
|
|
57
77
|
/**
|
|
58
78
|
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
@@ -62,9 +82,10 @@ export declare function addPageShowEventListener(listener: any, excludeEvents?:
|
|
|
62
82
|
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
63
83
|
* @param listener - The event callback to call when a page unload event is triggered
|
|
64
84
|
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
85
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
65
86
|
* @returns true - when at least one of the events was registered otherwise false
|
|
66
87
|
*/
|
|
67
|
-
export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
88
|
+
export declare function addPageUnloadEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
|
|
68
89
|
|
|
69
90
|
export declare class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
70
91
|
constructor();
|
|
@@ -117,7 +138,7 @@ export declare function arrReduce<T, R>(arr: T[], callbackfn: (previousValue: T
|
|
|
117
138
|
/**
|
|
118
139
|
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
119
140
|
* @param obj Object to add the event too.
|
|
120
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
141
|
+
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
|
|
121
142
|
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
122
143
|
* @param useCapture [Optional] Defaults to false
|
|
123
144
|
* @returns True if the function was bound successfully to the event, otherwise false
|
|
@@ -174,7 +195,26 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
174
195
|
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
175
196
|
*/
|
|
176
197
|
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
198
|
+
/**
|
|
199
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
200
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
201
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
202
|
+
* approach is to create a new instance and initialize that instance.
|
|
203
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
204
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
205
|
+
*/
|
|
206
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
177
207
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
208
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
209
|
+
/**
|
|
210
|
+
* Returns the unique event namespace that should be used
|
|
211
|
+
*/
|
|
212
|
+
evtNamespace(): string;
|
|
213
|
+
/**
|
|
214
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
215
|
+
* @param handler - the handler
|
|
216
|
+
*/
|
|
217
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
178
218
|
protected releaseQueue(): void;
|
|
179
219
|
}
|
|
180
220
|
|
|
@@ -223,9 +263,32 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
223
263
|
* Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
|
|
224
264
|
*/
|
|
225
265
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
266
|
+
/**
|
|
267
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
268
|
+
* finishes it's removal.
|
|
269
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
270
|
+
* @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.
|
|
271
|
+
* @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.
|
|
272
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
273
|
+
*/
|
|
274
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
226
275
|
constructor();
|
|
227
276
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
277
|
+
/**
|
|
278
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
279
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
280
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
281
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
282
|
+
* @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.
|
|
283
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
284
|
+
*/
|
|
285
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
228
286
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
287
|
+
/**
|
|
288
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
289
|
+
* @param handler - the handler
|
|
290
|
+
*/
|
|
291
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
229
292
|
/**
|
|
230
293
|
* Add this hook so that it is automatically removed during unloading
|
|
231
294
|
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
@@ -256,14 +319,29 @@ export declare function createClassFromInterface<T>(defaults?: T): new () => T;
|
|
|
256
319
|
|
|
257
320
|
export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
258
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Create an enum style object which has both the key => value and value => key mappings
|
|
324
|
+
* @param values - The values to populate on the new object
|
|
325
|
+
* @returns
|
|
326
|
+
*/
|
|
327
|
+
export declare function createEnumStyle<T>(values: T): T;
|
|
328
|
+
|
|
259
329
|
/**
|
|
260
330
|
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
261
331
|
* @param plugins - The plugin instances that will be executed
|
|
262
332
|
* @param config - The current config
|
|
263
333
|
* @param core - The current core instance
|
|
334
|
+
* @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
|
|
264
335
|
*/
|
|
265
336
|
export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
266
337
|
|
|
338
|
+
export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
|
|
339
|
+
|
|
340
|
+
export declare function createUnloadHandlerContainer(): {
|
|
341
|
+
add: (handler: UnloadHandler) => void;
|
|
342
|
+
run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
343
|
+
};
|
|
344
|
+
|
|
267
345
|
/**
|
|
268
346
|
* 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)
|
|
269
347
|
* https://caniuse.com/#search=Date.now
|
|
@@ -280,8 +358,11 @@ export declare function deleteCookie(logger: IDiagnosticLogger, name: string): b
|
|
|
280
358
|
/**
|
|
281
359
|
* Removes an event handler for the specified event
|
|
282
360
|
* @param Object to remove the event from
|
|
283
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
284
|
-
*
|
|
361
|
+
* @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
362
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
363
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
364
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
365
|
+
* otherwise this will only remove events with this specific handler.
|
|
285
366
|
* @param useCapture [Optional] Defaults to false
|
|
286
367
|
*/
|
|
287
368
|
export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
@@ -362,8 +443,131 @@ export declare function doPerf<T>(mgrSource: IPerfManagerProvider | IPerfManager
|
|
|
362
443
|
*/
|
|
363
444
|
export declare function dumpObj(object: any): string;
|
|
364
445
|
|
|
446
|
+
export declare const enum _eInternalMessageId {
|
|
447
|
+
BrowserDoesNotSupportLocalStorage = 0,
|
|
448
|
+
BrowserCannotReadLocalStorage = 1,
|
|
449
|
+
BrowserCannotReadSessionStorage = 2,
|
|
450
|
+
BrowserCannotWriteLocalStorage = 3,
|
|
451
|
+
BrowserCannotWriteSessionStorage = 4,
|
|
452
|
+
BrowserFailedRemovalFromLocalStorage = 5,
|
|
453
|
+
BrowserFailedRemovalFromSessionStorage = 6,
|
|
454
|
+
CannotSendEmptyTelemetry = 7,
|
|
455
|
+
ClientPerformanceMathError = 8,
|
|
456
|
+
ErrorParsingAISessionCookie = 9,
|
|
457
|
+
ErrorPVCalc = 10,
|
|
458
|
+
ExceptionWhileLoggingError = 11,
|
|
459
|
+
FailedAddingTelemetryToBuffer = 12,
|
|
460
|
+
FailedMonitorAjaxAbort = 13,
|
|
461
|
+
FailedMonitorAjaxDur = 14,
|
|
462
|
+
FailedMonitorAjaxOpen = 15,
|
|
463
|
+
FailedMonitorAjaxRSC = 16,
|
|
464
|
+
FailedMonitorAjaxSend = 17,
|
|
465
|
+
FailedMonitorAjaxGetCorrelationHeader = 18,
|
|
466
|
+
FailedToAddHandlerForOnBeforeUnload = 19,
|
|
467
|
+
FailedToSendQueuedTelemetry = 20,
|
|
468
|
+
FailedToReportDataLoss = 21,
|
|
469
|
+
FlushFailed = 22,
|
|
470
|
+
MessageLimitPerPVExceeded = 23,
|
|
471
|
+
MissingRequiredFieldSpecification = 24,
|
|
472
|
+
NavigationTimingNotSupported = 25,
|
|
473
|
+
OnError = 26,
|
|
474
|
+
SessionRenewalDateIsZero = 27,
|
|
475
|
+
SenderNotInitialized = 28,
|
|
476
|
+
StartTrackEventFailed = 29,
|
|
477
|
+
StopTrackEventFailed = 30,
|
|
478
|
+
StartTrackFailed = 31,
|
|
479
|
+
StopTrackFailed = 32,
|
|
480
|
+
TelemetrySampledAndNotSent = 33,
|
|
481
|
+
TrackEventFailed = 34,
|
|
482
|
+
TrackExceptionFailed = 35,
|
|
483
|
+
TrackMetricFailed = 36,
|
|
484
|
+
TrackPVFailed = 37,
|
|
485
|
+
TrackPVFailedCalc = 38,
|
|
486
|
+
TrackTraceFailed = 39,
|
|
487
|
+
TransmissionFailed = 40,
|
|
488
|
+
FailedToSetStorageBuffer = 41,
|
|
489
|
+
FailedToRestoreStorageBuffer = 42,
|
|
490
|
+
InvalidBackendResponse = 43,
|
|
491
|
+
FailedToFixDepricatedValues = 44,
|
|
492
|
+
InvalidDurationValue = 45,
|
|
493
|
+
TelemetryEnvelopeInvalid = 46,
|
|
494
|
+
CreateEnvelopeError = 47,
|
|
495
|
+
CannotSerializeObject = 48,
|
|
496
|
+
CannotSerializeObjectNonSerializable = 49,
|
|
497
|
+
CircularReferenceDetected = 50,
|
|
498
|
+
ClearAuthContextFailed = 51,
|
|
499
|
+
ExceptionTruncated = 52,
|
|
500
|
+
IllegalCharsInName = 53,
|
|
501
|
+
ItemNotInArray = 54,
|
|
502
|
+
MaxAjaxPerPVExceeded = 55,
|
|
503
|
+
MessageTruncated = 56,
|
|
504
|
+
NameTooLong = 57,
|
|
505
|
+
SampleRateOutOfRange = 58,
|
|
506
|
+
SetAuthContextFailed = 59,
|
|
507
|
+
SetAuthContextFailedAccountName = 60,
|
|
508
|
+
StringValueTooLong = 61,
|
|
509
|
+
StartCalledMoreThanOnce = 62,
|
|
510
|
+
StopCalledWithoutStart = 63,
|
|
511
|
+
TelemetryInitializerFailed = 64,
|
|
512
|
+
TrackArgumentsNotSpecified = 65,
|
|
513
|
+
UrlTooLong = 66,
|
|
514
|
+
SessionStorageBufferFull = 67,
|
|
515
|
+
CannotAccessCookie = 68,
|
|
516
|
+
IdTooLong = 69,
|
|
517
|
+
InvalidEvent = 70,
|
|
518
|
+
FailedMonitorAjaxSetRequestHeader = 71,
|
|
519
|
+
SendBrowserInfoOnUserInit = 72,
|
|
520
|
+
PluginException = 73,
|
|
521
|
+
NotificationException = 74,
|
|
522
|
+
SnippetScriptLoadFailure = 99,
|
|
523
|
+
InvalidInstrumentationKey = 100,
|
|
524
|
+
CannotParseAiBlobValue = 101,
|
|
525
|
+
InvalidContentBlob = 102,
|
|
526
|
+
TrackPageActionEventFailed = 103,
|
|
527
|
+
FailedAddingCustomDefinedRequestContext = 104,
|
|
528
|
+
InMemoryStorageBufferFull = 105
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export declare const enum eLoggingSeverity {
|
|
532
|
+
/**
|
|
533
|
+
* Error will be sent as internal telemetry
|
|
534
|
+
*/
|
|
535
|
+
CRITICAL = 1,
|
|
536
|
+
/**
|
|
537
|
+
* Error will NOT be sent as internal telemetry, and will only be shown in browser console
|
|
538
|
+
*/
|
|
539
|
+
WARNING = 2
|
|
540
|
+
}
|
|
541
|
+
|
|
365
542
|
export declare const EventHelper: IEventHelper;
|
|
366
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Removes an event handler for the specified event
|
|
546
|
+
* @param Object to remove the event from
|
|
547
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
548
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
549
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
550
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
551
|
+
* otherwise this will only remove events with this specific handler.
|
|
552
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
553
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
554
|
+
* @param useCapture [Optional] Defaults to false
|
|
555
|
+
*/
|
|
556
|
+
export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): void;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
560
|
+
* @param obj Object to add the event too.
|
|
561
|
+
* @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
|
|
562
|
+
* namespaces "click" "click.mynamespace" in addition to specific namespaces.
|
|
563
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
564
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
565
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
566
|
+
* @param useCapture [Optional] Defaults to false
|
|
567
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
568
|
+
*/
|
|
569
|
+
export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): boolean;
|
|
570
|
+
|
|
367
571
|
/**
|
|
368
572
|
* The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
|
|
369
573
|
*/
|
|
@@ -609,11 +813,97 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
609
813
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
610
814
|
*/
|
|
611
815
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
816
|
+
/**
|
|
817
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
818
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
819
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
820
|
+
* approach is to create a new instance and initialize that instance.
|
|
821
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
822
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
823
|
+
*/
|
|
824
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
612
825
|
/**
|
|
613
826
|
* Find and return the (first) plugin with the specified identifier if present
|
|
614
827
|
* @param pluginIdentifier
|
|
615
828
|
*/
|
|
616
829
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
830
|
+
/**
|
|
831
|
+
* Add a new plugin to the installation
|
|
832
|
+
* @param plugin - The new plugin to add
|
|
833
|
+
* @param replaceExisting - should any existing plugin be replaced
|
|
834
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
835
|
+
*/
|
|
836
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
837
|
+
/**
|
|
838
|
+
* Returns the unique event namespace that should be used when registering events
|
|
839
|
+
*/
|
|
840
|
+
evtNamespace(): string;
|
|
841
|
+
/**
|
|
842
|
+
* Add a handler that will be called when the SDK is being unloaded
|
|
843
|
+
* @param handler - the handler
|
|
844
|
+
*/
|
|
845
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
declare interface IBaseProcessingContext {
|
|
849
|
+
/**
|
|
850
|
+
* The current core instance for the request
|
|
851
|
+
*/
|
|
852
|
+
core: () => IAppInsightsCore;
|
|
853
|
+
/**
|
|
854
|
+
* THe current diagnostic logger for the request
|
|
855
|
+
*/
|
|
856
|
+
diagLog: () => IDiagnosticLogger;
|
|
857
|
+
/**
|
|
858
|
+
* Gets the current core config instance
|
|
859
|
+
*/
|
|
860
|
+
getCfg: () => IConfiguration;
|
|
861
|
+
/**
|
|
862
|
+
* Gets the named extension config
|
|
863
|
+
*/
|
|
864
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
865
|
+
/**
|
|
866
|
+
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
867
|
+
* default value is returned
|
|
868
|
+
* @param identifier The named extension identifier
|
|
869
|
+
* @param field The config field name
|
|
870
|
+
* @param defaultValue The default value to return if no defined config exists
|
|
871
|
+
*/
|
|
872
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
873
|
+
/**
|
|
874
|
+
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
875
|
+
* required if there is a nextPlugin
|
|
876
|
+
*/
|
|
877
|
+
hasNext: () => boolean;
|
|
878
|
+
/**
|
|
879
|
+
* Returns the next configured plugin proxy
|
|
880
|
+
*/
|
|
881
|
+
getNext: () => ITelemetryPluginChain;
|
|
882
|
+
/**
|
|
883
|
+
* Helper to set the next plugin proxy
|
|
884
|
+
*/
|
|
885
|
+
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
886
|
+
/**
|
|
887
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
888
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
889
|
+
* @param callback - The function call for each plugin in the context chain
|
|
890
|
+
*/
|
|
891
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
892
|
+
/**
|
|
893
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
894
|
+
* @param onComplete - The onComplete to call
|
|
895
|
+
* @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
|
|
896
|
+
* @param args - Any additional arguments to pass to the onComplete function
|
|
897
|
+
*/
|
|
898
|
+
onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
|
|
899
|
+
/**
|
|
900
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
901
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
902
|
+
* then the current execution order will be copied.
|
|
903
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
904
|
+
* order then the next plugin will be NOT set.
|
|
905
|
+
*/
|
|
906
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
|
|
617
907
|
}
|
|
618
908
|
|
|
619
909
|
/**
|
|
@@ -629,9 +919,14 @@ export declare interface IChannelControls extends ITelemetryPlugin {
|
|
|
629
919
|
*/
|
|
630
920
|
resume(): void;
|
|
631
921
|
/**
|
|
632
|
-
* Tear down
|
|
922
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
923
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
924
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
925
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
926
|
+
* @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.
|
|
927
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
633
928
|
*/
|
|
634
|
-
teardown()
|
|
929
|
+
teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
635
930
|
/**
|
|
636
931
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
637
932
|
* @param async - send data asynchronously when true
|
|
@@ -1000,7 +1295,7 @@ export declare interface ICoreUtils {
|
|
|
1000
1295
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
1001
1296
|
* @return {boolean} - true if the handler was successfully added
|
|
1002
1297
|
*/
|
|
1003
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
1298
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
1004
1299
|
/**
|
|
1005
1300
|
* 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)
|
|
1006
1301
|
* https://caniuse.com/#search=Date.now
|
|
@@ -1236,6 +1531,20 @@ export declare interface IInstrumentHooksCallbacks {
|
|
|
1236
1531
|
|
|
1237
1532
|
declare interface ILoadedPlugin<T extends IPlugin> {
|
|
1238
1533
|
plugin: T;
|
|
1534
|
+
/**
|
|
1535
|
+
* Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
|
|
1536
|
+
* via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
|
|
1537
|
+
* @returns boolean = true if the plugin is in a state where it is operational.
|
|
1538
|
+
*/
|
|
1539
|
+
isEnabled: () => boolean;
|
|
1540
|
+
/**
|
|
1541
|
+
* You can optionally enable / disable a plugin from processing events.
|
|
1542
|
+
* Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
|
|
1543
|
+
* as the plugin must also have been successfully initialized and not had it's `teardown` method called
|
|
1544
|
+
* (unless it's also been re-initialized)
|
|
1545
|
+
*/
|
|
1546
|
+
setEnabled: (isEnabled: boolean) => void;
|
|
1547
|
+
remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
|
|
1239
1548
|
}
|
|
1240
1549
|
|
|
1241
1550
|
/**
|
|
@@ -1454,7 +1763,7 @@ export declare const _InternalMessageId: {
|
|
|
1454
1763
|
InMemoryStorageBufferFull: number;
|
|
1455
1764
|
};
|
|
1456
1765
|
|
|
1457
|
-
export declare type _InternalMessageId = number |
|
|
1766
|
+
export declare type _InternalMessageId = number | _eInternalMessageId;
|
|
1458
1767
|
|
|
1459
1768
|
/**
|
|
1460
1769
|
* This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
|
|
@@ -1575,10 +1884,14 @@ export declare interface IPlugin {
|
|
|
1575
1884
|
*/
|
|
1576
1885
|
isInitialized?: () => boolean;
|
|
1577
1886
|
/**
|
|
1578
|
-
* Tear down the plugin and remove any hooked value, the plugin should
|
|
1579
|
-
* therefore
|
|
1887
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1888
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
1889
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
1890
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
1891
|
+
* @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.
|
|
1892
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
1580
1893
|
*/
|
|
1581
|
-
teardown?: () => void;
|
|
1894
|
+
teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
1582
1895
|
/**
|
|
1583
1896
|
* Extension name
|
|
1584
1897
|
*/
|
|
@@ -1593,67 +1906,47 @@ export declare interface IPlugin {
|
|
|
1593
1906
|
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1594
1907
|
* between multiple AppInsights instances
|
|
1595
1908
|
*/
|
|
1596
|
-
export declare interface IProcessTelemetryContext {
|
|
1597
|
-
/**
|
|
1598
|
-
* The current core instance for the request
|
|
1599
|
-
*/
|
|
1600
|
-
core: () => IAppInsightsCore;
|
|
1601
|
-
/**
|
|
1602
|
-
* THe current diagnostic logger for the request
|
|
1603
|
-
*/
|
|
1604
|
-
diagLog: () => IDiagnosticLogger;
|
|
1605
|
-
/**
|
|
1606
|
-
* Gets the current core config instance
|
|
1607
|
-
*/
|
|
1608
|
-
getCfg: () => IConfiguration;
|
|
1609
|
-
/**
|
|
1610
|
-
* Gets the named extension config
|
|
1611
|
-
*/
|
|
1612
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
1613
|
-
/**
|
|
1614
|
-
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
1615
|
-
* default value is returned
|
|
1616
|
-
* @param identifier The named extension identifier
|
|
1617
|
-
* @param field The config field name
|
|
1618
|
-
* @param defaultValue The default value to return if no defined config exists
|
|
1619
|
-
*/
|
|
1620
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
1621
|
-
/**
|
|
1622
|
-
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
1623
|
-
* required if there is a nextPlugin
|
|
1624
|
-
*/
|
|
1625
|
-
hasNext: () => boolean;
|
|
1626
|
-
/**
|
|
1627
|
-
* Returns the next configured plugin proxy
|
|
1628
|
-
*/
|
|
1629
|
-
getNext: () => ITelemetryPluginChain;
|
|
1630
|
-
/**
|
|
1631
|
-
* Helper to set the next plugin proxy
|
|
1632
|
-
*/
|
|
1633
|
-
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
1909
|
+
export declare interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
1634
1910
|
/**
|
|
1635
1911
|
* Call back for telemetry processing before it it is sent
|
|
1636
1912
|
* @param env - This is the current event being reported
|
|
1913
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1637
1914
|
*/
|
|
1638
|
-
processNext: (env: ITelemetryItem) => void;
|
|
1639
|
-
/**
|
|
1640
|
-
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
1641
|
-
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
1642
|
-
* @param callback - The function call for each plugin in the context chain
|
|
1643
|
-
*/
|
|
1644
|
-
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
1915
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
1645
1916
|
/**
|
|
1646
|
-
* Create a new context using the core and config from the current instance
|
|
1917
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1647
1918
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1648
1919
|
* then the current execution order will be copied.
|
|
1649
1920
|
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1650
1921
|
* order then the next plugin will be NOT set.
|
|
1651
1922
|
*/
|
|
1652
1923
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1928
|
+
* between multiple AppInsights instances
|
|
1929
|
+
*/
|
|
1930
|
+
declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1653
1931
|
/**
|
|
1654
|
-
*
|
|
1932
|
+
* This Plugin has finished unloading, so unload the next one
|
|
1933
|
+
* @param uploadState - The state of the unload process
|
|
1934
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1655
1935
|
*/
|
|
1656
|
-
|
|
1936
|
+
processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
|
|
1937
|
+
/**
|
|
1938
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1939
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1940
|
+
* then the current execution order will be copied.
|
|
1941
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1942
|
+
* order then the next plugin will be NOT set.
|
|
1943
|
+
*/
|
|
1944
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
export declare interface _IRegisteredEvents {
|
|
1948
|
+
name: string;
|
|
1949
|
+
handler: any;
|
|
1657
1950
|
}
|
|
1658
1951
|
|
|
1659
1952
|
/**
|
|
@@ -1812,15 +2105,7 @@ export declare interface ITelemetryItem {
|
|
|
1812
2105
|
/**
|
|
1813
2106
|
* Configuration provided to SDK core
|
|
1814
2107
|
*/
|
|
1815
|
-
export declare interface ITelemetryPlugin extends IPlugin {
|
|
1816
|
-
/**
|
|
1817
|
-
* Call back for telemetry processing before it it is sent
|
|
1818
|
-
* @param env - This is the current event being reported
|
|
1819
|
-
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
1820
|
-
* can optionally use this to access the current core instance or define / pass additional information
|
|
1821
|
-
* to later plugins (vs appending items to the telemetry item)
|
|
1822
|
-
*/
|
|
1823
|
-
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2108
|
+
export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
|
|
1824
2109
|
/**
|
|
1825
2110
|
* Set next extension for telemetry processing, this is not optional as plugins should use the
|
|
1826
2111
|
* processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
|
|
@@ -1836,7 +2121,7 @@ export declare interface ITelemetryPlugin extends IPlugin {
|
|
|
1836
2121
|
/**
|
|
1837
2122
|
* Configuration provided to SDK core
|
|
1838
2123
|
*/
|
|
1839
|
-
export declare interface ITelemetryPluginChain {
|
|
2124
|
+
export declare interface ITelemetryPluginChain extends ITelemetryProcessor {
|
|
1840
2125
|
/**
|
|
1841
2126
|
* Returns the underlying plugin that is being proxied for the processTelemetry call
|
|
1842
2127
|
*/
|
|
@@ -1845,6 +2130,16 @@ export declare interface ITelemetryPluginChain {
|
|
|
1845
2130
|
* Returns the next plugin
|
|
1846
2131
|
*/
|
|
1847
2132
|
getNext: () => ITelemetryPluginChain;
|
|
2133
|
+
/**
|
|
2134
|
+
* This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
|
|
2135
|
+
* call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
|
|
2136
|
+
* @param unloadCtx - The unload context to use for this call.
|
|
2137
|
+
* @param unloadState - The details of the unload operation
|
|
2138
|
+
*/
|
|
2139
|
+
unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
declare interface ITelemetryProcessor {
|
|
1848
2143
|
/**
|
|
1849
2144
|
* Call back for telemetry processing before it it is sent
|
|
1850
2145
|
* @param env - This is the current event being reported
|
|
@@ -1852,7 +2147,18 @@ export declare interface ITelemetryPluginChain {
|
|
|
1852
2147
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
1853
2148
|
* to later plugins (vs appending items to the telemetry item)
|
|
1854
2149
|
*/
|
|
1855
|
-
processTelemetry: (env: ITelemetryItem, itemCtx
|
|
2150
|
+
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
export declare interface ITelemetryUnloadState {
|
|
2154
|
+
reason: TelemetryUnloadReason;
|
|
2155
|
+
isAsync: boolean;
|
|
2156
|
+
flushComplete?: boolean;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
export declare interface IUnloadHandlerContainer {
|
|
2160
|
+
add: (handler: UnloadHandler) => void;
|
|
2161
|
+
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
1856
2162
|
}
|
|
1857
2163
|
|
|
1858
2164
|
/**
|
|
@@ -1867,16 +2173,14 @@ export declare interface ITelemetryPluginChain {
|
|
|
1867
2173
|
*/
|
|
1868
2174
|
export declare function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
1869
2175
|
|
|
1870
|
-
export declare
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
WARNING = 2
|
|
1879
|
-
}
|
|
2176
|
+
export declare const LoggingSeverity: {
|
|
2177
|
+
CRITICAL: number;
|
|
2178
|
+
WARNING: number;
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
export declare type LoggingSeverity = number | eLoggingSeverity;
|
|
2182
|
+
|
|
2183
|
+
export declare function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
|
|
1880
2184
|
|
|
1881
2185
|
export declare const MinChannelPriorty: number;
|
|
1882
2186
|
|
|
@@ -1968,6 +2272,18 @@ export { objCreate }
|
|
|
1968
2272
|
*/
|
|
1969
2273
|
export declare function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
1970
2274
|
|
|
2275
|
+
/**
|
|
2276
|
+
* Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
|
|
2277
|
+
* It will NOT merge inherited or non-enumerable properties.
|
|
2278
|
+
* @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
|
|
2279
|
+
* @param obj2 - object to merge.
|
|
2280
|
+
* @param obj3 - object to merge.
|
|
2281
|
+
* @param obj4 - object to merge.
|
|
2282
|
+
* @param obj5 - object to merge.
|
|
2283
|
+
* @returns The extended first object.
|
|
2284
|
+
*/
|
|
2285
|
+
export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj?: boolean | T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
|
|
2286
|
+
|
|
1971
2287
|
/**
|
|
1972
2288
|
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
|
1973
2289
|
* performance optimization to avoid the creation of a new array for large objects
|
|
@@ -2114,8 +2430,9 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
|
|
|
2114
2430
|
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
2115
2431
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
2116
2432
|
* to later plugins (vs appending items to the telemetry item)
|
|
2433
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
2117
2434
|
*/
|
|
2118
|
-
processNext: (env: ITelemetryItem) => void;
|
|
2435
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
2119
2436
|
/**
|
|
2120
2437
|
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
2121
2438
|
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
@@ -2123,7 +2440,6 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
|
|
|
2123
2440
|
*/
|
|
2124
2441
|
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
2125
2442
|
/**
|
|
2126
|
-
/**
|
|
2127
2443
|
* Create a new context using the core and config from the current instance
|
|
2128
2444
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
2129
2445
|
* then the current execution order will be copied.
|
|
@@ -2161,6 +2477,17 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
|
|
|
2161
2477
|
*/
|
|
2162
2478
|
export declare function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
2163
2479
|
|
|
2480
|
+
export declare function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
2484
|
+
*
|
|
2485
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
2486
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2487
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
2488
|
+
*/
|
|
2489
|
+
export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
|
|
2490
|
+
|
|
2164
2491
|
/**
|
|
2165
2492
|
* generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
|
|
2166
2493
|
* @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
|
|
@@ -2174,6 +2501,43 @@ export declare function random32(signed?: boolean): number;
|
|
|
2174
2501
|
*/
|
|
2175
2502
|
export declare function randomValue(maxValue: number): number;
|
|
2176
2503
|
|
|
2504
|
+
/**
|
|
2505
|
+
* Trys to remove event handler(s) for the specified event/namespace to the window, body and document
|
|
2506
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
2507
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
2508
|
+
* @param callback {any} - - The callback function that needs to be removed from the given event, when using a
|
|
2509
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
2510
|
+
* otherwise this will only remove events with this specific handler.
|
|
2511
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2512
|
+
*/
|
|
2513
|
+
export declare function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): void;
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* Remove the listener from the array of events
|
|
2517
|
+
* @param events An string array of event names to bind the listener to
|
|
2518
|
+
* @param listener The event callback to call when the event is triggered
|
|
2519
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
2520
|
+
*/
|
|
2521
|
+
export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
* Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
|
|
2525
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
|
|
2526
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
2527
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
2528
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
2529
|
+
*/
|
|
2530
|
+
export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2531
|
+
|
|
2532
|
+
/**
|
|
2533
|
+
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
2534
|
+
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
2535
|
+
* @param listener - The specific event callback to to be removed
|
|
2536
|
+
* @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
|
|
2537
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
2538
|
+
*/
|
|
2539
|
+
export declare function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
2540
|
+
|
|
2177
2541
|
/**
|
|
2178
2542
|
* Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
|
|
2179
2543
|
* associated with the configuration or a legacy default.
|
|
@@ -2217,6 +2581,10 @@ export declare const enum SendRequestReason {
|
|
|
2217
2581
|
* The event(s) being sent as a retry
|
|
2218
2582
|
*/
|
|
2219
2583
|
Retry = 5,
|
|
2584
|
+
/**
|
|
2585
|
+
* The SDK is unloading
|
|
2586
|
+
*/
|
|
2587
|
+
SdkUnload = 6,
|
|
2220
2588
|
/**
|
|
2221
2589
|
* Maximum batch size would be exceeded
|
|
2222
2590
|
*/
|
|
@@ -2305,6 +2673,28 @@ export declare interface Tags {
|
|
|
2305
2673
|
|
|
2306
2674
|
export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
2307
2675
|
|
|
2676
|
+
/**
|
|
2677
|
+
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
2678
|
+
*/
|
|
2679
|
+
declare const enum TelemetryUnloadReason {
|
|
2680
|
+
/**
|
|
2681
|
+
* Teardown has been called without any context.
|
|
2682
|
+
*/
|
|
2683
|
+
ManualTeardown = 0,
|
|
2684
|
+
/**
|
|
2685
|
+
* Just this plugin is being removed
|
|
2686
|
+
*/
|
|
2687
|
+
PluginUnload = 1,
|
|
2688
|
+
/**
|
|
2689
|
+
* This instance of the plugin is being removed and replaced
|
|
2690
|
+
*/
|
|
2691
|
+
PluginReplace = 2,
|
|
2692
|
+
/**
|
|
2693
|
+
* The entire SDK is being unloaded
|
|
2694
|
+
*/
|
|
2695
|
+
SdkUnload = 50
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2308
2698
|
export declare function throwError(message: string): never;
|
|
2309
2699
|
|
|
2310
2700
|
/**
|
|
@@ -2316,6 +2706,8 @@ export declare function uaDisallowsSameSiteNone(userAgent: string): boolean;
|
|
|
2316
2706
|
|
|
2317
2707
|
export declare const Undefined = "undefined";
|
|
2318
2708
|
|
|
2709
|
+
export declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2710
|
+
|
|
2319
2711
|
export declare function useXDomainRequest(): boolean | undefined;
|
|
2320
2712
|
|
|
2321
2713
|
export { }
|