@microsoft/1ds-core-js 4.3.6-nightly3.2502-14 → 4.3.6-nightly3.2503-01
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/bundle/es5/{ms.core-4.3.6-nightly3.2502-14.gbl.js → ms.core-4.3.6-nightly3.2503-01.gbl.js} +262 -307
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.gbl.js.map +1 -0
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.gbl.min.js +7 -0
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.gbl.min.js.map +1 -0
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.integrity.json +46 -0
- package/bundle/es5/{ms.core-4.3.6-nightly3.2502-14.js → ms.core-4.3.6-nightly3.2503-01.js} +262 -307
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.js.map +1 -0
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.min.js +7 -0
- package/bundle/es5/ms.core-4.3.6-nightly3.2503-01.min.js.map +1 -0
- package/bundle/es5/ms.core.gbl.js +261 -306
- package/bundle/es5/ms.core.gbl.js.map +1 -1
- package/bundle/es5/ms.core.gbl.min.js +2 -2
- package/bundle/es5/ms.core.gbl.min.js.map +1 -1
- package/bundle/es5/ms.core.integrity.json +17 -17
- package/bundle/es5/ms.core.js +261 -306
- package/bundle/es5/ms.core.js.map +1 -1
- package/bundle/es5/ms.core.min.js +2 -2
- package/bundle/es5/ms.core.min.js.map +1 -1
- package/dist/es5/ms.core.js +259 -304
- package/dist/es5/ms.core.js.map +1 -1
- package/dist/es5/ms.core.min.js +2 -2
- package/dist/es5/ms.core.min.js.map +1 -1
- package/dist-es5/AppInsightsCore.js +4 -4
- package/dist-es5/AppInsightsCore.js.map +1 -1
- package/dist-es5/BaseCore.js +4 -4
- package/dist-es5/BaseCore.js.map +1 -1
- package/dist-es5/DataModels.js +1 -1
- package/dist-es5/Enums.js +1 -1
- package/dist-es5/Index.js +1 -1
- package/dist-es5/InternalConstants.js +1 -1
- package/dist-es5/Utils.js +5 -5
- package/dist-es5/Utils.js.map +1 -1
- package/dist-es5/ValueSanitizer.js +17 -18
- package/dist-es5/ValueSanitizer.js.map +1 -1
- package/dist-es5/__DynamicConstants.js +5 -7
- package/dist-es5/__DynamicConstants.js.map +1 -1
- package/package.json +3 -3
- package/types/1ds-core-js.d.ts +2 -2
- package/types/1ds-core-js.namespaced.d.ts +2 -2
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.gbl.js.map +0 -1
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.gbl.min.js +0 -7
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.gbl.min.js.map +0 -1
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.integrity.json +0 -46
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.js.map +0 -1
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.min.js +0 -7
- package/bundle/es5/ms.core-4.3.6-nightly3.2502-14.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -14,7 +14,7 @@ import { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, d
|
|
|
14
14
|
import { objDeepFreeze } from "@nevware21/ts-utils";
|
|
15
15
|
import { STR_DEFAULT_ENDPOINT_URL, STR_EMPTY, STR_PROPERTIES, STR_VERSION } from "./InternalConstants";
|
|
16
16
|
import { FullVersionString, getTime, isLatency } from "./Utils";
|
|
17
|
-
import { _DYN_INDEX_OF, _DYN_INITIALIZE,
|
|
17
|
+
import { _DYN_INDEX_OF, _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS, _DYN_TIMINGS } from "./__DynamicConstants";
|
|
18
18
|
/**
|
|
19
19
|
* The default settings for the config.
|
|
20
20
|
* WE MUST include all defaults here to ensure that the config is created with all of the properties
|
|
@@ -43,10 +43,10 @@ var AppInsightsCore = /** @class */ (function (_super) {
|
|
|
43
43
|
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
|
|
44
44
|
doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
|
|
45
45
|
try {
|
|
46
|
-
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self
|
|
46
|
+
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
49
|
-
var logger_1 = _self
|
|
49
|
+
var logger_1 = _self.logger;
|
|
50
50
|
var message = dumpObj(e);
|
|
51
51
|
if (message[_DYN_INDEX_OF /* @min:%2eindexOf */]("channels") !== -1) {
|
|
52
52
|
// Add some additional context to the underlying reported error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsCore.js.map","sources":["AppInsightsCore.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* AppInsightsCore.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, doPerf, dumpObj, throwError } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL, STR_EMPTY, STR_PROPERTIES, STR_VERSION } from \"./InternalConstants\";\r\nimport { FullVersionString, getTime, isLatency } from \"./Utils\";\r\nimport { _DYN_INDEX_OF, _DYN_INITIALIZE,
|
|
1
|
+
{"version":3,"file":"AppInsightsCore.js.map","sources":["AppInsightsCore.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* AppInsightsCore.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, doPerf, dumpObj, throwError } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL, STR_EMPTY, STR_PROPERTIES, STR_VERSION } from \"./InternalConstants\";\r\nimport { FullVersionString, getTime, isLatency } from \"./Utils\";\r\nimport { _DYN_INDEX_OF, _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS, _DYN_TIMINGS } from \"./__DynamicConstants\";\r\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultConfig = objDeepFreeze({\r\n endpointUrl: STR_DEFAULT_ENDPOINT_URL,\r\n propertyStorageOverride: { isVal: _chkPropOverride }\r\n});\r\nfunction _chkPropOverride(propertyStorageOverride) {\r\n // Validate property storage override\r\n if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {\r\n throwError(\"Invalid property storage override passed.\");\r\n }\r\n return true;\r\n}\r\n/**\r\n * @group Classes\r\n * @group Entrypoint\r\n */\r\nvar AppInsightsCore = /** @class */ (function (_super) {\r\n __extends(AppInsightsCore, _super);\r\n function AppInsightsCore() {\r\n var _this = _super.call(this) || this;\r\n dynamicProto(AppInsightsCore, _this, function (_self, _base) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n doPerf(_self, function () { return \"AppInsightsCore.initialize\"; }, function () {\r\n try {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);\r\n }\r\n catch (e) {\r\n var logger_1 = _self.logger;\r\n var message = dumpObj(e);\r\n if (message[_DYN_INDEX_OF /* @min:%2eindexOf */](\"channels\") !== -1) {\r\n // Add some additional context to the underlying reported error\r\n message += \"\\n - Channels must be provided through config.channels only!\";\r\n }\r\n _throwInternal(logger_1, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"SDK Initialization Failed - no telemetry will be sent: \" + message);\r\n }\r\n }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });\r\n };\r\n _self.track = function (item) {\r\n doPerf(_self, function () { return \"AppInsightsCore.track\"; }, function () {\r\n var telemetryItem = item;\r\n if (telemetryItem) {\r\n telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n telemetryItem[_DYN_TIMINGS /* @min:%2etimings */].trackStart = getTime();\r\n if (!isLatency(telemetryItem.latency)) {\r\n telemetryItem.latency = 1 /* EventLatencyValue.Normal */;\r\n }\r\n var itemExt = telemetryItem.ext = telemetryItem.ext || {};\r\n itemExt.sdk = itemExt.sdk || {};\r\n itemExt.sdk.ver = FullVersionString;\r\n var baseData = telemetryItem.baseData = telemetryItem.baseData || {};\r\n baseData[STR_PROPERTIES /* @min:%2eproperties */] = baseData[STR_PROPERTIES /* @min:%2eproperties */] || {};\r\n var itemProperties = baseData[STR_PROPERTIES /* @min:%2eproperties */];\r\n itemProperties[STR_VERSION] = itemProperties[STR_VERSION] || _self.pluginVersionString || STR_EMPTY;\r\n }\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: item }); }, !(item.sync));\r\n };\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {\r\n return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || \"InternalLog\");\r\n };\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Initialize the sdk.\r\n * @param config - The configuration to initialize the SDK.\r\n * @param extensions - An array of extensions that are to be used by the core.\r\n */\r\n AppInsightsCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AppInsightsCore.prototype.track = function (item) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n AppInsightsCore.prototype.pollInternalLogs = function (eventName) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return AppInsightsCore;\r\n}(InternalCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;+DAiBM,CAAC;;;;;2BACoB;AAC3B;AACA;AACA"}
|
package/dist-es5/BaseCore.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -17,7 +17,7 @@ import { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, d
|
|
|
17
17
|
import { objDeepFreeze } from "@nevware21/ts-utils";
|
|
18
18
|
import { STR_DEFAULT_ENDPOINT_URL } from "./InternalConstants";
|
|
19
19
|
import { FullVersionString } from "./Utils";
|
|
20
|
-
import { _DYN_INITIALIZE,
|
|
20
|
+
import { _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS } from "./__DynamicConstants";
|
|
21
21
|
/**
|
|
22
22
|
* The default settings for the config.
|
|
23
23
|
* WE MUST include all defaults here to ensure that the config is created with all of the properties
|
|
@@ -33,10 +33,10 @@ var BaseCore = /** @class */ (function (_super) {
|
|
|
33
33
|
dynamicProto(BaseCore, _this, function (_self, _base) {
|
|
34
34
|
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
|
|
35
35
|
try {
|
|
36
|
-
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self
|
|
36
|
+
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
|
-
_throwInternal(_self
|
|
39
|
+
_throwInternal(_self.logger, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
_self.track = function (item) {
|
package/dist-es5/BaseCore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCore.js.map","sources":["BaseCore.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* BaseCore.ts\r\n* 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:\r\n* 1. Internal logging\r\n* 2. Sending notifications on telemetry sent/discarded\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, dumpObj } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL } from \"./InternalConstants\";\r\nimport { FullVersionString } from \"./Utils\";\r\nimport { _DYN_INITIALIZE,
|
|
1
|
+
{"version":3,"file":"BaseCore.js.map","sources":["BaseCore.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* BaseCore.ts\r\n* 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:\r\n* 1. Internal logging\r\n* 2. Sending notifications on telemetry sent/discarded\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, dumpObj } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL } from \"./InternalConstants\";\r\nimport { FullVersionString } from \"./Utils\";\r\nimport { _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS } from \"./__DynamicConstants\";\r\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultConfig = objDeepFreeze({\r\n endpointUrl: STR_DEFAULT_ENDPOINT_URL\r\n});\r\nvar BaseCore = /** @class */ (function (_super) {\r\n __extends(BaseCore, _super);\r\n function BaseCore() {\r\n var _this = _super.call(this) || this;\r\n dynamicProto(BaseCore, _this, function (_self, _base) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n try {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.logger, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"Initialization Failed: \" + dumpObj(e) + \"\\n - Note: Channels must be provided through config.channels only\");\r\n }\r\n };\r\n _self.track = function (item) {\r\n var telemetryItem = item;\r\n if (telemetryItem) {\r\n var ext = telemetryItem.ext = telemetryItem.ext || {};\r\n ext.sdk = ext.sdk || {};\r\n ext.sdk.ver = FullVersionString;\r\n }\r\n _base.track(telemetryItem);\r\n };\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {\r\n return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || \"InternalLog\");\r\n };\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Initialize the sdk.\r\n * @param config - The configuration to initialize the SDK.\r\n * @param extensions - An array of extensions that are to be used by the core.\r\n */\r\n BaseCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.track = function (item) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n BaseCore.prototype.pollInternalLogs = function (eventName) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return BaseCore;\r\n}(InternalCore));\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;wDAiBM,CAAC;;;;;oBACa;AACpB;AACA;AACA"}
|
package/dist-es5/DataModels.js
CHANGED
package/dist-es5/Enums.js
CHANGED
package/dist-es5/Index.js
CHANGED
package/dist-es5/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -14,8 +14,8 @@ import { arrForEach, getGlobalInst, getNavigator, hasDocument, hasWindow, isArra
|
|
|
14
14
|
import { ObjProto, strShimObject } from "@microsoft/applicationinsights-shims";
|
|
15
15
|
import { strIndexOf, strLeft } from "@nevware21/ts-utils";
|
|
16
16
|
import { STR_EMPTY } from "./InternalConstants";
|
|
17
|
-
import { _DYN_INDEX_OF,
|
|
18
|
-
export var Version = '4.3.6-nightly3.
|
|
17
|
+
import { _DYN_INDEX_OF, _DYN_LENGTH, _DYN_PROCESS_TELEMETRY_ST0, _DYN_TIMINGS, _DYN_VALUE } from "./__DynamicConstants";
|
|
18
|
+
export var Version = '4.3.6-nightly3.2503-01';
|
|
19
19
|
export var FullVersionString = "1DS-Web-JS-" + Version;
|
|
20
20
|
var ObjHasOwnProperty = ObjProto.hasOwnProperty;
|
|
21
21
|
// Defining here so we don't need to take (import) the ApplicationInsights Common module
|
|
@@ -130,8 +130,8 @@ export function sanitizeProperty(name, property, stringifyObjects) {
|
|
|
130
130
|
// If either pii or cc is set convert value to string (since only string pii/cc is allowed).
|
|
131
131
|
// If the value is a complex type like an array that can't be converted to string we will drop
|
|
132
132
|
// the property.
|
|
133
|
-
if (!isNullOrUndefined(property
|
|
134
|
-
if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property
|
|
133
|
+
if (!isNullOrUndefined(property.kind)) {
|
|
134
|
+
if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property.kind)) {
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();
|
package/dist-es5/Utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js.map","sources":["Utils.js"],"sourcesContent":["var _a;\r\n/**\r\n* Utils.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { arrForEach, getGlobalInst, getNavigator, hasDocument, hasWindow, isArray, isBoolean, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isUndefined, newGuid, objForEachKey, perfNow } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ObjProto, strShimObject } from \"@microsoft/applicationinsights-shims\";\r\nimport { strIndexOf, strLeft } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { _DYN_INDEX_OF, _DYN_KIND, _DYN_LENGTH, _DYN_PROCESS_TELEMETRY_ST0, _DYN_TIMINGS, _DYN_VALUE } from \"./__DynamicConstants\";\r\nexport var Version = '4.3.6-nightly3.2502-14';\r\nexport var FullVersionString = \"1DS-Web-JS-\" + Version;\r\nvar ObjHasOwnProperty = ObjProto.hasOwnProperty;\r\n// Defining here so we don't need to take (import) the ApplicationInsights Common module\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n// If value is array just get the type for the first element\r\nvar _fieldTypeEventPropMap = (_a = {},\r\n _a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,\r\n _a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a);\r\n/**\r\n * @ignore\r\n */\r\n// let _uaDisallowsSameSiteNone = null;\r\nvar uInt8ArraySupported = null;\r\n// var _areCookiesAvailable: boolean | undefined;\r\n/**\r\n * Checks if document object is available\r\n */\r\nexport var isDocumentObjectAvailable = hasDocument();\r\n/**\r\n * Checks if window object is available\r\n */\r\nexport var isWindowObjectAvailable = hasWindow();\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// <summary> takes a value and checks for undefined, null and empty string </summary>\r\n /// <param type=\"any\"> value to be tested </param>\r\n /// <returns> true if value is null undefined or emptyString </returns>\r\n return !(value === STR_EMPTY || isNullOrUndefined(value));\r\n}\r\n/**\r\n * Gets the tenant id from the tenant token.\r\n * @param apiKey - The token from which the tenant id is to be extracted.\r\n * @returns The tenant id.\r\n */\r\nexport function getTenantId(apiKey) {\r\n if (apiKey) {\r\n var indexTenantId = strIndexOf(apiKey, \"-\");\r\n if (indexTenantId > -1) {\r\n return strLeft(apiKey, indexTenantId);\r\n }\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Checks if Uint8Array are available in the current environment. Safari and Firefox along with\r\n * ReactNative are known to not support Uint8Array properly.\r\n * @returns True if available, false otherwise.\r\n */\r\nexport function isUint8ArrayAvailable() {\r\n if (uInt8ArraySupported === null) {\r\n uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();\r\n }\r\n return uInt8ArraySupported;\r\n}\r\n/**\r\n * Checks if the value is a valid EventLatency.\r\n * @param value - The value that needs to be checked.\r\n * @returns True if the value is in AWTEventLatency, false otherwise.\r\n */\r\nexport function isLatency(value) {\r\n if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Sanitizes the Property. It checks the that the property name and value are valid. It also\r\n * checks/populates the correct type and pii of the property value.\r\n * @param name - property name - The property name.\r\n * @param property - The property value or an IEventProperty containing value,\r\n * type ,pii and customer content.\r\n * @returns IEventProperty containing valid name, value, pii and type or null if invalid.\r\n */\r\nexport function sanitizeProperty(name, property, stringifyObjects) {\r\n // Check that property is valid\r\n if ((!property && !isValueAssigned(property)) || typeof name !== \"string\") {\r\n return null;\r\n }\r\n // Perf optimization -- only need to get the type once not multiple times\r\n var propType = typeof property;\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n if (propType === \"string\" || propType === \"number\" || propType === \"boolean\" || isArray(property)) {\r\n property = { value: property };\r\n }\r\n else if (propType === \"object\" && !ObjHasOwnProperty.call(property, \"value\")) {\r\n property = { value: stringifyObjects ? JSON.stringify(property) : property };\r\n }\r\n else if (isNullOrUndefined(property[_DYN_VALUE /* @min:%2evalue */])\r\n || property[_DYN_VALUE /* @min:%2evalue */] === STR_EMPTY || (!isString(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isNumber(property[_DYN_VALUE /* @min:%2evalue */]) && !isBoolean(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isArray(property[_DYN_VALUE /* @min:%2evalue */]))) {\r\n // Since property is IEventProperty, we need to validate its value\r\n return null;\r\n }\r\n // We need to check that if the property value is an array, it is valid\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) &&\r\n !isArrayValid(property[_DYN_VALUE /* @min:%2evalue */])) {\r\n return null;\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property[_DYN_KIND /* @min:%2ekind */])) {\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property[_DYN_KIND /* @min:%2ekind */])) {\r\n return null;\r\n }\r\n property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();\r\n }\r\n return property;\r\n}\r\nexport function getCommonSchemaMetaData(value, kind, type) {\r\n var encodedTypeValue = -1;\r\n if (!isUndefined(value)) {\r\n if (kind > 0) {\r\n if (kind === 32 /* eValueKind.CustomerContent_GenericContent */) {\r\n // encode customer content. Value can only be string. bit 13-16 are for cc\r\n encodedTypeValue = (1 << 13);\r\n }\r\n else if (kind <= 13) {\r\n // encode PII. Value can only be string. bits 5-12 are for Pii\r\n encodedTypeValue = (kind << 5);\r\n }\r\n }\r\n // isDataType checks that the \"type\" is a number so we don't need to check for undefined\r\n if (isDataType(type)) {\r\n // Data Type is provided and valid, so use that\r\n if (encodedTypeValue === -1) {\r\n // Don't return -1\r\n encodedTypeValue = 0;\r\n }\r\n encodedTypeValue |= type;\r\n }\r\n else {\r\n var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;\r\n if (encodedTypeValue !== -1 && propType !== -1) {\r\n // pii exists so we must return correct type\r\n encodedTypeValue |= propType;\r\n }\r\n else if (propType === 6 /* eEventPropertyType.Double */) {\r\n encodedTypeValue = propType;\r\n }\r\n }\r\n }\r\n return encodedTypeValue;\r\n}\r\n/**\r\n * Helper to get and decode the cookie value using decodeURIComponent, this is for historical\r\n * backward compatibility where the document.cookie value was decoded before parsing.\r\n * @param cookieMgr - The cookie manager to use\r\n * @param name - The name of the cookie to get\r\n * @param decode - A flag to indicate whether the cookie value should be decoded\r\n * @returns The decoded cookie value (if available) otherwise an empty string.\r\n */\r\nexport function getCookieValue(cookieMgr, name, decode) {\r\n if (decode === void 0) { decode = true; }\r\n var cookieValue;\r\n if (cookieMgr) {\r\n cookieValue = cookieMgr.get(name);\r\n if (decode && cookieValue && decodeURIComponent) {\r\n cookieValue = decodeURIComponent(cookieValue);\r\n }\r\n }\r\n return cookieValue || STR_EMPTY;\r\n}\r\n/**\r\n * Create a new guid.\r\n * @param style - The style of guid to generated, defaults to Digits\r\n * Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000\r\n * Braces - 32 digits separated by hyphens, enclosed in braces: \\{00000000-0000-0000-0000-000000000000\\}\r\n * Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)\r\n * Numeric - 32 digits: 00000000000000000000000000000000\r\n */\r\nexport function createGuid(style) {\r\n if (style === void 0) { style = \"D\" /* GuidStyle.Digits */; }\r\n var theGuid = newGuid();\r\n if (style === \"B\" /* GuidStyle.Braces */) {\r\n theGuid = \"{\" + theGuid + \"}\";\r\n }\r\n else if (style === \"P\" /* GuidStyle.Parentheses */) {\r\n theGuid = \"(\" + theGuid + \")\";\r\n }\r\n else if (style === \"N\" /* GuidStyle.Numeric */) {\r\n theGuid = theGuid.replace(/-/g, STR_EMPTY);\r\n }\r\n return theGuid;\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments[_DYN_LENGTH /* @min:%2elength */];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (isBoolean(theArgs[0])) {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n objForEachKey(obj, function (prop, value) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && value && isObject(value)) {\r\n if (isArray(value)) {\r\n extended[prop] = extended[prop] || [];\r\n arrForEach(value, function (arrayValue, arrayIndex) {\r\n if (arrayValue && isObject(arrayValue)) {\r\n extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);\r\n }\r\n else {\r\n extended[prop][arrayIndex] = arrayValue;\r\n }\r\n });\r\n }\r\n else {\r\n extended[prop] = extend(true, extended[prop], value);\r\n }\r\n }\r\n else {\r\n extended[prop] = value;\r\n }\r\n });\r\n }\r\n return extended;\r\n}\r\nexport var getTime = perfNow;\r\nexport function isValueKind(value) {\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isDataType(value) {\r\n // Remark: 0 returns false, but it doesn't affect encoding anyways\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value >= 0 && value <= 9) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isSafariOrFirefox() {\r\n var nav = getNavigator();\r\n // If non-browser navigator will be undefined\r\n if (!isUndefined(nav) && nav.userAgent) {\r\n var ua = nav.userAgent.toLowerCase();\r\n if ((ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"safari\") >= 0 || ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"firefox\") >= 0) && ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"chrome\") < 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isArrayValid(value) {\r\n return value[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\nexport function setProcessTelemetryTimings(event, identifier) {\r\n var evt = event;\r\n evt[_DYN_TIMINGS /* @min:%2etimings */] = evt[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] = evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */][identifier] = getTime();\r\n}\r\n/**\r\n * Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value\r\n * @param value - The value to determine the type\r\n */\r\nexport function getFieldValueType(value) {\r\n var theType = 0 /* FieldValueSanitizerType.NotSet */;\r\n if (value !== null && value !== undefined) {\r\n var objType = typeof value;\r\n if (objType === \"string\") {\r\n theType = 1 /* FieldValueSanitizerType.String */;\r\n }\r\n else if (objType === \"number\") {\r\n theType = 2 /* FieldValueSanitizerType.Number */;\r\n }\r\n else if (objType === \"boolean\") {\r\n theType = 3 /* FieldValueSanitizerType.Boolean */;\r\n }\r\n else if (objType === strShimObject) {\r\n theType = 4 /* FieldValueSanitizerType.Object */;\r\n if (isArray(value)) {\r\n theType = 4096 /* FieldValueSanitizerType.Array */;\r\n if (value[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Empty arrays are not supported and are considered to be the same as null\r\n theType |= getFieldValueType(value[0]);\r\n }\r\n }\r\n else if (ObjHasOwnProperty.call(value, \"value\")) {\r\n // Looks like an IEventProperty\r\n theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value[_DYN_VALUE /* @min:%2evalue */]);\r\n }\r\n }\r\n }\r\n return theType;\r\n}\r\n/**\r\n * Helper to identify whether we are running in a chromium based browser environment\r\n */\r\nexport function isChromium() {\r\n return !!getGlobalInst(\"chrome\");\r\n}\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n * Check to see if the value is \\> 0\r\n * @param value - The value to check\r\n * @returns true if \\> 0 otherwise false\r\n */\r\nexport function isGreaterThanZero(value) {\r\n return value > 0;\r\n}\r\n//# sourceMappingURL=Utils.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"Utils.js.map","sources":["Utils.js"],"sourcesContent":["var _a;\r\n/**\r\n* Utils.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { arrForEach, getGlobalInst, getNavigator, hasDocument, hasWindow, isArray, isBoolean, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isUndefined, newGuid, objForEachKey, perfNow } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ObjProto, strShimObject } from \"@microsoft/applicationinsights-shims\";\r\nimport { strIndexOf, strLeft } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { _DYN_INDEX_OF, _DYN_LENGTH, _DYN_PROCESS_TELEMETRY_ST0, _DYN_TIMINGS, _DYN_VALUE } from \"./__DynamicConstants\";\r\nexport var Version = '4.3.6-nightly3.2503-01';\r\nexport var FullVersionString = \"1DS-Web-JS-\" + Version;\r\nvar ObjHasOwnProperty = ObjProto.hasOwnProperty;\r\n// Defining here so we don't need to take (import) the ApplicationInsights Common module\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n// If value is array just get the type for the first element\r\nvar _fieldTypeEventPropMap = (_a = {},\r\n _a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,\r\n _a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a);\r\n/**\r\n * @ignore\r\n */\r\n// let _uaDisallowsSameSiteNone = null;\r\nvar uInt8ArraySupported = null;\r\n// var _areCookiesAvailable: boolean | undefined;\r\n/**\r\n * Checks if document object is available\r\n */\r\nexport var isDocumentObjectAvailable = hasDocument();\r\n/**\r\n * Checks if window object is available\r\n */\r\nexport var isWindowObjectAvailable = hasWindow();\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// <summary> takes a value and checks for undefined, null and empty string </summary>\r\n /// <param type=\"any\"> value to be tested </param>\r\n /// <returns> true if value is null undefined or emptyString </returns>\r\n return !(value === STR_EMPTY || isNullOrUndefined(value));\r\n}\r\n/**\r\n * Gets the tenant id from the tenant token.\r\n * @param apiKey - The token from which the tenant id is to be extracted.\r\n * @returns The tenant id.\r\n */\r\nexport function getTenantId(apiKey) {\r\n if (apiKey) {\r\n var indexTenantId = strIndexOf(apiKey, \"-\");\r\n if (indexTenantId > -1) {\r\n return strLeft(apiKey, indexTenantId);\r\n }\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Checks if Uint8Array are available in the current environment. Safari and Firefox along with\r\n * ReactNative are known to not support Uint8Array properly.\r\n * @returns True if available, false otherwise.\r\n */\r\nexport function isUint8ArrayAvailable() {\r\n if (uInt8ArraySupported === null) {\r\n uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();\r\n }\r\n return uInt8ArraySupported;\r\n}\r\n/**\r\n * Checks if the value is a valid EventLatency.\r\n * @param value - The value that needs to be checked.\r\n * @returns True if the value is in AWTEventLatency, false otherwise.\r\n */\r\nexport function isLatency(value) {\r\n if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Sanitizes the Property. It checks the that the property name and value are valid. It also\r\n * checks/populates the correct type and pii of the property value.\r\n * @param name - property name - The property name.\r\n * @param property - The property value or an IEventProperty containing value,\r\n * type ,pii and customer content.\r\n * @returns IEventProperty containing valid name, value, pii and type or null if invalid.\r\n */\r\nexport function sanitizeProperty(name, property, stringifyObjects) {\r\n // Check that property is valid\r\n if ((!property && !isValueAssigned(property)) || typeof name !== \"string\") {\r\n return null;\r\n }\r\n // Perf optimization -- only need to get the type once not multiple times\r\n var propType = typeof property;\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n if (propType === \"string\" || propType === \"number\" || propType === \"boolean\" || isArray(property)) {\r\n property = { value: property };\r\n }\r\n else if (propType === \"object\" && !ObjHasOwnProperty.call(property, \"value\")) {\r\n property = { value: stringifyObjects ? JSON.stringify(property) : property };\r\n }\r\n else if (isNullOrUndefined(property[_DYN_VALUE /* @min:%2evalue */])\r\n || property[_DYN_VALUE /* @min:%2evalue */] === STR_EMPTY || (!isString(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isNumber(property[_DYN_VALUE /* @min:%2evalue */]) && !isBoolean(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isArray(property[_DYN_VALUE /* @min:%2evalue */]))) {\r\n // Since property is IEventProperty, we need to validate its value\r\n return null;\r\n }\r\n // We need to check that if the property value is an array, it is valid\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) &&\r\n !isArrayValid(property[_DYN_VALUE /* @min:%2evalue */])) {\r\n return null;\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property.kind)) {\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property.kind)) {\r\n return null;\r\n }\r\n property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();\r\n }\r\n return property;\r\n}\r\nexport function getCommonSchemaMetaData(value, kind, type) {\r\n var encodedTypeValue = -1;\r\n if (!isUndefined(value)) {\r\n if (kind > 0) {\r\n if (kind === 32 /* eValueKind.CustomerContent_GenericContent */) {\r\n // encode customer content. Value can only be string. bit 13-16 are for cc\r\n encodedTypeValue = (1 << 13);\r\n }\r\n else if (kind <= 13) {\r\n // encode PII. Value can only be string. bits 5-12 are for Pii\r\n encodedTypeValue = (kind << 5);\r\n }\r\n }\r\n // isDataType checks that the \"type\" is a number so we don't need to check for undefined\r\n if (isDataType(type)) {\r\n // Data Type is provided and valid, so use that\r\n if (encodedTypeValue === -1) {\r\n // Don't return -1\r\n encodedTypeValue = 0;\r\n }\r\n encodedTypeValue |= type;\r\n }\r\n else {\r\n var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;\r\n if (encodedTypeValue !== -1 && propType !== -1) {\r\n // pii exists so we must return correct type\r\n encodedTypeValue |= propType;\r\n }\r\n else if (propType === 6 /* eEventPropertyType.Double */) {\r\n encodedTypeValue = propType;\r\n }\r\n }\r\n }\r\n return encodedTypeValue;\r\n}\r\n/**\r\n * Helper to get and decode the cookie value using decodeURIComponent, this is for historical\r\n * backward compatibility where the document.cookie value was decoded before parsing.\r\n * @param cookieMgr - The cookie manager to use\r\n * @param name - The name of the cookie to get\r\n * @param decode - A flag to indicate whether the cookie value should be decoded\r\n * @returns The decoded cookie value (if available) otherwise an empty string.\r\n */\r\nexport function getCookieValue(cookieMgr, name, decode) {\r\n if (decode === void 0) { decode = true; }\r\n var cookieValue;\r\n if (cookieMgr) {\r\n cookieValue = cookieMgr.get(name);\r\n if (decode && cookieValue && decodeURIComponent) {\r\n cookieValue = decodeURIComponent(cookieValue);\r\n }\r\n }\r\n return cookieValue || STR_EMPTY;\r\n}\r\n/**\r\n * Create a new guid.\r\n * @param style - The style of guid to generated, defaults to Digits\r\n * Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000\r\n * Braces - 32 digits separated by hyphens, enclosed in braces: \\{00000000-0000-0000-0000-000000000000\\}\r\n * Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)\r\n * Numeric - 32 digits: 00000000000000000000000000000000\r\n */\r\nexport function createGuid(style) {\r\n if (style === void 0) { style = \"D\" /* GuidStyle.Digits */; }\r\n var theGuid = newGuid();\r\n if (style === \"B\" /* GuidStyle.Braces */) {\r\n theGuid = \"{\" + theGuid + \"}\";\r\n }\r\n else if (style === \"P\" /* GuidStyle.Parentheses */) {\r\n theGuid = \"(\" + theGuid + \")\";\r\n }\r\n else if (style === \"N\" /* GuidStyle.Numeric */) {\r\n theGuid = theGuid.replace(/-/g, STR_EMPTY);\r\n }\r\n return theGuid;\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments[_DYN_LENGTH /* @min:%2elength */];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (isBoolean(theArgs[0])) {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n objForEachKey(obj, function (prop, value) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && value && isObject(value)) {\r\n if (isArray(value)) {\r\n extended[prop] = extended[prop] || [];\r\n arrForEach(value, function (arrayValue, arrayIndex) {\r\n if (arrayValue && isObject(arrayValue)) {\r\n extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);\r\n }\r\n else {\r\n extended[prop][arrayIndex] = arrayValue;\r\n }\r\n });\r\n }\r\n else {\r\n extended[prop] = extend(true, extended[prop], value);\r\n }\r\n }\r\n else {\r\n extended[prop] = value;\r\n }\r\n });\r\n }\r\n return extended;\r\n}\r\nexport var getTime = perfNow;\r\nexport function isValueKind(value) {\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isDataType(value) {\r\n // Remark: 0 returns false, but it doesn't affect encoding anyways\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value >= 0 && value <= 9) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isSafariOrFirefox() {\r\n var nav = getNavigator();\r\n // If non-browser navigator will be undefined\r\n if (!isUndefined(nav) && nav.userAgent) {\r\n var ua = nav.userAgent.toLowerCase();\r\n if ((ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"safari\") >= 0 || ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"firefox\") >= 0) && ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"chrome\") < 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isArrayValid(value) {\r\n return value[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\nexport function setProcessTelemetryTimings(event, identifier) {\r\n var evt = event;\r\n evt[_DYN_TIMINGS /* @min:%2etimings */] = evt[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] = evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */][identifier] = getTime();\r\n}\r\n/**\r\n * Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value\r\n * @param value - The value to determine the type\r\n */\r\nexport function getFieldValueType(value) {\r\n var theType = 0 /* FieldValueSanitizerType.NotSet */;\r\n if (value !== null && value !== undefined) {\r\n var objType = typeof value;\r\n if (objType === \"string\") {\r\n theType = 1 /* FieldValueSanitizerType.String */;\r\n }\r\n else if (objType === \"number\") {\r\n theType = 2 /* FieldValueSanitizerType.Number */;\r\n }\r\n else if (objType === \"boolean\") {\r\n theType = 3 /* FieldValueSanitizerType.Boolean */;\r\n }\r\n else if (objType === strShimObject) {\r\n theType = 4 /* FieldValueSanitizerType.Object */;\r\n if (isArray(value)) {\r\n theType = 4096 /* FieldValueSanitizerType.Array */;\r\n if (value[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Empty arrays are not supported and are considered to be the same as null\r\n theType |= getFieldValueType(value[0]);\r\n }\r\n }\r\n else if (ObjHasOwnProperty.call(value, \"value\")) {\r\n // Looks like an IEventProperty\r\n theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value[_DYN_VALUE /* @min:%2evalue */]);\r\n }\r\n }\r\n }\r\n return theType;\r\n}\r\n/**\r\n * Helper to identify whether we are running in a chromium based browser environment\r\n */\r\nexport function isChromium() {\r\n return !!getGlobalInst(\"chrome\");\r\n}\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n * Check to see if the value is \\> 0\r\n * @param value - The value to check\r\n * @returns true if \\> 0 otherwise false\r\n */\r\nexport function isGreaterThanZero(value) {\r\n return value > 0;\r\n}\r\n//# sourceMappingURL=Utils.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@ import { isNullOrUndefined, isString, objForEachKey } from "@microsoft/applicati
|
|
|
7
7
|
import { arrForEach, arrIncludes, arrIndexOf, getLength } from "@nevware21/ts-utils";
|
|
8
8
|
import { STR_EMPTY } from "./InternalConstants";
|
|
9
9
|
import { getFieldValueType, isValueAssigned, isValueKind } from "./Utils";
|
|
10
|
-
import { _DYN_CAN_HANDLE, _DYN_HANDLE_FIELD,
|
|
10
|
+
import { _DYN_CAN_HANDLE, _DYN_HANDLE_FIELD, _DYN_LENGTH, _DYN_RM_FIELD_SANITIZER, _DYN_RM_SANITIZER, _DYN_VALUE } from "./__DynamicConstants";
|
|
11
11
|
function _isSpecialName(name) {
|
|
12
12
|
return (name == "__proto__" || name == "constructor" || name == "prototype");
|
|
13
13
|
}
|
|
@@ -22,7 +22,6 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
22
22
|
_fieldSanitizers.push(fieldSanitizerProvider);
|
|
23
23
|
}
|
|
24
24
|
function _getFieldSanitizer(path, name) {
|
|
25
|
-
var _a, _b, _c;
|
|
26
25
|
var result;
|
|
27
26
|
var fieldLookup = _sanitizerMap[path];
|
|
28
27
|
if (fieldLookup) {
|
|
@@ -34,10 +33,10 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
34
33
|
if (_fieldSanitizers[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
35
34
|
for (var lp = 0; lp < _fieldSanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
36
35
|
if (_fieldSanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
|
|
37
|
-
result =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
result = {
|
|
37
|
+
canHandle: true,
|
|
38
|
+
fieldHandler: _fieldSanitizers[lp]
|
|
39
|
+
};
|
|
41
40
|
break;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -45,9 +44,9 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
45
44
|
else if (_sanitizers[_DYN_LENGTH /* @min:%2elength */] === 0) {
|
|
46
45
|
// Special use-case where there is no sanitizer to pass on to, so just resolving the field
|
|
47
46
|
// and returning the resulting value (same as sanitizeProperty())
|
|
48
|
-
result =
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
result = {
|
|
48
|
+
canHandle: true
|
|
49
|
+
};
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
// We still don't have a handler so lets lookup the providers
|
|
@@ -56,11 +55,11 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
56
55
|
result = null;
|
|
57
56
|
for (var lp = 0; lp < _sanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
58
57
|
if (_sanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
|
|
59
|
-
result =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
result = {
|
|
59
|
+
canHandle: true,
|
|
60
|
+
handler: _sanitizers[lp],
|
|
61
|
+
fieldHandler: null
|
|
62
|
+
};
|
|
64
63
|
break;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -204,8 +203,8 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
204
203
|
// If either pii or cc is set convert value to string (since only string pii/cc is allowed).
|
|
205
204
|
// If the value is a complex type like an array that can't be converted to string we will drop
|
|
206
205
|
// the property.
|
|
207
|
-
if (!isNullOrUndefined(property
|
|
208
|
-
if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property
|
|
206
|
+
if (!isNullOrUndefined(property.kind)) {
|
|
207
|
+
if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property.kind)) {
|
|
209
208
|
return null;
|
|
210
209
|
}
|
|
211
210
|
// Convert the value to a string and assign back to the original value
|
|
@@ -221,7 +220,7 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
221
220
|
}
|
|
222
221
|
function _callFieldSanitizer(fieldProvider, path, name, theType, property) {
|
|
223
222
|
if (property && fieldProvider) {
|
|
224
|
-
var sanitizer = fieldProvider.getSanitizer(path, name, theType, property
|
|
223
|
+
var sanitizer = fieldProvider.getSanitizer(path, name, theType, property.kind, property.propertyType);
|
|
225
224
|
if (sanitizer) {
|
|
226
225
|
// This is where we the field will call the handler to "scrub" the value. This the primary hook for the ClientHashing Plugin to
|
|
227
226
|
// be able to apply the hashFunc() / Sha256 conversion of the properties value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueSanitizer.js.map","sources":["ValueSanitizer.js"],"sourcesContent":["import { isNullOrUndefined, isString, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport { arrForEach, arrIncludes, arrIndexOf, getLength } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { getFieldValueType, isValueAssigned, isValueKind } from \"./Utils\";\r\nimport { _DYN_CAN_HANDLE, _DYN_HANDLE_FIELD, _DYN_KIND, _DYN_LENGTH, _DYN_RM_FIELD_SANITIZER, _DYN_RM_SANITIZER, _DYN_VALUE } from \"./__DynamicConstants\";\r\nfunction _isSpecialName(name) {\r\n return (name == \"__proto__\" || name == \"constructor\" || name == \"prototype\");\r\n}\r\nvar ValueSanitizer = /** @class */ (function () {\r\n function ValueSanitizer(fieldSanitizerProvider) {\r\n var _self = this;\r\n // To aid with performance this is a lookup map to check if the field value sanitizer supports this field\r\n var _sanitizerMap = {};\r\n var _sanitizers = [];\r\n var _fieldSanitizers = [];\r\n if (fieldSanitizerProvider) {\r\n _fieldSanitizers.push(fieldSanitizerProvider);\r\n }\r\n function _getFieldSanitizer(path, name) {\r\n var _a, _b, _c;\r\n var result;\r\n var fieldLookup = _sanitizerMap[path];\r\n if (fieldLookup) {\r\n result = fieldLookup[name];\r\n }\r\n if (!result && result !== null) {\r\n // Null is a valid result indicating that the value sanitizer does not support this field\r\n if (isString(path) && isString(name)) {\r\n if (_fieldSanitizers[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n for (var lp = 0; lp < _fieldSanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n if (_fieldSanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {\r\n result = (_a = {},\r\n _a[_DYN_CAN_HANDLE /* @min:canHandle */] = true,\r\n _a.fieldHandler = _fieldSanitizers[lp],\r\n _a);\r\n break;\r\n }\r\n }\r\n }\r\n else if (_sanitizers[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n // Special use-case where there is no sanitizer to pass on to, so just resolving the field\r\n // and returning the resulting value (same as sanitizeProperty())\r\n result = (_b = {},\r\n _b[_DYN_CAN_HANDLE /* @min:canHandle */] = true,\r\n _b);\r\n }\r\n }\r\n // We still don't have a handler so lets lookup the providers\r\n if (!result && result !== null) {\r\n // Setting the result to null -- which means we and any contained sanitizers can't handle this field\r\n result = null;\r\n for (var lp = 0; lp < _sanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n if (_sanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {\r\n result = (_c = {},\r\n _c[_DYN_CAN_HANDLE /* @min:canHandle */] = true,\r\n _c.handler = _sanitizers[lp],\r\n _c.fieldHandler = null,\r\n _c);\r\n break;\r\n }\r\n }\r\n }\r\n if (!fieldLookup) {\r\n // Handle edge case to avoid prototype pollution\r\n if (_isSpecialName(path)) {\r\n return null;\r\n }\r\n fieldLookup = _sanitizerMap[path] = {};\r\n }\r\n // Handle edge case to avoid prototype pollution\r\n if (_isSpecialName(name)) {\r\n return null;\r\n }\r\n fieldLookup[name] = result;\r\n }\r\n return result;\r\n }\r\n _self.clearCache = function () {\r\n _sanitizerMap = {};\r\n };\r\n _self.addSanitizer = function (newSanitizer) {\r\n if (newSanitizer) {\r\n if (!arrIncludes(_sanitizers, newSanitizer)) {\r\n _sanitizers.push(newSanitizer);\r\n }\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n };\r\n _self.addFieldSanitizer = function (fieldSanitizer) {\r\n if (fieldSanitizer) {\r\n if (!arrIncludes(_fieldSanitizers, fieldSanitizer)) {\r\n _fieldSanitizers.push(fieldSanitizer);\r\n }\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n };\r\n _self[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] = function (theSanitizer) {\r\n if (theSanitizer) {\r\n var idx = arrIndexOf(_sanitizers, theSanitizer);\r\n if (idx !== -1) {\r\n _sanitizers.splice(idx, 1);\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n // Try and remove the sanitizer from any chained sanitizer as well\r\n arrForEach(_sanitizers, function (sanitizer) {\r\n sanitizer && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */](theSanitizer);\r\n });\r\n }\r\n };\r\n _self[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] = function (theFieldSanitizer) {\r\n if (theFieldSanitizer) {\r\n var idx = arrIndexOf(_fieldSanitizers, theFieldSanitizer);\r\n if (idx !== -1) {\r\n _fieldSanitizers.splice(idx, 1);\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n // Try and remove the field sanitizer from any chained sanitizer as well\r\n arrForEach(_sanitizers, function (sanitizer) {\r\n sanitizer && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */](theFieldSanitizer);\r\n });\r\n }\r\n };\r\n _self.isEmpty = function () {\r\n return (getLength(_sanitizers) + getLength(_fieldSanitizers)) === 0;\r\n };\r\n _self[_DYN_HANDLE_FIELD /* @min:%2ehandleField */] = function (path, name) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n return mapValue ? mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */] : false;\r\n };\r\n _self[_DYN_VALUE /* @min:%2evalue */] = function (path, name, value, stringifyObjects) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n if (mapValue && mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n if (!mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n return null;\r\n }\r\n if (mapValue.handler) {\r\n // This value sanitizer can't handle this field so pass it only the next one\r\n return mapValue.handler[_DYN_VALUE /* @min:%2evalue */](path, name, value, stringifyObjects);\r\n }\r\n // Check that property is valid\r\n if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {\r\n return null;\r\n }\r\n var property = null;\r\n var fieldType = getFieldValueType(value);\r\n if ((fieldType & 8192 /* FieldValueSanitizerType.EventProperty */) === 8192 /* FieldValueSanitizerType.EventProperty */) {\r\n var subType = fieldType & ~8192 /* FieldValueSanitizerType.EventProperty */;\r\n property = value;\r\n if (!isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */]) ||\r\n (subType !== 1 /* FieldValueSanitizerType.String */ &&\r\n subType !== 2 /* FieldValueSanitizerType.Number */ &&\r\n subType !== 3 /* FieldValueSanitizerType.Boolean */ &&\r\n (subType & 4096 /* FieldValueSanitizerType.Array */) !== 4096 /* FieldValueSanitizerType.Array */)) {\r\n // Not a supported IEventProperty type to be able to sanitize\r\n return null;\r\n }\r\n }\r\n else if (fieldType === 1 /* FieldValueSanitizerType.String */ ||\r\n fieldType === 2 /* FieldValueSanitizerType.Number */ ||\r\n fieldType === 3 /* FieldValueSanitizerType.Boolean */ ||\r\n (fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */) {\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n property = _convertToProperty(path, name, value);\r\n }\r\n else if (fieldType === 4 /* FieldValueSanitizerType.Object */) {\r\n property = _convertToProperty(path, name, !!stringifyObjects ? JSON.stringify(value) : value);\r\n }\r\n if (property) {\r\n return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);\r\n }\r\n }\r\n return null;\r\n };\r\n _self.property = function (path, name, property, stringifyObjects) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n return null;\r\n }\r\n // Check that property is valid\r\n if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */])) {\r\n return null;\r\n }\r\n var fieldType = getFieldValueType(property[_DYN_VALUE /* @min:%2evalue */]);\r\n if (fieldType === 0 /* FieldValueSanitizerType.NotSet */) {\r\n // Not a supported field that we can sanitize or serialize\r\n return null;\r\n }\r\n return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);\r\n };\r\n function _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects) {\r\n if (mapValue.handler) {\r\n // This value sanitizer can't handle this field so pass it only the next one\r\n return mapValue.handler.property(path, name, property, stringifyObjects);\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property[_DYN_KIND /* @min:%2ekind */])) {\r\n if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property[_DYN_KIND /* @min:%2ekind */])) {\r\n return null;\r\n }\r\n // Convert the value to a string and assign back to the original value\r\n property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();\r\n }\r\n return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);\r\n }\r\n function _convertToProperty(path, name, value) {\r\n if (isValueAssigned(value)) {\r\n return { value: value };\r\n }\r\n return null;\r\n }\r\n function _callFieldSanitizer(fieldProvider, path, name, theType, property) {\r\n if (property && fieldProvider) {\r\n var sanitizer = fieldProvider.getSanitizer(path, name, theType, property[_DYN_KIND /* @min:%2ekind */], property.propertyType);\r\n if (sanitizer) {\r\n // This is where we the field will call the handler to \"scrub\" the value. This the primary hook for the ClientHashing Plugin to\r\n // be able to apply the hashFunc() / Sha256 conversion of the properties value\r\n if (theType === 4 /* FieldValueSanitizerType.Object */) {\r\n // Special case of an embedded object (ext.metadata, data.properties)\r\n var newValue_1 = {};\r\n var propValue = property[_DYN_VALUE /* @min:%2evalue */];\r\n objForEachKey(propValue, function (propKey, theValue) {\r\n var newPath = path + \".\" + name;\r\n if (isValueAssigned(theValue)) {\r\n var newProp = _convertToProperty(newPath, propKey, theValue);\r\n newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);\r\n if (newProp) {\r\n newValue_1[propKey] = newProp[_DYN_VALUE /* @min:%2evalue */];\r\n }\r\n }\r\n });\r\n property[_DYN_VALUE /* @min:%2evalue */] = newValue_1;\r\n }\r\n else {\r\n var details = {\r\n path: path,\r\n name: name,\r\n type: theType,\r\n prop: property,\r\n sanitizer: _self\r\n };\r\n property = sanitizer.call(_self, details);\r\n }\r\n }\r\n }\r\n return property;\r\n }\r\n }\r\n ValueSanitizer.getFieldType = getFieldValueType;\r\n return ValueSanitizer;\r\n}());\r\nexport { ValueSanitizer };\r\n//# sourceMappingURL=ValueSanitizer.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"ValueSanitizer.js.map","sources":["ValueSanitizer.js"],"sourcesContent":["import { isNullOrUndefined, isString, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport { arrForEach, arrIncludes, arrIndexOf, getLength } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { getFieldValueType, isValueAssigned, isValueKind } from \"./Utils\";\r\nimport { _DYN_CAN_HANDLE, _DYN_HANDLE_FIELD, _DYN_LENGTH, _DYN_RM_FIELD_SANITIZER, _DYN_RM_SANITIZER, _DYN_VALUE } from \"./__DynamicConstants\";\r\nfunction _isSpecialName(name) {\r\n return (name == \"__proto__\" || name == \"constructor\" || name == \"prototype\");\r\n}\r\nvar ValueSanitizer = /** @class */ (function () {\r\n function ValueSanitizer(fieldSanitizerProvider) {\r\n var _self = this;\r\n // To aid with performance this is a lookup map to check if the field value sanitizer supports this field\r\n var _sanitizerMap = {};\r\n var _sanitizers = [];\r\n var _fieldSanitizers = [];\r\n if (fieldSanitizerProvider) {\r\n _fieldSanitizers.push(fieldSanitizerProvider);\r\n }\r\n function _getFieldSanitizer(path, name) {\r\n var result;\r\n var fieldLookup = _sanitizerMap[path];\r\n if (fieldLookup) {\r\n result = fieldLookup[name];\r\n }\r\n if (!result && result !== null) {\r\n // Null is a valid result indicating that the value sanitizer does not support this field\r\n if (isString(path) && isString(name)) {\r\n if (_fieldSanitizers[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n for (var lp = 0; lp < _fieldSanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n if (_fieldSanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {\r\n result = {\r\n canHandle: true,\r\n fieldHandler: _fieldSanitizers[lp]\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n else if (_sanitizers[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n // Special use-case where there is no sanitizer to pass on to, so just resolving the field\r\n // and returning the resulting value (same as sanitizeProperty())\r\n result = {\r\n canHandle: true\r\n };\r\n }\r\n }\r\n // We still don't have a handler so lets lookup the providers\r\n if (!result && result !== null) {\r\n // Setting the result to null -- which means we and any contained sanitizers can't handle this field\r\n result = null;\r\n for (var lp = 0; lp < _sanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n if (_sanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {\r\n result = {\r\n canHandle: true,\r\n handler: _sanitizers[lp],\r\n fieldHandler: null\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n if (!fieldLookup) {\r\n // Handle edge case to avoid prototype pollution\r\n if (_isSpecialName(path)) {\r\n return null;\r\n }\r\n fieldLookup = _sanitizerMap[path] = {};\r\n }\r\n // Handle edge case to avoid prototype pollution\r\n if (_isSpecialName(name)) {\r\n return null;\r\n }\r\n fieldLookup[name] = result;\r\n }\r\n return result;\r\n }\r\n _self.clearCache = function () {\r\n _sanitizerMap = {};\r\n };\r\n _self.addSanitizer = function (newSanitizer) {\r\n if (newSanitizer) {\r\n if (!arrIncludes(_sanitizers, newSanitizer)) {\r\n _sanitizers.push(newSanitizer);\r\n }\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n };\r\n _self.addFieldSanitizer = function (fieldSanitizer) {\r\n if (fieldSanitizer) {\r\n if (!arrIncludes(_fieldSanitizers, fieldSanitizer)) {\r\n _fieldSanitizers.push(fieldSanitizer);\r\n }\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n };\r\n _self[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] = function (theSanitizer) {\r\n if (theSanitizer) {\r\n var idx = arrIndexOf(_sanitizers, theSanitizer);\r\n if (idx !== -1) {\r\n _sanitizers.splice(idx, 1);\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n // Try and remove the sanitizer from any chained sanitizer as well\r\n arrForEach(_sanitizers, function (sanitizer) {\r\n sanitizer && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */](theSanitizer);\r\n });\r\n }\r\n };\r\n _self[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] = function (theFieldSanitizer) {\r\n if (theFieldSanitizer) {\r\n var idx = arrIndexOf(_fieldSanitizers, theFieldSanitizer);\r\n if (idx !== -1) {\r\n _fieldSanitizers.splice(idx, 1);\r\n // Invalidate any previously mapped fields\r\n _sanitizerMap = {};\r\n }\r\n // Try and remove the field sanitizer from any chained sanitizer as well\r\n arrForEach(_sanitizers, function (sanitizer) {\r\n sanitizer && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */](theFieldSanitizer);\r\n });\r\n }\r\n };\r\n _self.isEmpty = function () {\r\n return (getLength(_sanitizers) + getLength(_fieldSanitizers)) === 0;\r\n };\r\n _self[_DYN_HANDLE_FIELD /* @min:%2ehandleField */] = function (path, name) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n return mapValue ? mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */] : false;\r\n };\r\n _self[_DYN_VALUE /* @min:%2evalue */] = function (path, name, value, stringifyObjects) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n if (mapValue && mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n if (!mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n return null;\r\n }\r\n if (mapValue.handler) {\r\n // This value sanitizer can't handle this field so pass it only the next one\r\n return mapValue.handler[_DYN_VALUE /* @min:%2evalue */](path, name, value, stringifyObjects);\r\n }\r\n // Check that property is valid\r\n if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {\r\n return null;\r\n }\r\n var property = null;\r\n var fieldType = getFieldValueType(value);\r\n if ((fieldType & 8192 /* FieldValueSanitizerType.EventProperty */) === 8192 /* FieldValueSanitizerType.EventProperty */) {\r\n var subType = fieldType & ~8192 /* FieldValueSanitizerType.EventProperty */;\r\n property = value;\r\n if (!isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */]) ||\r\n (subType !== 1 /* FieldValueSanitizerType.String */ &&\r\n subType !== 2 /* FieldValueSanitizerType.Number */ &&\r\n subType !== 3 /* FieldValueSanitizerType.Boolean */ &&\r\n (subType & 4096 /* FieldValueSanitizerType.Array */) !== 4096 /* FieldValueSanitizerType.Array */)) {\r\n // Not a supported IEventProperty type to be able to sanitize\r\n return null;\r\n }\r\n }\r\n else if (fieldType === 1 /* FieldValueSanitizerType.String */ ||\r\n fieldType === 2 /* FieldValueSanitizerType.Number */ ||\r\n fieldType === 3 /* FieldValueSanitizerType.Boolean */ ||\r\n (fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */) {\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n property = _convertToProperty(path, name, value);\r\n }\r\n else if (fieldType === 4 /* FieldValueSanitizerType.Object */) {\r\n property = _convertToProperty(path, name, !!stringifyObjects ? JSON.stringify(value) : value);\r\n }\r\n if (property) {\r\n return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);\r\n }\r\n }\r\n return null;\r\n };\r\n _self.property = function (path, name, property, stringifyObjects) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {\r\n return null;\r\n }\r\n // Check that property is valid\r\n if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */])) {\r\n return null;\r\n }\r\n var fieldType = getFieldValueType(property[_DYN_VALUE /* @min:%2evalue */]);\r\n if (fieldType === 0 /* FieldValueSanitizerType.NotSet */) {\r\n // Not a supported field that we can sanitize or serialize\r\n return null;\r\n }\r\n return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);\r\n };\r\n function _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects) {\r\n if (mapValue.handler) {\r\n // This value sanitizer can't handle this field so pass it only the next one\r\n return mapValue.handler.property(path, name, property, stringifyObjects);\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property.kind)) {\r\n if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property.kind)) {\r\n return null;\r\n }\r\n // Convert the value to a string and assign back to the original value\r\n property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();\r\n }\r\n return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);\r\n }\r\n function _convertToProperty(path, name, value) {\r\n if (isValueAssigned(value)) {\r\n return { value: value };\r\n }\r\n return null;\r\n }\r\n function _callFieldSanitizer(fieldProvider, path, name, theType, property) {\r\n if (property && fieldProvider) {\r\n var sanitizer = fieldProvider.getSanitizer(path, name, theType, property.kind, property.propertyType);\r\n if (sanitizer) {\r\n // This is where we the field will call the handler to \"scrub\" the value. This the primary hook for the ClientHashing Plugin to\r\n // be able to apply the hashFunc() / Sha256 conversion of the properties value\r\n if (theType === 4 /* FieldValueSanitizerType.Object */) {\r\n // Special case of an embedded object (ext.metadata, data.properties)\r\n var newValue_1 = {};\r\n var propValue = property[_DYN_VALUE /* @min:%2evalue */];\r\n objForEachKey(propValue, function (propKey, theValue) {\r\n var newPath = path + \".\" + name;\r\n if (isValueAssigned(theValue)) {\r\n var newProp = _convertToProperty(newPath, propKey, theValue);\r\n newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);\r\n if (newProp) {\r\n newValue_1[propKey] = newProp[_DYN_VALUE /* @min:%2evalue */];\r\n }\r\n }\r\n });\r\n property[_DYN_VALUE /* @min:%2evalue */] = newValue_1;\r\n }\r\n else {\r\n var details = {\r\n path: path,\r\n name: name,\r\n type: theType,\r\n prop: property,\r\n sanitizer: _self\r\n };\r\n property = sanitizer.call(_self, details);\r\n }\r\n }\r\n }\r\n return property;\r\n }\r\n }\r\n ValueSanitizer.getFieldType = getFieldValueType;\r\n return ValueSanitizer;\r\n}());\r\nexport { ValueSanitizer };\r\n//# sourceMappingURL=ValueSanitizer.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -9,20 +9,18 @@
|
|
|
9
9
|
// ##############################################################
|
|
10
10
|
// AUTO GENERATED FILE: This file is Auto Generated during build.
|
|
11
11
|
// ##############################################################
|
|
12
|
-
//
|
|
13
|
-
// Note: DON'T Export these const from the package as we are still targeting
|
|
14
|
-
//
|
|
12
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
13
|
+
// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!
|
|
14
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
15
15
|
export var _DYN_INITIALIZE = "initialize"; // Count: 4
|
|
16
|
-
export var _DYN_LOGGER = "logger"; // Count: 4
|
|
17
16
|
export var _DYN_INDEX_OF = "indexOf"; // Count: 4
|
|
18
17
|
export var _DYN_TIMINGS = "timings"; // Count: 4
|
|
19
18
|
export var _DYN_POLL_INTERNAL_LOGS = "pollInternalLogs"; // Count: 4
|
|
20
19
|
export var _DYN_VALUE = "value"; // Count: 20
|
|
21
|
-
export var _DYN_KIND = "kind"; // Count: 5
|
|
22
20
|
export var _DYN_LENGTH = "length"; // Count: 7
|
|
23
21
|
export var _DYN_PROCESS_TELEMETRY_ST0 = "processTelemetryStart"; // Count: 3
|
|
24
22
|
export var _DYN_HANDLE_FIELD = "handleField"; // Count: 3
|
|
25
23
|
export var _DYN_RM_SANITIZER = "rmSanitizer"; // Count: 3
|
|
26
24
|
export var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer"; // Count: 3
|
|
27
|
-
export var _DYN_CAN_HANDLE = "canHandle"; // Count:
|
|
25
|
+
export var _DYN_CAN_HANDLE = "canHandle"; // Count: 4
|
|
28
26
|
//# sourceMappingURL=__DynamicConstants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n//
|
|
1
|
+
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_INDEX_OF = \"indexOf\"; // Count: 4\r\nexport var _DYN_TIMINGS = \"timings\"; // Count: 4\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 4\r\nexport var _DYN_VALUE = \"value\"; // Count: 20\r\nexport var _DYN_LENGTH = \"length\"; // Count: 7\r\nexport var _DYN_PROCESS_TELEMETRY_ST0 = \"processTelemetryStart\"; // Count: 3\r\nexport var _DYN_HANDLE_FIELD = \"handleField\"; // Count: 3\r\nexport var _DYN_RM_SANITIZER = \"rmSanitizer\"; // Count: 3\r\nexport var _DYN_RM_FIELD_SANITIZER = \"rmFieldSanitizer\"; // Count: 3\r\nexport var _DYN_CAN_HANDLE = \"canHandle\"; // Count: 4\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/1ds-core-js",
|
|
3
|
-
"version": "4.3.6-nightly3.
|
|
3
|
+
"version": "4.3.6-nightly3.2503-01",
|
|
4
4
|
"description": "Microsoft Application Insights JavaScript SDK - 1ds-core-js",
|
|
5
5
|
"author": "Microsoft Application Insights Team",
|
|
6
6
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@microsoft/applicationinsights-shims": "3.0.1",
|
|
40
|
-
"@microsoft/applicationinsights-core-js": "3.3.6-nightly3.
|
|
40
|
+
"@microsoft/applicationinsights-core-js": "3.3.6-nightly3.2503-01",
|
|
41
41
|
"@microsoft/dynamicproto-js": "^2.0.3",
|
|
42
|
-
"@nevware21/ts-utils": ">= 0.11.
|
|
42
|
+
"@nevware21/ts-utils": ">= 0.11.8 < 2.x",
|
|
43
43
|
"@nevware21/ts-async": ">= 0.5.4 < 2.x"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
package/types/1ds-core-js.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -1320,7 +1320,7 @@ export declare class ValueSanitizer implements IValueSanitizer {
|
|
|
1320
1320
|
constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
-
export declare const Version = "4.3.6-nightly3.
|
|
1323
|
+
export declare const Version = "4.3.6-nightly3.2503-01";
|
|
1324
1324
|
|
|
1325
1325
|
export { _warnToConsole }
|
|
1326
1326
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.3.6-nightly3.
|
|
2
|
+
* 1DS JS SDK Core, 4.3.6-nightly3.2503-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -5212,7 +5212,7 @@ declare namespace oneDS {
|
|
|
5212
5212
|
constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
|
|
5213
5213
|
}
|
|
5214
5214
|
|
|
5215
|
-
const Version = "4.3.6-nightly3.
|
|
5215
|
+
const Version = "4.3.6-nightly3.2503-01";
|
|
5216
5216
|
|
|
5217
5217
|
/**
|
|
5218
5218
|
* This is a helper method which will call warnToConsole on the passed logger with the provided message.
|