@microsoft/applicationinsights-core-js 2.8.0-beta.2203-07 → 2.8.0-beta.2203-10
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 +17 -6
- 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.d.ts +1 -1
- package/dist/applicationinsights-core-js.js +17 -6
- 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 +1 -1
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +4 -2
- 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 +7 -7
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +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 +4 -2
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +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 +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +6 -6
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +1 -1
- package/src/JavaScriptSDK/ChannelController.ts +3 -1
- package/src/JavaScriptSDK/CoreUtils.ts +1 -1
- package/src/JavaScriptSDK/DiagnosticLogger.ts +1 -1
- package/src/JavaScriptSDK/EnvUtils.ts +1 -1
- package/src/JavaScriptSDK/EventHelpers.ts +11 -5
- package/src/JavaScriptSDK/HelperFuncs.ts +23 -23
- package/src/JavaScriptSDK/PerfManager.ts +2 -5
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +10 -8
- package/src/JavaScriptSDK/RandomHelper.ts +1 -1
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +1 -1
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +1 -1
- package/types/JavaScriptSDK/HelperFuncs.d.ts +3 -3
|
@@ -22,9 +22,9 @@ const strToString = "toString";
|
|
|
22
22
|
* Constant string defined to support minimization
|
|
23
23
|
* @ignore
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
const str__Proto = "__proto__";
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
28
|
* Constant string defined to support minimization
|
|
29
29
|
* @ignore
|
|
30
30
|
*/
|
|
@@ -58,27 +58,27 @@ const rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
|
58
58
|
* Pre-lookup to check if we are running on a modern browser (i.e. not IE8)
|
|
59
59
|
* @ignore
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
let _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
64
|
* Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
|
|
65
65
|
* @ignore
|
|
66
66
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
export function _getObjProto(target:any) {
|
|
68
|
+
if (target) {
|
|
69
|
+
// This method doesn't existing in older browsers (e.g. IE8)
|
|
70
|
+
if (_objGetPrototypeOf) {
|
|
71
|
+
return _objGetPrototypeOf(target);
|
|
72
|
+
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
// target[Constructor] May break if the constructor has been changed or removed
|
|
75
|
+
let newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
76
|
+
if(newProto) {
|
|
77
|
+
return newProto;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
return null;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export function objToString(obj: any) {
|
|
@@ -186,7 +186,7 @@ export function strEndsWith(value: string, search: string) {
|
|
|
186
186
|
* @param search - The characters to be searched for at the end of the value.
|
|
187
187
|
* @returns true if the given search value is found at the end of the string, otherwise false.
|
|
188
188
|
*/
|
|
189
|
-
|
|
189
|
+
export function _strEndsWithPoly(value: string, search: string) {
|
|
190
190
|
let result = false;
|
|
191
191
|
let searchLen = search ? search.length : 0;
|
|
192
192
|
let valLen = value ? value.length : 0;
|
|
@@ -214,7 +214,7 @@ export function strEndsWith(value: string, search: string) {
|
|
|
214
214
|
export function strStartsWith(value: string, checkValue: string) {
|
|
215
215
|
let result = false;
|
|
216
216
|
if (value && checkValue && !(result = value === checkValue)) {
|
|
217
|
-
|
|
217
|
+
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
218
218
|
result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -227,7 +227,7 @@ export function strStartsWith(value: string, checkValue: string) {
|
|
|
227
227
|
* @param checkValue - The characters to be searched for at the start of the value.
|
|
228
228
|
* @returns true if the given search value is found at the start of the string, otherwise false.
|
|
229
229
|
*/
|
|
230
|
-
|
|
230
|
+
export function _strStartsWithPoly(value: string, checkValue: string) {
|
|
231
231
|
// Using helper for performance and because string startsWith() is not available on IE
|
|
232
232
|
let result = false;
|
|
233
233
|
let chkLen = checkValue ? checkValue.length : 0;
|
|
@@ -328,7 +328,7 @@ export function isPlainObject(value: any): boolean {
|
|
|
328
328
|
let result: boolean = false;
|
|
329
329
|
|
|
330
330
|
if (value && typeof value === "object") {
|
|
331
|
-
|
|
331
|
+
// Inlining _objGetPrototypeOf for performance to avoid an additional function call
|
|
332
332
|
let proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
333
333
|
if (!proto) {
|
|
334
334
|
// No prototype found so this is a plain Object eg. 'Object.create(null)'
|
|
@@ -796,7 +796,7 @@ export function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() =
|
|
|
796
796
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
797
797
|
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
798
798
|
*/
|
|
799
|
-
|
|
799
|
+
export function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget: boolean = true) {
|
|
800
800
|
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
801
801
|
arrForEach(functionsToProxy, (theFuncName) => {
|
|
802
802
|
if (isString(theFuncName)) {
|
|
@@ -888,7 +888,7 @@ export function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1 | any, obj2?: T2, ob
|
|
|
888
888
|
idx++;
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
-
|
|
891
|
+
// Handle case when target is a string or something (possible in deep copy)
|
|
892
892
|
if (!isObject(extended)) {
|
|
893
893
|
extended = {} as T1 & T2 & T3 & T4 & T5 & T6;
|
|
894
894
|
}
|
|
@@ -104,12 +104,9 @@ export class PerfEvent implements IPerfEvent {
|
|
|
104
104
|
_self.isChildEvt = (): boolean => true;
|
|
105
105
|
}
|
|
106
106
|
_self[key] = value;
|
|
107
|
-
}
|
|
108
|
-
else if (key === PerfEvent.ChildrenContextKey) {
|
|
107
|
+
} else if (key === PerfEvent.ChildrenContextKey) {
|
|
109
108
|
_self[key] = value;
|
|
110
|
-
}
|
|
111
|
-
else
|
|
112
|
-
{
|
|
109
|
+
} else {
|
|
113
110
|
let ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
114
111
|
ctx[key] = value;
|
|
115
112
|
}
|
|
@@ -78,7 +78,9 @@ function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain
|
|
|
78
78
|
let context: IInternalContext<T> = {
|
|
79
79
|
_next: _moveNext,
|
|
80
80
|
ctx: {
|
|
81
|
-
core: () => {
|
|
81
|
+
core: () => {
|
|
82
|
+
return core
|
|
83
|
+
},
|
|
82
84
|
diagLog: () => {
|
|
83
85
|
return safeGetLogger(core, config);
|
|
84
86
|
},
|
|
@@ -274,7 +276,7 @@ export function createProcessTelemetryUnloadContext(telemetryChain: ITelemetryPl
|
|
|
274
276
|
* @param core - The current core instance
|
|
275
277
|
* @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
|
|
276
278
|
*/
|
|
277
|
-
|
|
279
|
+
export function createProcessTelemetryUpdateContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core:IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryUpdateContext {
|
|
278
280
|
let internalContext: IInternalContext<IProcessTelemetryUpdateContext> = _createInternalContext<IProcessTelemetryUpdateContext>(telemetryChain, config, core, startAt);
|
|
279
281
|
let context = internalContext.ctx;
|
|
280
282
|
|
|
@@ -307,7 +309,7 @@ export function createProcessTelemetryUnloadContext(telemetryChain: ITelemetryPl
|
|
|
307
309
|
* should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error
|
|
308
310
|
* reporting (hasRun) when errors occur.
|
|
309
311
|
*/
|
|
310
|
-
|
|
312
|
+
export function createTelemetryProxyChain(plugins: IPlugin[], config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): ITelemetryPluginChain {
|
|
311
313
|
let firstProxy: ITelemetryPluginChain = null;
|
|
312
314
|
let add = startAt ? false : true;
|
|
313
315
|
|
|
@@ -399,11 +401,11 @@ export function createTelemetryPluginProxy(plugin: ITelemetryPlugin, config: ICo
|
|
|
399
401
|
}
|
|
400
402
|
|
|
401
403
|
function _processChain<T extends IBaseProcessingContext>(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
itemCtx: T,
|
|
405
|
+
processPluginFn: (itemCtx: T) => boolean,
|
|
406
|
+
name: string,
|
|
407
|
+
details: () => any,
|
|
408
|
+
isAsync: boolean) {
|
|
407
409
|
|
|
408
410
|
let hasRun = false;
|
|
409
411
|
let identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
@@ -122,7 +122,7 @@ export function mwcRandom32(signed?: boolean) {
|
|
|
122
122
|
* The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
|
|
123
123
|
* @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
export function newId(maxLength = 22): string {
|
|
126
126
|
const base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
127
127
|
|
|
128
128
|
// Start with an initial random number, consuming the value in reverse byte order
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
export const enum TelemetryUnloadReason {
|
|
8
8
|
/**
|
|
9
9
|
* Teardown has been called without any context.
|
|
10
10
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
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;
|