@microsoft/1ds-core-js 3.1.9 → 3.2.0

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 (54) hide show
  1. package/README.md +1 -1
  2. package/bundle/{ms.core-3.1.9.gbl.js → ms.core-3.2.0.gbl.js} +2560 -1200
  3. package/bundle/ms.core-3.2.0.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.2.0.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.2.0.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.2.0.integrity.json +46 -0
  7. package/bundle/{ms.core-3.1.9.js → ms.core-3.2.0.js} +2560 -1200
  8. package/bundle/ms.core-3.2.0.js.map +1 -0
  9. package/bundle/ms.core-3.2.0.min.js +7 -0
  10. package/bundle/ms.core-3.2.0.min.js.map +1 -0
  11. package/bundle/ms.core.gbl.js +2559 -1199
  12. package/bundle/ms.core.gbl.js.map +1 -1
  13. package/bundle/ms.core.gbl.min.js +2 -2
  14. package/bundle/ms.core.gbl.min.js.map +1 -1
  15. package/bundle/ms.core.integrity.json +17 -17
  16. package/bundle/ms.core.js +2559 -1199
  17. package/bundle/ms.core.js.map +1 -1
  18. package/bundle/ms.core.min.js +2 -2
  19. package/bundle/ms.core.min.js.map +1 -1
  20. package/dist/ms.core.js +97 -56
  21. package/dist/ms.core.js.map +1 -1
  22. package/dist/ms.core.min.js +2 -2
  23. package/dist/ms.core.min.js.map +1 -1
  24. package/dist-esm/src/AppInsightsCore.js +5 -6
  25. package/dist-esm/src/AppInsightsCore.js.map +1 -1
  26. package/dist-esm/src/BaseCore.d.ts +0 -8
  27. package/dist-esm/src/BaseCore.js +4 -5
  28. package/dist-esm/src/BaseCore.js.map +1 -1
  29. package/dist-esm/src/DataModels.js +1 -1
  30. package/dist-esm/src/ESPromise.js +1 -1
  31. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  32. package/dist-esm/src/Enums.d.ts +174 -172
  33. package/dist-esm/src/Enums.js +63 -103
  34. package/dist-esm/src/Enums.js.map +1 -1
  35. package/dist-esm/src/Index.d.ts +4 -3
  36. package/dist-esm/src/Index.js +4 -6
  37. package/dist-esm/src/Index.js.map +1 -1
  38. package/dist-esm/src/Utils.d.ts +6 -5
  39. package/dist-esm/src/Utils.js +21 -14
  40. package/dist-esm/src/Utils.js.map +1 -1
  41. package/dist-esm/src/ValueSanitizer.js +1 -1
  42. package/package.json +4 -4
  43. package/src/AppInsightsCore.ts +6 -6
  44. package/src/BaseCore.ts +6 -6
  45. package/src/Enums.ts +155 -65
  46. package/src/Index.ts +14 -7
  47. package/src/Utils.ts +23 -14
  48. package/bundle/ms.core-3.1.9.gbl.js.map +0 -1
  49. package/bundle/ms.core-3.1.9.gbl.min.js +0 -7
  50. package/bundle/ms.core-3.1.9.gbl.min.js.map +0 -1
  51. package/bundle/ms.core-3.1.9.integrity.json +0 -46
  52. package/bundle/ms.core-3.1.9.js.map +0 -1
  53. package/bundle/ms.core-3.1.9.min.js +0 -7
  54. package/bundle/ms.core-3.1.9.min.js.map +0 -1
@@ -3,9 +3,9 @@
3
3
  * @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
4
4
  * @copyright Microsoft 2018
5
5
  */
6
- import { AppInsightsCore as InternalCore, IPlugin, LoggingSeverity, ITelemetryItem, IDiagnosticLogger, INotificationManager, doPerf, arrForEach, dumpObj, DiagnosticLogger } from "@microsoft/applicationinsights-core-js";
6
+ import { AppInsightsCore as InternalCore, IPlugin, eLoggingSeverity, ITelemetryItem, IDiagnosticLogger, INotificationManager, doPerf, arrForEach, dumpObj, DiagnosticLogger } from "@microsoft/applicationinsights-core-js";
7
7
  import { IExtendedConfiguration, IExtendedTelemetryItem, IExtendedAppInsightsCore } from "./DataModels";
8
- import { EventLatency, _ExtendedInternalMessageId } from "./Enums";
8
+ import { EventLatencyValue, _eExtendedInternalMessageId } from "./Enums";
9
9
  import { isLatency, FullVersionString, getTime } from "./Utils";
10
10
  import dynamicProto from "@microsoft/dynamicproto-js";
11
11
 
@@ -26,7 +26,7 @@ export default class AppInsightsCore extends InternalCore implements IExtendedAp
26
26
  if (!_self.logger || !_self.logger.queue) {
27
27
  // The AI Base can inject a No-Op logger so if not defined or the No-Op, change to use a default logger so initialization errors
28
28
  // are not dropped on the floor if one is not already defined
29
- _self.logger = new DiagnosticLogger({ loggingLevelConsole: LoggingSeverity.CRITICAL });
29
+ _self.logger = new DiagnosticLogger({ loggingLevelConsole: eLoggingSeverity.CRITICAL });
30
30
  }
31
31
 
32
32
  _self.initialize = (config: IExtendedConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager) => {
@@ -81,8 +81,8 @@ export default class AppInsightsCore extends InternalCore implements IExtendedAp
81
81
  message += "\n - Channels must be provided through config.channels only!";
82
82
  }
83
83
  logger.throwInternal(
84
- LoggingSeverity.CRITICAL,
85
- _ExtendedInternalMessageId.FailedToInitializeSDK, "SDK Initialization Failed - no telemetry will be sent: " + message
84
+ eLoggingSeverity.CRITICAL,
85
+ _eExtendedInternalMessageId.FailedToInitializeSDK, "SDK Initialization Failed - no telemetry will be sent: " + message
86
86
  );
87
87
  }
88
88
  }, () => ({ config, extensions, logger, notificationManager }));
@@ -95,7 +95,7 @@ export default class AppInsightsCore extends InternalCore implements IExtendedAp
95
95
  telemetryItem.timings = telemetryItem.timings || {};
96
96
  telemetryItem.timings.trackStart = getTime();
97
97
  if (!isLatency(telemetryItem.latency)) {
98
- telemetryItem.latency = EventLatency.Normal;
98
+ telemetryItem.latency = EventLatencyValue.Normal;
99
99
  }
100
100
 
101
101
  let itemExt = telemetryItem.ext = telemetryItem.ext || {};
package/src/BaseCore.ts CHANGED
@@ -6,11 +6,11 @@
6
6
  * @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
7
7
  * @copyright Microsoft 2018
8
8
  */
9
- import { BaseCore as InternalCore, IPlugin, LoggingSeverity, ITelemetryItem, IDiagnosticLogger, INotificationManager, dumpObj } from "@microsoft/applicationinsights-core-js";
9
+ import dynamicProto from "@microsoft/dynamicproto-js";
10
+ import { BaseCore as InternalCore, IPlugin, eLoggingSeverity, ITelemetryItem, IDiagnosticLogger, INotificationManager, dumpObj, _throwInternal } from "@microsoft/applicationinsights-core-js";
10
11
  import { IExtendedConfiguration, IExtendedTelemetryItem, IExtendedAppInsightsCore } from "./DataModels";
11
- import { _ExtendedInternalMessageId } from "./Enums";
12
+ import { _eExtendedInternalMessageId } from "./Enums";
12
13
  import { FullVersionString, isDocumentObjectAvailable } from "./Utils";
13
- import dynamicProto from "@microsoft/dynamicproto-js";
14
14
 
15
15
  export default class BaseCore extends InternalCore implements IExtendedAppInsightsCore {
16
16
 
@@ -34,9 +34,9 @@ export default class BaseCore extends InternalCore implements IExtendedAppInsigh
34
34
  try {
35
35
  _base.initialize(config, extensions, logger, notificationManager);
36
36
  } catch (e) {
37
- _self.logger.throwInternal(
38
- LoggingSeverity.CRITICAL,
39
- _ExtendedInternalMessageId.FailedToInitializeSDK, "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only"
37
+ _throwInternal(_self.logger,
38
+ eLoggingSeverity.CRITICAL,
39
+ _eExtendedInternalMessageId.FailedToInitializeSDK, "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only"
40
40
  );
41
41
  }
42
42
  };
package/src/Enums.ts CHANGED
@@ -5,75 +5,112 @@
5
5
  * File containing the enums as constants.
6
6
  */
7
7
 
8
- import { _InternalMessageId } from "@microsoft/applicationinsights-core-js";
8
+ import { _InternalMessageId, _eInternalMessageId, createEnumStyle, objFreeze } from "@microsoft/applicationinsights-core-js";
9
9
 
10
10
  /**
11
- * The ValueKind contains a set of values that specify value kind of the property.
11
+ * The eValueKind contains a set of values that specify value kind of the property.
12
12
  * Either PII (Personal Identifiable Information) or customer content.
13
13
  */
14
- export const ValueKind = {
14
+ export const enum eValueKind {
15
15
  /**
16
16
  * No kind.
17
17
  */
18
- NotSet: 0,
18
+ NotSet = 0,
19
+
19
20
  /**
20
21
  * An LDAP distinguished name. For example, CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM.
21
22
  */
22
- Pii_DistinguishedName: 1,
23
+ Pii_DistinguishedName = 1,
24
+
23
25
  /**
24
26
  * Generic information.
25
27
  */
26
- Pii_GenericData: 2,
28
+ Pii_GenericData = 2,
29
+
27
30
  /**
28
31
  * An IPV4 Internet address. For example, 192.0.2.1.
29
32
  */
30
- Pii_IPV4Address: 3,
33
+ Pii_IPV4Address = 3,
34
+
31
35
  /**
32
36
  * An IPV6 Internet address. For example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
33
37
  */
34
- Pii_IPv6Address: 4,
38
+ Pii_IPv6Address = 4,
39
+
35
40
  /**
36
41
  * The Subject of an e-mail message.
37
42
  */
38
- Pii_MailSubject: 5,
43
+ Pii_MailSubject = 5,
44
+
39
45
  /**
40
46
  * A telephone number.
41
47
  */
42
- Pii_PhoneNumber: 6,
48
+ Pii_PhoneNumber = 6,
49
+
43
50
  /**
44
51
  * A query string.
45
52
  */
46
- Pii_QueryString: 7,
53
+ Pii_QueryString = 7,
54
+
47
55
  /**
48
56
  * An SIP (Session Internet Protocol) address.
49
57
  */
50
- Pii_SipAddress: 8,
58
+ Pii_SipAddress = 8,
59
+
51
60
  /**
52
61
  * An e-mail address.
53
62
  */
54
- Pii_SmtpAddress: 9,
63
+ Pii_SmtpAddress = 9,
64
+
55
65
  /**
56
66
  * An user ID.
57
67
  */
58
- Pii_Identity: 10,
68
+ Pii_Identity = 10,
69
+
59
70
  /**
60
71
  * A URI (Uniform Resource Identifier).
61
72
  */
62
- Pii_Uri: 11,
73
+ Pii_Uri = 11,
74
+
63
75
  /**
64
76
  * The fully-qualified domain name.
65
77
  */
66
- Pii_Fqdn: 12,
78
+ Pii_Fqdn = 12,
79
+
67
80
  /**
68
81
  * Scrubs the last octet in a IPV4 Internet address.
69
82
  * For example: 10.121.227.147 becomes 10.121.227.*
70
83
  */
71
- Pii_IPV4AddressLegacy: 13,
84
+ Pii_IPV4AddressLegacy = 13,
85
+
72
86
  /**
73
87
  * Generic content.
74
88
  */
75
- CustomerContent_GenericContent: 32
76
- };
89
+ CustomerContent_GenericContent = 32
90
+ }
91
+
92
+ /**
93
+ * The ValueKind contains a set of values that specify value kind of the property.
94
+ * Either PII (Personal Identifiable Information) or customer content.
95
+ */
96
+ export const ValueKind = createEnumStyle<typeof eValueKind>({
97
+ NotSet: eValueKind.NotSet,
98
+ Pii_DistinguishedName: eValueKind.Pii_DistinguishedName,
99
+ Pii_GenericData: eValueKind.Pii_GenericData,
100
+ Pii_IPV4Address: eValueKind.Pii_IPV4Address,
101
+ Pii_IPv6Address: eValueKind.Pii_IPv6Address,
102
+ Pii_MailSubject: eValueKind.Pii_MailSubject,
103
+ Pii_PhoneNumber: eValueKind.Pii_PhoneNumber,
104
+ Pii_QueryString: eValueKind.Pii_QueryString,
105
+ Pii_SipAddress: eValueKind.Pii_SipAddress,
106
+ Pii_SmtpAddress: eValueKind.Pii_SmtpAddress,
107
+ Pii_Identity: eValueKind.Pii_Identity,
108
+ Pii_Uri: eValueKind.Pii_Uri,
109
+ Pii_Fqdn: eValueKind.Pii_Fqdn,
110
+ Pii_IPV4AddressLegacy: eValueKind.Pii_IPV4AddressLegacy,
111
+ CustomerContent_GenericContent: eValueKind.CustomerContent_GenericContent
112
+ });
113
+ export type ValueKind = number | eValueKind
77
114
 
78
115
  /**
79
116
  * The EventLatency contains a set of values that specify the latency with which an event is sent.
@@ -102,7 +139,7 @@ export const enum EventLatencyValue {
102
139
  /**
103
140
  * The EventLatency contains a set of values that specify the latency with which an event is sent.
104
141
  */
105
- export const EventLatency = {
142
+ export const EventLatency = createEnumStyle<typeof EventLatencyValue>({
106
143
  /**
107
144
  * Normal latency.
108
145
  */
@@ -121,23 +158,41 @@ export const EventLatency = {
121
158
  * Added in v3.1.1
122
159
  */
123
160
  Immediate: EventLatencyValue.Immediate
124
- };
161
+ });
162
+ export type EventLatency = number | EventLatencyValue
163
+
164
+ /**
165
+ * Enum for property types.
166
+ */
167
+ export const enum eEventPropertyType {
168
+ Unspecified = 0,
169
+ String = 1,
170
+ Int32 = 2,
171
+ UInt32 = 3,
172
+ Int64 = 4,
173
+ UInt64 = 5,
174
+ Double = 6,
175
+ Bool = 7,
176
+ Guid = 8,
177
+ DateTime = 9
178
+ }
125
179
 
126
180
  /**
127
181
  * Enum for property types.
128
182
  */
129
- export const EventPropertyType = {
130
- Unspecified: 0,
131
- String: 1,
132
- Int32: 2,
133
- UInt32: 3,
134
- Int64: 4,
135
- UInt64: 5,
136
- Double: 6,
137
- Bool: 7,
138
- Guid: 8,
139
- DateTime: 9
140
- };
183
+ export const EventPropertyType = createEnumStyle<typeof eEventPropertyType>({
184
+ Unspecified: eEventPropertyType.Unspecified,
185
+ String: eEventPropertyType.String,
186
+ Int32: eEventPropertyType.Int32,
187
+ UInt32: eEventPropertyType.UInt32,
188
+ Int64: eEventPropertyType.Int64,
189
+ UInt64: eEventPropertyType.UInt64,
190
+ Double: eEventPropertyType.Double,
191
+ Bool: eEventPropertyType.Bool,
192
+ Guid: eEventPropertyType.Guid,
193
+ DateTime: eEventPropertyType.DateTime
194
+ });
195
+ export type EventPropertyType = number | eEventPropertyType
141
196
 
142
197
  /**
143
198
  * The EventPersistence contains a set of values that specify the event's persistence.
@@ -156,16 +211,18 @@ export const enum EventPersistenceValue {
156
211
  /**
157
212
  * The EventPersistence contains a set of values that specify the event's persistence.
158
213
  */
159
- export const EventPersistence = {
214
+ export const EventPersistence = createEnumStyle<typeof EventPersistenceValue>({
160
215
  /**
161
216
  * Normal persistence.
162
217
  */
163
218
  Normal: EventPersistenceValue.Normal,
219
+
164
220
  /**
165
221
  * Critical persistence.
166
222
  */
167
223
  Critical: EventPersistenceValue.Critical
168
- };
224
+ });
225
+ export type EventPersistence = number | EventPersistenceValue;
169
226
 
170
227
  /**
171
228
  * Define a specific way to send an event synchronously
@@ -201,48 +258,81 @@ export const enum EventSendType {
201
258
  /**
202
259
  * The TraceLevel contains a set of values that specify the trace level for the trace messages.
203
260
  */
204
- export const TraceLevel = {
261
+ export const enum eTraceLevel {
205
262
  /**
206
263
  * None.
207
264
  */
208
- NONE: 0,
265
+ NONE = 0,
209
266
  /**
210
267
  * Error trace.
211
268
  */
212
- ERROR: 1,
269
+ ERROR = 1,
213
270
  /**
214
271
  * Warning trace.
215
272
  */
216
- WARNING: 2,
273
+ WARNING = 2,
217
274
  /**
218
275
  * Information trace.
219
276
  */
220
- INFORMATION: 3
221
- };
222
-
223
- export const _ExtendedInternalMessageId = {
224
- ..._InternalMessageId,
225
- AuthHandShakeError: 501,
226
- AuthRedirectFail: 502,
227
- BrowserCannotReadLocalStorage: 503,
228
- BrowserCannotWriteLocalStorage: 504,
229
- BrowserDoesNotSupportLocalStorage: 505,
230
- CannotParseBiBlobValue: 506,
231
- CannotParseDataAttribute: 507,
232
- CVPluginNotAvailable: 508,
233
- DroppedEvent: 509,
234
- ErrorParsingAISessionCookie: 510,
235
- ErrorProvidedChannels: 511,
236
- FailedToGetCookies: 512,
237
- FailedToInitializeCorrelationVector: 513,
238
- FailedToInitializeSDK: 514,
239
- InvalidContentBlob: 515,
240
- InvalidCorrelationValue: 516,
241
- SessionRenewalDateIsZero: 517,
242
- SendPostOnCompleteFailure: 518,
243
- PostResponseHandler: 519,
244
- SDKNotInitialized: 520
245
- };
277
+ INFORMATION = 3
278
+ }
279
+
280
+ export const TraceLevel = createEnumStyle<typeof eTraceLevel>({
281
+ NONE: eTraceLevel.NONE,
282
+ ERROR: eTraceLevel.ERROR,
283
+ WARNING: eTraceLevel.WARNING,
284
+ INFORMATION: eTraceLevel.INFORMATION,
285
+ });
286
+ export type TraceLevel = number | eTraceLevel;
287
+
288
+ export const enum _eExtendedInternalMessageId {
289
+ AuthHandShakeError = 501,
290
+ AuthRedirectFail = 502,
291
+ BrowserCannotReadLocalStorage = 503,
292
+ BrowserCannotWriteLocalStorage = 504,
293
+ BrowserDoesNotSupportLocalStorage = 505,
294
+ CannotParseBiBlobValue = 506,
295
+ CannotParseDataAttribute = 507,
296
+ CVPluginNotAvailable = 508,
297
+ DroppedEvent = 509,
298
+ ErrorParsingAISessionCookie = 510,
299
+ ErrorProvidedChannels = 511,
300
+ FailedToGetCookies = 512,
301
+ FailedToInitializeCorrelationVector = 513,
302
+ FailedToInitializeSDK = 514,
303
+ InvalidContentBlob = 515,
304
+ InvalidCorrelationValue = 516,
305
+ SessionRenewalDateIsZero = 517,
306
+ SendPostOnCompleteFailure = 518,
307
+ PostResponseHandler = 519,
308
+ SDKNotInitialized = 520
309
+ }
310
+
311
+ export const _ExtendedInternalMessageId = objFreeze({
312
+ ..._InternalMessageId,
313
+ ...createEnumStyle<typeof _eExtendedInternalMessageId>({
314
+ AuthHandShakeError: _eExtendedInternalMessageId.AuthHandShakeError,
315
+ AuthRedirectFail: _eExtendedInternalMessageId.AuthRedirectFail,
316
+ BrowserCannotReadLocalStorage: _eExtendedInternalMessageId.BrowserCannotReadLocalStorage,
317
+ BrowserCannotWriteLocalStorage: _eExtendedInternalMessageId.BrowserCannotWriteLocalStorage,
318
+ BrowserDoesNotSupportLocalStorage: _eExtendedInternalMessageId.BrowserDoesNotSupportLocalStorage,
319
+ CannotParseBiBlobValue: _eExtendedInternalMessageId.CannotParseBiBlobValue,
320
+ CannotParseDataAttribute: _eExtendedInternalMessageId.CannotParseDataAttribute,
321
+ CVPluginNotAvailable: _eExtendedInternalMessageId.CVPluginNotAvailable,
322
+ DroppedEvent: _eExtendedInternalMessageId.DroppedEvent,
323
+ ErrorParsingAISessionCookie: _eExtendedInternalMessageId.ErrorParsingAISessionCookie,
324
+ ErrorProvidedChannels: _eExtendedInternalMessageId.ErrorProvidedChannels,
325
+ FailedToGetCookies: _eExtendedInternalMessageId.FailedToGetCookies,
326
+ FailedToInitializeCorrelationVector: _eExtendedInternalMessageId.FailedToInitializeCorrelationVector,
327
+ FailedToInitializeSDK: _eExtendedInternalMessageId.FailedToInitializeSDK,
328
+ InvalidContentBlob: _eExtendedInternalMessageId.InvalidContentBlob,
329
+ InvalidCorrelationValue: _eExtendedInternalMessageId.InvalidCorrelationValue,
330
+ SessionRenewalDateIsZero: _eExtendedInternalMessageId.SessionRenewalDateIsZero,
331
+ SendPostOnCompleteFailure: _eExtendedInternalMessageId.SendPostOnCompleteFailure,
332
+ PostResponseHandler: _eExtendedInternalMessageId.PostResponseHandler,
333
+ SDKNotInitialized: _eExtendedInternalMessageId.SDKNotInitialized
334
+ })});
335
+ export type _ExtendedInternalMessageId = number | _eExtendedInternalMessageId | _eInternalMessageId;
246
336
 
247
337
  // Following the format styles as defined by .Net (https://docs.microsoft.com/en-us/dotnet/api/system.guid.tostring?view=netcore-3.1)
248
338
  export const enum GuidStyle {
package/src/Index.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * File to export public classes, interfaces and enums.
6
6
  */
7
7
  import {
8
- ValueKind, EventLatency, EventPersistence, TraceLevel, EventPropertyType, _ExtendedInternalMessageId, GuidStyle, FieldValueSanitizerType,
8
+ ValueKind, EventLatency, EventPersistence, TraceLevel, EventPropertyType, _ExtendedInternalMessageId, _eExtendedInternalMessageId, GuidStyle, FieldValueSanitizerType,
9
9
  TransportType, EventLatencyValue, EventPersistenceValue, EventSendType
10
10
  } from "./Enums";
11
11
  import {
@@ -23,7 +23,7 @@ import { ValueSanitizer } from "./ValueSanitizer";
23
23
  export {
24
24
  ValueKind, IExtendedConfiguration, IPropertyStorageOverride,
25
25
  EventLatency, EventPersistence, TraceLevel, IEventProperty, IExtendedTelemetryItem, TransportType,
26
- AppInsightsCore, BaseCore, _ExtendedInternalMessageId, IExtendedAppInsightsCore, EventPropertyType,
26
+ AppInsightsCore, BaseCore, _ExtendedInternalMessageId, _eExtendedInternalMessageId, IExtendedAppInsightsCore, EventPropertyType,
27
27
  IEventTiming, ESPromise, ESPromiseOnResolvedFunc, ESPromiseOnRejectedFunc, ResolverResolveFunc,
28
28
  ResolverRejectFunc, ESPromiseScheduler, ESPromiseSchedulerEvent, GuidStyle,
29
29
  FieldValueSanitizerFunc, FieldValueSanitizerType, FieldValueSanitizerTypes, IFieldSanitizerDetails,
@@ -37,12 +37,13 @@ export {
37
37
  MinChannelPriorty, EventsDiscardedReason, ICoreUtils, IDiagnosticLogger, DiagnosticLogger, LoggingSeverity, SendRequestReason,
38
38
  IPerfEvent, IPerfManager, IPerfManagerProvider, PerfEvent, PerfManager, doPerf, ICustomProperties, Tags,
39
39
  EventHelper, AppInsightsCore as InternalAppInsightsCore, BaseCore as InternalBaseCore, _InternalLogMessage, _InternalMessageId,
40
+ createEnumStyle, eLoggingSeverity, _eInternalMessageId, _throwInternal,// _warnToConsole, _logInternalMessage
40
41
  // The HelperFuncs functions
41
42
  isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, attachEvent, detachEvent, normalizeJsName,
42
43
  objForEachKey, strStartsWith, strEndsWith, strContains, strTrim, isDate, isArray, isError, isString, isNumber, isBoolean,
43
44
  toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError,
44
- setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, optimizeObject,
45
- objCreate, addEventHandler, newGuid, perfNow, newId, generateW3CId, safeGetLogger,
45
+ setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, optimizeObject,
46
+ objCreate, addEventHandler, newGuid, perfNow, newId, generateW3CId, safeGetLogger, objFreeze, objSeal,
46
47
  // EnvUtils
47
48
  getGlobal, getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto,
48
49
  hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON,
@@ -53,12 +54,18 @@ export {
53
54
  // Cookie Handling
54
55
  ICookieMgr, ICookieMgrConfig, uaDisallowsSameSiteNone as disallowsSameSiteNone,
55
56
  areCookiesSupported, areCookiesSupported as cookieAvailable, createCookieMgr, safeGetCookieMgr,
56
- // Constants
57
- strIKey, strExtensionConfig,
58
57
  // Aliases
59
58
  toISOString as getISOString,
60
59
  isBeaconsSupported, isFetchSupported, isXhrSupported, useXDomainRequest,
61
- addPageHideEventListener, addPageShowEventListener, addEventListeners, addPageUnloadEventListener
60
+ addPageHideEventListener, addPageShowEventListener, addEventListeners, addPageUnloadEventListener,
61
+ removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace,
62
+ createUniqueNamespace,
63
+ _IRegisteredEvents, __getRegisteredEvents,
64
+ TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer,
65
+ createProcessTelemetryContext,
66
+ IProcessTelemetryUnloadContext, UnloadHandler, IUnloadHandlerContainer, ITelemetryUnloadState, createUnloadHandlerContainer, TelemetryUnloadReason,
67
+ ITelemetryUpdateState, IUnloadableComponent
68
+
62
69
  } from "@microsoft/applicationinsights-core-js";
63
70
 
64
71
  export {
package/src/Utils.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { objCreateFn, strShimObject } from "@microsoft/applicationinsights-shims";
8
8
  import { IEventProperty, IExtendedTelemetryItem } from "./DataModels";
9
- import { EventPropertyType, _ExtendedInternalMessageId, GuidStyle, ValueKind, FieldValueSanitizerType, EventLatency } from "./Enums";
9
+ import { eEventPropertyType, _ExtendedInternalMessageId, GuidStyle, eValueKind, FieldValueSanitizerType, EventLatency, EventLatencyValue } from "./Enums";
10
10
  import {
11
11
  ITelemetryItem, getDocument, getNavigator, getWindow, getGlobalInst,
12
12
  objForEachKey, isUndefined, isNullOrUndefined, isNumber, isReactNative, isString, isBoolean, isArray,
@@ -22,16 +22,17 @@ export const FullVersionString = "1DS-Web-JS-" + Version;
22
22
  // Defining here so we don't need to take (import) the ApplicationInsights Common module
23
23
  const strDisabledPropertyName: string = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
24
24
  const strWithCredentials: string = "withCredentials";
25
+ const strTimeout: string = "timeout";
25
26
 
26
27
  // If value is array just get the type for the first element
27
28
  const _fieldTypeEventPropMap = {
28
- [FieldValueSanitizerType.NotSet]: EventPropertyType.Unspecified,
29
- [FieldValueSanitizerType.Number]: EventPropertyType.Double,
30
- [FieldValueSanitizerType.String]: EventPropertyType.String,
31
- [FieldValueSanitizerType.Boolean]: EventPropertyType.Bool,
32
- [FieldValueSanitizerType.Array | FieldValueSanitizerType.Number]: EventPropertyType.Double,
33
- [FieldValueSanitizerType.Array | FieldValueSanitizerType.String]: EventPropertyType.String,
34
- [FieldValueSanitizerType.Array | FieldValueSanitizerType.Boolean]: EventPropertyType.Bool
29
+ [FieldValueSanitizerType.NotSet]: eEventPropertyType.Unspecified,
30
+ [FieldValueSanitizerType.Number]: eEventPropertyType.Double,
31
+ [FieldValueSanitizerType.String]: eEventPropertyType.String,
32
+ [FieldValueSanitizerType.Boolean]: eEventPropertyType.Bool,
33
+ [FieldValueSanitizerType.Array | FieldValueSanitizerType.Number]: eEventPropertyType.Double,
34
+ [FieldValueSanitizerType.Array | FieldValueSanitizerType.String]: eEventPropertyType.String,
35
+ [FieldValueSanitizerType.Array | FieldValueSanitizerType.Boolean]: eEventPropertyType.Bool
35
36
  };
36
37
 
37
38
  /**
@@ -96,8 +97,8 @@ export function isUint8ArrayAvailable(): boolean {
96
97
  * @param value - The value that needs to be checked.
97
98
  * @returns True if the value is in AWTEventLatency, false otherwise.
98
99
  */
99
- export function isLatency(value: number | undefined | typeof EventLatency): boolean {
100
- if (value && isNumber(value) && value >= EventLatency.Normal && value <= EventLatency.Immediate) {
100
+ export function isLatency(value: EventLatency | undefined): boolean {
101
+ if (value && isNumber(value) && value >= EventLatencyValue.Normal && value <= EventLatencyValue.Immediate) {
101
102
  return true;
102
103
  }
103
104
  return false;
@@ -184,7 +185,7 @@ export function getCommonSchemaMetaData(value: string | boolean | number | strin
184
185
  if (encodedTypeValue !== -1 && propType !== -1) {
185
186
  // pii exists so we must return correct type
186
187
  encodedTypeValue |= propType;
187
- } else if (propType === EventPropertyType.Double) {
188
+ } else if (propType === eEventPropertyType.Double) {
188
189
  encodedTypeValue = propType;
189
190
  }
190
191
  }
@@ -337,7 +338,7 @@ export let getTime = perfNow;
337
338
 
338
339
  export function isValueKind(value: number | undefined): boolean {
339
340
  // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization
340
- if (value === ValueKind.NotSet || ((value > ValueKind.NotSet && value <= ValueKind.Pii_IPV4AddressLegacy) || value === ValueKind.CustomerContent_GenericContent)) {
341
+ if (value === eValueKind.NotSet || ((value > eValueKind.NotSet && value <= eValueKind.Pii_IPV4AddressLegacy) || value === eValueKind.CustomerContent_GenericContent)) {
341
342
  return true;
342
343
  }
343
344
 
@@ -517,11 +518,12 @@ export function isChromium() {
517
518
  * @param withCredentials - Option flag indicating that credentials should be sent
518
519
  * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)
519
520
  * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)
521
+ * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request
520
522
  * @returns A new opened XHR request
521
523
  */
522
- export function openXhr(method: string, urlString: string, withCredentials?: boolean, disabled: boolean = false, isSync: boolean = false) {
524
+ export function openXhr(method: string, urlString: string, withCredentials?: boolean, disabled: boolean = false, isSync: boolean = false, timeout?: number) {
523
525
 
524
- function _wrapSetXhrProp(xhr: XMLHttpRequest, prop: string, value: boolean) {
526
+ function _wrapSetXhrProp<T>(xhr: XMLHttpRequest, prop: string, value: T) {
525
527
  try {
526
528
  xhr[prop] = value;
527
529
  } catch (e) {
@@ -552,5 +554,12 @@ export function openXhr(method: string, urlString: string, withCredentials?: boo
552
554
  _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
553
555
  }
554
556
 
557
+ // Only set the timeout for asynchronous requests as
558
+ // "Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.""
559
+ // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout
560
+ if (!isSync && timeout) {
561
+ _wrapSetXhrProp(xhr, strTimeout, timeout);
562
+ }
563
+
555
564
  return xhr;
556
565
  }