@microsoft/1ds-core-js 4.0.1 → 4.0.2-nightly3.2307-25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -28
- package/bundle/es5/{ms.core-4.0.1.gbl.js → ms.core-4.0.2-nightly3.2307-25.gbl.js} +392 -373
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.gbl.js.map +1 -0
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.gbl.min.js +7 -0
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.gbl.min.js.map +1 -0
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.integrity.json +46 -0
- package/bundle/es5/{ms.core-4.0.1.js → ms.core-4.0.2-nightly3.2307-25.js} +392 -373
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.js.map +1 -0
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.min.js +7 -0
- package/bundle/es5/ms.core-4.0.2-nightly3.2307-25.min.js.map +1 -0
- package/bundle/es5/ms.core.gbl.js +391 -372
- 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 +391 -372
- 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 +389 -370
- 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 +18 -14
- package/dist-es5/AppInsightsCore.js.map +1 -1
- package/dist-es5/BaseCore.js +8 -8
- package/dist-es5/BaseCore.js.map +1 -1
- package/dist-es5/DataModels.js +1 -1
- package/dist-es5/Enums.js +2 -2
- package/dist-es5/Enums.js.map +1 -1
- package/dist-es5/Index.js +7 -7
- package/dist-es5/Index.js.map +1 -1
- package/dist-es5/InternalConstants.js +1 -1
- package/dist-es5/Utils.js +20 -19
- package/dist-es5/Utils.js.map +1 -1
- package/dist-es5/ValueSanitizer.js +29 -28
- package/dist-es5/ValueSanitizer.js.map +1 -1
- package/dist-es5/__DynamicConstants.js +28 -0
- package/dist-es5/__DynamicConstants.js.map +1 -0
- package/package.json +41 -22
- package/types/1ds-core-js.d.ts +14 -22
- package/types/1ds-core-js.namespaced.d.ts +11 -19
- package/bundle/es5/ms.core-4.0.1.gbl.js.map +0 -1
- package/bundle/es5/ms.core-4.0.1.gbl.min.js +0 -7
- package/bundle/es5/ms.core-4.0.1.gbl.min.js.map +0 -1
- package/bundle/es5/ms.core-4.0.1.integrity.json +0 -46
- package/bundle/es5/ms.core-4.0.1.js.map +0 -1
- package/bundle/es5/ms.core-4.0.1.min.js +0 -7
- package/bundle/es5/ms.core-4.0.1.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.0.
|
|
2
|
+
* 1DS JS SDK Core, 4.0.2-nightly3.2307-25
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -7,6 +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, _DYN_KIND, _DYN_LENGTH, _DYN_RM_FIELD_SANITIZER, _DYN_RM_SANITIZER, _DYN_VALUE } from "./__DynamicConstants";
|
|
10
11
|
var ValueSanitizer = /** @class */ (function () {
|
|
11
12
|
function ValueSanitizer(fieldSanitizerProvider) {
|
|
12
13
|
var _self = this;
|
|
@@ -26,9 +27,9 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
26
27
|
if (!result && result !== null) {
|
|
27
28
|
// Null is a valid result indicating that the value sanitizer does not support this field
|
|
28
29
|
if (isString(path) && isString(name)) {
|
|
29
|
-
if (_fieldSanitizers
|
|
30
|
-
for (var lp = 0; lp < _fieldSanitizers
|
|
31
|
-
if (_fieldSanitizers[lp]
|
|
30
|
+
if (_fieldSanitizers[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
31
|
+
for (var lp = 0; lp < _fieldSanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
32
|
+
if (_fieldSanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
|
|
32
33
|
result = {
|
|
33
34
|
canHandle: true,
|
|
34
35
|
fieldHandler: _fieldSanitizers[lp]
|
|
@@ -37,7 +38,7 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
else if (_sanitizers
|
|
41
|
+
else if (_sanitizers[_DYN_LENGTH /* @min:%2elength */] === 0) {
|
|
41
42
|
// Special use-case where there is no sanitizer to pass on to, so just resolving the field
|
|
42
43
|
// and returning the resulting value (same as sanitizeProperty())
|
|
43
44
|
result = {
|
|
@@ -49,8 +50,8 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
49
50
|
if (!result && result !== null) {
|
|
50
51
|
// Setting the result to null -- which means we and any contained sanitizers can't handle this field
|
|
51
52
|
result = null;
|
|
52
|
-
for (var lp = 0; lp < _sanitizers
|
|
53
|
-
if (_sanitizers[lp]
|
|
53
|
+
for (var lp = 0; lp < _sanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
54
|
+
if (_sanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
|
|
54
55
|
result = {
|
|
55
56
|
canHandle: true,
|
|
56
57
|
handler: _sanitizers[lp],
|
|
@@ -88,7 +89,7 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
88
89
|
_sanitizerMap = {};
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
|
-
_self
|
|
92
|
+
_self[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] = function (theSanitizer) {
|
|
92
93
|
if (theSanitizer) {
|
|
93
94
|
var idx = arrIndexOf(_sanitizers, theSanitizer);
|
|
94
95
|
if (idx !== -1) {
|
|
@@ -98,11 +99,11 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
98
99
|
}
|
|
99
100
|
// Try and remove the sanitizer from any chained sanitizer as well
|
|
100
101
|
arrForEach(_sanitizers, function (sanitizer) {
|
|
101
|
-
sanitizer && sanitizer
|
|
102
|
+
sanitizer && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */](theSanitizer);
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
};
|
|
105
|
-
_self
|
|
106
|
+
_self[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] = function (theFieldSanitizer) {
|
|
106
107
|
if (theFieldSanitizer) {
|
|
107
108
|
var idx = arrIndexOf(_fieldSanitizers, theFieldSanitizer);
|
|
108
109
|
if (idx !== -1) {
|
|
@@ -112,26 +113,26 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
112
113
|
}
|
|
113
114
|
// Try and remove the field sanitizer from any chained sanitizer as well
|
|
114
115
|
arrForEach(_sanitizers, function (sanitizer) {
|
|
115
|
-
sanitizer && sanitizer
|
|
116
|
+
sanitizer && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */](theFieldSanitizer);
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
_self.isEmpty = function () {
|
|
120
121
|
return (getLength(_sanitizers) + getLength(_fieldSanitizers)) === 0;
|
|
121
122
|
};
|
|
122
|
-
_self
|
|
123
|
+
_self[_DYN_HANDLE_FIELD /* @min:%2ehandleField */] = function (path, name) {
|
|
123
124
|
var mapValue = _getFieldSanitizer(path, name);
|
|
124
|
-
return mapValue ? mapValue
|
|
125
|
+
return mapValue ? mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */] : false;
|
|
125
126
|
};
|
|
126
|
-
_self
|
|
127
|
+
_self[_DYN_VALUE /* @min:%2evalue */] = function (path, name, value, stringifyObjects) {
|
|
127
128
|
var mapValue = _getFieldSanitizer(path, name);
|
|
128
|
-
if (mapValue && mapValue
|
|
129
|
-
if (!mapValue || !mapValue
|
|
129
|
+
if (mapValue && mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
|
|
130
|
+
if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
132
133
|
if (mapValue.handler) {
|
|
133
134
|
// This value sanitizer can't handle this field so pass it only the next one
|
|
134
|
-
return mapValue.handler
|
|
135
|
+
return mapValue.handler[_DYN_VALUE /* @min:%2evalue */](path, name, value, stringifyObjects);
|
|
135
136
|
}
|
|
136
137
|
// Check that property is valid
|
|
137
138
|
if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {
|
|
@@ -142,7 +143,7 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
142
143
|
if ((fieldType & 8192 /* FieldValueSanitizerType.EventProperty */) === 8192 /* FieldValueSanitizerType.EventProperty */) {
|
|
143
144
|
var subType = fieldType & ~8192 /* FieldValueSanitizerType.EventProperty */;
|
|
144
145
|
property = value;
|
|
145
|
-
if (!isValueAssigned(property
|
|
146
|
+
if (!isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */]) ||
|
|
146
147
|
(subType !== 1 /* FieldValueSanitizerType.String */ &&
|
|
147
148
|
subType !== 2 /* FieldValueSanitizerType.Number */ &&
|
|
148
149
|
subType !== 3 /* FieldValueSanitizerType.Boolean */ &&
|
|
@@ -169,14 +170,14 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
169
170
|
};
|
|
170
171
|
_self.property = function (path, name, property, stringifyObjects) {
|
|
171
172
|
var mapValue = _getFieldSanitizer(path, name);
|
|
172
|
-
if (!mapValue || !mapValue
|
|
173
|
+
if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
175
176
|
// Check that property is valid
|
|
176
|
-
if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property
|
|
177
|
+
if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */])) {
|
|
177
178
|
return null;
|
|
178
179
|
}
|
|
179
|
-
var fieldType = getFieldValueType(property
|
|
180
|
+
var fieldType = getFieldValueType(property[_DYN_VALUE /* @min:%2evalue */]);
|
|
180
181
|
if (fieldType === 0 /* FieldValueSanitizerType.NotSet */) {
|
|
181
182
|
// Not a supported field that we can sanitize or serialize
|
|
182
183
|
return null;
|
|
@@ -191,12 +192,12 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
191
192
|
// If either pii or cc is set convert value to string (since only string pii/cc is allowed).
|
|
192
193
|
// If the value is a complex type like an array that can't be converted to string we will drop
|
|
193
194
|
// the property.
|
|
194
|
-
if (!isNullOrUndefined(property
|
|
195
|
-
if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property
|
|
195
|
+
if (!isNullOrUndefined(property[_DYN_KIND /* @min:%2ekind */])) {
|
|
196
|
+
if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property[_DYN_KIND /* @min:%2ekind */])) {
|
|
196
197
|
return null;
|
|
197
198
|
}
|
|
198
199
|
// Convert the value to a string and assign back to the original value
|
|
199
|
-
property
|
|
200
|
+
property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();
|
|
200
201
|
}
|
|
201
202
|
return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);
|
|
202
203
|
}
|
|
@@ -208,25 +209,25 @@ var ValueSanitizer = /** @class */ (function () {
|
|
|
208
209
|
}
|
|
209
210
|
function _callFieldSanitizer(fieldProvider, path, name, theType, property) {
|
|
210
211
|
if (property && fieldProvider) {
|
|
211
|
-
var sanitizer = fieldProvider.getSanitizer(path, name, theType, property
|
|
212
|
+
var sanitizer = fieldProvider.getSanitizer(path, name, theType, property[_DYN_KIND /* @min:%2ekind */], property.propertyType);
|
|
212
213
|
if (sanitizer) {
|
|
213
214
|
// This is where we the field will call the handler to "scrub" the value. This the primary hook for the ClientHashing Plugin to
|
|
214
215
|
// be able to apply the hashFunc() / Sha256 conversion of the properties value
|
|
215
216
|
if (theType === 4 /* FieldValueSanitizerType.Object */) {
|
|
216
217
|
// Special case of an embedded object (ext.metadata, data.properties)
|
|
217
218
|
var newValue_1 = {};
|
|
218
|
-
var propValue = property
|
|
219
|
+
var propValue = property[_DYN_VALUE /* @min:%2evalue */];
|
|
219
220
|
objForEachKey(propValue, function (propKey, theValue) {
|
|
220
221
|
var newPath = path + "." + name;
|
|
221
222
|
if (isValueAssigned(theValue)) {
|
|
222
223
|
var newProp = _convertToProperty(newPath, propKey, theValue);
|
|
223
224
|
newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);
|
|
224
225
|
if (newProp) {
|
|
225
|
-
newValue_1[propKey] = newProp
|
|
226
|
+
newValue_1[propKey] = newProp[_DYN_VALUE /* @min:%2evalue */];
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
});
|
|
229
|
-
property
|
|
230
|
+
property[_DYN_VALUE /* @min:%2evalue */] = newValue_1;
|
|
230
231
|
}
|
|
231
232
|
else {
|
|
232
233
|
var details = {
|
|
@@ -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\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.length > 0) {\r\n for (var lp = 0; lp < _fieldSanitizers.length; lp++) {\r\n if (_fieldSanitizers[lp].handleField(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.length === 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.length; lp++) {\r\n if (_sanitizers[lp].handleField(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 fieldLookup = _sanitizerMap[path] = {};\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.rmSanitizer = 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.rmSanitizer && sanitizer.rmSanitizer(theSanitizer);\r\n });\r\n }\r\n };\r\n _self.rmFieldSanitizer = 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.rmFieldSanitizer && sanitizer.rmFieldSanitizer(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.handleField = function (path, name) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n return mapValue ? mapValue.canHandle : false;\r\n };\r\n _self.value = function (path, name, value, stringifyObjects) {\r\n var mapValue = _getFieldSanitizer(path, name);\r\n if (mapValue && mapValue.canHandle) {\r\n if (!mapValue || !mapValue.canHandle) {\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.value(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.value) ||\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.canHandle) {\r\n return null;\r\n }\r\n // Check that property is valid\r\n if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property.value)) {\r\n return null;\r\n }\r\n var fieldType = getFieldValueType(property.value);\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.value = property.value.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.value;\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.value;\r\n }\r\n }\r\n });\r\n property.value = 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"}
|
|
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\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 fieldLookup = _sanitizerMap[path] = {};\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 || !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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 1DS JS SDK Core, 4.0.2-nightly3.2307-25
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
* (Microsoft Internal Only)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Licensed under the MIT License.
|
|
8
|
+
// @skip-file-minify
|
|
9
|
+
// ##############################################################
|
|
10
|
+
// AUTO GENERATED FILE: This file is Auto Generated during build.
|
|
11
|
+
// ##############################################################
|
|
12
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
13
|
+
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
|
|
14
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
15
|
+
export var _DYN_INITIALIZE = "initialize"; // Count: 4
|
|
16
|
+
export var _DYN_LOGGER = "logger"; // Count: 4
|
|
17
|
+
export var _DYN_INDEX_OF = "indexOf"; // Count: 4
|
|
18
|
+
export var _DYN_TIMINGS = "timings"; // Count: 4
|
|
19
|
+
export var _DYN_POLL_INTERNAL_LOGS = "pollInternalLogs"; // Count: 4
|
|
20
|
+
export var _DYN_VALUE = "value"; // Count: 20
|
|
21
|
+
export var _DYN_KIND = "kind"; // Count: 5
|
|
22
|
+
export var _DYN_LENGTH = "length"; // Count: 7
|
|
23
|
+
export var _DYN_PROCESS_TELEMETRY_ST0 = "processTelemetryStart"; // Count: 3
|
|
24
|
+
export var _DYN_HANDLE_FIELD = "handleField"; // Count: 3
|
|
25
|
+
export var _DYN_RM_SANITIZER = "rmSanitizer"; // Count: 3
|
|
26
|
+
export var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer"; // Count: 3
|
|
27
|
+
export var _DYN_CAN_HANDLE = "canHandle"; // Count: 7
|
|
28
|
+
//# sourceMappingURL=__DynamicConstants.js.map
|
|
@@ -0,0 +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// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_LOGGER = \"logger\"; // 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_KIND = \"kind\"; // Count: 5\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: 7\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;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,53 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/1ds-core-js",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "Microsoft Application Insights JavaScript SDK - 1ds-core-js
|
|
3
|
+
"version": "4.0.2-nightly3.2307-25",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"clean": "git clean -xdf",
|
|
11
|
+
"build": "npm run build:esm && npm run build:browser && npm run dtsgen && npm run sri",
|
|
12
|
+
"build:esm": "grunt 1dsCoreBuild",
|
|
13
|
+
"build:browser": "npx rollup -c rollup.config.js --bundleConfigAsCjs",
|
|
14
|
+
"rebuild": "npm run build",
|
|
15
|
+
"ai-min": "grunt 1dsCore-min",
|
|
16
|
+
"ai-restore": "grunt 1dsCore-restore",
|
|
17
|
+
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"1DS JS SDK Core\" -oneDs",
|
|
18
|
+
"test": "grunt 1dsCoreTest",
|
|
19
|
+
"mintest": "grunt 1dsCoreMinTest",
|
|
20
|
+
"perftest": "",
|
|
13
21
|
"publishPackage": "npm publish",
|
|
14
|
-
"docs": "typedoc --out docs docs --excludePrivate --excludeProtected --tsconfig lib/tsconfig.json --theme minimal",
|
|
15
22
|
"sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
|
|
16
|
-
"npm-pack": "npm pack"
|
|
17
|
-
|
|
18
|
-
"publishConfig": {
|
|
19
|
-
"registry": "https://registry.npmjs.org"
|
|
23
|
+
"npm-pack": "npm pack",
|
|
24
|
+
"api-docs": "typedoc"
|
|
20
25
|
},
|
|
21
26
|
"repository": {
|
|
22
27
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/microsoft/ApplicationInsights-JS"
|
|
28
|
+
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/shared/1ds-core-js"
|
|
24
29
|
},
|
|
25
30
|
"main": "dist/es5/ms.core.js",
|
|
26
31
|
"module": "dist-es5/Index.js",
|
|
27
32
|
"types": "types/1ds-core-js.d.ts",
|
|
28
33
|
"keywords": [
|
|
29
|
-
"
|
|
30
|
-
"azure",
|
|
31
|
-
"cloud",
|
|
32
|
-
"script errors",
|
|
33
|
-
"microsoft",
|
|
34
|
-
"application insights",
|
|
34
|
+
"1DS",
|
|
35
35
|
"Js",
|
|
36
36
|
"SDK"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@microsoft/applicationinsights-shims": "
|
|
40
|
-
"@microsoft/applicationinsights-core-js": "3.0.
|
|
39
|
+
"@microsoft/applicationinsights-shims": "3.0.1",
|
|
40
|
+
"@microsoft/applicationinsights-core-js": "3.0.3-nightly3.2307-25",
|
|
41
41
|
"@microsoft/dynamicproto-js": "^2.0.2",
|
|
42
42
|
"@nevware21/ts-utils": ">= 0.9.6 < 2.x",
|
|
43
43
|
"@nevware21/ts-async": ">= 0.2.4 < 2.x"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@
|
|
46
|
+
"@types/qunit": "^2.19.3",
|
|
47
|
+
"@types/sinon": "4.3.3",
|
|
48
|
+
"@microsoft/ai-test-framework": "0.0.1",
|
|
49
|
+
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
|
50
|
+
"@microsoft/applicationinsights-rollup-es5": "1.0.2",
|
|
51
|
+
"@microsoft/api-extractor": "^7.18.19",
|
|
47
52
|
"@nevware21/ts-async": ">= 0.2.4 < 2.x",
|
|
48
53
|
"grunt": "^1.5.3",
|
|
49
54
|
"grunt-cli": "^1.4.3",
|
|
55
|
+
"grunt-contrib-qunit": "^6.2.1",
|
|
56
|
+
"globby": "^11.0.0",
|
|
57
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
58
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
59
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
60
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
61
|
+
"rollup": "^3.20.0",
|
|
62
|
+
"typedoc": "^0.24.8",
|
|
50
63
|
"typescript": "^4.9.3",
|
|
51
|
-
"tslib": "^2.0.0"
|
|
64
|
+
"tslib": "^2.0.0",
|
|
65
|
+
"qunit": "^2.11.2",
|
|
66
|
+
"sinon": "^7.3.1",
|
|
67
|
+
"pako": "^2.0.3"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"tag": "nightly3"
|
|
52
71
|
}
|
|
53
|
-
}
|
|
72
|
+
}
|
package/types/1ds-core-js.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.0.
|
|
2
|
+
* 1DS JS SDK Core, 4.0.2-nightly3.2307-25
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* https://
|
|
5
|
+
* Microsoft Application Insights Team
|
|
6
|
+
* https://github.com/microsoft/ApplicationInsights-JS#readme
|
|
7
7
|
*
|
|
8
8
|
* ---------------------------------------------------------------------------
|
|
9
9
|
* This is a single combined (rollup) declaration file for the package,
|
|
@@ -194,6 +194,10 @@ export { addEventListeners }
|
|
|
194
194
|
export { addPageHideEventListener }
|
|
195
195
|
export { addPageShowEventListener }
|
|
196
196
|
export { addPageUnloadEventListener }
|
|
197
|
+
/**
|
|
198
|
+
* @group Classes
|
|
199
|
+
* @group Entrypoint
|
|
200
|
+
*/
|
|
197
201
|
export declare class AppInsightsCore<C extends IExtendedConfiguration = IExtendedConfiguration> extends InternalAppInsightsCore<C> {
|
|
198
202
|
constructor();
|
|
199
203
|
/**
|
|
@@ -246,7 +250,7 @@ export { dumpObj }
|
|
|
246
250
|
/**
|
|
247
251
|
* Enum for property types.
|
|
248
252
|
*/
|
|
249
|
-
declare const enum eEventPropertyType {
|
|
253
|
+
export declare const enum eEventPropertyType {
|
|
250
254
|
Unspecified = 0,
|
|
251
255
|
String = 1,
|
|
252
256
|
Int32 = 2,
|
|
@@ -287,7 +291,7 @@ export { eLoggingSeverity }
|
|
|
287
291
|
/**
|
|
288
292
|
* The TraceLevel contains a set of values that specify the trace level for the trace messages.
|
|
289
293
|
*/
|
|
290
|
-
declare const enum eTraceLevel {
|
|
294
|
+
export declare const enum eTraceLevel {
|
|
291
295
|
/**
|
|
292
296
|
* None.
|
|
293
297
|
*/
|
|
@@ -310,7 +314,7 @@ declare const enum eTraceLevel {
|
|
|
310
314
|
* The eValueKind contains a set of values that specify value kind of the property.
|
|
311
315
|
* Either PII (Personal Identifiable Information) or customer content.
|
|
312
316
|
*/
|
|
313
|
-
declare const enum eValueKind {
|
|
317
|
+
export declare const enum eValueKind {
|
|
314
318
|
/**
|
|
315
319
|
* No kind.
|
|
316
320
|
*/
|
|
@@ -660,18 +664,6 @@ export declare interface IExtendedConfiguration extends IConfiguration {
|
|
|
660
664
|
* ```
|
|
661
665
|
*/
|
|
662
666
|
enableCompoundKey?: boolean;
|
|
663
|
-
/**
|
|
664
|
-
* [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
|
|
665
|
-
* event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
|
|
666
|
-
* Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
|
|
667
|
-
*/
|
|
668
|
-
disablePageUnloadEvents?: string[];
|
|
669
|
-
/**
|
|
670
|
-
* [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
|
|
671
|
-
* hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
|
|
672
|
-
* Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
|
|
673
|
-
*/
|
|
674
|
-
disablePageShowEvents?: string[];
|
|
675
667
|
/**
|
|
676
668
|
* Add "&w=0" parameter to support UA Parsing when web-workers don't have access to Document.
|
|
677
669
|
* Default is false
|
|
@@ -721,7 +713,7 @@ export declare interface IExtendedTelemetryItem extends ITelemetryItem {
|
|
|
721
713
|
/**
|
|
722
714
|
* This interface defines the object that is passed to any provided FieldValueSanitizerFunc, it provides not only the value to be sanitized but also
|
|
723
715
|
* some context about the value like it's location within the envelope (serialized object), the format is defined via the
|
|
724
|
-
* [Common Schema 4.0](https://
|
|
716
|
+
* [Common Schema 4.0](https://aka.ms/CommonSchema) specification.
|
|
725
717
|
*/
|
|
726
718
|
export declare interface IFieldSanitizerDetails {
|
|
727
719
|
/**
|
|
@@ -748,7 +740,7 @@ export declare interface IFieldSanitizerDetails {
|
|
|
748
740
|
|
|
749
741
|
/**
|
|
750
742
|
* This interface is used during the serialization of individual fields when converting the events into envelope (serialized object) which is sent to the services,
|
|
751
|
-
* the format is defined via the [Common Schema 4.0](https://
|
|
743
|
+
* the format is defined via the [Common Schema 4.0](https://aka.ms/CommonSchema) specification. The path and field names used are based
|
|
752
744
|
* on how the data is serialized to the service (CS 4.0 location) and not specifically the location on the event object you pass into the track methods (unless they are the same).
|
|
753
745
|
*/
|
|
754
746
|
export declare interface IFieldValueSanitizerProvider {
|
|
@@ -884,7 +876,7 @@ export { IUnloadHook }
|
|
|
884
876
|
export { IUnloadHookContainer }
|
|
885
877
|
/**
|
|
886
878
|
* This interface is used during the serialization of events into envelope (serialized object) which is sent to the services, the format is defined via the
|
|
887
|
-
* [Common Schema 4.0](https://
|
|
879
|
+
* [Common Schema 4.0](https://aka.ms/CommonSchema) specification. The path and field names used are based on how the data is serialized
|
|
888
880
|
* to the service (CS 4.0 location) and not specifically the location on the event object you pass into the track methods (unless they are the same).
|
|
889
881
|
*/
|
|
890
882
|
export declare interface IValueSanitizer {
|
|
@@ -1103,7 +1095,7 @@ export declare class ValueSanitizer implements IValueSanitizer {
|
|
|
1103
1095
|
constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
|
|
1104
1096
|
}
|
|
1105
1097
|
|
|
1106
|
-
export declare const Version = "4.0.
|
|
1098
|
+
export declare const Version = "4.0.2-nightly3.2307-25";
|
|
1107
1099
|
|
|
1108
1100
|
export { _warnToConsole }
|
|
1109
1101
|
export { WatcherFunction }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK Core, 4.0.
|
|
2
|
+
* 1DS JS SDK Core, 4.0.2-nightly3.2307-25
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* https://
|
|
5
|
+
* Microsoft Application Insights Team
|
|
6
|
+
* https://github.com/microsoft/ApplicationInsights-JS#readme
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare namespace oneDS {
|
|
@@ -189,6 +189,10 @@ declare namespace oneDS {
|
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
|
192
|
+
/**
|
|
193
|
+
* @group Classes
|
|
194
|
+
* @group Entrypoint
|
|
195
|
+
*/
|
|
192
196
|
class AppInsightsCore<C extends IExtendedConfiguration = IExtendedConfiguration> extends InternalAppInsightsCore<C> {
|
|
193
197
|
constructor();
|
|
194
198
|
/**
|
|
@@ -655,18 +659,6 @@ declare namespace oneDS {
|
|
|
655
659
|
* ```
|
|
656
660
|
*/
|
|
657
661
|
enableCompoundKey?: boolean;
|
|
658
|
-
/**
|
|
659
|
-
* [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
|
|
660
|
-
* event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
|
|
661
|
-
* Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
|
|
662
|
-
*/
|
|
663
|
-
disablePageUnloadEvents?: string[];
|
|
664
|
-
/**
|
|
665
|
-
* [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
|
|
666
|
-
* hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
|
|
667
|
-
* Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
|
|
668
|
-
*/
|
|
669
|
-
disablePageShowEvents?: string[];
|
|
670
662
|
/**
|
|
671
663
|
* Add "&w=0" parameter to support UA Parsing when web-workers don't have access to Document.
|
|
672
664
|
* Default is false
|
|
@@ -716,7 +708,7 @@ declare namespace oneDS {
|
|
|
716
708
|
/**
|
|
717
709
|
* This interface defines the object that is passed to any provided FieldValueSanitizerFunc, it provides not only the value to be sanitized but also
|
|
718
710
|
* some context about the value like it's location within the envelope (serialized object), the format is defined via the
|
|
719
|
-
* [Common Schema 4.0](https://
|
|
711
|
+
* [Common Schema 4.0](https://aka.ms/CommonSchema) specification.
|
|
720
712
|
*/
|
|
721
713
|
interface IFieldSanitizerDetails {
|
|
722
714
|
/**
|
|
@@ -743,7 +735,7 @@ declare namespace oneDS {
|
|
|
743
735
|
|
|
744
736
|
/**
|
|
745
737
|
* This interface is used during the serialization of individual fields when converting the events into envelope (serialized object) which is sent to the services,
|
|
746
|
-
* the format is defined via the [Common Schema 4.0](https://
|
|
738
|
+
* the format is defined via the [Common Schema 4.0](https://aka.ms/CommonSchema) specification. The path and field names used are based
|
|
747
739
|
* on how the data is serialized to the service (CS 4.0 location) and not specifically the location on the event object you pass into the track methods (unless they are the same).
|
|
748
740
|
*/
|
|
749
741
|
interface IFieldValueSanitizerProvider {
|
|
@@ -879,7 +871,7 @@ declare namespace oneDS {
|
|
|
879
871
|
|
|
880
872
|
/**
|
|
881
873
|
* This interface is used during the serialization of events into envelope (serialized object) which is sent to the services, the format is defined via the
|
|
882
|
-
* [Common Schema 4.0](https://
|
|
874
|
+
* [Common Schema 4.0](https://aka.ms/CommonSchema) specification. The path and field names used are based on how the data is serialized
|
|
883
875
|
* to the service (CS 4.0 location) and not specifically the location on the event object you pass into the track methods (unless they are the same).
|
|
884
876
|
*/
|
|
885
877
|
interface IValueSanitizer {
|
|
@@ -1098,7 +1090,7 @@ declare namespace oneDS {
|
|
|
1098
1090
|
constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
|
|
1099
1091
|
}
|
|
1100
1092
|
|
|
1101
|
-
const Version = "4.0.
|
|
1093
|
+
const Version = "4.0.2-nightly3.2307-25";
|
|
1102
1094
|
|
|
1103
1095
|
|
|
1104
1096
|
|