@microsoft/applicationinsights-common 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02

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 (182) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +418 -237
  3. package/browser/applicationinsights-common.js.map +1 -1
  4. package/browser/applicationinsights-common.min.js +2 -2
  5. package/browser/applicationinsights-common.min.js.map +1 -1
  6. package/dist/applicationinsights-common.api.json +102 -51
  7. package/dist/applicationinsights-common.api.md +14 -4
  8. package/dist/applicationinsights-common.d.ts +18 -10
  9. package/dist/applicationinsights-common.js +418 -237
  10. package/dist/applicationinsights-common.js.map +1 -1
  11. package/dist/applicationinsights-common.min.js +2 -2
  12. package/dist/applicationinsights-common.min.js.map +1 -1
  13. package/dist/applicationinsights-common.rollup.d.ts +18 -10
  14. package/dist-esm/ConnectionStringParser.js +1 -1
  15. package/dist-esm/Constants.js +1 -1
  16. package/dist-esm/DomHelperFuncs.js +1 -1
  17. package/dist-esm/Enums.js +11 -24
  18. package/dist-esm/Enums.js.map +1 -1
  19. package/dist-esm/HelperFuncs.js +7 -6
  20. package/dist-esm/HelperFuncs.js.map +1 -1
  21. package/dist-esm/Interfaces/ConnectionString.js +1 -1
  22. package/dist-esm/Interfaces/Context/IApplication.js +1 -1
  23. package/dist-esm/Interfaces/Context/IDevice.js +1 -1
  24. package/dist-esm/Interfaces/Context/IInternal.js +1 -1
  25. package/dist-esm/Interfaces/Context/ILocation.js +1 -1
  26. package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
  27. package/dist-esm/Interfaces/Context/ISample.js +1 -1
  28. package/dist-esm/Interfaces/Context/ISession.js +1 -1
  29. package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
  30. package/dist-esm/Interfaces/Context/IUser.js +1 -1
  31. package/dist-esm/Interfaces/Context/IWeb.js +1 -1
  32. package/dist-esm/Interfaces/Contracts/AvailabilityData.js +52 -0
  33. package/dist-esm/Interfaces/Contracts/AvailabilityData.js.map +1 -0
  34. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +89 -0
  35. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js.map +1 -0
  36. package/dist-esm/Interfaces/Contracts/DataPointType.js +8 -0
  37. package/dist-esm/Interfaces/Contracts/DataPointType.js.map +1 -0
  38. package/dist-esm/Interfaces/Contracts/DependencyKind.js +8 -0
  39. package/dist-esm/Interfaces/Contracts/DependencyKind.js.map +1 -0
  40. package/dist-esm/Interfaces/Contracts/DependencySourceType.js +8 -0
  41. package/dist-esm/Interfaces/Contracts/DependencySourceType.js.map +1 -0
  42. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +1 -1
  43. package/dist-esm/Interfaces/Contracts/Generated/Base.js +1 -1
  44. package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js +1 -1
  45. package/dist-esm/Interfaces/Contracts/Generated/Data.js +1 -1
  46. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +1 -1
  47. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +1 -1
  48. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +1 -1
  49. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +1 -1
  50. package/dist-esm/Interfaces/Contracts/Generated/Domain.js +1 -1
  51. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +1 -1
  52. package/dist-esm/Interfaces/Contracts/Generated/EventData.js +1 -1
  53. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +1 -1
  54. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +1 -1
  55. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +1 -1
  56. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +1 -1
  57. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +1 -1
  58. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +1 -1
  59. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +1 -1
  60. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +1 -1
  61. package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js +1 -1
  62. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +1 -1
  63. package/dist-esm/Interfaces/Contracts/IBase.js +8 -0
  64. package/dist-esm/Interfaces/Contracts/IBase.js.map +1 -0
  65. package/dist-esm/Interfaces/Contracts/IData.js +8 -0
  66. package/dist-esm/Interfaces/Contracts/IData.js.map +1 -0
  67. package/dist-esm/Interfaces/Contracts/IDataPoint.js +6 -0
  68. package/dist-esm/Interfaces/Contracts/IDataPoint.js.map +1 -0
  69. package/dist-esm/Interfaces/Contracts/IDomain.js +8 -0
  70. package/dist-esm/Interfaces/Contracts/IDomain.js.map +1 -0
  71. package/dist-esm/Interfaces/Contracts/IEnvelope.js +46 -0
  72. package/dist-esm/Interfaces/Contracts/IEnvelope.js.map +1 -0
  73. package/dist-esm/Interfaces/Contracts/IEventData.js +8 -0
  74. package/dist-esm/Interfaces/Contracts/IEventData.js.map +1 -0
  75. package/dist-esm/Interfaces/Contracts/IExceptionData.js +8 -0
  76. package/dist-esm/Interfaces/Contracts/IExceptionData.js.map +1 -0
  77. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +8 -0
  78. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js.map +1 -0
  79. package/dist-esm/Interfaces/Contracts/IMessageData.js +8 -0
  80. package/dist-esm/Interfaces/Contracts/IMessageData.js.map +1 -0
  81. package/dist-esm/Interfaces/Contracts/IMetricData.js +8 -0
  82. package/dist-esm/Interfaces/Contracts/IMetricData.js.map +1 -0
  83. package/dist-esm/Interfaces/Contracts/IPageViewData.js +8 -0
  84. package/dist-esm/Interfaces/Contracts/IPageViewData.js.map +1 -0
  85. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +8 -0
  86. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js.map +1 -0
  87. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +8 -0
  88. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js.map +1 -0
  89. package/dist-esm/Interfaces/Contracts/IStackFrame.js +8 -0
  90. package/dist-esm/Interfaces/Contracts/IStackFrame.js.map +1 -0
  91. package/dist-esm/Interfaces/Contracts/RequestData.js +46 -0
  92. package/dist-esm/Interfaces/Contracts/RequestData.js.map +1 -0
  93. package/dist-esm/Interfaces/Contracts/SeverityLevel.js +19 -0
  94. package/dist-esm/Interfaces/Contracts/SeverityLevel.js.map +1 -0
  95. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  96. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  97. package/dist-esm/Interfaces/IConfig.js +1 -1
  98. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  99. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  100. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  101. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  102. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  103. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  104. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  105. package/dist-esm/Interfaces/IPartC.js +1 -1
  106. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  107. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  108. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  109. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  110. package/dist-esm/Interfaces/PartAExtensions.js +1 -1
  111. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  112. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  113. package/dist-esm/RequestResponseHeaders.js +1 -1
  114. package/dist-esm/StorageHelperFuncs.js +8 -8
  115. package/dist-esm/StorageHelperFuncs.js.map +1 -1
  116. package/dist-esm/Telemetry/Common/Base.js +1 -1
  117. package/dist-esm/Telemetry/Common/Data.js +1 -1
  118. package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
  119. package/dist-esm/Telemetry/Common/DataSanitizer.js +8 -8
  120. package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
  121. package/dist-esm/Telemetry/Common/Envelope.js +1 -1
  122. package/dist-esm/Telemetry/Event.js +1 -1
  123. package/dist-esm/Telemetry/Exception.js +1 -1
  124. package/dist-esm/Telemetry/Metric.js +1 -1
  125. package/dist-esm/Telemetry/PageView.js +1 -1
  126. package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
  127. package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
  128. package/dist-esm/Telemetry/Trace.js +1 -1
  129. package/dist-esm/TelemetryItemCreator.js +1 -1
  130. package/dist-esm/UrlHelperFuncs.js +1 -1
  131. package/dist-esm/Util.js +1 -1
  132. package/dist-esm/applicationinsights-common.js +1 -1
  133. package/package.json +2 -2
  134. package/src/Enums.ts +19 -3
  135. package/src/HelperFuncs.ts +7 -5
  136. package/src/Interfaces/Contracts/AvailabilityData.ts +57 -0
  137. package/src/Interfaces/Contracts/ContextTagKeys.ts +299 -0
  138. package/src/Interfaces/Contracts/DataPointType.ts +10 -0
  139. package/src/Interfaces/Contracts/DependencyKind.ts +11 -0
  140. package/src/Interfaces/Contracts/DependencySourceType.ts +11 -0
  141. package/src/Interfaces/Contracts/IBase.ts +13 -0
  142. package/src/Interfaces/Contracts/IData.ts +19 -0
  143. package/src/Interfaces/Contracts/IDataPoint.ts +44 -0
  144. package/src/Interfaces/Contracts/IDomain.ts +8 -0
  145. package/src/Interfaces/Contracts/IEnvelope.ts +50 -0
  146. package/src/Interfaces/Contracts/IEventData.ts +30 -0
  147. package/src/Interfaces/Contracts/IExceptionData.ts +37 -0
  148. package/src/Interfaces/Contracts/IExceptionDetails.ts +45 -0
  149. package/src/Interfaces/Contracts/IMessageData.ts +36 -0
  150. package/src/Interfaces/Contracts/IMetricData.ts +31 -0
  151. package/src/Interfaces/Contracts/IPageViewData.ts +26 -0
  152. package/src/Interfaces/Contracts/IPageViewPerfData.ts +35 -0
  153. package/src/Interfaces/Contracts/IRemoteDependencyData.ts +65 -0
  154. package/src/Interfaces/Contracts/IStackFrame.ts +33 -0
  155. package/src/Interfaces/Contracts/RequestData.ts +50 -0
  156. package/src/Interfaces/Contracts/SeverityLevel.ts +15 -0
  157. package/src/StorageHelperFuncs.ts +7 -7
  158. package/src/Telemetry/Common/DataSanitizer.ts +7 -7
  159. package/src/applicationinsights-common.ts +1 -1
  160. package/types/Enums.d.ts +13 -2
  161. package/types/Interfaces/Contracts/AvailabilityData.d.ts +0 -0
  162. package/types/Interfaces/Contracts/ContextTagKeys.d.ts +175 -0
  163. package/types/Interfaces/Contracts/DataPointType.d.ts +7 -0
  164. package/types/Interfaces/Contracts/DependencyKind.d.ts +8 -0
  165. package/types/Interfaces/Contracts/DependencySourceType.d.ts +8 -0
  166. package/types/Interfaces/Contracts/IBase.d.ts +9 -0
  167. package/types/Interfaces/Contracts/IData.d.ts +14 -0
  168. package/types/Interfaces/Contracts/IDataPoint.d.ts +34 -0
  169. package/types/Interfaces/Contracts/IDomain.d.ts +5 -0
  170. package/types/Interfaces/Contracts/IEnvelope.d.ts +0 -0
  171. package/types/Interfaces/Contracts/IEventData.d.ts +22 -0
  172. package/types/Interfaces/Contracts/IExceptionData.d.ts +28 -0
  173. package/types/Interfaces/Contracts/IExceptionDetails.d.ts +34 -0
  174. package/types/Interfaces/Contracts/IMessageData.d.ts +27 -0
  175. package/types/Interfaces/Contracts/IMetricData.d.ts +23 -0
  176. package/types/Interfaces/Contracts/IPageViewData.d.ts +18 -0
  177. package/types/Interfaces/Contracts/IPageViewPerfData.d.ts +26 -0
  178. package/types/Interfaces/Contracts/IRemoteDependencyData.d.ts +50 -0
  179. package/types/Interfaces/Contracts/IStackFrame.d.ts +25 -0
  180. package/types/Interfaces/Contracts/RequestData.d.ts +0 -0
  181. package/types/Interfaces/Contracts/SeverityLevel.d.ts +10 -0
  182. package/types/applicationinsights-common.d.ts +1 -1
@@ -1,10 +1,10 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
- import { LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from "@microsoft/applicationinsights-core-js";
7
+ import { _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from "@microsoft/applicationinsights-core-js";
8
8
  export function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
9
9
  var origLength = key.length;
10
10
  var field = dataSanitizeKey(logger, key);
@@ -28,7 +28,7 @@ export function dataSanitizeKey(logger, name) {
28
28
  // truncate the string to 150 chars
29
29
  if (name.length > 150 /* MAX_NAME_LENGTH */) {
30
30
  nameTrunc = name.substring(0, 150 /* MAX_NAME_LENGTH */);
31
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 /* MAX_NAME_LENGTH */ + " characters.", { name: name }, true);
31
+ logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 /* MAX_NAME_LENGTH */ + " characters.", { name: name }, true);
32
32
  }
33
33
  }
34
34
  return nameTrunc || name;
@@ -41,7 +41,7 @@ export function dataSanitizeString(logger, value, maxLength) {
41
41
  value = strTrim(value);
42
42
  if (value.toString().length > maxLength) {
43
43
  valueTrunc = value.toString().substring(0, maxLength);
44
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
44
+ logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
45
45
  }
46
46
  }
47
47
  return valueTrunc || value;
@@ -54,7 +54,7 @@ export function dataSanitizeMessage(logger, message) {
54
54
  if (message) {
55
55
  if (message.length > 32768 /* MAX_MESSAGE_LENGTH */) {
56
56
  messageTrunc = message.substring(0, 32768 /* MAX_MESSAGE_LENGTH */);
57
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 /* MAX_MESSAGE_LENGTH */ + " characters.", { message: message }, true);
57
+ logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 /* MAX_MESSAGE_LENGTH */ + " characters.", { message: message }, true);
58
58
  }
59
59
  }
60
60
  return messageTrunc || message;
@@ -66,7 +66,7 @@ export function dataSanitizeException(logger, exception) {
66
66
  var value = "" + exception;
67
67
  if (value.length > 32768 /* MAX_EXCEPTION_LENGTH */) {
68
68
  exceptionTrunc = value.substring(0, 32768 /* MAX_EXCEPTION_LENGTH */);
69
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 /* MAX_EXCEPTION_LENGTH */ + " characters.", { exception: exception }, true);
69
+ logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 /* MAX_EXCEPTION_LENGTH */ + " characters.", { exception: exception }, true);
70
70
  }
71
71
  }
72
72
  return exceptionTrunc || exception;
@@ -81,7 +81,7 @@ export function dataSanitizeProperties(logger, properties) {
81
81
  value = getJSON().stringify(value);
82
82
  }
83
83
  catch (e) {
84
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
84
+ logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
85
85
  }
86
86
  }
87
87
  value = dataSanitizeString(logger, value, 8192 /* MAX_PROPERTY_LENGTH */);
@@ -112,7 +112,7 @@ export function dataSanitizeInput(logger, input, maxLength, _msgId) {
112
112
  input = strTrim(input);
113
113
  if (input.length > maxLength) {
114
114
  inputTrunc = input.substring(0, maxLength);
115
- logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
115
+ logger && logger.throwInternal(2 /* WARNING */, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
116
116
  }
117
117
  }
118
118
  return inputTrunc || input;
@@ -1 +1 @@
1
- {"version":3,"file":"DataSanitizer.js.map","sources":["DataSanitizer.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nexport function dataSanitizeKeyAndAddUniqueness(logger, key, map) {\r\n var origLength = key.length;\r\n var field = dataSanitizeKey(logger, key);\r\n // validation truncated the length. We need to add uniqueness\r\n if (field.length !== origLength) {\r\n var i = 0;\r\n var uniqueField = field;\r\n while (map[uniqueField] !== undefined) {\r\n i++;\r\n uniqueField = field.substring(0, 150 /* MAX_NAME_LENGTH */ - 3) + dsPadNumber(i);\r\n }\r\n field = uniqueField;\r\n }\r\n return field;\r\n}\r\nexport function dataSanitizeKey(logger, name) {\r\n var nameTrunc;\r\n if (name) {\r\n // Remove any leading or trailing whitespace\r\n name = strTrim(name.toString());\r\n // truncate the string to 150 chars\r\n if (name.length > 150 /* MAX_NAME_LENGTH */) {\r\n nameTrunc = name.substring(0, 150 /* MAX_NAME_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, \"name is too long. It has been truncated to \" + 150 /* MAX_NAME_LENGTH */ + \" characters.\", { name: name }, true);\r\n }\r\n }\r\n return nameTrunc || name;\r\n}\r\nexport function dataSanitizeString(logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = 1024 /* MAX_STRING_LENGTH */; }\r\n var valueTrunc;\r\n if (value) {\r\n maxLength = maxLength ? maxLength : 1024 /* MAX_STRING_LENGTH */; // in case default parameters dont work\r\n value = strTrim(value);\r\n if (value.toString().length > maxLength) {\r\n valueTrunc = value.toString().substring(0, maxLength);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, \"string value is too long. It has been truncated to \" + maxLength + \" characters.\", { value: value }, true);\r\n }\r\n }\r\n return valueTrunc || value;\r\n}\r\nexport function dataSanitizeUrl(logger, url) {\r\n return dataSanitizeInput(logger, url, 2048 /* MAX_URL_LENGTH */, _InternalMessageId.UrlTooLong);\r\n}\r\nexport function dataSanitizeMessage(logger, message) {\r\n var messageTrunc;\r\n if (message) {\r\n if (message.length > 32768 /* MAX_MESSAGE_LENGTH */) {\r\n messageTrunc = message.substring(0, 32768 /* MAX_MESSAGE_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, \"message is too long, it has been truncated to \" + 32768 /* MAX_MESSAGE_LENGTH */ + \" characters.\", { message: message }, true);\r\n }\r\n }\r\n return messageTrunc || message;\r\n}\r\nexport function dataSanitizeException(logger, exception) {\r\n var exceptionTrunc;\r\n if (exception) {\r\n // Make surte its a string\r\n var value = \"\" + exception;\r\n if (value.length > 32768 /* MAX_EXCEPTION_LENGTH */) {\r\n exceptionTrunc = value.substring(0, 32768 /* MAX_EXCEPTION_LENGTH */);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, \"exception is too long, it has been truncated to \" + 32768 /* MAX_EXCEPTION_LENGTH */ + \" characters.\", { exception: exception }, true);\r\n }\r\n }\r\n return exceptionTrunc || exception;\r\n}\r\nexport function dataSanitizeProperties(logger, properties) {\r\n if (properties) {\r\n var tempProps_1 = {};\r\n objForEachKey(properties, function (prop, value) {\r\n if (isObject(value) && hasJSON()) {\r\n // Stringify any part C properties\r\n try {\r\n value = getJSON().stringify(value);\r\n }\r\n catch (e) {\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, \"custom property is not valid\", { exception: e }, true);\r\n }\r\n }\r\n value = dataSanitizeString(logger, value, 8192 /* MAX_PROPERTY_LENGTH */);\r\n prop = dataSanitizeKeyAndAddUniqueness(logger, prop, tempProps_1);\r\n tempProps_1[prop] = value;\r\n });\r\n properties = tempProps_1;\r\n }\r\n return properties;\r\n}\r\nexport function dataSanitizeMeasurements(logger, measurements) {\r\n if (measurements) {\r\n var tempMeasurements_1 = {};\r\n objForEachKey(measurements, function (measure, value) {\r\n measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1);\r\n tempMeasurements_1[measure] = value;\r\n });\r\n measurements = tempMeasurements_1;\r\n }\r\n return measurements;\r\n}\r\nexport function dataSanitizeId(logger, id) {\r\n return id ? dataSanitizeInput(logger, id, 128 /* MAX_ID_LENGTH */, _InternalMessageId.IdTooLong).toString() : id;\r\n}\r\nexport function dataSanitizeInput(logger, input, maxLength, _msgId) {\r\n var inputTrunc;\r\n if (input) {\r\n input = strTrim(input);\r\n if (input.length > maxLength) {\r\n inputTrunc = input.substring(0, maxLength);\r\n logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, \"input is too long, it has been truncated to \" + maxLength + \" characters.\", { data: input }, true);\r\n }\r\n }\r\n return inputTrunc || input;\r\n}\r\nexport function dsPadNumber(num) {\r\n var s = \"00\" + num;\r\n return s.substr(s.length - 3);\r\n}\r\n/**\r\n * Provides the DataSanitizer functions within the previous namespace.\r\n */\r\nexport var DataSanitizer = {\r\n MAX_NAME_LENGTH: 150 /* MAX_NAME_LENGTH */,\r\n MAX_ID_LENGTH: 128 /* MAX_ID_LENGTH */,\r\n MAX_PROPERTY_LENGTH: 8192 /* MAX_PROPERTY_LENGTH */,\r\n MAX_STRING_LENGTH: 1024 /* MAX_STRING_LENGTH */,\r\n MAX_URL_LENGTH: 2048 /* MAX_URL_LENGTH */,\r\n MAX_MESSAGE_LENGTH: 32768 /* MAX_MESSAGE_LENGTH */,\r\n MAX_EXCEPTION_LENGTH: 32768 /* MAX_EXCEPTION_LENGTH */,\r\n sanitizeKeyAndAddUniqueness: dataSanitizeKeyAndAddUniqueness,\r\n sanitizeKey: dataSanitizeKey,\r\n sanitizeString: dataSanitizeString,\r\n sanitizeUrl: dataSanitizeUrl,\r\n sanitizeMessage: dataSanitizeMessage,\r\n sanitizeException: dataSanitizeException,\r\n sanitizeProperties: dataSanitizeProperties,\r\n sanitizeMeasurements: dataSanitizeMeasurements,\r\n sanitizeId: dataSanitizeId,\r\n sanitizeInput: dataSanitizeInput,\r\n padNumber: dsPadNumber,\r\n trim: strTrim\r\n};\r\n//# sourceMappingURL=DataSanitizer.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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":"DataSanitizer.js.map","sources":["DataSanitizer.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nexport function dataSanitizeKeyAndAddUniqueness(logger, key, map) {\r\n var origLength = key.length;\r\n var field = dataSanitizeKey(logger, key);\r\n // validation truncated the length. We need to add uniqueness\r\n if (field.length !== origLength) {\r\n var i = 0;\r\n var uniqueField = field;\r\n while (map[uniqueField] !== undefined) {\r\n i++;\r\n uniqueField = field.substring(0, 150 /* MAX_NAME_LENGTH */ - 3) + dsPadNumber(i);\r\n }\r\n field = uniqueField;\r\n }\r\n return field;\r\n}\r\nexport function dataSanitizeKey(logger, name) {\r\n var nameTrunc;\r\n if (name) {\r\n // Remove any leading or trailing whitespace\r\n name = strTrim(name.toString());\r\n // truncate the string to 150 chars\r\n if (name.length > 150 /* MAX_NAME_LENGTH */) {\r\n nameTrunc = name.substring(0, 150 /* MAX_NAME_LENGTH */);\r\n logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.NameTooLong, \"name is too long. It has been truncated to \" + 150 /* MAX_NAME_LENGTH */ + \" characters.\", { name: name }, true);\r\n }\r\n }\r\n return nameTrunc || name;\r\n}\r\nexport function dataSanitizeString(logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = 1024 /* MAX_STRING_LENGTH */; }\r\n var valueTrunc;\r\n if (value) {\r\n maxLength = maxLength ? maxLength : 1024 /* MAX_STRING_LENGTH */; // in case default parameters dont work\r\n value = strTrim(value);\r\n if (value.toString().length > maxLength) {\r\n valueTrunc = value.toString().substring(0, maxLength);\r\n logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.StringValueTooLong, \"string value is too long. It has been truncated to \" + maxLength + \" characters.\", { value: value }, true);\r\n }\r\n }\r\n return valueTrunc || value;\r\n}\r\nexport function dataSanitizeUrl(logger, url) {\r\n return dataSanitizeInput(logger, url, 2048 /* MAX_URL_LENGTH */, _InternalMessageId.UrlTooLong);\r\n}\r\nexport function dataSanitizeMessage(logger, message) {\r\n var messageTrunc;\r\n if (message) {\r\n if (message.length > 32768 /* MAX_MESSAGE_LENGTH */) {\r\n messageTrunc = message.substring(0, 32768 /* MAX_MESSAGE_LENGTH */);\r\n logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.MessageTruncated, \"message is too long, it has been truncated to \" + 32768 /* MAX_MESSAGE_LENGTH */ + \" characters.\", { message: message }, true);\r\n }\r\n }\r\n return messageTrunc || message;\r\n}\r\nexport function dataSanitizeException(logger, exception) {\r\n var exceptionTrunc;\r\n if (exception) {\r\n // Make surte its a string\r\n var value = \"\" + exception;\r\n if (value.length > 32768 /* MAX_EXCEPTION_LENGTH */) {\r\n exceptionTrunc = value.substring(0, 32768 /* MAX_EXCEPTION_LENGTH */);\r\n logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.ExceptionTruncated, \"exception is too long, it has been truncated to \" + 32768 /* MAX_EXCEPTION_LENGTH */ + \" characters.\", { exception: exception }, true);\r\n }\r\n }\r\n return exceptionTrunc || exception;\r\n}\r\nexport function dataSanitizeProperties(logger, properties) {\r\n if (properties) {\r\n var tempProps_1 = {};\r\n objForEachKey(properties, function (prop, value) {\r\n if (isObject(value) && hasJSON()) {\r\n // Stringify any part C properties\r\n try {\r\n value = getJSON().stringify(value);\r\n }\r\n catch (e) {\r\n logger && logger.throwInternal(2 /* WARNING */, _InternalMessageId.CannotSerializeObjectNonSerializable, \"custom property is not valid\", { exception: e }, true);\r\n }\r\n }\r\n value = dataSanitizeString(logger, value, 8192 /* MAX_PROPERTY_LENGTH */);\r\n prop = dataSanitizeKeyAndAddUniqueness(logger, prop, tempProps_1);\r\n tempProps_1[prop] = value;\r\n });\r\n properties = tempProps_1;\r\n }\r\n return properties;\r\n}\r\nexport function dataSanitizeMeasurements(logger, measurements) {\r\n if (measurements) {\r\n var tempMeasurements_1 = {};\r\n objForEachKey(measurements, function (measure, value) {\r\n measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1);\r\n tempMeasurements_1[measure] = value;\r\n });\r\n measurements = tempMeasurements_1;\r\n }\r\n return measurements;\r\n}\r\nexport function dataSanitizeId(logger, id) {\r\n return id ? dataSanitizeInput(logger, id, 128 /* MAX_ID_LENGTH */, _InternalMessageId.IdTooLong).toString() : id;\r\n}\r\nexport function dataSanitizeInput(logger, input, maxLength, _msgId) {\r\n var inputTrunc;\r\n if (input) {\r\n input = strTrim(input);\r\n if (input.length > maxLength) {\r\n inputTrunc = input.substring(0, maxLength);\r\n logger && logger.throwInternal(2 /* WARNING */, _msgId, \"input is too long, it has been truncated to \" + maxLength + \" characters.\", { data: input }, true);\r\n }\r\n }\r\n return inputTrunc || input;\r\n}\r\nexport function dsPadNumber(num) {\r\n var s = \"00\" + num;\r\n return s.substr(s.length - 3);\r\n}\r\n/**\r\n * Provides the DataSanitizer functions within the previous namespace.\r\n */\r\nexport var DataSanitizer = {\r\n MAX_NAME_LENGTH: 150 /* MAX_NAME_LENGTH */,\r\n MAX_ID_LENGTH: 128 /* MAX_ID_LENGTH */,\r\n MAX_PROPERTY_LENGTH: 8192 /* MAX_PROPERTY_LENGTH */,\r\n MAX_STRING_LENGTH: 1024 /* MAX_STRING_LENGTH */,\r\n MAX_URL_LENGTH: 2048 /* MAX_URL_LENGTH */,\r\n MAX_MESSAGE_LENGTH: 32768 /* MAX_MESSAGE_LENGTH */,\r\n MAX_EXCEPTION_LENGTH: 32768 /* MAX_EXCEPTION_LENGTH */,\r\n sanitizeKeyAndAddUniqueness: dataSanitizeKeyAndAddUniqueness,\r\n sanitizeKey: dataSanitizeKey,\r\n sanitizeString: dataSanitizeString,\r\n sanitizeUrl: dataSanitizeUrl,\r\n sanitizeMessage: dataSanitizeMessage,\r\n sanitizeException: dataSanitizeException,\r\n sanitizeProperties: dataSanitizeProperties,\r\n sanitizeMeasurements: dataSanitizeMeasurements,\r\n sanitizeId: dataSanitizeId,\r\n sanitizeInput: dataSanitizeInput,\r\n padNumber: dsPadNumber,\r\n trim: strTrim\r\n};\r\n//# sourceMappingURL=DataSanitizer.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/dist-esm/Util.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-common",
3
- "version": "2.8.0-beta.2203-01",
3
+ "version": "2.8.0-beta.2203-02",
4
4
  "description": "Microsoft Application Insights Common JavaScript Library",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@microsoft/applicationinsights-shims": "2.0.1",
50
- "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-01",
50
+ "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-02",
51
51
  "@microsoft/dynamicproto-js": "^1.1.4"
52
52
  },
53
53
  "license": "MIT",
package/src/Enums.ts CHANGED
@@ -1,26 +1,35 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
+ import { createEnumStyle } from "@microsoft/applicationinsights-core-js";
5
+
4
6
  /**
5
7
  * Type of storage to differentiate between local storage and session storage
6
8
  */
7
- export enum StorageType {
9
+ export const enum eStorageType {
8
10
  LocalStorage,
9
11
  SessionStorage
10
12
  }
11
13
 
14
+ export const StorageType = createEnumStyle<{ [key in (keyof typeof eStorageType)]: number; }>({
15
+ LocalStorage: eStorageType.LocalStorage,
16
+ SessionStorage: eStorageType.SessionStorage
17
+ });
18
+ export type StorageType = eStorageType | typeof StorageType;
19
+
20
+
12
21
  /**
13
22
  * Enum is used in aiDataContract to describe how fields are serialized.
14
23
  * For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
15
24
  */
16
25
  export const enum FieldType { Default = 0, Required = 1, Array = 2, Hidden = 4 }
17
26
 
18
- export enum DistributedTracingModes {
27
+ export const enum eDistributedTracingModes {
19
28
  /**
20
29
  * (Default) Send Application Insights correlation headers
21
30
  */
22
31
 
23
- AI=0,
32
+ AI = 0,
24
33
 
25
34
  /**
26
35
  * Send both W3C Trace Context headers and back-compatibility Application Insights headers
@@ -32,3 +41,10 @@ export enum DistributedTracingModes {
32
41
  */
33
42
  W3C
34
43
  }
44
+
45
+ export const DistributedTracingModes = createEnumStyle<{ [key in (keyof typeof eDistributedTracingModes)]: number; }>({
46
+ AI: eDistributedTracingModes.AI,
47
+ AI_AND_W3C: eDistributedTracingModes.AI_AND_W3C,
48
+ W3C: eDistributedTracingModes.W3C
49
+ });
50
+ export type DistributedTracingModes = number | eDistributedTracingModes;
@@ -3,6 +3,8 @@
3
3
 
4
4
  import { arrForEach, IPlugin, isString } from "@microsoft/applicationinsights-core-js";
5
5
 
6
+ const strEmpty = "";
7
+
6
8
  export function stringToBoolOrDefault(str: any, defaultValue = false): boolean {
7
9
  if (str === undefined || str === null) {
8
10
  return defaultValue;
@@ -21,10 +23,10 @@ export function msToTimeSpan(totalms: number): string {
21
23
 
22
24
  totalms = Math.round(totalms);
23
25
 
24
- let ms = "" + totalms % 1000;
25
- let sec = "" + Math.floor(totalms / 1000) % 60;
26
- let min = "" + Math.floor(totalms / (1000 * 60)) % 60;
27
- let hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
26
+ let ms = strEmpty + totalms % 1000;
27
+ let sec = strEmpty + Math.floor(totalms / 1000) % 60;
28
+ let min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
29
+ let hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
28
30
  const days = Math.floor(totalms / (1000 * 60 * 60 * 24));
29
31
 
30
32
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
@@ -32,7 +34,7 @@ export function msToTimeSpan(totalms: number): string {
32
34
  min = min.length < 2 ? "0" + min : min;
33
35
  hour = hour.length < 2 ? "0" + hour : hour;
34
36
 
35
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
37
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
36
38
  }
37
39
 
38
40
  export function getExtensionByName(extensions: IPlugin[], identifier: string): IPlugin | null {
@@ -0,0 +1,57 @@
1
+ // // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // // Licensed under the MIT License.
3
+
4
+ // // THIS FILE WAS AUTOGENERATED
5
+ // import { Domain } from "./Domain";
6
+ // "use strict";
7
+
8
+ // /**
9
+ // * Instances of AvailabilityData represent the result of executing an availability test.
10
+ // */
11
+ // export class AvailabilityData implements Domain {
12
+
13
+ // /**
14
+ // * Schema version
15
+ // */
16
+ // public ver: number = 2;
17
+
18
+ // /**
19
+ // * Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.
20
+ // */
21
+ // public id: string;
22
+
23
+ // /**
24
+ // * Name of the test that these availability results represent.
25
+ // */
26
+ // public name: string;
27
+
28
+ // /**
29
+ // * Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.
30
+ // */
31
+ // public duration: string;
32
+
33
+ // /**
34
+ // * Success flag.
35
+ // */
36
+ // public success: boolean;
37
+
38
+ // /**
39
+ // * Name of the location where the test was run from.
40
+ // */
41
+ // public runLocation: string;
42
+
43
+ // /**
44
+ // * Diagnostic message for the result.
45
+ // */
46
+ // public message: string;
47
+
48
+ // /**
49
+ // * Collection of custom properties.
50
+ // */
51
+ // public properties: any = {};
52
+
53
+ // /**
54
+ // * Collection of custom measurements.
55
+ // */
56
+ // public measurements: any = {};
57
+ // }
@@ -0,0 +1,299 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { createClassFromInterface } from "@microsoft/applicationinsights-core-js";
5
+
6
+ function _aiNameFunc(baseName: string) {
7
+ let aiName = "ai." + baseName + ".";
8
+ return function(name: string) {
9
+ return aiName + name;
10
+ }
11
+ }
12
+
13
+ let _aiApplication = _aiNameFunc("application");
14
+ let _aiDevice = _aiNameFunc("device");
15
+ let _aiLocation = _aiNameFunc("location");
16
+ let _aiOperation = _aiNameFunc("operation");
17
+ let _aiSession = _aiNameFunc("session");
18
+ let _aiUser = _aiNameFunc("user");
19
+ let _aiCloud = _aiNameFunc("cloud");
20
+ let _aiInternal = _aiNameFunc("internal");
21
+
22
+ export interface IContextTagKeys {
23
+
24
+ /**
25
+ * Application version. Information in the application context fields is always about the application that is sending the telemetry.
26
+ */
27
+ readonly applicationVersion: string;
28
+
29
+ /**
30
+ * Application build.
31
+ */
32
+ readonly applicationBuild: string;
33
+
34
+ /**
35
+ * Application type id.
36
+ */
37
+ readonly applicationTypeId: string;
38
+
39
+ /**
40
+ * Application id.
41
+ */
42
+ readonly applicationId: string;
43
+
44
+ /**
45
+ * Application layer.
46
+ */
47
+ readonly applicationLayer: string;
48
+
49
+ /**
50
+ * Unique client device id. Computer name in most cases.
51
+ */
52
+ readonly deviceId: string;
53
+ readonly deviceIp: string;
54
+ readonly deviceLanguage: string;
55
+
56
+ /**
57
+ * Device locale using <language>-<REGION> pattern, following RFC 5646. Example 'en-US'.
58
+ */
59
+ readonly deviceLocale: string;
60
+
61
+ /**
62
+ * Model of the device the end user of the application is using. Used for client scenarios. If this field is empty then it is derived from the user agent.
63
+ */
64
+ readonly deviceModel: string;
65
+ readonly deviceFriendlyName: string;
66
+ readonly deviceNetwork: string;
67
+ readonly deviceNetworkName: string;
68
+
69
+ /**
70
+ * Client device OEM name taken from the browser.
71
+ */
72
+ readonly deviceOEMName: string;
73
+ readonly deviceOS: string;
74
+
75
+ /**
76
+ * Operating system name and version of the device the end user of the application is using. If this field is empty then it is derived from the user agent. Example 'Windows 10 Pro 10.0.10586.0'
77
+ */
78
+ readonly deviceOSVersion: string;
79
+
80
+ /**
81
+ * Name of the instance where application is running. Computer name for on-premisis, instance name for Azure.
82
+ */
83
+ readonly deviceRoleInstance: string;
84
+
85
+ /**
86
+ * Name of the role application is part of. Maps directly to the role name in azure.
87
+ */
88
+ readonly deviceRoleName: string;
89
+ readonly deviceScreenResolution: string;
90
+
91
+ /**
92
+ * The type of the device the end user of the application is using. Used primarily to distinguish JavaScript telemetry from server side telemetry. Examples: 'PC', 'Phone', 'Browser'. 'PC' is the default value.
93
+ */
94
+ readonly deviceType: string;
95
+ readonly deviceMachineName: string;
96
+ readonly deviceVMName: string;
97
+ readonly deviceBrowser: string;
98
+
99
+ /**
100
+ * The browser name and version as reported by the browser.
101
+ */
102
+ readonly deviceBrowserVersion: string;
103
+
104
+ /**
105
+ * The IP address of the client device. IPv4 and IPv6 are supported. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
106
+ */
107
+ readonly locationIp: string;
108
+
109
+ /**
110
+ * The country of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
111
+ */
112
+ readonly locationCountry: string;
113
+
114
+ /**
115
+ * The province/state of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
116
+ */
117
+ readonly locationProvince: string;
118
+
119
+ /**
120
+ * The city of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
121
+ */
122
+ readonly locationCity: string;
123
+
124
+ /**
125
+ * A unique identifier for the operation instance. The operation.id is created by either a request or a page view. All other telemetry sets this to the value for the containing request or page view. Operation.id is used for finding all the telemetry items for a specific operation instance.
126
+ */
127
+ readonly operationId: string;
128
+
129
+ /**
130
+ * The name (group) of the operation. The operation.name is created by either a request or a page view. All other telemetry items set this to the value for the containing request or page view. Operation.name is used for finding all the telemetry items for a group of operations (i.e. 'GET Home/Index').
131
+ */
132
+ readonly operationName: string;
133
+
134
+ /**
135
+ * The unique identifier of the telemetry item's immediate parent.
136
+ */
137
+ readonly operationParentId: string;
138
+ readonly operationRootId: string;
139
+
140
+ /**
141
+ * Name of synthetic source. Some telemetry from the application may represent a synthetic traffic. It may be web crawler indexing the web site, site availability tests or traces from diagnostic libraries like Application Insights SDK itself.
142
+ */
143
+ readonly operationSyntheticSource: string;
144
+
145
+ /**
146
+ * The correlation vector is a light weight vector clock which can be used to identify and order related events across clients and services.
147
+ */
148
+ readonly operationCorrelationVector: string;
149
+
150
+ /**
151
+ * Session ID - the instance of the user's interaction with the app. Information in the session context fields is always about the end user. When telemetry is sent from a service, the session context is about the user that initiated the operation in the service.
152
+ */
153
+ readonly sessionId: string;
154
+
155
+ /**
156
+ * Boolean value indicating whether the session identified by ai.session.id is first for the user or not.
157
+ */
158
+ readonly sessionIsFirst: string;
159
+ readonly sessionIsNew: string;
160
+ readonly userAccountAcquisitionDate: string;
161
+
162
+ /**
163
+ * In multi-tenant applications this is the account ID or name which the user is acting with. Examples may be subscription ID for Azure portal or blog name blogging platform.
164
+ */
165
+ readonly userAccountId: string;
166
+
167
+ /**
168
+ * The browser's user agent string as reported by the browser. This property will be used to extract informaiton regarding the customer's browser but will not be stored. Use custom properties to store the original user agent.
169
+ */
170
+ readonly userAgent: string;
171
+
172
+ /**
173
+ * Anonymous user id. Represents the end user of the application. When telemetry is sent from a service, the user context is about the user that initiated the operation in the service.
174
+ */
175
+ readonly userId: string;
176
+
177
+ /**
178
+ * Store region for UWP applications.
179
+ */
180
+ readonly userStoreRegion: string;
181
+
182
+ /**
183
+ * Authenticated user id. The opposite of ai.user.id, this represents the user with a friendly name. Since it's PII information it is not collected by default by most SDKs.
184
+ */
185
+ readonly userAuthUserId: string;
186
+ readonly userAnonymousUserAcquisitionDate: string;
187
+ readonly userAuthenticatedUserAcquisitionDate: string;
188
+ readonly cloudName: string;
189
+
190
+ /**
191
+ * Name of the role the application is a part of. Maps directly to the role name in azure.
192
+ */
193
+ readonly cloudRole: string;
194
+ readonly cloudRoleVer: string;
195
+
196
+ /**
197
+ * Name of the instance where the application is running. Computer name for on-premisis, instance name for Azure.
198
+ */
199
+ readonly cloudRoleInstance: string;
200
+ readonly cloudEnvironment: string;
201
+ readonly cloudLocation: string;
202
+ readonly cloudDeploymentUnit: string;
203
+
204
+ /**
205
+ * SDK version. See https://github.com/microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification for information.
206
+ */
207
+ readonly internalSdkVersion: string;
208
+
209
+ /**
210
+ * Agent version. Used to indicate the version of StatusMonitor installed on the computer if it is used for data collection.
211
+ */
212
+ readonly internalAgentVersion: string;
213
+
214
+ /**
215
+ * This is the node name used for billing purposes. Use it to override the standard detection of nodes.
216
+ */
217
+ readonly internalNodeName: string;
218
+
219
+ /**
220
+ * This identifies the version of the snippet that was used to initialize the SDK
221
+ */
222
+ readonly internalSnippet: string;
223
+
224
+ /**
225
+ * This identifies the source of the Sdk script (used to identify whether the SDK was loaded via the CDN)
226
+ */
227
+ readonly internalSdkSrc: string;
228
+ }
229
+
230
+ export class ContextTagKeys extends createClassFromInterface<IContextTagKeys>({
231
+ applicationVersion: _aiApplication("ver"),
232
+ applicationBuild: _aiApplication("build"),
233
+ applicationTypeId: _aiApplication("typeId"),
234
+ applicationId: _aiApplication("applicationId"),
235
+ applicationLayer: _aiApplication("layer"),
236
+
237
+ deviceId: _aiDevice("id"),
238
+ deviceIp: _aiDevice("ip"),
239
+ deviceLanguage: _aiDevice("language"),
240
+ deviceLocale: _aiDevice("locale"),
241
+ deviceModel: _aiDevice("model"),
242
+ deviceFriendlyName: _aiDevice("friendlyName"),
243
+ deviceNetwork: _aiDevice("network"),
244
+ deviceNetworkName: _aiDevice("networkName"),
245
+ deviceOEMName: _aiDevice("oemName"),
246
+ deviceOS: _aiDevice("os"),
247
+ deviceOSVersion: _aiDevice("osVersion"),
248
+ deviceRoleInstance: _aiDevice("roleInstance"),
249
+ deviceRoleName: _aiDevice("roleName"),
250
+ deviceScreenResolution: _aiDevice("screenResolution"),
251
+ deviceType: _aiDevice("type"),
252
+ deviceMachineName: _aiDevice("machineName"),
253
+ deviceVMName: _aiDevice("vmName"),
254
+ deviceBrowser: _aiDevice("browser"),
255
+ deviceBrowserVersion: _aiDevice("browserVersion"),
256
+
257
+ locationIp: _aiLocation("ip"),
258
+ locationCountry: _aiLocation("country"),
259
+ locationProvince: _aiLocation("province"),
260
+ locationCity: _aiLocation("city"),
261
+
262
+ operationId: _aiOperation("id"),
263
+ operationName: _aiOperation("name"),
264
+ operationParentId: _aiOperation("parentId"),
265
+ operationRootId: _aiOperation("rootId"),
266
+ operationSyntheticSource: _aiOperation("syntheticSource"),
267
+ operationCorrelationVector: _aiOperation("correlationVector"),
268
+
269
+ sessionId: _aiSession("id"),
270
+ sessionIsFirst: _aiSession("isFirst"),
271
+ sessionIsNew: _aiSession("isNew"),
272
+
273
+ userAccountAcquisitionDate: _aiUser("accountAcquisitionDate"),
274
+ userAccountId: _aiUser("accountId"),
275
+ userAgent: _aiUser("userAgent"),
276
+ userId: _aiUser("id"),
277
+ userStoreRegion: _aiUser("storeRegion"),
278
+ userAuthUserId: _aiUser("authUserId"),
279
+ userAnonymousUserAcquisitionDate: _aiUser("anonUserAcquisitionDate"),
280
+ userAuthenticatedUserAcquisitionDate: _aiUser("authUserAcquisitionDate"),
281
+
282
+ cloudName: _aiCloud("name"),
283
+ cloudRole: _aiCloud("role"),
284
+ cloudRoleVer: _aiCloud("roleVer"),
285
+ cloudRoleInstance: _aiCloud("roleInstance"),
286
+ cloudEnvironment: _aiCloud("environment"),
287
+ cloudLocation: _aiCloud("location"),
288
+ cloudDeploymentUnit: _aiCloud("deploymentUnit"),
289
+
290
+ internalNodeName: _aiInternal("nodeName"),
291
+ internalSdkVersion: _aiInternal("sdkVersion"),
292
+ internalAgentVersion: _aiInternal("agentVersion"),
293
+ internalSnippet: _aiInternal("snippet"),
294
+ internalSdkSrc: _aiInternal("sdkSrc")
295
+ }) {
296
+ constructor() {
297
+ super();
298
+ }
299
+ }