@microsoft/1ds-core-js 3.2.3 → 3.2.4
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/README.md +1 -1
- package/bundle/{ms.core-3.2.3.gbl.js → ms.core-3.2.4.gbl.js} +823 -716
- package/bundle/ms.core-3.2.4.gbl.js.map +1 -0
- package/bundle/ms.core-3.2.4.gbl.min.js +7 -0
- package/bundle/ms.core-3.2.4.gbl.min.js.map +1 -0
- package/bundle/ms.core-3.2.4.integrity.json +46 -0
- package/bundle/{ms.core-3.2.3.js → ms.core-3.2.4.js} +823 -716
- package/bundle/ms.core-3.2.4.js.map +1 -0
- package/bundle/ms.core-3.2.4.min.js +7 -0
- package/bundle/ms.core-3.2.4.min.js.map +1 -0
- package/bundle/ms.core.gbl.js +822 -715
- package/bundle/ms.core.gbl.js.map +1 -1
- package/bundle/ms.core.gbl.min.js +2 -2
- package/bundle/ms.core.gbl.min.js.map +1 -1
- package/bundle/ms.core.integrity.json +17 -17
- package/bundle/ms.core.js +822 -715
- package/bundle/ms.core.js.map +1 -1
- package/bundle/ms.core.min.js +2 -2
- package/bundle/ms.core.min.js.map +1 -1
- package/dist/ms.core.js +34 -33
- package/dist/ms.core.js.map +1 -1
- package/dist/ms.core.min.js +2 -2
- package/dist/ms.core.min.js.map +1 -1
- package/dist-esm/src/AppInsightsCore.d.ts +2 -7
- package/dist-esm/src/AppInsightsCore.js +24 -26
- package/dist-esm/src/AppInsightsCore.js.map +1 -1
- package/dist-esm/src/BaseCore.d.ts +2 -2
- package/dist-esm/src/BaseCore.js +16 -10
- package/dist-esm/src/BaseCore.js.map +1 -1
- package/dist-esm/src/DataModels.js +1 -1
- package/dist-esm/src/ESPromise.d.ts +5 -5
- package/dist-esm/src/ESPromise.js +7 -7
- package/dist-esm/src/ESPromise.js.map +1 -1
- package/dist-esm/src/ESPromiseScheduler.d.ts +4 -4
- package/dist-esm/src/ESPromiseScheduler.js +8 -8
- package/dist-esm/src/ESPromiseScheduler.js.map +1 -1
- package/dist-esm/src/Enums.d.ts +5 -5
- package/dist-esm/src/Enums.js +6 -6
- package/dist-esm/src/Enums.js.map +1 -1
- package/dist-esm/src/Index.d.ts +1 -2
- package/dist-esm/src/Index.js +2 -2
- package/dist-esm/src/Index.js.map +1 -1
- package/dist-esm/src/InternalConstants.d.ts +6 -0
- package/dist-esm/src/InternalConstants.js +19 -0
- package/dist-esm/src/InternalConstants.js.map +1 -0
- package/dist-esm/src/Utils.d.ts +9 -3
- package/dist-esm/src/Utils.js +19 -18
- package/dist-esm/src/Utils.js.map +1 -1
- package/dist-esm/src/ValueSanitizer.d.ts +1 -1
- package/dist-esm/src/ValueSanitizer.js +5 -4
- package/dist-esm/src/ValueSanitizer.js.map +1 -1
- package/package.json +4 -2
- package/src/AppInsightsCore.ts +28 -30
- package/src/BaseCore.ts +13 -10
- package/src/ESPromise.ts +6 -6
- package/src/ESPromiseScheduler.ts +8 -8
- package/src/Enums.ts +5 -5
- package/src/Index.ts +1 -1
- package/src/InternalConstants.ts +16 -0
- package/src/Utils.ts +24 -24
- package/src/ValueSanitizer.ts +5 -4
- package/bundle/ms.core-3.2.3.gbl.js.map +0 -1
- package/bundle/ms.core-3.2.3.gbl.min.js +0 -7
- package/bundle/ms.core-3.2.3.gbl.min.js.map +0 -1
- package/bundle/ms.core-3.2.3.integrity.json +0 -46
- package/bundle/ms.core-3.2.3.js.map +0 -1
- package/bundle/ms.core-3.2.3.min.js +0 -7
- package/bundle/ms.core-3.2.3.min.js.map +0 -1
package/src/BaseCore.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
* BaseCore.ts
|
|
3
|
+
* Base Core is a subset of 1DS Web SDK Core. The purpose of Base Core is to generate a smaller bundle size while providing essential features of Core. Features that are not included in Base Core are:
|
|
4
|
+
* 1. Internal logging
|
|
5
|
+
* 2. Sending notifications on telemetry sent/discarded
|
|
6
|
+
* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
|
|
7
|
+
* @copyright Microsoft 2018
|
|
8
|
+
*/
|
|
9
9
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
BaseCore as InternalCore, IDiagnosticLogger, INotificationManager, IPlugin, ITelemetryItem, _throwInternal, dumpObj, eLoggingSeverity
|
|
12
|
+
} from "@microsoft/applicationinsights-core-js";
|
|
13
|
+
import { IExtendedAppInsightsCore, IExtendedConfiguration, IExtendedTelemetryItem } from "./DataModels";
|
|
12
14
|
import { _eExtendedInternalMessageId } from "./Enums";
|
|
15
|
+
import { STR_DEFAULT_ENDPOINT_URL } from "./InternalConstants";
|
|
13
16
|
import { FullVersionString, isDocumentObjectAvailable } from "./Utils";
|
|
14
17
|
|
|
15
18
|
export default class BaseCore extends InternalCore implements IExtendedAppInsightsCore {
|
|
@@ -24,7 +27,7 @@ export default class BaseCore extends InternalCore implements IExtendedAppInsigh
|
|
|
24
27
|
|
|
25
28
|
_self.initialize = (config: IExtendedConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager) => {
|
|
26
29
|
if (config && !config.endpointUrl) {
|
|
27
|
-
config.endpointUrl =
|
|
30
|
+
config.endpointUrl = STR_DEFAULT_ENDPOINT_URL;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
_self.getWParam = () => {
|
package/src/ESPromise.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* ESPromise.ts
|
|
3
|
+
* @author Nev Wylie (newylie))
|
|
4
|
+
* @copyright Microsoft 2019
|
|
5
|
+
* Simplified wrapper to provide ES6 style Promise callback handling for older browsers
|
|
6
|
+
*/
|
|
7
7
|
|
|
8
|
-
import { isFunction } from "@microsoft/applicationinsights-core-js";
|
|
9
8
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
9
|
+
import { isFunction } from "@microsoft/applicationinsights-core-js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @ignore -- Don't include in the generated documentation
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
* ESPromiseScheduler.ts
|
|
3
|
+
* @author Nev Wylie (newylie)
|
|
4
|
+
* @copyright Microsoft 2019
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
|
-
import ESPromise from "./ESPromise";
|
|
8
|
-
import { ResolverResolveFunc, ResolverRejectFunc } from "./ESPromise";
|
|
9
|
-
import { IDiagnosticLogger, getGlobal } from "@microsoft/applicationinsights-core-js";
|
|
10
7
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
8
|
+
import ESPromise from "./ESPromise";
|
|
9
|
+
import { IDiagnosticLogger, _warnToConsole, getGlobal } from "@microsoft/applicationinsights-core-js";
|
|
10
|
+
import { ResolverRejectFunc, ResolverResolveFunc } from "./ESPromise";
|
|
11
11
|
|
|
12
12
|
/** This is a default timeout that will cause outstanding running promises to be removed/rejected to avoid filling up memory with blocked events */
|
|
13
13
|
const LazyRejectPeriod = 600000; // 10 Minutes
|
|
@@ -309,7 +309,7 @@ export default class ESPromiseScheduler {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
function _warnLog(message: string) {
|
|
312
|
-
diagLog
|
|
312
|
+
_warnToConsole(diagLog, "ESPromiseScheduler[" + _scheduledName + "] " + message);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
package/src/Enums.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* Enums.ts
|
|
3
|
+
* @author Abhilash Panwar (abpanwar)
|
|
4
|
+
* @copyright Microsoft 2018
|
|
5
|
+
* File containing the enums as constants.
|
|
6
|
+
*/
|
|
7
7
|
|
|
8
8
|
import { _InternalMessageId, _eInternalMessageId, createEnumStyle, objFreeze } from "@microsoft/applicationinsights-core-js";
|
|
9
9
|
|
package/src/Index.ts
CHANGED
|
@@ -37,7 +37,7 @@ export {
|
|
|
37
37
|
MinChannelPriorty, EventsDiscardedReason, ICoreUtils, IDiagnosticLogger, DiagnosticLogger, LoggingSeverity, SendRequestReason,
|
|
38
38
|
IPerfEvent, IPerfManager, IPerfManagerProvider, PerfEvent, PerfManager, doPerf, ICustomProperties, Tags,
|
|
39
39
|
EventHelper, AppInsightsCore as InternalAppInsightsCore, BaseCore as InternalBaseCore, _InternalLogMessage, _InternalMessageId,
|
|
40
|
-
createEnumStyle, eLoggingSeverity, _eInternalMessageId, _throwInternal
|
|
40
|
+
createEnumStyle, eLoggingSeverity, _eInternalMessageId, _throwInternal, _warnToConsole, _logInternalMessage,
|
|
41
41
|
// The HelperFuncs functions
|
|
42
42
|
isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, attachEvent, detachEvent, normalizeJsName,
|
|
43
43
|
objForEachKey, strStartsWith, strEndsWith, strContains, strTrim, isDate, isArray, isError, isString, isNumber, isBoolean,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
+
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
|
|
6
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
7
|
+
|
|
8
|
+
// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
|
|
9
|
+
// as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
|
|
10
|
+
|
|
11
|
+
export const STR_EMPTY = "";
|
|
12
|
+
export const STR_DEFAULT_ENDPOINT_URL = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
|
|
13
|
+
export const STR_PLUGIN_VERSION_STRING = "pluginVersionString";
|
|
14
|
+
export const STR_PLUGIN_VERSION_STRING_ARR = STR_PLUGIN_VERSION_STRING + "Arr" as "pluginVersionStringArr";
|
|
15
|
+
export const STR_VERSION = "version";
|
|
16
|
+
export const STR_PROPERTIES = "properties";
|
package/src/Utils.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { objCreateFn, strShimObject } from "@microsoft/applicationinsights-shims";
|
|
8
|
-
import { IEventProperty, IExtendedTelemetryItem } from "./DataModels";
|
|
9
|
-
import { eEventPropertyType, _ExtendedInternalMessageId, GuidStyle, eValueKind, FieldValueSanitizerType, EventLatency, EventLatencyValue } from "./Enums";
|
|
2
|
+
* Utils.ts
|
|
3
|
+
* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
|
|
4
|
+
* @copyright Microsoft 2018
|
|
5
|
+
* File containing utility functions.
|
|
6
|
+
*/
|
|
10
7
|
import {
|
|
11
|
-
ITelemetryItem,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mwcRandom32, mwcRandomSeed, random32, randomValue, newId, isIE, dateNow, isError, isDate, isTypeof, ICoreUtils, strEndsWith, useXDomainRequest, isBeaconsSupported, addPageUnloadEventListener,
|
|
8
|
+
ICookieMgr, ICoreUtils, ITelemetryItem, addEventHandler, addPageUnloadEventListener, areCookiesSupported, arrForEach, arrIndexOf, arrMap,
|
|
9
|
+
arrReduce, dateNow, generateW3CId, getDocument, getGlobalInst, getNavigator, getWindow, hasOwnProperty, isArray, isBeaconsSupported,
|
|
10
|
+
isBoolean, isDate, isError, isFunction, isIE, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isTypeof, isUndefined,
|
|
11
|
+
mwcRandom32, mwcRandomSeed, newGuid, newId, objDefineAccessors, objForEachKey, objKeys, perfNow, random32, randomValue, safeGetCookieMgr,
|
|
12
|
+
strEndsWith, strObject, strTrim, strUndefined, toISOString, uaDisallowsSameSiteNone, useXDomainRequest
|
|
17
13
|
} from "@microsoft/applicationinsights-core-js";
|
|
14
|
+
import { ObjHasOwnProperty, objCreateFn, strShimObject, strShimPrototype } from "@microsoft/applicationinsights-shims";
|
|
15
|
+
import { IEventProperty, IExtendedTelemetryItem } from "./DataModels";
|
|
16
|
+
import { EventLatency, EventLatencyValue, FieldValueSanitizerType, GuidStyle, eEventPropertyType, eValueKind } from "./Enums";
|
|
17
|
+
import { STR_EMPTY } from "./InternalConstants";
|
|
18
18
|
|
|
19
19
|
export const Version = "#version#";
|
|
20
20
|
export const FullVersionString = "1DS-Web-JS-" + Version;
|
|
@@ -62,7 +62,7 @@ export function isValueAssigned(value: any) {
|
|
|
62
62
|
/// <summary> takes a value and checks for undefined, null and empty string </summary>
|
|
63
63
|
/// <param type="any"> value to be tested </param>
|
|
64
64
|
/// <returns> true if value is null undefined or emptyString </returns>
|
|
65
|
-
return !(value ===
|
|
65
|
+
return !(value === STR_EMPTY || isNullOrUndefined(value));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -77,7 +77,7 @@ export function getTenantId(apiKey: string | undefined): string {
|
|
|
77
77
|
return apiKey.substring(0, indexTenantId);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return STR_EMPTY;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -126,10 +126,10 @@ export function sanitizeProperty(name: string,
|
|
|
126
126
|
// If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.
|
|
127
127
|
if (propType === "string" || propType === "number" || propType === "boolean" || isArray(property)) {
|
|
128
128
|
property = ({ value: property } as IEventProperty);
|
|
129
|
-
} else if (propType === "object" && !
|
|
129
|
+
} else if (propType === "object" && !ObjHasOwnProperty.call(property, "value")) {
|
|
130
130
|
property = ({ value: stringifyObjects ? JSON.stringify(property) : property } as IEventProperty);
|
|
131
131
|
} else if (isNullOrUndefined((property as IEventProperty).value)
|
|
132
|
-
|| (property as IEventProperty).value ===
|
|
132
|
+
|| (property as IEventProperty).value === STR_EMPTY || (!isString((property as IEventProperty).value)
|
|
133
133
|
&& !isNumber((property as IEventProperty).value) && !isBoolean((property as IEventProperty).value)
|
|
134
134
|
&& !isArray((property as IEventProperty).value))) {
|
|
135
135
|
// Since property is IEventProperty, we need to validate its value
|
|
@@ -238,7 +238,7 @@ export function getCookie(name: string): string {
|
|
|
238
238
|
return getCookieValue(safeGetCookieMgr(null), name);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
return
|
|
241
|
+
return STR_EMPTY;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/**
|
|
@@ -258,7 +258,7 @@ export function getCookieValue(cookieMgr: ICookieMgr, name: string, decode: bool
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
return cookieValue ||
|
|
261
|
+
return cookieValue || STR_EMPTY;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/**
|
|
@@ -277,7 +277,7 @@ export function createGuid(style: GuidStyle = GuidStyle.Digits): string {
|
|
|
277
277
|
} else if (style === GuidStyle.Parentheses) {
|
|
278
278
|
theGuid = "(" + theGuid + ")";
|
|
279
279
|
} else if (style === GuidStyle.Numeric) {
|
|
280
|
-
theGuid = theGuid.replace(/-/g,
|
|
280
|
+
theGuid = theGuid.replace(/-/g, STR_EMPTY);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
return theGuid;
|
|
@@ -298,7 +298,7 @@ export function extend(obj?: any, obj2?: any, obj3?: any, obj4?: any, obj5?: any
|
|
|
298
298
|
var deep = false;
|
|
299
299
|
var i = 0;
|
|
300
300
|
var length = arguments.length;
|
|
301
|
-
var objProto = Object[
|
|
301
|
+
var objProto = Object[strShimPrototype];
|
|
302
302
|
var theArgs = arguments;
|
|
303
303
|
|
|
304
304
|
// Check if a deep merge
|
|
@@ -400,7 +400,7 @@ export function getFieldValueType(value: any): FieldValueSanitizerType {
|
|
|
400
400
|
// Empty arrays are not supported and are considered to be the same as null
|
|
401
401
|
theType |= getFieldValueType(value[0]);
|
|
402
402
|
}
|
|
403
|
-
} else if (
|
|
403
|
+
} else if (ObjHasOwnProperty.call(value, "value")) {
|
|
404
404
|
// Looks like an IEventProperty
|
|
405
405
|
theType = FieldValueSanitizerType.EventProperty | getFieldValueType(value.value);
|
|
406
406
|
}
|
|
@@ -562,4 +562,4 @@ export function openXhr(method: string, urlString: string, withCredentials?: boo
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
return xhr;
|
|
565
|
-
}
|
|
565
|
+
}
|
package/src/ValueSanitizer.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { isNullOrUndefined,
|
|
2
|
-
import { isValueKind, isValueAssigned, getFieldValueType } from "./Utils";
|
|
1
|
+
import { isNullOrUndefined, isString, objForEachKey } from "@microsoft/applicationinsights-core-js";
|
|
3
2
|
import {
|
|
4
|
-
|
|
3
|
+
FieldValueSanitizerFunc, FieldValueSanitizerTypes, IEventProperty, IFieldSanitizerDetails, IFieldValueSanitizerProvider, IValueSanitizer
|
|
5
4
|
} from "./DataModels";
|
|
6
5
|
import { FieldValueSanitizerType } from "./Enums";
|
|
6
|
+
import { STR_EMPTY } from "./InternalConstants";
|
|
7
|
+
import { getFieldValueType, isValueAssigned, isValueKind } from "./Utils";
|
|
7
8
|
|
|
8
9
|
interface ISanitizerMapValue {
|
|
9
10
|
canHandle: boolean;
|
|
@@ -154,7 +155,7 @@ export class ValueSanitizer implements IValueSanitizer {
|
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
// Check that property is valid
|
|
157
|
-
if (!isString(name) || isNullOrUndefined(value) || (value as any) ===
|
|
158
|
+
if (!isString(name) || isNullOrUndefined(value) || (value as any) === STR_EMPTY) {
|
|
158
159
|
return null;
|
|
159
160
|
}
|
|
160
161
|
|