@microsoft/applicationinsights-common 2.7.5-nightly.2203-02 → 2.7.5-nightly.2203-03

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 (187) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +852 -243
  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 +172 -62
  7. package/dist/applicationinsights-common.api.md +21 -8
  8. package/dist/applicationinsights-common.d.ts +33 -12
  9. package/dist/applicationinsights-common.js +852 -243
  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 +33 -12
  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 +27 -12
  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 +2 -2
  133. package/dist-esm/applicationinsights-common.js.map +1 -1
  134. package/package.json +3 -3
  135. package/src/Enums.ts +19 -3
  136. package/src/HelperFuncs.ts +7 -5
  137. package/src/Interfaces/Contracts/AvailabilityData.ts +57 -0
  138. package/src/Interfaces/Contracts/ContextTagKeys.ts +299 -0
  139. package/src/Interfaces/Contracts/DataPointType.ts +10 -0
  140. package/src/Interfaces/Contracts/DependencyKind.ts +11 -0
  141. package/src/Interfaces/Contracts/DependencySourceType.ts +11 -0
  142. package/src/Interfaces/Contracts/IBase.ts +13 -0
  143. package/src/Interfaces/Contracts/IData.ts +19 -0
  144. package/src/Interfaces/Contracts/IDataPoint.ts +44 -0
  145. package/src/Interfaces/Contracts/IDomain.ts +8 -0
  146. package/src/Interfaces/Contracts/IEnvelope.ts +50 -0
  147. package/src/Interfaces/Contracts/IEventData.ts +30 -0
  148. package/src/Interfaces/Contracts/IExceptionData.ts +37 -0
  149. package/src/Interfaces/Contracts/IExceptionDetails.ts +45 -0
  150. package/src/Interfaces/Contracts/IMessageData.ts +36 -0
  151. package/src/Interfaces/Contracts/IMetricData.ts +31 -0
  152. package/src/Interfaces/Contracts/IPageViewData.ts +26 -0
  153. package/src/Interfaces/Contracts/IPageViewPerfData.ts +35 -0
  154. package/src/Interfaces/Contracts/IRemoteDependencyData.ts +65 -0
  155. package/src/Interfaces/Contracts/IStackFrame.ts +33 -0
  156. package/src/Interfaces/Contracts/RequestData.ts +50 -0
  157. package/src/Interfaces/Contracts/SeverityLevel.ts +15 -0
  158. package/src/StorageHelperFuncs.ts +34 -17
  159. package/src/Telemetry/Common/DataSanitizer.ts +13 -13
  160. package/src/Telemetry/Exception.ts +27 -15
  161. package/src/TelemetryItemCreator.ts +1 -1
  162. package/src/applicationinsights-common.ts +2 -2
  163. package/types/Enums.d.ts +13 -2
  164. package/types/Interfaces/Contracts/AvailabilityData.d.ts +0 -0
  165. package/types/Interfaces/Contracts/ContextTagKeys.d.ts +175 -0
  166. package/types/Interfaces/Contracts/DataPointType.d.ts +7 -0
  167. package/types/Interfaces/Contracts/DependencyKind.d.ts +8 -0
  168. package/types/Interfaces/Contracts/DependencySourceType.d.ts +8 -0
  169. package/types/Interfaces/Contracts/IBase.d.ts +9 -0
  170. package/types/Interfaces/Contracts/IData.d.ts +14 -0
  171. package/types/Interfaces/Contracts/IDataPoint.d.ts +34 -0
  172. package/types/Interfaces/Contracts/IDomain.d.ts +5 -0
  173. package/types/Interfaces/Contracts/IEnvelope.d.ts +0 -0
  174. package/types/Interfaces/Contracts/IEventData.d.ts +22 -0
  175. package/types/Interfaces/Contracts/IExceptionData.d.ts +28 -0
  176. package/types/Interfaces/Contracts/IExceptionDetails.d.ts +34 -0
  177. package/types/Interfaces/Contracts/IMessageData.d.ts +27 -0
  178. package/types/Interfaces/Contracts/IMetricData.d.ts +23 -0
  179. package/types/Interfaces/Contracts/IPageViewData.d.ts +18 -0
  180. package/types/Interfaces/Contracts/IPageViewPerfData.d.ts +26 -0
  181. package/types/Interfaces/Contracts/IRemoteDependencyData.d.ts +50 -0
  182. package/types/Interfaces/Contracts/IStackFrame.d.ts +25 -0
  183. package/types/Interfaces/Contracts/RequestData.d.ts +0 -0
  184. package/types/Interfaces/Contracts/SeverityLevel.d.ts +10 -0
  185. package/types/StorageHelperFuncs.d.ts +14 -2
  186. package/types/applicationinsights-common.d.ts +2 -2
  187. package/types/tsdoc-metadata.json +1 -1
@@ -0,0 +1,35 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { IPageViewData } from "./IPageViewData";
5
+
6
+ /**
7
+ * An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request.
8
+ */
9
+ export interface IPageViewPerfData extends IPageViewData {
10
+
11
+ /**
12
+ * Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
13
+ */
14
+ perfTotal: string;
15
+
16
+ /**
17
+ * Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
18
+ */
19
+ networkConnect: string;
20
+
21
+ /**
22
+ * Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
23
+ */
24
+ sentRequest: string;
25
+
26
+ /**
27
+ * Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
28
+ */
29
+ receivedResponse: string;
30
+
31
+ /**
32
+ * DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
33
+ */
34
+ domProcessing: string;
35
+ }
@@ -0,0 +1,65 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { IDomain } from "./IDomain";
5
+
6
+ /**
7
+ * An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.
8
+ */
9
+ export interface IRemoteDependencyData extends IDomain {
10
+
11
+ /**
12
+ * Schema version
13
+ */
14
+ ver: number; /* 2 */
15
+
16
+ /**
17
+ * Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.
18
+ */
19
+ name: string;
20
+
21
+ /**
22
+ * Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.
23
+ */
24
+ id: string;
25
+
26
+ /**
27
+ * Result code of a dependency call. Examples are SQL error code and HTTP status code.
28
+ */
29
+ resultCode: string;
30
+
31
+ /**
32
+ * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.
33
+ */
34
+ duration: string;
35
+
36
+ /**
37
+ * Indication of successful or unsuccessful call.
38
+ */
39
+ success: boolean; /* true */
40
+
41
+ /**
42
+ * Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters.
43
+ */
44
+ data: string;
45
+
46
+ /**
47
+ * Target site of a dependency call. Examples are server name, host address.
48
+ */
49
+ target: string;
50
+
51
+ /**
52
+ * Dependency type name. Very low cardinality value for logical grouping of dependencies and interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP.
53
+ */
54
+ type: string;
55
+
56
+ /**
57
+ * Collection of custom properties.
58
+ */
59
+ properties: any; /* {} */
60
+
61
+ /**
62
+ * Collection of custom measurements.
63
+ */
64
+ measurements: any; /* {} */
65
+ }
@@ -0,0 +1,33 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ /**
5
+ * Stack frame information.
6
+ */
7
+ export interface IStackFrame {
8
+
9
+ /**
10
+ * Level in the call stack. For the long stacks SDK may not report every function in a call stack.
11
+ */
12
+ level: number;
13
+
14
+ /**
15
+ * Method name.
16
+ */
17
+ method: string;
18
+
19
+ /**
20
+ * Name of the assembly (dll, jar, etc.) containing this function.
21
+ */
22
+ assembly: string;
23
+
24
+ /**
25
+ * File name or URL of the method implementation.
26
+ */
27
+ fileName: string;
28
+
29
+ /**
30
+ * Line number of the code implementation.
31
+ */
32
+ line: number;
33
+ }
@@ -0,0 +1,50 @@
1
+ // // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // // Licensed under the MIT License.
3
+
4
+ // import { IDomain } from "./IDomain";
5
+
6
+ // /**
7
+ // * An instance of Request represents completion of an external request to the application to do work and contains a summary of that request execution and the results.
8
+ // */
9
+ // export class RequestData implements IDomain {
10
+
11
+ // /**
12
+ // * Schema version
13
+ // */
14
+ // public ver: number = 2;
15
+
16
+ // /**
17
+ // * Identifier of a request call instance. Used for correlation between request and other telemetry items.
18
+ // */
19
+ // public id: string;
20
+
21
+ // /**
22
+ // * Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller.
23
+ // */
24
+ // public source: string;
25
+
26
+ // /**
27
+ // * Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'.
28
+ // */
29
+ // public name: string;
30
+
31
+ // /**
32
+ // * Indication of successful or unsuccessful call.
33
+ // */
34
+ // public success: boolean;
35
+
36
+ // /**
37
+ // * Request URL with all query string parameters.
38
+ // */
39
+ // public url: string;
40
+
41
+ // /**
42
+ // * Collection of custom properties.
43
+ // */
44
+ // public properties: any = {};
45
+
46
+ // /**
47
+ // * Collection of custom measurements.
48
+ // */
49
+ // public measurements: any = {};
50
+ // }
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ // THIS FILE WAS AUTOGENERATED
5
+
6
+ /**
7
+ * Defines the level of severity for the event.
8
+ */
9
+ export enum SeverityLevel {
10
+ Verbose = 0,
11
+ Information = 1,
12
+ Warning = 2,
13
+ Error = 3,
14
+ Critical = 4,
15
+ }
@@ -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, _InternalMessageId, _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,8 +94,8 @@ export function utlGetLocalStorage(logger: IDiagnosticLogger, name: string): str
78
94
  } catch (e) {
79
95
  _canUseLocalStorage = false;
80
96
 
81
- logger.throwInternal(
82
- LoggingSeverity.WARNING,
97
+ _throwInternal(logger,
98
+ eLoggingSeverity.WARNING,
83
99
  _InternalMessageId.BrowserCannotReadLocalStorage,
84
100
  "Browser failed read of local storage. " + getExceptionName(e),
85
101
  { exception: dumpObj(e) });
@@ -97,8 +113,8 @@ export function utlSetLocalStorage(logger: IDiagnosticLogger, name: string, data
97
113
  } catch (e) {
98
114
  _canUseLocalStorage = false;
99
115
 
100
- logger.throwInternal(
101
- LoggingSeverity.WARNING,
116
+ _throwInternal(logger,
117
+ eLoggingSeverity.WARNING,
102
118
  _InternalMessageId.BrowserCannotWriteLocalStorage,
103
119
  "Browser failed write to local storage. " + getExceptionName(e),
104
120
  { exception: dumpObj(e) });
@@ -116,8 +132,8 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
116
132
  } catch (e) {
117
133
  _canUseLocalStorage = false;
118
134
 
119
- logger.throwInternal(
120
- LoggingSeverity.WARNING,
135
+ _throwInternal(logger,
136
+ eLoggingSeverity.WARNING,
121
137
  _InternalMessageId.BrowserFailedRemovalFromLocalStorage,
122
138
  "Browser failed removal of local storage item. " + getExceptionName(e),
123
139
  { exception: dumpObj(e) });
@@ -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,8 +170,8 @@ export function utlGetSessionStorage(logger: IDiagnosticLogger, name: string): s
154
170
  } catch (e) {
155
171
  _canUseSessionStorage = false;
156
172
 
157
- logger.throwInternal(
158
- LoggingSeverity.WARNING,
173
+ _throwInternal(logger,
174
+ eLoggingSeverity.WARNING,
159
175
  _InternalMessageId.BrowserCannotReadSessionStorage,
160
176
  "Browser failed read of session storage. " + getExceptionName(e),
161
177
  { exception: dumpObj(e) });
@@ -173,8 +189,8 @@ export function utlSetSessionStorage(logger: IDiagnosticLogger, name: string, da
173
189
  } catch (e) {
174
190
  _canUseSessionStorage = false;
175
191
 
176
- logger.throwInternal(
177
- LoggingSeverity.WARNING,
192
+ _throwInternal(logger,
193
+ eLoggingSeverity.WARNING,
178
194
  _InternalMessageId.BrowserCannotWriteSessionStorage,
179
195
  "Browser failed write to session storage. " + getExceptionName(e),
180
196
  { exception: dumpObj(e) });
@@ -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,
211
+ _throwInternal(logger,
212
+ eLoggingSeverity.WARNING,
197
213
  _InternalMessageId.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,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, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim, _throwInternal } from "@microsoft/applicationinsights-core-js";
5
5
 
6
6
  export const enum DataSanitizerValues {
7
7
  /**
@@ -66,8 +66,8 @@ 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,
69
+ _throwInternal(logger,
70
+ eLoggingSeverity.WARNING,
71
71
  _InternalMessageId.NameTooLong,
72
72
  "name is too long. It has been truncated to " + DataSanitizerValues.MAX_NAME_LENGTH + " characters.",
73
73
  { name }, true);
@@ -84,8 +84,8 @@ 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,
87
+ _throwInternal(logger,
88
+ eLoggingSeverity.WARNING,
89
89
  _InternalMessageId.StringValueTooLong,
90
90
  "string value is too long. It has been truncated to " + maxLength + " characters.",
91
91
  { value }, true);
@@ -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, _InternalMessageId.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, _InternalMessageId.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, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e}, true);
144
144
  }
145
145
  }
146
146
  value = dataSanitizeString(logger, value, DataSanitizerValues.MAX_PROPERTY_LENGTH);
@@ -177,8 +177,8 @@ export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLeng
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 },
@@ -282,4 +282,4 @@ export const DataSanitizer: IDataSanitizer = {
282
282
  sanitizeInput: dataSanitizeInput,
283
283
  padNumber: dsPadNumber,
284
284
  trim: strTrim
285
- };
285
+ };
@@ -341,32 +341,44 @@ export class Exception extends ExceptionData implements ISerializable {
341
341
  this.exceptions = [new _ExceptionDetails(logger, exception, properties)];
342
342
  this.properties = dataSanitizeProperties(logger, properties);
343
343
  this.measurements = dataSanitizeMeasurements(logger, measurements);
344
- if (severityLevel) { this.severityLevel = severityLevel; }
345
- if (id) { this.id = id; }
344
+ if (severityLevel) {
345
+ this.severityLevel = severityLevel;
346
+ }
347
+ if (id) {
348
+ this.id = id;
349
+ }
346
350
  } else {
347
351
  this.exceptions = exception.exceptions;
348
352
  this.properties = exception.properties;
349
353
  this.measurements = exception.measurements;
350
- if (exception.severityLevel) { this.severityLevel = exception.severityLevel; }
351
- if (exception.id) { this.id = exception.id; }
352
- if (exception.problemGroup) { this.problemGroup = exception.problemGroup; }
354
+ if (exception.severityLevel) {
355
+ this.severityLevel = exception.severityLevel;
356
+ }
357
+ if (exception.id) {
358
+ this.id = exception.id;
359
+ }
360
+ if (exception.problemGroup) {
361
+ this.problemGroup = exception.problemGroup;
362
+ }
353
363
 
354
364
  // bool/int types, use isNullOrUndefined
355
365
  this.ver = 2; // TODO: handle the CS"4.0" ==> breeze 2 conversion in a better way
356
- if (!isNullOrUndefined(exception.isManual)) { this.isManual = exception.isManual; }
366
+ if (!isNullOrUndefined(exception.isManual)) {
367
+ this.isManual = exception.isManual;
368
+ }
357
369
  }
358
370
  }
359
371
 
360
372
  public static CreateAutoException(
361
- message: string | Event,
362
- url: string,
363
- lineNumber: number,
364
- columnNumber: number,
365
- error: any,
366
- evt?: Event|string,
367
- stack?: string,
368
- errorSrc?: string
369
- ): IAutoExceptionTelemetry {
373
+ message: string | Event,
374
+ url: string,
375
+ lineNumber: number,
376
+ columnNumber: number,
377
+ error: any,
378
+ evt?: Event|string,
379
+ stack?: string,
380
+ errorSrc?: string
381
+ ): IAutoExceptionTelemetry {
370
382
 
371
383
  let errorType = _getErrorType(error || evt || message);
372
384
 
@@ -29,7 +29,7 @@ export class TelemetryItemCreator {
29
29
  if (isNullOrUndefined(item) ||
30
30
  isNullOrUndefined(baseType) ||
31
31
  isNullOrUndefined(envelopeName)) {
32
- throw Error("Input doesn't contain all required fields");
32
+ throw Error("Input doesn't contain all required fields");
33
33
  }
34
34
 
35
35
  let iKey = "";
@@ -57,12 +57,12 @@ export { IPropertiesPlugin } from "./Interfaces/IPropertiesPlugin";
57
57
  export { IUser, IUserContext } from "./Interfaces/Context/IUser";
58
58
  export { ITelemetryTrace, ITraceState } from "./Interfaces/Context/ITelemetryTrace";
59
59
  export { IRequestContext } from "./Interfaces/IRequestContext";
60
- export { DistributedTracingModes } from "./Enums";
60
+ export { eDistributedTracingModes, DistributedTracingModes } from "./Enums";
61
61
  export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
62
62
  export { isBeaconsSupported as isBeaconApiSupported } from "@microsoft/applicationinsights-core-js"
63
63
  export { createDomEvent } from "./DomHelperFuncs";
64
64
  export {
65
- utlDisableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage,
65
+ utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage,
66
66
  utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage
67
67
  } from "./StorageHelperFuncs";
68
68
  export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
package/types/Enums.d.ts CHANGED
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * Type of storage to differentiate between local storage and session storage
3
3
  */
4
- export declare enum StorageType {
4
+ export declare const enum eStorageType {
5
5
  LocalStorage = 0,
6
6
  SessionStorage = 1
7
7
  }
8
+ export declare const StorageType: {
9
+ LocalStorage: number;
10
+ SessionStorage: number;
11
+ };
12
+ export declare type StorageType = eStorageType | typeof StorageType;
8
13
  /**
9
14
  * Enum is used in aiDataContract to describe how fields are serialized.
10
15
  * For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
@@ -15,7 +20,7 @@ export declare const enum FieldType {
15
20
  Array = 2,
16
21
  Hidden = 4
17
22
  }
18
- export declare enum DistributedTracingModes {
23
+ export declare const enum eDistributedTracingModes {
19
24
  /**
20
25
  * (Default) Send Application Insights correlation headers
21
26
  */
@@ -29,3 +34,9 @@ export declare enum DistributedTracingModes {
29
34
  */
30
35
  W3C = 2
31
36
  }
37
+ export declare const DistributedTracingModes: {
38
+ AI: number;
39
+ AI_AND_W3C: number;
40
+ W3C: number;
41
+ };
42
+ export declare type DistributedTracingModes = number | eDistributedTracingModes;