@microsoft/applicationinsights-common 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06

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 (254) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +926 -539
  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 +2625 -945
  7. package/dist/applicationinsights-common.api.md +103 -46
  8. package/dist/applicationinsights-common.d.ts +520 -286
  9. package/dist/applicationinsights-common.js +926 -539
  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 +520 -286
  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/{Generated/ContextTagKeys.js → ContextTagKeys.js} +1 -1
  35. package/dist-esm/Interfaces/Contracts/{Generated/ContextTagKeys.js.map → ContextTagKeys.js.map} +0 -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/Domain.js → IBase.js} +2 -2
  43. package/dist-esm/Interfaces/Contracts/IBase.js.map +1 -0
  44. package/dist-esm/Interfaces/Contracts/IData.js +8 -0
  45. package/dist-esm/Interfaces/Contracts/IData.js.map +1 -0
  46. package/dist-esm/Interfaces/Contracts/IDataPoint.js +6 -0
  47. package/dist-esm/Interfaces/Contracts/IDataPoint.js.map +1 -0
  48. package/dist-esm/Interfaces/Contracts/IDomain.js +8 -0
  49. package/dist-esm/Interfaces/Contracts/IDomain.js.map +1 -0
  50. package/dist-esm/Interfaces/Contracts/IEnvelope.js +46 -0
  51. package/dist-esm/Interfaces/Contracts/IEnvelope.js.map +1 -0
  52. package/dist-esm/Interfaces/Contracts/IEventData.js +8 -0
  53. package/dist-esm/Interfaces/Contracts/IEventData.js.map +1 -0
  54. package/dist-esm/Interfaces/Contracts/IExceptionData.js +8 -0
  55. package/dist-esm/Interfaces/Contracts/IExceptionData.js.map +1 -0
  56. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +8 -0
  57. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js.map +1 -0
  58. package/dist-esm/Interfaces/Contracts/IMessageData.js +8 -0
  59. package/dist-esm/Interfaces/Contracts/IMessageData.js.map +1 -0
  60. package/dist-esm/Interfaces/Contracts/IMetricData.js +8 -0
  61. package/dist-esm/Interfaces/Contracts/IMetricData.js.map +1 -0
  62. package/dist-esm/Interfaces/Contracts/IPageViewData.js +8 -0
  63. package/dist-esm/Interfaces/Contracts/IPageViewData.js.map +1 -0
  64. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +8 -0
  65. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js.map +1 -0
  66. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +8 -0
  67. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js.map +1 -0
  68. package/dist-esm/Interfaces/Contracts/IStackFrame.js +8 -0
  69. package/dist-esm/Interfaces/Contracts/IStackFrame.js.map +1 -0
  70. package/dist-esm/Interfaces/Contracts/RequestData.js +46 -0
  71. package/dist-esm/Interfaces/Contracts/RequestData.js.map +1 -0
  72. package/dist-esm/Interfaces/Contracts/{Generated/SeverityLevel.js → SeverityLevel.js} +1 -1
  73. package/dist-esm/Interfaces/Contracts/{Generated/SeverityLevel.js.map → SeverityLevel.js.map} +0 -0
  74. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  75. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  76. package/dist-esm/Interfaces/IConfig.js +1 -1
  77. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  78. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  79. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  80. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  81. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  82. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  83. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  84. package/dist-esm/Interfaces/IPartC.js +1 -1
  85. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  86. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  87. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  88. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  89. package/dist-esm/Interfaces/PartAExtensions.js +2 -2
  90. package/dist-esm/Interfaces/PartAExtensions.js.map +1 -1
  91. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  92. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  93. package/dist-esm/RequestResponseHeaders.js +1 -1
  94. package/dist-esm/StorageHelperFuncs.js +27 -12
  95. package/dist-esm/StorageHelperFuncs.js.map +1 -1
  96. package/dist-esm/Telemetry/Common/Data.js +6 -11
  97. package/dist-esm/Telemetry/Common/Data.js.map +1 -1
  98. package/dist-esm/Telemetry/Common/DataPoint.js +8 -9
  99. package/dist-esm/Telemetry/Common/DataPoint.js.map +1 -1
  100. package/dist-esm/Telemetry/Common/DataSanitizer.js +10 -10
  101. package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
  102. package/dist-esm/Telemetry/Common/Envelope.js +12 -12
  103. package/dist-esm/Telemetry/Common/Envelope.js.map +1 -1
  104. package/dist-esm/Telemetry/Event.js +9 -12
  105. package/dist-esm/Telemetry/Event.js.map +1 -1
  106. package/dist-esm/Telemetry/Exception.js +74 -81
  107. package/dist-esm/Telemetry/Exception.js.map +1 -1
  108. package/dist-esm/Telemetry/Metric.js +9 -12
  109. package/dist-esm/Telemetry/Metric.js.map +1 -1
  110. package/dist-esm/Telemetry/PageView.js +12 -15
  111. package/dist-esm/Telemetry/PageView.js.map +1 -1
  112. package/dist-esm/Telemetry/PageViewPerformance.js +16 -19
  113. package/dist-esm/Telemetry/PageViewPerformance.js.map +1 -1
  114. package/dist-esm/Telemetry/RemoteDependencyData.js +17 -20
  115. package/dist-esm/Telemetry/RemoteDependencyData.js.map +1 -1
  116. package/dist-esm/Telemetry/Trace.js +10 -13
  117. package/dist-esm/Telemetry/Trace.js.map +1 -1
  118. package/dist-esm/TelemetryItemCreator.js +1 -1
  119. package/dist-esm/UrlHelperFuncs.js +1 -1
  120. package/dist-esm/Util.js +1 -1
  121. package/dist-esm/applicationinsights-common.js +4 -7
  122. package/dist-esm/applicationinsights-common.js.map +1 -1
  123. package/package.json +3 -3
  124. package/src/Enums.ts +19 -3
  125. package/src/HelperFuncs.ts +7 -5
  126. package/src/Interfaces/Contracts/AvailabilityData.ts +57 -0
  127. package/src/Interfaces/Contracts/{Generated/ContextTagKeys.ts → ContextTagKeys.ts} +0 -0
  128. package/src/Interfaces/Contracts/{Generated/DataPointType.ts → DataPointType.ts} +2 -3
  129. package/src/Interfaces/Contracts/{Generated/DependencyKind.ts → DependencyKind.ts} +2 -3
  130. package/src/Interfaces/Contracts/{Generated/DependencySourceType.ts → DependencySourceType.ts} +2 -3
  131. package/src/Interfaces/Contracts/{Generated/Base.ts → IBase.ts} +2 -7
  132. package/src/Interfaces/Contracts/{Generated/Data.ts → IData.ts} +5 -12
  133. package/src/Interfaces/Contracts/{Generated/DataPoint.ts → IDataPoint.ts} +8 -8
  134. package/src/Interfaces/Contracts/{Generated/Domain.ts → IDomain.ts} +1 -3
  135. package/src/Interfaces/Contracts/IEnvelope.ts +50 -0
  136. package/src/Interfaces/Contracts/{Generated/EventData.ts → IEventData.ts} +7 -10
  137. package/src/Interfaces/Contracts/{Generated/ExceptionData.ts → IExceptionData.ts} +8 -11
  138. package/src/Interfaces/Contracts/{Generated/ExceptionDetails.ts → IExceptionDetails.ts} +9 -10
  139. package/src/Interfaces/Contracts/{Generated/MessageData.ts → IMessageData.ts} +7 -10
  140. package/src/Interfaces/Contracts/{Generated/MetricData.ts → IMetricData.ts} +7 -10
  141. package/{types/Interfaces/Contracts/Generated/PageViewData.d.ts → src/Interfaces/Contracts/IPageViewData.ts} +10 -19
  142. package/src/Interfaces/Contracts/IPageViewPerfData.ts +35 -0
  143. package/src/Interfaces/Contracts/{Generated/RemoteDependencyData.ts → IRemoteDependencyData.ts} +13 -16
  144. package/src/Interfaces/Contracts/{Generated/StackFrame.ts → IStackFrame.ts} +6 -7
  145. package/src/Interfaces/Contracts/RequestData.ts +50 -0
  146. package/src/Interfaces/Contracts/{Generated/SeverityLevel.ts → SeverityLevel.ts} +0 -0
  147. package/src/Interfaces/IExceptionTelemetry.ts +1 -1
  148. package/src/Interfaces/ITraceTelemetry.ts +1 -1
  149. package/src/Interfaces/PartAExtensions.ts +1 -1
  150. package/src/Interfaces/Telemetry/IEnvelope.ts +35 -3
  151. package/src/StorageHelperFuncs.ts +40 -23
  152. package/src/Telemetry/Common/Data.ts +12 -4
  153. package/src/Telemetry/Common/DataPoint.ts +38 -2
  154. package/src/Telemetry/Common/DataSanitizer.ts +19 -19
  155. package/src/Telemetry/Common/Envelope.ts +51 -10
  156. package/src/Telemetry/Event.ts +30 -12
  157. package/src/Telemetry/Exception.ts +179 -80
  158. package/src/Telemetry/Metric.ts +27 -7
  159. package/src/Telemetry/PageView.ts +45 -10
  160. package/src/Telemetry/PageViewPerformance.ts +76 -14
  161. package/src/Telemetry/RemoteDependencyData.ts +70 -15
  162. package/src/Telemetry/Trace.ts +34 -8
  163. package/src/TelemetryItemCreator.ts +1 -1
  164. package/src/applicationinsights-common.ts +7 -7
  165. package/types/Enums.d.ts +13 -2
  166. package/types/Interfaces/Contracts/AvailabilityData.d.ts +0 -0
  167. package/types/Interfaces/Contracts/{Generated/ContextTagKeys.d.ts → ContextTagKeys.d.ts} +0 -0
  168. package/types/Interfaces/Contracts/{Generated/DataPointType.d.ts → DataPointType.d.ts} +1 -1
  169. package/types/Interfaces/Contracts/{Generated/DependencyKind.d.ts → DependencyKind.d.ts} +1 -1
  170. package/types/Interfaces/Contracts/{Generated/DependencySourceType.d.ts → DependencySourceType.d.ts} +1 -1
  171. package/types/Interfaces/Contracts/{Generated/Base.d.ts → IBase.d.ts} +1 -2
  172. package/types/Interfaces/Contracts/{Generated/Data.d.ts → IData.d.ts} +2 -3
  173. package/types/Interfaces/Contracts/{Generated/DataPoint.d.ts → IDataPoint.d.ts} +1 -1
  174. package/types/Interfaces/Contracts/{Generated/Domain.d.ts → IDomain.d.ts} +1 -1
  175. package/types/Interfaces/Contracts/IEnvelope.d.ts +0 -0
  176. package/types/Interfaces/Contracts/{Generated/EventData.d.ts → IEventData.d.ts} +2 -3
  177. package/types/Interfaces/Contracts/{Generated/ExceptionData.d.ts → IExceptionData.d.ts} +4 -5
  178. package/types/Interfaces/Contracts/{Generated/ExceptionDetails.d.ts → IExceptionDetails.d.ts} +3 -3
  179. package/types/Interfaces/Contracts/{Generated/MessageData.d.ts → IMessageData.d.ts} +2 -3
  180. package/types/Interfaces/Contracts/{Generated/MetricData.d.ts → IMetricData.d.ts} +4 -5
  181. package/types/Interfaces/Contracts/IPageViewData.d.ts +18 -0
  182. package/types/Interfaces/Contracts/IPageViewPerfData.d.ts +26 -0
  183. package/types/Interfaces/Contracts/{Generated/RemoteDependencyData.d.ts → IRemoteDependencyData.d.ts} +2 -3
  184. package/types/Interfaces/Contracts/{Generated/StackFrame.d.ts → IStackFrame.d.ts} +1 -1
  185. package/types/Interfaces/Contracts/RequestData.d.ts +0 -0
  186. package/types/Interfaces/Contracts/{Generated/SeverityLevel.d.ts → SeverityLevel.d.ts} +0 -0
  187. package/types/Interfaces/IExceptionTelemetry.d.ts +1 -1
  188. package/types/Interfaces/ITraceTelemetry.d.ts +1 -1
  189. package/types/Interfaces/PartAExtensions.d.ts +1 -1
  190. package/types/Interfaces/Telemetry/IEnvelope.d.ts +24 -0
  191. package/types/StorageHelperFuncs.d.ts +14 -2
  192. package/types/Telemetry/Common/Data.d.ts +10 -2
  193. package/types/Telemetry/Common/DataPoint.d.ts +31 -2
  194. package/types/Telemetry/Common/DataSanitizer.d.ts +3 -3
  195. package/types/Telemetry/Common/Envelope.d.ts +35 -4
  196. package/types/Telemetry/Event.d.ts +19 -3
  197. package/types/Telemetry/Exception.d.ts +75 -7
  198. package/types/Telemetry/Metric.d.ts +19 -2
  199. package/types/Telemetry/PageView.d.ts +30 -2
  200. package/types/Telemetry/PageViewPerformance.d.ts +50 -2
  201. package/types/Telemetry/RemoteDependencyData.d.ts +46 -2
  202. package/types/Telemetry/Trace.d.ts +23 -3
  203. package/types/applicationinsights-common.d.ts +7 -7
  204. package/types/tsdoc-metadata.json +1 -1
  205. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +0 -27
  206. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js.map +0 -1
  207. package/dist-esm/Interfaces/Contracts/Generated/Base.js +0 -17
  208. package/dist-esm/Interfaces/Contracts/Generated/Base.js.map +0 -1
  209. package/dist-esm/Interfaces/Contracts/Generated/Data.js +0 -21
  210. package/dist-esm/Interfaces/Contracts/Generated/Data.js.map +0 -1
  211. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +0 -21
  212. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js.map +0 -1
  213. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +0 -16
  214. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js.map +0 -1
  215. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +0 -17
  216. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js.map +0 -1
  217. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +0 -17
  218. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js.map +0 -1
  219. package/dist-esm/Interfaces/Contracts/Generated/Domain.js.map +0 -1
  220. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +0 -28
  221. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js.map +0 -1
  222. package/dist-esm/Interfaces/Contracts/Generated/EventData.js +0 -28
  223. package/dist-esm/Interfaces/Contracts/Generated/EventData.js.map +0 -1
  224. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +0 -32
  225. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js.map +0 -1
  226. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +0 -24
  227. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js.map +0 -1
  228. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +0 -28
  229. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js.map +0 -1
  230. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +0 -32
  231. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js.map +0 -1
  232. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +0 -34
  233. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js.map +0 -1
  234. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +0 -34
  235. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js.map +0 -1
  236. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +0 -32
  237. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js.map +0 -1
  238. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +0 -28
  239. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js.map +0 -1
  240. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +0 -17
  241. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js.map +0 -1
  242. package/dist-esm/Telemetry/Common/Base.js +0 -22
  243. package/dist-esm/Telemetry/Common/Base.js.map +0 -1
  244. package/src/Interfaces/Contracts/Generated/AvailabilityData.ts +0 -57
  245. package/src/Interfaces/Contracts/Generated/Envelope.ts +0 -50
  246. package/src/Interfaces/Contracts/Generated/PageViewData.ts +0 -50
  247. package/src/Interfaces/Contracts/Generated/PageViewPerfData.ts +0 -70
  248. package/src/Interfaces/Contracts/Generated/RequestData.ts +0 -50
  249. package/src/Telemetry/Common/Base.ts +0 -14
  250. package/types/Interfaces/Contracts/Generated/AvailabilityData.d.ts +0 -42
  251. package/types/Interfaces/Contracts/Generated/Envelope.d.ts +0 -38
  252. package/types/Interfaces/Contracts/Generated/PageViewPerfData.d.ts +0 -51
  253. package/types/Interfaces/Contracts/Generated/RequestData.d.ts +0 -38
  254. package/types/Telemetry/Common/Base.d.ts +0 -8
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { dumpObj, getExceptionName, getGlobal, getGlobalInst, IDiagnosticLogger, isNullOrUndefined, LoggingSeverity, objForEachKey, _InternalMessageId } from "@microsoft/applicationinsights-core-js";
4
+ import { dumpObj, getExceptionName, getGlobal, getGlobalInst, IDiagnosticLogger, isNullOrUndefined, eLoggingSeverity, objForEachKey, _eInternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
5
5
  import { StorageType } from "./Enums";
6
6
 
7
7
  let _canUseLocalStorage: boolean = undefined;
@@ -57,13 +57,29 @@ function _getSessionStorageObject(): Storage {
57
57
  return null;
58
58
  }
59
59
 
60
+ /**
61
+ * Disables the global SDK usage of local or session storage if available
62
+ */
60
63
  export function utlDisableStorage() {
61
64
  _canUseLocalStorage = false;
62
65
  _canUseSessionStorage = false;
63
66
  }
64
67
 
65
- export function utlCanUseLocalStorage(): boolean {
66
- if (_canUseLocalStorage === undefined) {
68
+ /**
69
+ * Re-enables the global SDK usage of local or session storage if available
70
+ */
71
+ export function utlEnableStorage() {
72
+ _canUseLocalStorage = utlCanUseLocalStorage(true);
73
+ _canUseSessionStorage = utlCanUseSessionStorage(true);
74
+ }
75
+
76
+ /**
77
+ * Returns whether LocalStorage can be used, if the reset parameter is passed a true this will override
78
+ * any previous disable calls.
79
+ * @param reset - Should the usage be reset and determined only based on whether LocalStorage is available
80
+ */
81
+ export function utlCanUseLocalStorage(reset?: boolean): boolean {
82
+ if (reset || _canUseLocalStorage === undefined) {
67
83
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
68
84
  }
69
85
 
@@ -78,9 +94,9 @@ export function utlGetLocalStorage(logger: IDiagnosticLogger, name: string): str
78
94
  } catch (e) {
79
95
  _canUseLocalStorage = false;
80
96
 
81
- logger.throwInternal(
82
- LoggingSeverity.WARNING,
83
- _InternalMessageId.BrowserCannotReadLocalStorage,
97
+ _throwInternal(logger,
98
+ eLoggingSeverity.WARNING,
99
+ _eInternalMessageId.BrowserCannotReadLocalStorage,
84
100
  "Browser failed read of local storage. " + getExceptionName(e),
85
101
  { exception: dumpObj(e) });
86
102
  }
@@ -97,9 +113,9 @@ export function utlSetLocalStorage(logger: IDiagnosticLogger, name: string, data
97
113
  } catch (e) {
98
114
  _canUseLocalStorage = false;
99
115
 
100
- logger.throwInternal(
101
- LoggingSeverity.WARNING,
102
- _InternalMessageId.BrowserCannotWriteLocalStorage,
116
+ _throwInternal(logger,
117
+ eLoggingSeverity.WARNING,
118
+ _eInternalMessageId.BrowserCannotWriteLocalStorage,
103
119
  "Browser failed write to local storage. " + getExceptionName(e),
104
120
  { exception: dumpObj(e) });
105
121
  }
@@ -116,9 +132,9 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
116
132
  } catch (e) {
117
133
  _canUseLocalStorage = false;
118
134
 
119
- logger.throwInternal(
120
- LoggingSeverity.WARNING,
121
- _InternalMessageId.BrowserFailedRemovalFromLocalStorage,
135
+ _throwInternal(logger,
136
+ eLoggingSeverity.WARNING,
137
+ _eInternalMessageId.BrowserFailedRemovalFromLocalStorage,
122
138
  "Browser failed removal of local storage item. " + getExceptionName(e),
123
139
  { exception: dumpObj(e) });
124
140
  }
@@ -126,8 +142,8 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
126
142
  return false;
127
143
  }
128
144
 
129
- export function utlCanUseSessionStorage(): boolean {
130
- if (_canUseSessionStorage === undefined) {
145
+ export function utlCanUseSessionStorage(reset?: boolean): boolean {
146
+ if (reset || _canUseSessionStorage === undefined) {
131
147
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
132
148
  }
133
149
 
@@ -154,9 +170,9 @@ export function utlGetSessionStorage(logger: IDiagnosticLogger, name: string): s
154
170
  } catch (e) {
155
171
  _canUseSessionStorage = false;
156
172
 
157
- logger.throwInternal(
158
- LoggingSeverity.WARNING,
159
- _InternalMessageId.BrowserCannotReadSessionStorage,
173
+ _throwInternal(logger,
174
+ eLoggingSeverity.WARNING,
175
+ _eInternalMessageId.BrowserCannotReadSessionStorage,
160
176
  "Browser failed read of session storage. " + getExceptionName(e),
161
177
  { exception: dumpObj(e) });
162
178
  }
@@ -173,9 +189,9 @@ export function utlSetSessionStorage(logger: IDiagnosticLogger, name: string, da
173
189
  } catch (e) {
174
190
  _canUseSessionStorage = false;
175
191
 
176
- logger.throwInternal(
177
- LoggingSeverity.WARNING,
178
- _InternalMessageId.BrowserCannotWriteSessionStorage,
192
+ _throwInternal(logger,
193
+ eLoggingSeverity.WARNING,
194
+ _eInternalMessageId.BrowserCannotWriteSessionStorage,
179
195
  "Browser failed write to session storage. " + getExceptionName(e),
180
196
  { exception: dumpObj(e) });
181
197
  }
@@ -192,12 +208,13 @@ export function utlRemoveSessionStorage(logger: IDiagnosticLogger, name: string)
192
208
  } catch (e) {
193
209
  _canUseSessionStorage = false;
194
210
 
195
- logger.throwInternal(
196
- LoggingSeverity.WARNING,
197
- _InternalMessageId.BrowserFailedRemovalFromSessionStorage,
211
+ _throwInternal(logger,
212
+ eLoggingSeverity.WARNING,
213
+ _eInternalMessageId.BrowserFailedRemovalFromSessionStorage,
198
214
  "Browser failed removal of session storage item. " + getExceptionName(e),
199
215
  { exception: dumpObj(e) });
200
216
  }
201
217
  }
218
+
202
219
  return false;
203
220
  }
@@ -1,11 +1,11 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { Data as AIData } from "../../Interfaces/Contracts/Generated/Data";
4
+ import { IData } from "../../Interfaces/Contracts/IData";
5
5
  import { ISerializable } from "../../Interfaces/Telemetry/ISerializable";
6
6
  import { FieldType } from "../../Enums";
7
7
 
8
- export class Data<TDomain> extends AIData<TDomain> implements ISerializable {
8
+ export class Data<TDomain> implements IData<TDomain>, ISerializable {
9
9
 
10
10
  /**
11
11
  * The data contract for serializing this object.
@@ -15,12 +15,20 @@ export class Data<TDomain> extends AIData<TDomain> implements ISerializable {
15
15
  baseData: FieldType.Required
16
16
  }
17
17
 
18
+ /**
19
+ * Name of item (B section) if any. If telemetry data is derived straight from this, this should be null.
20
+ */
21
+ public baseType: string;
22
+
23
+ /**
24
+ * Container for data item (B section).
25
+ */
26
+ public baseData: TDomain;
27
+
18
28
  /**
19
29
  * Constructs a new instance of telemetry data.
20
30
  */
21
31
  constructor(baseType: string, data: TDomain) {
22
- super();
23
-
24
32
  this.baseType = baseType;
25
33
  this.baseData = data;
26
34
  }
@@ -1,11 +1,12 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { DataPoint as AIDataPoint } from "../../Interfaces/Contracts/Generated/DataPoint";
4
+ import { IDataPoint } from "../../Interfaces/Contracts/IDataPoint";
5
5
  import { ISerializable } from "../../Interfaces/Telemetry/ISerializable";
6
6
  import { FieldType } from "../../Enums";
7
+ import { DataPointType } from "../../Interfaces/Contracts/DataPointType";
7
8
 
8
- export class DataPoint extends AIDataPoint implements ISerializable {
9
+ export class DataPoint implements IDataPoint, ISerializable {
9
10
 
10
11
  /**
11
12
  * The data contract for serializing this object.
@@ -19,4 +20,39 @@ export class DataPoint extends AIDataPoint implements ISerializable {
19
20
  max: FieldType.Default,
20
21
  stdDev: FieldType.Default
21
22
  }
23
+
24
+ /**
25
+ * Name of the metric.
26
+ */
27
+ public name: string;
28
+
29
+ /**
30
+ * Metric type. Single measurement or the aggregated value.
31
+ */
32
+ public kind: DataPointType = DataPointType.Measurement;
33
+
34
+ /**
35
+ * Single value for measurement. Sum of individual measurements for the aggregation.
36
+ */
37
+ public value: number;
38
+
39
+ /**
40
+ * Metric weight of the aggregated metric. Should not be set for a measurement.
41
+ */
42
+ public count: number;
43
+
44
+ /**
45
+ * Minimum value of the aggregated metric. Should not be set for a measurement.
46
+ */
47
+ public min: number;
48
+
49
+ /**
50
+ * Maximum value of the aggregated metric. Should not be set for a measurement.
51
+ */
52
+ public max: number;
53
+
54
+ /**
55
+ * Standard deviation of the aggregated metric. Should not be set for a measurement.
56
+ */
57
+ public stdDev: number;
22
58
  }
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim } from "@microsoft/applicationinsights-core-js";
4
+ import { IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim, _throwInternal } from "@microsoft/applicationinsights-core-js";
5
5
 
6
6
  export const enum DataSanitizerValues {
7
7
  /**
@@ -66,9 +66,9 @@ export function dataSanitizeKey(logger: IDiagnosticLogger, name: any) {
66
66
  // truncate the string to 150 chars
67
67
  if (name.length > DataSanitizerValues.MAX_NAME_LENGTH) {
68
68
  nameTrunc = name.substring(0, DataSanitizerValues.MAX_NAME_LENGTH);
69
- logger && logger.throwInternal(
70
- LoggingSeverity.WARNING,
71
- _InternalMessageId.NameTooLong,
69
+ _throwInternal(logger,
70
+ eLoggingSeverity.WARNING,
71
+ _eInternalMessageId.NameTooLong,
72
72
  "name is too long. It has been truncated to " + DataSanitizerValues.MAX_NAME_LENGTH + " characters.",
73
73
  { name }, true);
74
74
  }
@@ -84,9 +84,9 @@ export function dataSanitizeString(logger: IDiagnosticLogger, value: any, maxLen
84
84
  value = strTrim(value);
85
85
  if (value.toString().length > maxLength) {
86
86
  valueTrunc = value.toString().substring(0, maxLength);
87
- logger && logger.throwInternal(
88
- LoggingSeverity.WARNING,
89
- _InternalMessageId.StringValueTooLong,
87
+ _throwInternal(logger,
88
+ eLoggingSeverity.WARNING,
89
+ _eInternalMessageId.StringValueTooLong,
90
90
  "string value is too long. It has been truncated to " + maxLength + " characters.",
91
91
  { value }, true);
92
92
  }
@@ -96,7 +96,7 @@ export function dataSanitizeString(logger: IDiagnosticLogger, value: any, maxLen
96
96
  }
97
97
 
98
98
  export function dataSanitizeUrl(logger: IDiagnosticLogger, url: any) {
99
- return dataSanitizeInput(logger, url, DataSanitizerValues.MAX_URL_LENGTH, _InternalMessageId.UrlTooLong);
99
+ return dataSanitizeInput(logger, url, DataSanitizerValues.MAX_URL_LENGTH, _eInternalMessageId.UrlTooLong);
100
100
  }
101
101
 
102
102
  export function dataSanitizeMessage(logger: IDiagnosticLogger, message: any) {
@@ -104,8 +104,8 @@ export function dataSanitizeMessage(logger: IDiagnosticLogger, message: any) {
104
104
  if (message) {
105
105
  if (message.length > DataSanitizerValues.MAX_MESSAGE_LENGTH) {
106
106
  messageTrunc = message.substring(0, DataSanitizerValues.MAX_MESSAGE_LENGTH);
107
- logger && logger.throwInternal(
108
- LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated,
107
+ _throwInternal(logger,
108
+ eLoggingSeverity.WARNING, _eInternalMessageId.MessageTruncated,
109
109
  "message is too long, it has been truncated to " + DataSanitizerValues.MAX_MESSAGE_LENGTH + " characters.",
110
110
  { message },
111
111
  true);
@@ -122,8 +122,8 @@ export function dataSanitizeException(logger: IDiagnosticLogger, exception: any)
122
122
  let value:string = "" + exception;
123
123
  if (value.length > DataSanitizerValues.MAX_EXCEPTION_LENGTH) {
124
124
  exceptionTrunc = value.substring(0, DataSanitizerValues.MAX_EXCEPTION_LENGTH);
125
- logger && logger.throwInternal(
126
- LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + DataSanitizerValues.MAX_EXCEPTION_LENGTH + " characters.",
125
+ _throwInternal(logger,
126
+ eLoggingSeverity.WARNING, _eInternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + DataSanitizerValues.MAX_EXCEPTION_LENGTH + " characters.",
127
127
  { exception }, true);
128
128
  }
129
129
  }
@@ -140,7 +140,7 @@ export function dataSanitizeProperties(logger: IDiagnosticLogger, properties: an
140
140
  try {
141
141
  value = getJSON().stringify(value);
142
142
  } catch (e) {
143
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e}, true);
143
+ _throwInternal(logger,eLoggingSeverity.WARNING, _eInternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e}, true);
144
144
  }
145
145
  }
146
146
  value = dataSanitizeString(logger, value, DataSanitizerValues.MAX_PROPERTY_LENGTH);
@@ -168,17 +168,17 @@ export function dataSanitizeMeasurements(logger: IDiagnosticLogger, measurements
168
168
  }
169
169
 
170
170
  export function dataSanitizeId(logger: IDiagnosticLogger, id: string): string {
171
- return id ? dataSanitizeInput(logger, id, DataSanitizerValues.MAX_ID_LENGTH, _InternalMessageId.IdTooLong).toString() : id;
171
+ return id ? dataSanitizeInput(logger, id, DataSanitizerValues.MAX_ID_LENGTH, _eInternalMessageId.IdTooLong).toString() : id;
172
172
  }
173
173
 
174
- export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId) {
174
+ export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) {
175
175
  let inputTrunc : String;
176
176
  if (input) {
177
177
  input = strTrim(input);
178
178
  if (input.length > maxLength) {
179
179
  inputTrunc = input.substring(0, maxLength);
180
- logger && logger.throwInternal(
181
- LoggingSeverity.WARNING,
180
+ _throwInternal(logger,
181
+ eLoggingSeverity.WARNING,
182
182
  _msgId,
183
183
  "input is too long, it has been truncated to " + maxLength + " characters.",
184
184
  { data: input },
@@ -248,7 +248,7 @@ export interface IDataSanitizer {
248
248
 
249
249
  sanitizeId: (logger: IDiagnosticLogger, id: string) => string;
250
250
 
251
- sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId) => any;
251
+ sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) => any;
252
252
 
253
253
  padNumber: (num: number) => string;
254
254
 
@@ -282,4 +282,4 @@ export const DataSanitizer: IDataSanitizer = {
282
282
  sanitizeInput: dataSanitizeInput,
283
283
  padNumber: dsPadNumber,
284
284
  trim: strTrim
285
- };
285
+ };
@@ -1,15 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { Envelope as AIEnvelope } from "../../Interfaces/Contracts/Generated/Envelope";
5
- import { Base } from "../../Interfaces/Contracts/Generated/Base";
4
+ import { IBase } from "../../Interfaces/Contracts/IBase";
6
5
  import { IEnvelope } from "../../Interfaces/Telemetry/IEnvelope";
7
6
  import { dataSanitizeString } from "./DataSanitizer";
8
7
  import { FieldType } from "../../Enums";
9
8
  import { IDiagnosticLogger, toISOString } from "@microsoft/applicationinsights-core-js";
10
9
  import { strNotSpecified } from "../../Constants";
11
10
 
12
- export class Envelope extends AIEnvelope implements IEnvelope {
11
+ export class Envelope implements IEnvelope {
13
12
 
14
13
  /**
15
14
  * The data contract for serializing this object.
@@ -17,16 +16,58 @@ export class Envelope extends AIEnvelope implements IEnvelope {
17
16
  public aiDataContract: any;
18
17
 
19
18
  /**
20
- * Constructs a new instance of telemetry data.
19
+ * Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1.
21
20
  */
22
- constructor(logger: IDiagnosticLogger, data: Base, name: string) {
23
- super();
21
+ public ver: number; /* 1 */
24
22
 
25
- this.name = dataSanitizeString(logger, name) || strNotSpecified;
26
- this.data = data;
27
- this.time = toISOString(new Date());
23
+ /**
24
+ * Type name of telemetry data item.
25
+ */
26
+ public name: string;
27
+
28
+ /**
29
+ * Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z.
30
+ */
31
+ public time: string;
32
+
33
+ /**
34
+ * Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
35
+ */
36
+ public sampleRate: number; /* 100.0 */
37
+
38
+ /**
39
+ * Sequence field used to track absolute order of uploaded events.
40
+ */
41
+ public seq: string;
42
+
43
+ /**
44
+ * The application's instrumentation key. The key is typically represented as a GUID, but there are cases when it is not a guid. No code should rely on iKey being a GUID. Instrumentation key is case insensitive.
45
+ */
46
+ public iKey: string;
47
+
48
+ /**
49
+ * Key/value collection of context properties. See ContextTagKeys for information on available properties.
50
+ */
51
+ public tags: any; /* {} */
52
+
53
+ /**
54
+ * Telemetry data item.
55
+ */
56
+ public data: IBase;
57
+
58
+ /**
59
+ * Constructs a new instance of telemetry data.
60
+ */
61
+ constructor(logger: IDiagnosticLogger, data: IBase, name: string) {
62
+ let _self = this;
63
+ _self.ver = 1;
64
+ _self.sampleRate = 100.0;
65
+ _self.tags = {};
66
+ _self.name = dataSanitizeString(logger, name) || strNotSpecified;
67
+ _self.data = data;
68
+ _self.time = toISOString(new Date());
28
69
 
29
- this.aiDataContract = {
70
+ _self.aiDataContract = {
30
71
  time: FieldType.Required,
31
72
  iKey: FieldType.Required,
32
73
  name: FieldType.Required,
@@ -1,15 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
5
- import { EventData } from "../Interfaces/Contracts/Generated/EventData";
4
+ import { IEventData } from "../Interfaces/Contracts/IEventData";
6
5
  import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
7
6
  import { dataSanitizeString, dataSanitizeProperties, dataSanitizeMeasurements } from "./Common/DataSanitizer";
8
7
  import { FieldType } from "../Enums";
9
8
  import { strNotSpecified } from "../Constants";
9
+ import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
10
10
 
11
- export class Event extends EventData implements ISerializable {
12
-
11
+ export class Event implements IEventData, ISerializable {
13
12
  public static envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
14
13
  public static dataType = "EventData";
15
14
 
@@ -18,17 +17,36 @@ export class Event extends EventData implements ISerializable {
18
17
  name: FieldType.Required,
19
18
  properties: FieldType.Default,
20
19
  measurements: FieldType.Default
21
- }
20
+ };
22
21
 
23
22
  /**
24
- * Constructs a new instance of the EventTelemetry object
23
+ * Schema version
25
24
  */
26
- constructor(logger: IDiagnosticLogger, name: string, properties?: any, measurements?: any) {
25
+ public ver: number; /* 2 */
26
+
27
+ /**
28
+ * Event name. Keep it low cardinality to allow proper grouping and useful metrics.
29
+ */
30
+ public name: string;
27
31
 
28
- super();
32
+ /**
33
+ * Collection of custom properties.
34
+ */
35
+ public properties: any; /* {} */
36
+
37
+ /**
38
+ * Collection of custom measurements.
39
+ */
40
+ public measurements: any; /* {} */
29
41
 
30
- this.name = dataSanitizeString(logger, name) || strNotSpecified;
31
- this.properties = dataSanitizeProperties(logger, properties);
32
- this.measurements = dataSanitizeMeasurements(logger, measurements);
42
+ /**
43
+ * Constructs a new instance of the EventTelemetry object
44
+ */
45
+ constructor(logger: IDiagnosticLogger, name: string, properties?: any, measurements?: any) {
46
+ let _self = this;
47
+ _self.ver = 2;
48
+ _self.name = dataSanitizeString(logger, name) || strNotSpecified;
49
+ _self.properties = dataSanitizeProperties(logger, properties);
50
+ _self.measurements = dataSanitizeMeasurements(logger, measurements);
33
51
  }
34
- }
52
+ }