@microsoft/applicationinsights-core-js 2.8.0-beta.2203-06 → 2.8.0-beta.2203-09
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 +23 -9
- 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 +260 -12
- package/dist/applicationinsights-core-js.api.md +8 -4
- package/dist/applicationinsights-core-js.d.ts +47 -5
- package/dist/applicationinsights-core-js.js +23 -9
- 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 +47 -5
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +13 -8
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +2 -2
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +2 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +6 -2
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/applicationinsights-core-js.js +2 -2
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +38 -8
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +1 -1
- package/src/JavaScriptSDK/ChannelController.ts +2 -0
- package/src/JavaScriptSDK/EventHelpers.ts +7 -1
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +22 -5
- package/types/JavaScriptSDK/BaseCore.d.ts +21 -1
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +20 -4
- package/types/applicationinsights-core-js.d.ts +1 -1
|
@@ -20,6 +20,9 @@ const strBeforeUnload: string = "beforeunload";
|
|
|
20
20
|
const strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
21
21
|
const strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
22
22
|
|
|
23
|
+
const rRemoveEmptyNs = /\.[\.]+/g;
|
|
24
|
+
const rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
25
|
+
|
|
23
26
|
let _guid = 1;
|
|
24
27
|
|
|
25
28
|
interface IEventDetails {
|
|
@@ -82,7 +85,7 @@ function _getEvtNamespace(eventName: string, evtNamespace?: string | string[]):
|
|
|
82
85
|
|
|
83
86
|
return {
|
|
84
87
|
type: parsedEvent[1],
|
|
85
|
-
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
88
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
86
89
|
};
|
|
87
90
|
}
|
|
88
91
|
|
|
@@ -201,6 +204,9 @@ export function mergeEvtNamespace(theNamespace: string, namespaces: string | str
|
|
|
201
204
|
} else {
|
|
202
205
|
newNamespaces = [ theNamespace, namespaces ];
|
|
203
206
|
}
|
|
207
|
+
|
|
208
|
+
// resort the namespaces so they are always in order
|
|
209
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
204
210
|
} else {
|
|
205
211
|
newNamespaces = theNamespace;
|
|
206
212
|
}
|
|
@@ -11,7 +11,9 @@ import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
|
11
11
|
import { IPerfManagerProvider } from "./IPerfManager";
|
|
12
12
|
import { ICookieMgr } from "./ICookieMgr";
|
|
13
13
|
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "./ITelemetryInitializers";
|
|
14
|
-
import {
|
|
14
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
15
|
+
import { UnloadHandler } from "../JavaScriptSDK/UnloadHandlerContainer";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
15
17
|
|
|
16
18
|
export interface ILoadedPlugin<T extends IPlugin> {
|
|
17
19
|
plugin: T;
|
|
@@ -116,8 +118,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
116
118
|
* approach is to create a new instance and initialize that instance.
|
|
117
119
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
118
120
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
121
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
122
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
123
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
119
124
|
*/
|
|
120
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
125
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
128
|
* Find and return the (first) plugin with the specified identifier if present
|
|
@@ -128,10 +133,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
128
133
|
/**
|
|
129
134
|
* Add a new plugin to the installation
|
|
130
135
|
* @param plugin - The new plugin to add
|
|
131
|
-
* @param replaceExisting - should any existing plugin be replaced
|
|
136
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
132
137
|
* @param doAsync - Should the add be performed asynchronously
|
|
138
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
133
139
|
*/
|
|
134
|
-
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting
|
|
140
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
135
141
|
|
|
136
142
|
/**
|
|
137
143
|
* Returns the unique event namespace that should be used when registering events
|
|
@@ -143,4 +149,15 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
143
149
|
* @param handler - the handler
|
|
144
150
|
*/
|
|
145
151
|
addUnloadCb(handler: UnloadHandler): void;
|
|
146
|
-
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Flush and send any batched / cached data immediately
|
|
155
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
156
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
157
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
158
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
159
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
160
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
161
|
+
*/
|
|
162
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
163
|
+
}
|
|
@@ -13,6 +13,7 @@ import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "../J
|
|
|
13
13
|
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
14
14
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
15
15
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
16
17
|
export declare class BaseCore implements IAppInsightsCore {
|
|
17
18
|
static defaultConfig: IConfiguration;
|
|
18
19
|
config: IConfiguration;
|
|
@@ -70,10 +71,20 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
70
71
|
* approach is to create a new instance and initialize that instance.
|
|
71
72
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
72
73
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
74
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
75
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
76
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
73
77
|
*/
|
|
74
78
|
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
75
79
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
76
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Add a new plugin to the installation
|
|
82
|
+
* @param plugin - The new plugin to add
|
|
83
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
84
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
85
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
86
|
+
*/
|
|
87
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
77
88
|
/**
|
|
78
89
|
* Returns the unique event namespace that should be used
|
|
79
90
|
*/
|
|
@@ -83,6 +94,15 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
83
94
|
* @param handler - the handler
|
|
84
95
|
*/
|
|
85
96
|
addUnloadCb(handler: UnloadHandler): void;
|
|
97
|
+
/**
|
|
98
|
+
* Flush and send any batched / cached data immediately
|
|
99
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
100
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
101
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
102
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
103
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
104
|
+
*/
|
|
105
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
|
|
86
106
|
protected releaseQueue(): void;
|
|
87
107
|
/**
|
|
88
108
|
* Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
|
|
@@ -9,7 +9,9 @@ import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
|
9
9
|
import { IPerfManagerProvider } from "./IPerfManager";
|
|
10
10
|
import { ICookieMgr } from "./ICookieMgr";
|
|
11
11
|
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "./ITelemetryInitializers";
|
|
12
|
-
import {
|
|
12
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
13
|
+
import { UnloadHandler } from "../JavaScriptSDK/UnloadHandlerContainer";
|
|
14
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
13
15
|
export interface ILoadedPlugin<T extends IPlugin> {
|
|
14
16
|
plugin: T;
|
|
15
17
|
/**
|
|
@@ -81,8 +83,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
81
83
|
* approach is to create a new instance and initialize that instance.
|
|
82
84
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
83
85
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
86
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
87
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
88
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
84
89
|
*/
|
|
85
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
90
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
86
91
|
/**
|
|
87
92
|
* Find and return the (first) plugin with the specified identifier if present
|
|
88
93
|
* @param pluginIdentifier
|
|
@@ -91,10 +96,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
91
96
|
/**
|
|
92
97
|
* Add a new plugin to the installation
|
|
93
98
|
* @param plugin - The new plugin to add
|
|
94
|
-
* @param replaceExisting - should any existing plugin be replaced
|
|
99
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
95
100
|
* @param doAsync - Should the add be performed asynchronously
|
|
101
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
96
102
|
*/
|
|
97
|
-
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting
|
|
103
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
98
104
|
/**
|
|
99
105
|
* Returns the unique event namespace that should be used when registering events
|
|
100
106
|
*/
|
|
@@ -104,4 +110,14 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
104
110
|
* @param handler - the handler
|
|
105
111
|
*/
|
|
106
112
|
addUnloadCb(handler: UnloadHandler): void;
|
|
113
|
+
/**
|
|
114
|
+
* Flush and send any batched / cached data immediately
|
|
115
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
116
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
117
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
118
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
119
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
120
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
121
|
+
*/
|
|
122
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
107
123
|
}
|
|
@@ -18,7 +18,7 @@ export { BaseTelemetryPlugin } from "./JavaScriptSDK/BaseTelemetryPlugin";
|
|
|
18
18
|
export { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from "./JavaScriptSDK/RandomHelper";
|
|
19
19
|
export { CoreUtils, ICoreUtils, EventHelper, IEventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from "./JavaScriptSDK/CoreUtils";
|
|
20
20
|
export { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, createEnumStyle, objExtend } from "./JavaScriptSDK/HelperFuncs";
|
|
21
|
-
export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
|
|
21
|
+
export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
|
|
22
22
|
export { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from "./JavaScriptSDK/EnvUtils";
|
|
23
23
|
export { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from "@microsoft/applicationinsights-shims";
|
|
24
24
|
export { NotificationManager } from "./JavaScriptSDK/NotificationManager";
|