@microsoft/1ds-core-js 4.0.0 → 4.0.2-nightly3.2307-24

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.
Files changed (49) hide show
  1. package/README.md +12 -28
  2. package/bundle/es5/{ms.core-4.0.0.gbl.js → ms.core-4.0.2-nightly3.2307-24.gbl.js} +611 -492
  3. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.gbl.js.map +1 -0
  4. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.gbl.min.js +7 -0
  5. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.integrity.json +46 -0
  7. package/bundle/es5/{ms.core-4.0.0.js → ms.core-4.0.2-nightly3.2307-24.js} +611 -492
  8. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.js.map +1 -0
  9. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.min.js +7 -0
  10. package/bundle/es5/ms.core-4.0.2-nightly3.2307-24.min.js.map +1 -0
  11. package/bundle/es5/ms.core.gbl.js +610 -491
  12. package/bundle/es5/ms.core.gbl.js.map +1 -1
  13. package/bundle/es5/ms.core.gbl.min.js +2 -2
  14. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  15. package/bundle/es5/ms.core.integrity.json +17 -17
  16. package/bundle/es5/ms.core.js +610 -491
  17. package/bundle/es5/ms.core.js.map +1 -1
  18. package/bundle/es5/ms.core.min.js +2 -2
  19. package/bundle/es5/ms.core.min.js.map +1 -1
  20. package/dist/es5/ms.core.js +608 -489
  21. package/dist/es5/ms.core.js.map +1 -1
  22. package/dist/es5/ms.core.min.js +2 -2
  23. package/dist/es5/ms.core.min.js.map +1 -1
  24. package/dist-es5/AppInsightsCore.js +18 -14
  25. package/dist-es5/AppInsightsCore.js.map +1 -1
  26. package/dist-es5/BaseCore.js +8 -8
  27. package/dist-es5/BaseCore.js.map +1 -1
  28. package/dist-es5/DataModels.js +1 -1
  29. package/dist-es5/Enums.js +2 -2
  30. package/dist-es5/Enums.js.map +1 -1
  31. package/dist-es5/Index.js +7 -7
  32. package/dist-es5/Index.js.map +1 -1
  33. package/dist-es5/InternalConstants.js +1 -1
  34. package/dist-es5/Utils.js +20 -19
  35. package/dist-es5/Utils.js.map +1 -1
  36. package/dist-es5/ValueSanitizer.js +32 -28
  37. package/dist-es5/ValueSanitizer.js.map +1 -1
  38. package/dist-es5/__DynamicConstants.js +28 -0
  39. package/dist-es5/__DynamicConstants.js.map +1 -0
  40. package/package.json +42 -23
  41. package/types/1ds-core-js.d.ts +20 -24
  42. package/types/1ds-core-js.namespaced.d.ts +17 -21
  43. package/bundle/es5/ms.core-4.0.0.gbl.js.map +0 -1
  44. package/bundle/es5/ms.core-4.0.0.gbl.min.js +0 -7
  45. package/bundle/es5/ms.core-4.0.0.gbl.min.js.map +0 -1
  46. package/bundle/es5/ms.core-4.0.0.integrity.json +0 -46
  47. package/bundle/es5/ms.core-4.0.0.js.map +0 -1
  48. package/bundle/es5/ms.core-4.0.0.min.js +0 -7
  49. package/bundle/es5/ms.core-4.0.0.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK Core, 4.0.0
2
+ * 1DS JS SDK Core, 4.0.2-nightly3.2307-24
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.length > 0) {
30
- for (var lp = 0; lp < _fieldSanitizers.length; lp++) {
31
- if (_fieldSanitizers[lp].handleField(path, name)) {
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.length === 0) {
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.length; lp++) {
53
- if (_sanitizers[lp].handleField(path, name)) {
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],
@@ -67,6 +68,9 @@ var ValueSanitizer = /** @class */ (function () {
67
68
  }
68
69
  return result;
69
70
  }
71
+ _self.clearCache = function () {
72
+ _sanitizerMap = {};
73
+ };
70
74
  _self.addSanitizer = function (newSanitizer) {
71
75
  if (newSanitizer) {
72
76
  if (!arrIncludes(_sanitizers, newSanitizer)) {
@@ -85,7 +89,7 @@ var ValueSanitizer = /** @class */ (function () {
85
89
  _sanitizerMap = {};
86
90
  }
87
91
  };
88
- _self.rmSanitizer = function (theSanitizer) {
92
+ _self[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] = function (theSanitizer) {
89
93
  if (theSanitizer) {
90
94
  var idx = arrIndexOf(_sanitizers, theSanitizer);
91
95
  if (idx !== -1) {
@@ -95,11 +99,11 @@ var ValueSanitizer = /** @class */ (function () {
95
99
  }
96
100
  // Try and remove the sanitizer from any chained sanitizer as well
97
101
  arrForEach(_sanitizers, function (sanitizer) {
98
- sanitizer && sanitizer.rmSanitizer && sanitizer.rmSanitizer(theSanitizer);
102
+ sanitizer && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */](theSanitizer);
99
103
  });
100
104
  }
101
105
  };
102
- _self.rmFieldSanitizer = function (theFieldSanitizer) {
106
+ _self[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] = function (theFieldSanitizer) {
103
107
  if (theFieldSanitizer) {
104
108
  var idx = arrIndexOf(_fieldSanitizers, theFieldSanitizer);
105
109
  if (idx !== -1) {
@@ -109,26 +113,26 @@ var ValueSanitizer = /** @class */ (function () {
109
113
  }
110
114
  // Try and remove the field sanitizer from any chained sanitizer as well
111
115
  arrForEach(_sanitizers, function (sanitizer) {
112
- sanitizer && sanitizer.rmFieldSanitizer && sanitizer.rmFieldSanitizer(theFieldSanitizer);
116
+ sanitizer && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */](theFieldSanitizer);
113
117
  });
114
118
  }
115
119
  };
116
120
  _self.isEmpty = function () {
117
121
  return (getLength(_sanitizers) + getLength(_fieldSanitizers)) === 0;
118
122
  };
119
- _self.handleField = function (path, name) {
123
+ _self[_DYN_HANDLE_FIELD /* @min:%2ehandleField */] = function (path, name) {
120
124
  var mapValue = _getFieldSanitizer(path, name);
121
- return mapValue ? mapValue.canHandle : false;
125
+ return mapValue ? mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */] : false;
122
126
  };
123
- _self.value = function (path, name, value, stringifyObjects) {
127
+ _self[_DYN_VALUE /* @min:%2evalue */] = function (path, name, value, stringifyObjects) {
124
128
  var mapValue = _getFieldSanitizer(path, name);
125
- if (mapValue && mapValue.canHandle) {
126
- if (!mapValue || !mapValue.canHandle) {
129
+ if (mapValue && mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
130
+ if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
127
131
  return null;
128
132
  }
129
133
  if (mapValue.handler) {
130
134
  // This value sanitizer can't handle this field so pass it only the next one
131
- return mapValue.handler.value(path, name, value, stringifyObjects);
135
+ return mapValue.handler[_DYN_VALUE /* @min:%2evalue */](path, name, value, stringifyObjects);
132
136
  }
133
137
  // Check that property is valid
134
138
  if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {
@@ -139,7 +143,7 @@ var ValueSanitizer = /** @class */ (function () {
139
143
  if ((fieldType & 8192 /* FieldValueSanitizerType.EventProperty */) === 8192 /* FieldValueSanitizerType.EventProperty */) {
140
144
  var subType = fieldType & ~8192 /* FieldValueSanitizerType.EventProperty */;
141
145
  property = value;
142
- if (!isValueAssigned(property.value) ||
146
+ if (!isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */]) ||
143
147
  (subType !== 1 /* FieldValueSanitizerType.String */ &&
144
148
  subType !== 2 /* FieldValueSanitizerType.Number */ &&
145
149
  subType !== 3 /* FieldValueSanitizerType.Boolean */ &&
@@ -166,14 +170,14 @@ var ValueSanitizer = /** @class */ (function () {
166
170
  };
167
171
  _self.property = function (path, name, property, stringifyObjects) {
168
172
  var mapValue = _getFieldSanitizer(path, name);
169
- if (!mapValue || !mapValue.canHandle) {
173
+ if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
170
174
  return null;
171
175
  }
172
176
  // Check that property is valid
173
- if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property.value)) {
177
+ if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */])) {
174
178
  return null;
175
179
  }
176
- var fieldType = getFieldValueType(property.value);
180
+ var fieldType = getFieldValueType(property[_DYN_VALUE /* @min:%2evalue */]);
177
181
  if (fieldType === 0 /* FieldValueSanitizerType.NotSet */) {
178
182
  // Not a supported field that we can sanitize or serialize
179
183
  return null;
@@ -188,12 +192,12 @@ var ValueSanitizer = /** @class */ (function () {
188
192
  // If either pii or cc is set convert value to string (since only string pii/cc is allowed).
189
193
  // If the value is a complex type like an array that can't be converted to string we will drop
190
194
  // the property.
191
- if (!isNullOrUndefined(property.kind)) {
192
- if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property.kind)) {
195
+ if (!isNullOrUndefined(property[_DYN_KIND /* @min:%2ekind */])) {
196
+ if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property[_DYN_KIND /* @min:%2ekind */])) {
193
197
  return null;
194
198
  }
195
199
  // Convert the value to a string and assign back to the original value
196
- property.value = property.value.toString();
200
+ property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();
197
201
  }
198
202
  return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);
199
203
  }
@@ -205,25 +209,25 @@ var ValueSanitizer = /** @class */ (function () {
205
209
  }
206
210
  function _callFieldSanitizer(fieldProvider, path, name, theType, property) {
207
211
  if (property && fieldProvider) {
208
- var sanitizer = fieldProvider.getSanitizer(path, name, theType, property.kind, property.propertyType);
212
+ var sanitizer = fieldProvider.getSanitizer(path, name, theType, property[_DYN_KIND /* @min:%2ekind */], property.propertyType);
209
213
  if (sanitizer) {
210
214
  // This is where we the field will call the handler to "scrub" the value. This the primary hook for the ClientHashing Plugin to
211
215
  // be able to apply the hashFunc() / Sha256 conversion of the properties value
212
216
  if (theType === 4 /* FieldValueSanitizerType.Object */) {
213
217
  // Special case of an embedded object (ext.metadata, data.properties)
214
218
  var newValue_1 = {};
215
- var propValue = property.value;
219
+ var propValue = property[_DYN_VALUE /* @min:%2evalue */];
216
220
  objForEachKey(propValue, function (propKey, theValue) {
217
221
  var newPath = path + "." + name;
218
222
  if (isValueAssigned(theValue)) {
219
223
  var newProp = _convertToProperty(newPath, propKey, theValue);
220
224
  newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);
221
225
  if (newProp) {
222
- newValue_1[propKey] = newProp.value;
226
+ newValue_1[propKey] = newProp[_DYN_VALUE /* @min:%2evalue */];
223
227
  }
224
228
  }
225
229
  });
226
- property.value = newValue_1;
230
+ property[_DYN_VALUE /* @min:%2evalue */] = newValue_1;
227
231
  }
228
232
  else {
229
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.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"}
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-24
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.0",
4
- "description": "Microsoft Application Insights JavaScript SDK - 1ds-core-js extensions",
3
+ "version": "4.0.2-nightly3.2307-24",
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
- "ai-min": "grunt core-min",
11
- "ai-restore": "grunt core-restore",
12
- "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"1DS JS SDK Core\" -hidePrivate",
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
- "1ds",
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": "^3.0.1",
40
- "@microsoft/applicationinsights-core-js": "3.0.1",
39
+ "@microsoft/applicationinsights-shims": "3.0.1",
40
+ "@microsoft/applicationinsights-core-js": "3.0.3-nightly3.2307-24",
41
41
  "@microsoft/dynamicproto-js": "^2.0.2",
42
- "@nevware21/ts-utils": ">= 0.9.5 < 2.x",
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
- "@microsoft/api-extractor": "7.18.19",
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
+ }
@@ -1,9 +1,9 @@
1
1
  /*
2
- * 1DS JS SDK Core, 4.0.0
2
+ * 1DS JS SDK Core, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
- * Javascript Telemetry SDKs <TelReachSDK@microsoft.com>
6
- * https://1dsdocs.azurewebsites.net/sdk.html
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,14 +194,18 @@ export { addEventListeners }
194
194
  export { addPageHideEventListener }
195
195
  export { addPageShowEventListener }
196
196
  export { addPageUnloadEventListener }
197
- export declare class AppInsightsCore extends InternalAppInsightsCore<IExtendedConfiguration> {
197
+ /**
198
+ * @group Classes
199
+ * @group Entrypoint
200
+ */
201
+ export declare class AppInsightsCore<C extends IExtendedConfiguration = IExtendedConfiguration> extends InternalAppInsightsCore<C> {
198
202
  constructor();
199
203
  /**
200
204
  * Initialize the sdk.
201
205
  * @param config - The configuration to initialize the SDK.
202
206
  * @param extensions - An array of extensions that are to be used by the core.
203
207
  */
204
- initialize(config: IExtendedConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
208
+ initialize(config: C, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
205
209
  track(item: IExtendedTelemetryItem | ITelemetryItem): void;
206
210
  /**
207
211
  * Periodically check logger.queue for
@@ -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://1dsdocs.azurewebsites.net/schema/README.html) specification.
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://1dsdocs.azurewebsites.net/schema/README.html) specification. The path and field names used are based
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://1dsdocs.azurewebsites.net/schema/README.html) specification. The path and field names used are based on how the data is serialized
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 {
@@ -1049,6 +1041,10 @@ export declare type ValueKind = number | eValueKind;
1049
1041
 
1050
1042
  export declare class ValueSanitizer implements IValueSanitizer {
1051
1043
  static getFieldType: typeof getFieldValueType;
1044
+ /**
1045
+ * Clear the current value sanitizer cache.
1046
+ */
1047
+ clearCache: () => void;
1052
1048
  /**
1053
1049
  * Add a value sanitizer as a fallback sanitizer if this sanitizer can't handle the path/name.
1054
1050
  */
@@ -1099,7 +1095,7 @@ export declare class ValueSanitizer implements IValueSanitizer {
1099
1095
  constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
1100
1096
  }
1101
1097
 
1102
- export declare const Version = "4.0.0";
1098
+ export declare const Version = "4.0.2-nightly3.2307-24";
1103
1099
 
1104
1100
  export { _warnToConsole }
1105
1101
  export { WatcherFunction }
@@ -1,9 +1,9 @@
1
1
  /*
2
- * 1DS JS SDK Core, 4.0.0
2
+ * 1DS JS SDK Core, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
- * Javascript Telemetry SDKs <TelReachSDK@microsoft.com>
6
- * https://1dsdocs.azurewebsites.net/sdk.html
5
+ * Microsoft Application Insights Team
6
+ * https://github.com/microsoft/ApplicationInsights-JS#readme
7
7
  */
8
8
 
9
9
  declare namespace oneDS {
@@ -189,14 +189,18 @@ declare namespace oneDS {
189
189
 
190
190
 
191
191
 
192
- class AppInsightsCore extends InternalAppInsightsCore<IExtendedConfiguration> {
192
+ /**
193
+ * @group Classes
194
+ * @group Entrypoint
195
+ */
196
+ class AppInsightsCore<C extends IExtendedConfiguration = IExtendedConfiguration> extends InternalAppInsightsCore<C> {
193
197
  constructor();
194
198
  /**
195
199
  * Initialize the sdk.
196
200
  * @param config - The configuration to initialize the SDK.
197
201
  * @param extensions - An array of extensions that are to be used by the core.
198
202
  */
199
- initialize(config: IExtendedConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
203
+ initialize(config: C, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
200
204
  track(item: IExtendedTelemetryItem | ITelemetryItem): void;
201
205
  /**
202
206
  * Periodically check logger.queue for
@@ -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://1dsdocs.azurewebsites.net/schema/README.html) specification.
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://1dsdocs.azurewebsites.net/schema/README.html) specification. The path and field names used are based
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://1dsdocs.azurewebsites.net/schema/README.html) specification. The path and field names used are based on how the data is serialized
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 {
@@ -1044,6 +1036,10 @@ declare namespace oneDS {
1044
1036
 
1045
1037
  class ValueSanitizer implements IValueSanitizer {
1046
1038
  static getFieldType: typeof getFieldValueType;
1039
+ /**
1040
+ * Clear the current value sanitizer cache.
1041
+ */
1042
+ clearCache: () => void;
1047
1043
  /**
1048
1044
  * Add a value sanitizer as a fallback sanitizer if this sanitizer can't handle the path/name.
1049
1045
  */
@@ -1094,7 +1090,7 @@ declare namespace oneDS {
1094
1090
  constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
1095
1091
  }
1096
1092
 
1097
- const Version = "4.0.0";
1093
+ const Version = "4.0.2-nightly3.2307-24";
1098
1094
 
1099
1095
 
1100
1096