@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2440 -1199
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +16710 -8876
- package/dist/applicationinsights-core-js.api.md +465 -140
- package/dist/applicationinsights-core-js.d.ts +856 -217
- package/dist/applicationinsights-core-js.js +2440 -1199
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +856 -217
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -72
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +45 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +80 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +51 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +10 -9
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +13 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +4 -105
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +114 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +56 -0
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +48 -8
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +183 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +23 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +37 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +34 -0
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +14 -9
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +89 -86
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +20 -10
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -2,59 +2,12 @@ import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
|
2
2
|
import { ICookieMgr } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
3
3
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
4
4
|
export declare const Undefined = "undefined";
|
|
5
|
-
/**
|
|
6
|
-
* Trys to add an event handler for the specified event to the window, body and document
|
|
7
|
-
* @param eventName {string} - The name of the event
|
|
8
|
-
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
9
|
-
* @return {boolean} - true if the handler was successfully added
|
|
10
|
-
*/
|
|
11
|
-
export declare function addEventHandler(eventName: string, callback: any): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Bind the listener to the array of events
|
|
14
|
-
* @param events An string array of event names to bind the listener to
|
|
15
|
-
* @param listener The event callback to call when the event is triggered
|
|
16
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
17
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
18
|
-
*/
|
|
19
|
-
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
22
|
-
* this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
|
|
23
|
-
* it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
|
|
24
|
-
* just navigating to a different Tab and may come back (without unloading the page). As such you may also
|
|
25
|
-
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
26
|
-
* @param listener - The event callback to call when a page unload event is triggered
|
|
27
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
28
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
29
|
-
*/
|
|
30
|
-
export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Listen to the pagehide and visibility changing to 'hidden' events
|
|
33
|
-
* @param listener - The event callback to call when a page hide event is triggered
|
|
34
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
35
|
-
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
36
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
37
|
-
*/
|
|
38
|
-
export declare function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Listen to the pageshow and visibility changing to 'visible' events
|
|
41
|
-
* @param listener - The event callback to call when a page is show event is triggered
|
|
42
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
43
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
44
|
-
*/
|
|
45
|
-
export declare function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
46
5
|
export declare function newGuid(): string;
|
|
47
6
|
/**
|
|
48
7
|
* Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)
|
|
49
8
|
* https://caniuse.com/#search=performance.now
|
|
50
9
|
*/
|
|
51
10
|
export declare function perfNow(): number;
|
|
52
|
-
/**
|
|
53
|
-
* Generate random base64 id string.
|
|
54
|
-
* The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
|
|
55
|
-
* @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
|
|
56
|
-
*/
|
|
57
|
-
export declare function newId(maxLength?: number): string;
|
|
58
11
|
/**
|
|
59
12
|
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
60
13
|
* @param value - The value to check whether it ends with the search value.
|
|
@@ -199,7 +152,7 @@ export interface ICoreUtils {
|
|
|
199
152
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
200
153
|
* @return {boolean} - true if the handler was successfully added
|
|
201
154
|
*/
|
|
202
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
155
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
203
156
|
/**
|
|
204
157
|
* 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)
|
|
205
158
|
* https://caniuse.com/#search=Date.now
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IDataCache {
|
|
2
|
+
id: string;
|
|
3
|
+
accept: (target: any) => boolean;
|
|
4
|
+
get: <T>(target: any, name: string, defValue?: T, addDefault?: boolean) => T;
|
|
5
|
+
kill: (target: any, name: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
|
|
8
|
+
export declare function createElmNodeData(name?: string): {
|
|
9
|
+
id: string;
|
|
10
|
+
accept: (target: any) => boolean;
|
|
11
|
+
get: <T>(target: any, name: string, defValue?: T, addDefault?: boolean) => T;
|
|
12
|
+
kill: (target: any, name: string) => void;
|
|
13
|
+
};
|
|
@@ -63,3 +63,26 @@ export declare class DiagnosticLogger implements IDiagnosticLogger {
|
|
|
63
63
|
*/
|
|
64
64
|
logInternalMessage(severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
|
|
68
|
+
* debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
|
|
69
|
+
* support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
|
|
70
|
+
* the code.
|
|
71
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
72
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
73
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
74
|
+
*/
|
|
75
|
+
export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
76
|
+
/**
|
|
77
|
+
* This is a helper method which will call warnToConsole on the passed logger with the provided message.
|
|
78
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
79
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
80
|
+
*/
|
|
81
|
+
export declare function _warnToConsole(logger: IDiagnosticLogger, message: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Logs a message to the internal queue.
|
|
84
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
85
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
86
|
+
* @param message {_InternalLogMessage} - The message to log.
|
|
87
|
+
*/
|
|
88
|
+
export declare function _logInternalMessage(logger: IDiagnosticLogger, severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export interface _IRegisteredEvents {
|
|
2
|
+
name: string;
|
|
3
|
+
handler: any;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
|
|
7
|
+
* applications to remove their own events
|
|
8
|
+
* @param target - The EventTarget that has registered events
|
|
9
|
+
* @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
10
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
11
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
12
|
+
*/
|
|
13
|
+
export declare function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
|
|
14
|
+
export declare function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
17
|
+
* @param obj Object to add the event too.
|
|
18
|
+
* @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
|
|
19
|
+
* namespaces "click" "click.mynamespace" in addition to specific namespaces.
|
|
20
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
21
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
22
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
23
|
+
* @param useCapture [Optional] Defaults to false
|
|
24
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
25
|
+
*/
|
|
26
|
+
export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Removes an event handler for the specified event
|
|
29
|
+
* @param Object to remove the event from
|
|
30
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
31
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
32
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
33
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
34
|
+
* otherwise this will only remove events with this specific handler.
|
|
35
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
36
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
37
|
+
* @param useCapture [Optional] Defaults to false
|
|
38
|
+
*/
|
|
39
|
+
export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
42
|
+
* @param obj Object to add the event too.
|
|
43
|
+
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
|
|
44
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
45
|
+
* @param useCapture [Optional] Defaults to false
|
|
46
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
47
|
+
*/
|
|
48
|
+
export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Removes an event handler for the specified event
|
|
51
|
+
* @param Object to remove the event from
|
|
52
|
+
* @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
53
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
54
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
55
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
56
|
+
* otherwise this will only remove events with this specific handler.
|
|
57
|
+
* @param useCapture [Optional] Defaults to false
|
|
58
|
+
*/
|
|
59
|
+
export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* Trys to add an event handler for the specified event to the window, body and document
|
|
62
|
+
* @param eventName {string} - The name of the event
|
|
63
|
+
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
64
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
65
|
+
* @return {boolean} - true if the handler was successfully added
|
|
66
|
+
*/
|
|
67
|
+
export declare function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Trys to remove event handler(s) for the specified event/namespace to the window, body and document
|
|
70
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
71
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
72
|
+
* @param callback {any} - - The callback function that needs to be removed from the given event, when using a
|
|
73
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
74
|
+
* otherwise this will only remove events with this specific handler.
|
|
75
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
76
|
+
*/
|
|
77
|
+
export declare function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
|
|
78
|
+
/**
|
|
79
|
+
* Bind the listener to the array of events
|
|
80
|
+
* @param events An string array of event names to bind the listener to
|
|
81
|
+
* @param listener The event callback to call when the event is triggered
|
|
82
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
83
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
84
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
85
|
+
*/
|
|
86
|
+
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Remove the listener from the array of events
|
|
89
|
+
* @param events An string array of event names to bind the listener to
|
|
90
|
+
* @param listener The event callback to call when the event is triggered
|
|
91
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
92
|
+
*/
|
|
93
|
+
export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
96
|
+
* this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
|
|
97
|
+
* it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
|
|
98
|
+
* just navigating to a different Tab and may come back (without unloading the page). As such you may also
|
|
99
|
+
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
100
|
+
* @param listener - The event callback to call when a page unload event is triggered
|
|
101
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
102
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
103
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
104
|
+
*/
|
|
105
|
+
export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
108
|
+
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
109
|
+
* @param listener - The specific event callback to to be removed
|
|
110
|
+
* @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
|
|
111
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
112
|
+
*/
|
|
113
|
+
export declare function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
114
|
+
/**
|
|
115
|
+
* Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
|
|
116
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
117
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
118
|
+
* @param listener - The event callback to call when a page hide event is triggered
|
|
119
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
120
|
+
* @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
|
|
121
|
+
* based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
122
|
+
* so that only the matching "removePageHideEventListener" can remove these events.
|
|
123
|
+
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
124
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
125
|
+
*/
|
|
126
|
+
export declare function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
|
|
129
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
|
|
130
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
131
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
132
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
133
|
+
*/
|
|
134
|
+
export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
135
|
+
/**
|
|
136
|
+
* Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
|
|
137
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
138
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
139
|
+
* @param listener - The event callback to call when a page is show event is triggered
|
|
140
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
141
|
+
* @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
|
|
142
|
+
* identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
143
|
+
* so that only the matching "removePageShowEventListener" can remove these events.
|
|
144
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
145
|
+
*/
|
|
146
|
+
export declare function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
|
|
149
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
|
|
150
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
151
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
152
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
153
|
+
*/
|
|
154
|
+
export declare function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
5
|
export declare function _getObjProto(target: any): any;
|
|
6
6
|
export declare function objToString(obj: any): any;
|
|
7
7
|
export declare function isTypeof(value: any, theType: string): boolean;
|
|
8
|
-
export declare function isUndefined(value: any):
|
|
9
|
-
export declare function isNotUndefined(value:
|
|
10
|
-
export declare function isNullOrUndefined(value: any):
|
|
11
|
-
export declare function isNotNullOrUndefined(value:
|
|
8
|
+
export declare function isUndefined(value: any): value is undefined;
|
|
9
|
+
export declare function isNotUndefined<T>(value: T): value is T;
|
|
10
|
+
export declare function isNullOrUndefined(value: any): value is null | undefined;
|
|
11
|
+
export declare function isNotNullOrUndefined<T>(value: T): value is T;
|
|
12
12
|
export declare function hasOwnProperty(obj: any, prop: string): boolean;
|
|
13
|
-
export declare function isObject(value:
|
|
13
|
+
export declare function isObject<T>(value: T): value is T;
|
|
14
14
|
export declare function isFunction(value: any): value is Function;
|
|
15
|
-
|
|
16
|
-
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
17
|
-
* @param obj Object to add the event too.
|
|
18
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
19
|
-
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
20
|
-
* @param useCapture [Optional] Defaults to false
|
|
21
|
-
* @returns True if the function was bound successfully to the event, otherwise false
|
|
22
|
-
*/
|
|
23
|
-
export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Removes an event handler for the specified event
|
|
26
|
-
* @param Object to remove the event from
|
|
27
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
28
|
-
* @param handlerRef {any} - The callback function that needs to be executed for the given event
|
|
29
|
-
* @param useCapture [Optional] Defaults to false
|
|
30
|
-
*/
|
|
31
|
-
export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
15
|
+
export declare function isPromiseLike<T>(value: any): value is PromiseLike<T>;
|
|
32
16
|
/**
|
|
33
17
|
* Validates that the string name conforms to the JS IdentifierName specification and if not
|
|
34
18
|
* normalizes the name so that it would. This method does not identify or change any keywords
|
|
@@ -43,7 +27,7 @@ export declare function normalizeJsName(name: string): string;
|
|
|
43
27
|
* @param target The target object to find and process the keys
|
|
44
28
|
* @param callbackfn The function to call with the details
|
|
45
29
|
*/
|
|
46
|
-
export declare function objForEachKey(target:
|
|
30
|
+
export declare function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
|
|
47
31
|
/**
|
|
48
32
|
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
49
33
|
* @param value - The value to check whether it ends with the search value.
|
|
@@ -83,7 +67,8 @@ export declare function strContains(value: string, search: string): boolean;
|
|
|
83
67
|
*/
|
|
84
68
|
export declare function isDate(obj: any): obj is Date;
|
|
85
69
|
/**
|
|
86
|
-
* Check if an object is of type Array
|
|
70
|
+
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
71
|
+
* and exists to help with TypeScript validation only.
|
|
87
72
|
*/
|
|
88
73
|
export declare let isArray: <T = any>(obj: any) => obj is Array<T>;
|
|
89
74
|
/**
|
|
@@ -136,7 +121,7 @@ export declare function _toISOStringPoly(date: Date): string;
|
|
|
136
121
|
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
|
|
137
122
|
* @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
138
123
|
*/
|
|
139
|
-
export declare function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
124
|
+
export declare function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
|
|
140
125
|
/**
|
|
141
126
|
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
142
127
|
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
@@ -186,6 +171,7 @@ export declare function objKeys(obj: {}): string[];
|
|
|
186
171
|
* @returns True if it was able to create the accessors otherwise false
|
|
187
172
|
*/
|
|
188
173
|
export declare function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
174
|
+
export declare function deepFreeze<T>(obj: T): T;
|
|
189
175
|
export declare const objFreeze: <T>(value: T) => T;
|
|
190
176
|
export declare const objSeal: <T>(value: T) => T;
|
|
191
177
|
/**
|
|
@@ -207,7 +193,7 @@ export declare function getExceptionName(object: any): string;
|
|
|
207
193
|
* @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
|
|
208
194
|
* @returns The existing or new value, depending what was set
|
|
209
195
|
*/
|
|
210
|
-
export declare function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
|
|
196
|
+
export declare function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
|
|
211
197
|
/**
|
|
212
198
|
* Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it
|
|
213
199
|
* @param target - The target object to return or set the default value
|
|
@@ -232,9 +218,27 @@ export declare function throwError(message: string): never;
|
|
|
232
218
|
* @param target - The target object to be assigned with the source properties and functions
|
|
233
219
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
234
220
|
* @param chkSet - An optional callback to determine whether a specific property/function should be proxied
|
|
235
|
-
* @memberof Initialization
|
|
236
221
|
*/
|
|
237
|
-
export declare function proxyAssign(target:
|
|
222
|
+
export declare function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
223
|
+
/**
|
|
224
|
+
* Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.
|
|
225
|
+
*
|
|
226
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
227
|
+
* @param name - The function name that will be added on the target
|
|
228
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
229
|
+
* @param theFunc - The function name on the source that will be proxied on the target
|
|
230
|
+
* @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
|
|
231
|
+
*/
|
|
232
|
+
export declare function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
|
|
233
|
+
/**
|
|
234
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
235
|
+
*
|
|
236
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
237
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
238
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
239
|
+
* @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
|
|
240
|
+
*/
|
|
241
|
+
export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
|
|
238
242
|
/**
|
|
239
243
|
* Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
|
|
240
244
|
* Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
|
|
@@ -259,4 +263,5 @@ export declare function optimizeObject<T>(theObject: T): T;
|
|
|
259
263
|
* @param obj5 - object to merge.
|
|
260
264
|
* @returns The extended first object.
|
|
261
265
|
*/
|
|
262
|
-
export declare function objExtend<
|
|
266
|
+
export declare function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
|
|
267
|
+
export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const strEmpty = "";
|
|
2
|
+
export declare const strProcessTelemetry = "processTelemetry";
|
|
3
|
+
export declare const strPriority = "priority";
|
|
4
|
+
export declare const strSetNextPlugin = "setNextPlugin";
|
|
5
|
+
export declare const strIsInitialized = "isInitialized";
|
|
6
|
+
export declare const strTeardown = "teardown";
|
|
7
|
+
export declare const strCore = "core";
|
|
8
|
+
export declare const strUpdate = "update";
|
|
9
|
+
export declare const strDisabled = "disabled";
|
|
10
|
+
export declare const strDoTeardown = "_doTeardown";
|
|
11
|
+
export declare const strProcessNext = "processNext";
|
|
12
|
+
export declare const strResume = "resume";
|
|
13
|
+
export declare const strPause = "pause";
|
|
14
|
+
export declare const strNotificationListener = "NotificationListener";
|
|
15
|
+
export declare const strAddNotificationListener: string;
|
|
16
|
+
export declare const strRemoveNotificationListener: string;
|
|
17
|
+
export declare const strEventsSent = "eventsSent";
|
|
18
|
+
export declare const strEventsDiscarded = "eventsDiscarded";
|
|
19
|
+
export declare const strEventsSendRequest = "eventsSendRequest";
|
|
20
|
+
export declare const strPerfEvent = "perfEvent";
|
|
@@ -46,7 +46,7 @@ export declare class PerfManager implements IPerfManager {
|
|
|
46
46
|
* Defined as private so it can be visualized via the DebugPlugin
|
|
47
47
|
*/
|
|
48
48
|
private ctx;
|
|
49
|
-
constructor(manager
|
|
49
|
+
constructor(manager?: INotificationManager);
|
|
50
50
|
/**
|
|
51
51
|
* Create a new event and start timing, the manager may return null/undefined to indicate that it does not
|
|
52
52
|
* want to monitor this source event.
|
|
@@ -1,17 +1,65 @@
|
|
|
1
1
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
2
|
-
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
3
2
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
4
3
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
5
|
-
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
6
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
4
|
+
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
7
6
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
7
|
+
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
10
|
+
* @param plugins - The plugin instances that will be executed
|
|
11
|
+
* @param config - The current config
|
|
12
|
+
* @param core - The current core instance
|
|
13
|
+
* @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
|
|
14
|
+
*/
|
|
15
|
+
export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain
|
|
18
|
+
* @param plugins - The plugin instances that will be executed
|
|
19
|
+
* @param config - The current config
|
|
20
|
+
* @param core - The current core instance
|
|
21
|
+
* @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
|
|
22
|
+
*/
|
|
23
|
+
export declare function createProcessTelemetryUnloadContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryUnloadContext;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration
|
|
26
|
+
* @param plugins - The plugin instances that will be executed
|
|
27
|
+
* @param config - The current config
|
|
28
|
+
* @param core - The current core instance
|
|
29
|
+
* @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
|
|
30
|
+
*/
|
|
31
|
+
export declare function createProcessTelemetryUpdateContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryUpdateContext;
|
|
32
|
+
/**
|
|
33
|
+
* Creates an execution chain from the array of plugins
|
|
34
|
+
* @param plugins - The array of plugins that will be executed in this order
|
|
35
|
+
* @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this
|
|
36
|
+
* should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error
|
|
37
|
+
* reporting (hasRun) when errors occur.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createTelemetryProxyChain(plugins: IPlugin[], config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): ITelemetryPluginChain;
|
|
40
|
+
/**
|
|
41
|
+
* Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and
|
|
42
|
+
* execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer
|
|
43
|
+
* contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the
|
|
44
|
+
* TelemetryPluginChain class).
|
|
45
|
+
* @param plugin - The plugin instance to proxy
|
|
46
|
+
* @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this
|
|
47
|
+
* should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error
|
|
48
|
+
* reporting (hasRun) when errors occur.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export declare function createTelemetryPluginProxy(plugin: ITelemetryPlugin, config: IConfiguration, core: IAppInsightsCore): ITelemetryPluginChain;
|
|
52
|
+
/**
|
|
53
|
+
* This class will be removed!
|
|
54
|
+
* @deprecated use createProcessTelemetryContext() instead
|
|
55
|
+
*/
|
|
8
56
|
export declare class ProcessTelemetryContext implements IProcessTelemetryContext {
|
|
9
57
|
/**
|
|
10
58
|
* Gets the current core config instance
|
|
11
59
|
*/
|
|
12
60
|
getCfg: () => IConfiguration;
|
|
13
61
|
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
14
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
|
|
62
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
15
63
|
/**
|
|
16
64
|
* Returns the IAppInsightsCore instance for the current request
|
|
17
65
|
*/
|
|
@@ -39,17 +87,32 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
|
|
|
39
87
|
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
40
88
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
41
89
|
* to later plugins (vs appending items to the telemetry item)
|
|
90
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
91
|
+
*/
|
|
92
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
93
|
+
/**
|
|
94
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
95
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
96
|
+
* @param callback - The function call for each plugin in the context chain
|
|
42
97
|
*/
|
|
43
|
-
|
|
98
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
44
99
|
/**
|
|
45
100
|
* Create a new context using the core and config from the current instance
|
|
101
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
102
|
+
* then the current execution order will be copied.
|
|
103
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
104
|
+
* order then the next plugin will be NOT set.
|
|
46
105
|
*/
|
|
47
106
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
107
|
+
/**
|
|
108
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
109
|
+
*/
|
|
110
|
+
onComplete: (onComplete: () => void) => void;
|
|
48
111
|
/**
|
|
49
112
|
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
50
113
|
* @param plugins - The plugin instances that will be executed
|
|
51
114
|
* @param config - The current config
|
|
52
115
|
* @param core - The current core instance
|
|
53
116
|
*/
|
|
54
|
-
constructor(
|
|
117
|
+
constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
|
|
55
118
|
}
|
|
@@ -21,3 +21,9 @@ export declare function mwcRandomSeed(value?: number): void;
|
|
|
21
21
|
* @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
|
|
22
22
|
*/
|
|
23
23
|
export declare function mwcRandom32(signed?: boolean): number;
|
|
24
|
+
/**
|
|
25
|
+
* Generate random base64 id string.
|
|
26
|
+
* The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
|
|
27
|
+
* @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
|
|
28
|
+
*/
|
|
29
|
+
export declare function newId(maxLength?: number): string;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
2
|
-
import {
|
|
2
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
3
|
+
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
4
|
+
import { IUnloadableComponent } from "../JavaScriptSDK.Interfaces/IUnloadableComponent";
|
|
5
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
6
|
+
export interface IPluginState {
|
|
7
|
+
core?: IAppInsightsCore;
|
|
8
|
+
isInitialized?: boolean;
|
|
9
|
+
tearDown?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function _getPluginState(plugin: IPlugin): IPluginState;
|
|
3
13
|
/**
|
|
4
14
|
* Initialize the queue of plugins
|
|
5
15
|
* @param plugins - The array of plugins to initialize and setting of the next plugin
|
|
@@ -7,5 +17,15 @@ import { ProcessTelemetryContext } from "./ProcessTelemetryContext";
|
|
|
7
17
|
* @param core THe current core instance
|
|
8
18
|
* @param extensions The extensions
|
|
9
19
|
*/
|
|
10
|
-
export declare function initializePlugins(processContext:
|
|
11
|
-
export declare function sortPlugins(plugins:
|
|
20
|
+
export declare function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
|
|
21
|
+
export declare function sortPlugins<T = IPlugin>(plugins: T[]): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any
|
|
24
|
+
* _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.
|
|
25
|
+
* @param components - The components you want to unload
|
|
26
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
27
|
+
* @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.
|
|
28
|
+
* @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.
|
|
29
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
30
|
+
*/
|
|
31
|
+
export declare function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
2
|
+
import { ITelemetryInitializerContainer, ITelemetryInitializerHandler, TelemetryInitializerFunction } from "../JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
3
|
+
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
4
|
+
import { BaseTelemetryPlugin } from "./BaseTelemetryPlugin";
|
|
5
|
+
export declare class TelemetryInitializerPlugin extends BaseTelemetryPlugin implements ITelemetryInitializerContainer {
|
|
6
|
+
identifier: string;
|
|
7
|
+
priority: number;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
11
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
12
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
13
|
+
*/
|
|
14
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
|
|
15
|
+
processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IProcessTelemetryUnloadContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
2
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
3
|
+
export declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
4
|
+
export interface IUnloadHandlerContainer {
|
|
5
|
+
add: (handler: UnloadHandler) => void;
|
|
6
|
+
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createUnloadHandlerContainer(): {
|
|
9
|
+
add: (handler: UnloadHandler) => void;
|
|
10
|
+
run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
11
|
+
};
|