@microsoft/1ds-core-js 3.2.2 → 3.2.5
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/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +14 -0
- package/LICENSE.TXT +3 -3
- package/NOTICE +17 -0
- package/PRIVACY +3 -0
- package/README.md +15 -1
- package/SECURITY.md +41 -0
- package/SUPPORT.md +14 -0
- package/bundle/{ms.core-3.2.2.gbl.js → ms.core-3.2.5.gbl.js} +1728 -1431
- package/bundle/ms.core-3.2.5.gbl.js.map +1 -0
- package/bundle/ms.core-3.2.5.gbl.min.js +7 -0
- package/bundle/ms.core-3.2.5.gbl.min.js.map +1 -0
- package/bundle/ms.core-3.2.5.integrity.json +46 -0
- package/bundle/{ms.core-3.2.2.js → ms.core-3.2.5.js} +1728 -1431
- package/bundle/ms.core-3.2.5.js.map +1 -0
- package/bundle/ms.core-3.2.5.min.js +7 -0
- package/bundle/ms.core-3.2.5.min.js.map +1 -0
- package/bundle/ms.core.gbl.js +1727 -1430
- 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 +1727 -1430
- 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 +44 -35
- 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 +27 -29
- package/dist-esm/src/AppInsightsCore.js.map +1 -1
- package/dist-esm/src/BaseCore.d.ts +2 -2
- package/dist-esm/src/BaseCore.js +18 -12
- package/dist-esm/src/BaseCore.js.map +1 -1
- package/dist-esm/src/DataModels.d.ts +5 -0
- package/dist-esm/src/DataModels.js +1 -1
- package/dist-esm/src/ESPromise.d.ts +5 -5
- package/dist-esm/src/ESPromise.js +15 -15
- 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 +6 -5
- package/dist-esm/src/Enums.js +61 -61
- package/dist-esm/src/Enums.js.map +1 -1
- package/dist-esm/src/Index.d.ts +1 -2
- package/dist-esm/src/Index.js +3 -3
- 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 +40 -39
- package/dist-esm/src/Utils.js.map +1 -1
- package/dist-esm/src/ValueSanitizer.d.ts +1 -1
- package/dist-esm/src/ValueSanitizer.js +19 -18
- package/dist-esm/src/ValueSanitizer.js.map +1 -1
- package/package.json +4 -3
- package/src/AppInsightsCore.ts +29 -31
- package/src/BaseCore.ts +14 -11
- package/src/DataModels.ts +6 -0
- package/src/ESPromise.ts +6 -6
- package/src/ESPromiseScheduler.ts +8 -8
- package/src/Enums.ts +5 -5
- package/src/Index.ts +3 -3
- package/src/InternalConstants.ts +16 -0
- package/src/Utils.ts +24 -24
- package/src/ValueSanitizer.ts +5 -4
- package/bundle/ms.core-3.2.2.gbl.js.map +0 -1
- package/bundle/ms.core-3.2.2.gbl.min.js +0 -7
- package/bundle/ms.core-3.2.2.gbl.min.js.map +0 -1
- package/bundle/ms.core-3.2.2.integrity.json +0 -46
- package/bundle/ms.core-3.2.2.js.map +0 -1
- package/bundle/ms.core-3.2.2.min.js +0 -7
- package/bundle/ms.core-3.2.2.min.js.map +0 -1
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
|
|