@microsoft/applicationinsights-common 2.8.4-nightly.2205-09 → 2.8.5-nightly.2206-02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +174 -127
  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 +81 -501
  7. package/dist/applicationinsights-common.api.md +24 -23
  8. package/dist/applicationinsights-common.d.ts +33 -91
  9. package/dist/applicationinsights-common.js +174 -127
  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 -91
  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 +1 -1
  18. package/dist-esm/HelperFuncs.js +1 -1
  19. package/dist-esm/Interfaces/ConnectionString.js +1 -1
  20. package/dist-esm/Interfaces/Context/IApplication.js +1 -1
  21. package/dist-esm/Interfaces/Context/IDevice.js +1 -1
  22. package/dist-esm/Interfaces/Context/IInternal.js +1 -1
  23. package/dist-esm/Interfaces/Context/ILocation.js +1 -1
  24. package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
  25. package/dist-esm/Interfaces/Context/ISample.js +1 -1
  26. package/dist-esm/Interfaces/Context/ISession.js +1 -1
  27. package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
  28. package/dist-esm/Interfaces/Context/IUser.js +1 -1
  29. package/dist-esm/Interfaces/Context/IWeb.js +1 -1
  30. package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
  31. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
  32. package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
  33. package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
  34. package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
  35. package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
  36. package/dist-esm/Interfaces/Contracts/IData.js +1 -1
  37. package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
  38. package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
  39. package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
  40. package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
  41. package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
  42. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
  43. package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
  44. package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
  45. package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
  46. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
  47. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
  48. package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
  49. package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
  50. package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
  51. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  52. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  53. package/dist-esm/Interfaces/IConfig.js +1 -1
  54. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  55. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  56. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  57. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  58. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  59. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  60. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  61. package/dist-esm/Interfaces/IPartC.js +1 -1
  62. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  63. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  64. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  65. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  66. package/dist-esm/Interfaces/PartAExtensions.js +1 -1
  67. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  68. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  69. package/dist-esm/RequestResponseHeaders.js +1 -1
  70. package/dist-esm/StorageHelperFuncs.js +1 -1
  71. package/dist-esm/Telemetry/Common/Data.js +1 -1
  72. package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
  73. package/dist-esm/Telemetry/Common/DataSanitizer.js +1 -1
  74. package/dist-esm/Telemetry/Common/Envelope.js +1 -1
  75. package/dist-esm/Telemetry/Event.js +1 -1
  76. package/dist-esm/Telemetry/Exception.js +1 -1
  77. package/dist-esm/Telemetry/Metric.js +1 -1
  78. package/dist-esm/Telemetry/PageView.js +1 -1
  79. package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
  80. package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
  81. package/dist-esm/Telemetry/Trace.js +1 -1
  82. package/dist-esm/TelemetryItemCreator.js +1 -1
  83. package/dist-esm/UrlHelperFuncs.js +1 -1
  84. package/dist-esm/Util.js +45 -2
  85. package/dist-esm/Util.js.map +1 -1
  86. package/dist-esm/applicationinsights-common.js +3 -4
  87. package/dist-esm/applicationinsights-common.js.map +1 -1
  88. package/package.json +2 -2
  89. package/src/Interfaces/Context/ITelemetryTrace.ts +6 -0
  90. package/src/Util.ts +49 -2
  91. package/src/applicationinsights-common.ts +6 -6
  92. package/types/Interfaces/Context/ITelemetryTrace.d.ts +5 -0
  93. package/types/Util.d.ts +9 -1
  94. package/types/applicationinsights-common.d.ts +2 -4
  95. package/types/tsdoc-metadata.json +1 -1
  96. package/dist-esm/Interfaces/ITraceParent.js +0 -8
  97. package/dist-esm/Interfaces/ITraceParent.js.map +0 -1
  98. package/dist-esm/W3cTraceParent.js +0 -192
  99. package/dist-esm/W3cTraceParent.js.map +0 -1
  100. package/src/Interfaces/ITraceParent.ts +0 -38
  101. package/src/W3cTraceParent.ts +0 -219
  102. package/types/Interfaces/ITraceParent.d.ts +0 -32
  103. package/types/W3cTraceParent.d.ts +0 -59
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { ContextTagKeys } from "./Contracts/ContextTagKeys";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/dist-esm/Util.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
- import { getPerformance, getExceptionName as coreGetExceptionName, dumpObj, isNullOrUndefined, strTrim, random32, isArray, isError, isDate, newId, generateW3CId, toISOString, arrForEach, getIEVersion, attachEvent, dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies, canUseCookies as coreCanUseCookies, getCookie as coreGetCookie, setCookie as coreSetCookie, deleteCookie as coreDeleteCookie, isBeaconsSupported, arrIndexOf } from "@microsoft/applicationinsights-core-js";
7
+ import { getPerformance, getExceptionName as coreGetExceptionName, dumpObj, isNullOrUndefined, strTrim, random32, isArray, isError, isDate, newId, generateW3CId, toISOString, arrForEach, getIEVersion, attachEvent, dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies, canUseCookies as coreCanUseCookies, getCookie as coreGetCookie, setCookie as coreSetCookie, deleteCookie as coreDeleteCookie, isBeaconsSupported, arrIndexOf, isValidTraceId, isValidSpanId } from "@microsoft/applicationinsights-core-js";
8
8
  import { RequestHeaders } from "./RequestResponseHeaders";
9
9
  import { dataSanitizeString } from "./Telemetry/Common/DataSanitizer";
10
10
  import { createDomEvent } from "./DomHelperFuncs";
@@ -204,4 +204,47 @@ export var DateTimeUtils = {
204
204
  Now: dateTimeUtilsNow,
205
205
  GetDuration: dateTimeUtilsDuration
206
206
  };
207
+ /**
208
+ * Creates a IDistributedTraceContext from an optional telemetryTrace
209
+ * @param telemetryTrace - The telemetryTrace instance that is being wrapped
210
+ * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
211
+ * @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
212
+ */
213
+ export function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {
214
+ var trace = telemetryTrace || {};
215
+ return {
216
+ getName: function () {
217
+ return trace.name;
218
+ },
219
+ setName: function (newValue) {
220
+ parentCtx && parentCtx.setName(newValue);
221
+ trace.name = newValue;
222
+ },
223
+ getTraceId: function () {
224
+ return trace.traceID;
225
+ },
226
+ setTraceId: function (newValue) {
227
+ parentCtx && parentCtx.setTraceId(newValue);
228
+ if (isValidTraceId(newValue)) {
229
+ trace.traceID = newValue;
230
+ }
231
+ },
232
+ getSpanId: function () {
233
+ return trace.parentID;
234
+ },
235
+ setSpanId: function (newValue) {
236
+ parentCtx && parentCtx.setSpanId(newValue);
237
+ if (isValidSpanId(newValue)) {
238
+ trace.parentID = newValue;
239
+ }
240
+ },
241
+ getTraceFlags: function () {
242
+ return trace.traceFlags;
243
+ },
244
+ setTraceFlags: function (newTraceFlags) {
245
+ parentCtx && parentCtx.setTraceFlags(newTraceFlags);
246
+ trace.traceFlags = newTraceFlags;
247
+ }
248
+ };
249
+ }
207
250
  //# sourceMappingURL=Util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.js.map","sources":["Util.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getPerformance, getExceptionName as coreGetExceptionName, dumpObj, isNullOrUndefined, strTrim, random32, isArray, isError, isDate, newId, generateW3CId, toISOString, arrForEach, getIEVersion, attachEvent, dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies, canUseCookies as coreCanUseCookies, getCookie as coreGetCookie, setCookie as coreSetCookie, deleteCookie as coreDeleteCookie, isBeaconsSupported, arrIndexOf } from \"@microsoft/applicationinsights-core-js\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { createDomEvent } from \"./DomHelperFuncs\";\r\nimport { stringToBoolOrDefault, msToTimeSpan, isCrossOriginError, getExtensionByName } from \"./HelperFuncs\";\r\nimport { strNotSpecified } from \"./Constants\";\r\nimport { utlCanUseLocalStorage, utlCanUseSessionStorage, utlDisableStorage, utlGetSessionStorage, utlGetSessionStorageKeys, utlGetLocalStorage, utlRemoveSessionStorage, utlRemoveStorage, utlSetSessionStorage, utlSetLocalStorage } from \"./StorageHelperFuncs\";\r\nimport { urlGetAbsoluteUrl, urlGetCompleteUrl, urlGetPathName, urlParseFullHost, urlParseHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n \"https://dc.services.visualstudio.com/v2/track\",\r\n \"https://breeze.aimon.applicationinsights.io/v2/track\",\r\n \"https://dc-int.services.visualstudio.com/v2/track\"\r\n];\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return arrIndexOf(_internalEndpoints, endpointUrl.toLowerCase()) !== -1;\r\n}\r\nexport var Util = {\r\n NotSpecified: strNotSpecified,\r\n createDomEvent: createDomEvent,\r\n disableStorage: utlDisableStorage,\r\n isInternalApplicationInsightsEndpoint: isInternalApplicationInsightsEndpoint,\r\n canUseLocalStorage: utlCanUseLocalStorage,\r\n getStorage: utlGetLocalStorage,\r\n setStorage: utlSetLocalStorage,\r\n removeStorage: utlRemoveStorage,\r\n canUseSessionStorage: utlCanUseSessionStorage,\r\n getSessionStorageKeys: utlGetSessionStorageKeys,\r\n getSessionStorage: utlGetSessionStorage,\r\n setSessionStorage: utlSetSessionStorage,\r\n removeSessionStorage: utlRemoveSessionStorage,\r\n disableCookies: coreDisableCookies,\r\n canUseCookies: coreCanUseCookies,\r\n disallowsSameSiteNone: uaDisallowsSameSiteNone,\r\n setCookie: coreSetCookie,\r\n stringToBoolOrDefault: stringToBoolOrDefault,\r\n getCookie: coreGetCookie,\r\n deleteCookie: coreDeleteCookie,\r\n trim: strTrim,\r\n newId: newId,\r\n random32: function () {\r\n return random32(true);\r\n },\r\n generateW3CId: generateW3CId,\r\n isArray: isArray,\r\n isError: isError,\r\n isDate: isDate,\r\n toISOStringForIE8: toISOString,\r\n getIEVersion: getIEVersion,\r\n msToTimeSpan: msToTimeSpan,\r\n isCrossOriginError: isCrossOriginError,\r\n dump: dumpObj,\r\n getExceptionName: coreGetExceptionName,\r\n addEventHandler: attachEvent,\r\n IsBeaconApiSupported: isBeaconsSupported,\r\n getExtension: getExtensionByName\r\n};\r\nexport var UrlHelper = {\r\n parseUrl: urlParseUrl,\r\n getAbsoluteUrl: urlGetAbsoluteUrl,\r\n getPathName: urlGetPathName,\r\n getCompleteUrl: urlGetCompleteUrl,\r\n parseHost: urlParseHost,\r\n parseFullHost: urlParseFullHost\r\n};\r\nexport var CorrelationIdHelper = {\r\n correlationIdPrefix: \"cid-v1:\",\r\n /**\r\n * Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.\r\n * Headers are always included if the current domain matches the request domain. If they do not match (CORS),\r\n * they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.\r\n * Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must\r\n * manually supply domains to include correlation headers on. Else, no headers will be included at all.\r\n */\r\n canIncludeCorrelationHeader: function (config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config.correlationHeaderExcludePatterns) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns.length; i++) {\r\n if (config.correlationHeaderExcludePatterns[i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host.toLowerCase();\r\n if (requestHost && (requestHost.indexOf(\":443\") !== -1 || requestHost.indexOf(\":80\") !== -1)) {\r\n // [Bug #1260] IE can include the port even for http and https URLs so if present\r\n // try and parse it to remove if it matches the default protocol port\r\n requestHost = (urlParseFullHost(requestUrl, true) || \"\").toLowerCase();\r\n }\r\n if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) {\r\n return false;\r\n }\r\n var includedDomains = config && config.correlationHeaderDomains;\r\n if (includedDomains) {\r\n var matchExists_1;\r\n arrForEach(includedDomains, function (domain) {\r\n var regex = new RegExp(domain.toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n matchExists_1 = matchExists_1 || regex.test(requestHost);\r\n });\r\n if (!matchExists_1) {\r\n return false;\r\n }\r\n }\r\n var excludedDomains = config && config.correlationHeaderExcludedDomains;\r\n if (!excludedDomains || excludedDomains.length === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains.length; i++) {\r\n var regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n if (regex.test(requestHost)) {\r\n return false;\r\n }\r\n }\r\n // if we don't know anything about the requestHost, require the user to use included/excludedDomains.\r\n // Previously we always returned false for a falsy requestHost\r\n return requestHost && requestHost.length > 0;\r\n },\r\n /**\r\n * Combines target appId and target role name from response header.\r\n */\r\n getCorrelationContext: function (responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders[1 /* eRequestHeaders.requestContextTargetKey */]);\r\n if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n },\r\n /**\r\n * Gets key from correlation response header\r\n */\r\n getCorrelationContextValue: function (responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader.split(\",\");\r\n for (var i = 0; i < keyValues.length; ++i) {\r\n var keyValue = keyValues[i].split(\"=\");\r\n if (keyValue.length === 2 && keyValue[0] === key) {\r\n return keyValue[1];\r\n }\r\n }\r\n }\r\n }\r\n};\r\nexport function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) {\r\n var target, name = commandName, data = commandName;\r\n if (absoluteUrl && absoluteUrl.length > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl.host;\r\n if (!name) {\r\n if (parsedUrl.pathname != null) {\r\n var pathName = (parsedUrl.pathname.length === 0) ? \"/\" : parsedUrl.pathname;\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl.pathname;\r\n name = dataSanitizeString(logger, method ? method + \" \" + pathName : pathName);\r\n }\r\n else {\r\n name = dataSanitizeString(logger, absoluteUrl);\r\n }\r\n }\r\n }\r\n else {\r\n target = commandName;\r\n name = commandName;\r\n }\r\n return {\r\n target: target,\r\n name: name,\r\n data: data\r\n };\r\n}\r\nexport function dateTimeUtilsNow() {\r\n // returns the window or webworker performance object\r\n var perf = getPerformance();\r\n if (perf && perf.now && perf.timing) {\r\n var now = perf.now() + perf.timing.navigationStart;\r\n // Known issue with IE where this calculation can be negative, so if it is then ignore and fallback\r\n if (now > 0) {\r\n return now;\r\n }\r\n }\r\n return dateNow();\r\n}\r\nexport function dateTimeUtilsDuration(start, end) {\r\n var result = null;\r\n if (start !== 0 && end !== 0 && !isNullOrUndefined(start) && !isNullOrUndefined(end)) {\r\n result = end - start;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A utility class that helps getting time related parameters\r\n */\r\nexport var DateTimeUtils = {\r\n Now: dateTimeUtilsNow,\r\n GetDuration: dateTimeUtilsDuration\r\n};\r\n//# sourceMappingURL=Util.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"Util.js.map","sources":["Util.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getPerformance, getExceptionName as coreGetExceptionName, dumpObj, isNullOrUndefined, strTrim, random32, isArray, isError, isDate, newId, generateW3CId, toISOString, arrForEach, getIEVersion, attachEvent, dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies, canUseCookies as coreCanUseCookies, getCookie as coreGetCookie, setCookie as coreSetCookie, deleteCookie as coreDeleteCookie, isBeaconsSupported, arrIndexOf, isValidTraceId, isValidSpanId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { createDomEvent } from \"./DomHelperFuncs\";\r\nimport { stringToBoolOrDefault, msToTimeSpan, isCrossOriginError, getExtensionByName } from \"./HelperFuncs\";\r\nimport { strNotSpecified } from \"./Constants\";\r\nimport { utlCanUseLocalStorage, utlCanUseSessionStorage, utlDisableStorage, utlGetSessionStorage, utlGetSessionStorageKeys, utlGetLocalStorage, utlRemoveSessionStorage, utlRemoveStorage, utlSetSessionStorage, utlSetLocalStorage } from \"./StorageHelperFuncs\";\r\nimport { urlGetAbsoluteUrl, urlGetCompleteUrl, urlGetPathName, urlParseFullHost, urlParseHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n \"https://dc.services.visualstudio.com/v2/track\",\r\n \"https://breeze.aimon.applicationinsights.io/v2/track\",\r\n \"https://dc-int.services.visualstudio.com/v2/track\"\r\n];\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return arrIndexOf(_internalEndpoints, endpointUrl.toLowerCase()) !== -1;\r\n}\r\nexport var Util = {\r\n NotSpecified: strNotSpecified,\r\n createDomEvent: createDomEvent,\r\n disableStorage: utlDisableStorage,\r\n isInternalApplicationInsightsEndpoint: isInternalApplicationInsightsEndpoint,\r\n canUseLocalStorage: utlCanUseLocalStorage,\r\n getStorage: utlGetLocalStorage,\r\n setStorage: utlSetLocalStorage,\r\n removeStorage: utlRemoveStorage,\r\n canUseSessionStorage: utlCanUseSessionStorage,\r\n getSessionStorageKeys: utlGetSessionStorageKeys,\r\n getSessionStorage: utlGetSessionStorage,\r\n setSessionStorage: utlSetSessionStorage,\r\n removeSessionStorage: utlRemoveSessionStorage,\r\n disableCookies: coreDisableCookies,\r\n canUseCookies: coreCanUseCookies,\r\n disallowsSameSiteNone: uaDisallowsSameSiteNone,\r\n setCookie: coreSetCookie,\r\n stringToBoolOrDefault: stringToBoolOrDefault,\r\n getCookie: coreGetCookie,\r\n deleteCookie: coreDeleteCookie,\r\n trim: strTrim,\r\n newId: newId,\r\n random32: function () {\r\n return random32(true);\r\n },\r\n generateW3CId: generateW3CId,\r\n isArray: isArray,\r\n isError: isError,\r\n isDate: isDate,\r\n toISOStringForIE8: toISOString,\r\n getIEVersion: getIEVersion,\r\n msToTimeSpan: msToTimeSpan,\r\n isCrossOriginError: isCrossOriginError,\r\n dump: dumpObj,\r\n getExceptionName: coreGetExceptionName,\r\n addEventHandler: attachEvent,\r\n IsBeaconApiSupported: isBeaconsSupported,\r\n getExtension: getExtensionByName\r\n};\r\nexport var UrlHelper = {\r\n parseUrl: urlParseUrl,\r\n getAbsoluteUrl: urlGetAbsoluteUrl,\r\n getPathName: urlGetPathName,\r\n getCompleteUrl: urlGetCompleteUrl,\r\n parseHost: urlParseHost,\r\n parseFullHost: urlParseFullHost\r\n};\r\nexport var CorrelationIdHelper = {\r\n correlationIdPrefix: \"cid-v1:\",\r\n /**\r\n * Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.\r\n * Headers are always included if the current domain matches the request domain. If they do not match (CORS),\r\n * they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.\r\n * Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must\r\n * manually supply domains to include correlation headers on. Else, no headers will be included at all.\r\n */\r\n canIncludeCorrelationHeader: function (config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config.correlationHeaderExcludePatterns) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns.length; i++) {\r\n if (config.correlationHeaderExcludePatterns[i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host.toLowerCase();\r\n if (requestHost && (requestHost.indexOf(\":443\") !== -1 || requestHost.indexOf(\":80\") !== -1)) {\r\n // [Bug #1260] IE can include the port even for http and https URLs so if present\r\n // try and parse it to remove if it matches the default protocol port\r\n requestHost = (urlParseFullHost(requestUrl, true) || \"\").toLowerCase();\r\n }\r\n if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) {\r\n return false;\r\n }\r\n var includedDomains = config && config.correlationHeaderDomains;\r\n if (includedDomains) {\r\n var matchExists_1;\r\n arrForEach(includedDomains, function (domain) {\r\n var regex = new RegExp(domain.toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n matchExists_1 = matchExists_1 || regex.test(requestHost);\r\n });\r\n if (!matchExists_1) {\r\n return false;\r\n }\r\n }\r\n var excludedDomains = config && config.correlationHeaderExcludedDomains;\r\n if (!excludedDomains || excludedDomains.length === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains.length; i++) {\r\n var regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n if (regex.test(requestHost)) {\r\n return false;\r\n }\r\n }\r\n // if we don't know anything about the requestHost, require the user to use included/excludedDomains.\r\n // Previously we always returned false for a falsy requestHost\r\n return requestHost && requestHost.length > 0;\r\n },\r\n /**\r\n * Combines target appId and target role name from response header.\r\n */\r\n getCorrelationContext: function (responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders[1 /* eRequestHeaders.requestContextTargetKey */]);\r\n if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n },\r\n /**\r\n * Gets key from correlation response header\r\n */\r\n getCorrelationContextValue: function (responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader.split(\",\");\r\n for (var i = 0; i < keyValues.length; ++i) {\r\n var keyValue = keyValues[i].split(\"=\");\r\n if (keyValue.length === 2 && keyValue[0] === key) {\r\n return keyValue[1];\r\n }\r\n }\r\n }\r\n }\r\n};\r\nexport function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) {\r\n var target, name = commandName, data = commandName;\r\n if (absoluteUrl && absoluteUrl.length > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl.host;\r\n if (!name) {\r\n if (parsedUrl.pathname != null) {\r\n var pathName = (parsedUrl.pathname.length === 0) ? \"/\" : parsedUrl.pathname;\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl.pathname;\r\n name = dataSanitizeString(logger, method ? method + \" \" + pathName : pathName);\r\n }\r\n else {\r\n name = dataSanitizeString(logger, absoluteUrl);\r\n }\r\n }\r\n }\r\n else {\r\n target = commandName;\r\n name = commandName;\r\n }\r\n return {\r\n target: target,\r\n name: name,\r\n data: data\r\n };\r\n}\r\nexport function dateTimeUtilsNow() {\r\n // returns the window or webworker performance object\r\n var perf = getPerformance();\r\n if (perf && perf.now && perf.timing) {\r\n var now = perf.now() + perf.timing.navigationStart;\r\n // Known issue with IE where this calculation can be negative, so if it is then ignore and fallback\r\n if (now > 0) {\r\n return now;\r\n }\r\n }\r\n return dateNow();\r\n}\r\nexport function dateTimeUtilsDuration(start, end) {\r\n var result = null;\r\n if (start !== 0 && end !== 0 && !isNullOrUndefined(start) && !isNullOrUndefined(end)) {\r\n result = end - start;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A utility class that helps getting time related parameters\r\n */\r\nexport var DateTimeUtils = {\r\n Now: dateTimeUtilsNow,\r\n GetDuration: dateTimeUtilsDuration\r\n};\r\n/**\r\n * Creates a IDistributedTraceContext from an optional telemetryTrace\r\n * @param telemetryTrace - The telemetryTrace instance that is being wrapped\r\n * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.\r\n * @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object\r\n */\r\nexport function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {\r\n var trace = telemetryTrace || {};\r\n return {\r\n getName: function () {\r\n return trace.name;\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace.name = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceID;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceID = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.parentID;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.parentID = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace.traceFlags;\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace.traceFlags = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=Util.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,10 +1,10 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
2
+ * Application Insights JavaScript SDK - Common, 2.8.5-nightly.2206-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
  // Licensed under the
7
- export { Util, CorrelationIdHelper, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, UrlHelper, isInternalApplicationInsightsEndpoint } from "./Util";
7
+ export { Util, CorrelationIdHelper, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, UrlHelper, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from "./Util";
8
8
  export { parseConnectionString, ConnectionStringParser } from "./ConnectionStringParser";
9
9
  export { RequestHeaders } from "./RequestResponseHeaders";
10
10
  export { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, strNotSpecified } from "./Constants";
@@ -25,11 +25,10 @@ export { TelemetryItemCreator, createTelemetryItem } from "./TelemetryItemCreato
25
25
  export { CtxTagKeys, Extensions } from "./Interfaces/PartAExtensions";
26
26
  export { DistributedTracingModes } from "./Enums";
27
27
  export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
28
- export { isBeaconsSupported as isBeaconApiSupported } from "@microsoft/applicationinsights-core-js";
28
+ export { isBeaconsSupported as isBeaconApiSupported, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "@microsoft/applicationinsights-core-js";
29
29
  export { createDomEvent } from "./DomHelperFuncs";
30
30
  export { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from "./StorageHelperFuncs";
31
31
  export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
32
- export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "./W3cTraceParent";
33
32
  export var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
34
33
  export var BreezeChannelIdentifier = "AppInsightsChannelPlugin";
35
34
  export var AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
@@ -1 +1 @@
1
- {"version":3,"file":"applicationinsights-common.js.map","sources":["applicationinsights-common.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the\r\nexport { Util, CorrelationIdHelper, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, UrlHelper, isInternalApplicationInsightsEndpoint } from \"./Util\";\r\nexport { parseConnectionString, ConnectionStringParser } from \"./ConnectionStringParser\";\r\nexport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, strNotSpecified } from \"./Constants\";\r\nexport { Envelope } from \"./Telemetry/Common/Envelope\";\r\nexport { Event } from \"./Telemetry/Event\";\r\nexport { Exception } from \"./Telemetry/Exception\";\r\nexport { Metric } from \"./Telemetry/Metric\";\r\nexport { PageView } from \"./Telemetry/PageView\";\r\nexport { RemoteDependencyData } from \"./Telemetry/RemoteDependencyData\";\r\nexport { Trace } from \"./Telemetry/Trace\";\r\nexport { PageViewPerformance } from \"./Telemetry/PageViewPerformance\";\r\nexport { Data } from \"./Telemetry/Common/Data\";\r\nexport { SeverityLevel } from \"./Interfaces/Contracts/SeverityLevel\";\r\nexport { ConfigurationManager } from \"./Interfaces/IConfig\";\r\nexport { ContextTagKeys } from \"./Interfaces/Contracts/ContextTagKeys\";\r\nexport { DataSanitizer, dataSanitizeKeyAndAddUniqueness, dataSanitizeKey, dataSanitizeString, dataSanitizeUrl, dataSanitizeMessage, dataSanitizeException, dataSanitizeProperties, dataSanitizeMeasurements, dataSanitizeId, dataSanitizeInput, dsPadNumber } from \"./Telemetry/Common/DataSanitizer\";\r\nexport { TelemetryItemCreator, createTelemetryItem } from \"./TelemetryItemCreator\";\r\nexport { CtxTagKeys, Extensions } from \"./Interfaces/PartAExtensions\";\r\nexport { DistributedTracingModes } from \"./Enums\";\r\nexport { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from \"./HelperFuncs\";\r\nexport { isBeaconsSupported as isBeaconApiSupported } from \"@microsoft/applicationinsights-core-js\";\r\nexport { createDomEvent } from \"./DomHelperFuncs\";\r\nexport { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from \"./StorageHelperFuncs\";\r\nexport { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from \"./UrlHelperFuncs\";\r\nexport { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"./W3cTraceParent\";\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map"],"names":[],"mappings":";;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"applicationinsights-common.js.map","sources":["applicationinsights-common.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the\r\nexport { Util, CorrelationIdHelper, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, UrlHelper, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from \"./Util\";\r\nexport { parseConnectionString, ConnectionStringParser } from \"./ConnectionStringParser\";\r\nexport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, strNotSpecified } from \"./Constants\";\r\nexport { Envelope } from \"./Telemetry/Common/Envelope\";\r\nexport { Event } from \"./Telemetry/Event\";\r\nexport { Exception } from \"./Telemetry/Exception\";\r\nexport { Metric } from \"./Telemetry/Metric\";\r\nexport { PageView } from \"./Telemetry/PageView\";\r\nexport { RemoteDependencyData } from \"./Telemetry/RemoteDependencyData\";\r\nexport { Trace } from \"./Telemetry/Trace\";\r\nexport { PageViewPerformance } from \"./Telemetry/PageViewPerformance\";\r\nexport { Data } from \"./Telemetry/Common/Data\";\r\nexport { SeverityLevel } from \"./Interfaces/Contracts/SeverityLevel\";\r\nexport { ConfigurationManager } from \"./Interfaces/IConfig\";\r\nexport { ContextTagKeys } from \"./Interfaces/Contracts/ContextTagKeys\";\r\nexport { DataSanitizer, dataSanitizeKeyAndAddUniqueness, dataSanitizeKey, dataSanitizeString, dataSanitizeUrl, dataSanitizeMessage, dataSanitizeException, dataSanitizeProperties, dataSanitizeMeasurements, dataSanitizeId, dataSanitizeInput, dsPadNumber } from \"./Telemetry/Common/DataSanitizer\";\r\nexport { TelemetryItemCreator, createTelemetryItem } from \"./TelemetryItemCreator\";\r\nexport { CtxTagKeys, Extensions } from \"./Interfaces/PartAExtensions\";\r\nexport { DistributedTracingModes } from \"./Enums\";\r\nexport { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from \"./HelperFuncs\";\r\nexport { isBeaconsSupported as isBeaconApiSupported, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"@microsoft/applicationinsights-core-js\";\r\nexport { createDomEvent } from \"./DomHelperFuncs\";\r\nexport { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from \"./StorageHelperFuncs\";\r\nexport { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from \"./UrlHelperFuncs\";\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map"],"names":[],"mappings":";;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-common",
3
- "version": "2.8.4-nightly.2205-09",
3
+ "version": "2.8.5-nightly.2206-02",
4
4
  "description": "Microsoft Application Insights Common JavaScript Library",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@microsoft/applicationinsights-shims": "2.0.1",
50
- "@microsoft/applicationinsights-core-js": "2.8.4-nightly.2205-09",
50
+ "@microsoft/applicationinsights-core-js": "2.8.5-nightly.2206-02",
51
51
  "@microsoft/dynamicproto-js": "^1.1.6"
52
52
  },
53
53
  "license": "MIT",
@@ -13,10 +13,16 @@ export interface ITelemetryTrace {
13
13
  parentID?: string;
14
14
 
15
15
  /**
16
+ * @deprecated Never Used
16
17
  * Trace state
17
18
  */
18
19
  traceState?: ITraceState;
19
20
 
21
+ /**
22
+ * An integer representation of the W3C TraceContext trace-flags. https://www.w3.org/TR/trace-context/#trace-flags
23
+ */
24
+ traceFlags?: number;
25
+
20
26
  /**
21
27
  * Name
22
28
  */
package/src/Util.ts CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies,
10
10
  canUseCookies as coreCanUseCookies, getCookie as coreGetCookie,
11
11
  setCookie as coreSetCookie, deleteCookie as coreDeleteCookie,
12
- isBeaconsSupported,
13
- arrIndexOf
12
+ isBeaconsSupported, arrIndexOf, IDistributedTraceContext,
13
+ isValidTraceId, isValidSpanId
14
14
  } from "@microsoft/applicationinsights-core-js";
15
15
  import { eRequestHeaders, RequestHeaders } from "./RequestResponseHeaders";
16
16
  import { dataSanitizeString } from "./Telemetry/Common/DataSanitizer";
@@ -20,6 +20,7 @@ import { stringToBoolOrDefault, msToTimeSpan, isCrossOriginError, getExtensionBy
20
20
  import { strNotSpecified } from "./Constants";
21
21
  import { utlCanUseLocalStorage, utlCanUseSessionStorage, utlDisableStorage, utlGetSessionStorage, utlGetSessionStorageKeys, utlGetLocalStorage, utlRemoveSessionStorage, utlRemoveStorage, utlSetSessionStorage, utlSetLocalStorage } from "./StorageHelperFuncs";
22
22
  import { urlGetAbsoluteUrl, urlGetCompleteUrl, urlGetPathName, urlParseFullHost, urlParseHost, urlParseUrl } from "./UrlHelperFuncs";
23
+ import { ITelemetryTrace } from "./Interfaces/Context/ITelemetryTrace";
23
24
 
24
25
  // listing only non-geo specific locations
25
26
  const _internalEndpoints: string[] = [
@@ -489,3 +490,49 @@ export const DateTimeUtils: IDateTimeUtils = {
489
490
  Now: dateTimeUtilsNow,
490
491
  GetDuration: dateTimeUtilsDuration
491
492
  };
493
+
494
+
495
+ /**
496
+ * Creates a IDistributedTraceContext from an optional telemetryTrace
497
+ * @param telemetryTrace - The telemetryTrace instance that is being wrapped
498
+ * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
499
+ * @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
500
+ */
501
+ export function createDistributedTraceContextFromTrace(telemetryTrace?: ITelemetryTrace, parentCtx?: IDistributedTraceContext): IDistributedTraceContext {
502
+ let trace: ITelemetryTrace = telemetryTrace || {};
503
+
504
+ return {
505
+ getName: (): string => {
506
+ return trace.name;
507
+ },
508
+ setName: (newValue: string): void => {
509
+ parentCtx && parentCtx.setName(newValue);
510
+ trace.name = newValue;
511
+ },
512
+ getTraceId: (): string => {
513
+ return trace.traceID;
514
+ },
515
+ setTraceId: (newValue: string): void => {
516
+ parentCtx && parentCtx.setTraceId(newValue);
517
+ if (isValidTraceId(newValue)) {
518
+ trace.traceID = newValue
519
+ }
520
+ },
521
+ getSpanId: (): string => {
522
+ return trace.parentID;
523
+ },
524
+ setSpanId: (newValue: string): void => {
525
+ parentCtx && parentCtx.setSpanId(newValue);
526
+ if (isValidSpanId(newValue)) {
527
+ trace.parentID = newValue
528
+ }
529
+ },
530
+ getTraceFlags: (): number => {
531
+ return trace.traceFlags;
532
+ },
533
+ setTraceFlags: (newTraceFlags?: number): void => {
534
+ parentCtx && parentCtx.setTraceFlags(newTraceFlags);
535
+ trace.traceFlags = newTraceFlags
536
+ }
537
+ };
538
+ }
@@ -3,7 +3,8 @@
3
3
  export {
4
4
  IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper,
5
5
  IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration,
6
- IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint
6
+ IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint,
7
+ createDistributedTraceContextFromTrace
7
8
  } from "./Util";
8
9
  export { parseConnectionString, ConnectionStringParser } from "./ConnectionStringParser";
9
10
  export { FieldType } from "./Enums";
@@ -59,17 +60,16 @@ export { ITelemetryTrace, ITraceState } from "./Interfaces/Context/ITelemetryTra
59
60
  export { IRequestContext } from "./Interfaces/IRequestContext";
60
61
  export { eDistributedTracingModes, DistributedTracingModes } from "./Enums";
61
62
  export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
62
- export { isBeaconsSupported as isBeaconApiSupported } from "@microsoft/applicationinsights-core-js"
63
+ export {
64
+ isBeaconsSupported as isBeaconApiSupported,
65
+ ITraceParent, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent
66
+ } from "@microsoft/applicationinsights-core-js"
63
67
  export { createDomEvent } from "./DomHelperFuncs";
64
68
  export {
65
69
  utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage,
66
70
  utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage
67
71
  } from "./StorageHelperFuncs";
68
72
  export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
69
- export { ITraceParent } from "./Interfaces/ITraceParent";
70
- export {
71
- createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent
72
- } from "./W3cTraceParent";
73
73
 
74
74
  export const PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
75
75
  export const BreezeChannelIdentifier = "AppInsightsChannelPlugin";
@@ -8,9 +8,14 @@ export interface ITelemetryTrace {
8
8
  */
9
9
  parentID?: string;
10
10
  /**
11
+ * @deprecated Never Used
11
12
  * Trace state
12
13
  */
13
14
  traceState?: ITraceState;
15
+ /**
16
+ * An integer representation of the W3C TraceContext trace-flags. https://www.w3.org/TR/trace-context/#trace-flags
17
+ */
18
+ traceFlags?: number;
14
19
  /**
15
20
  * Name
16
21
  */
package/types/Util.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { IDiagnosticLogger, IPlugin } from "@microsoft/applicationinsights-core-js";
1
+ import { IDiagnosticLogger, IPlugin, IDistributedTraceContext } from "@microsoft/applicationinsights-core-js";
2
2
  import { ICorrelationConfig } from "./Interfaces/ICorrelationConfig";
3
+ import { ITelemetryTrace } from "./Interfaces/Context/ITelemetryTrace";
3
4
  export declare function isInternalApplicationInsightsEndpoint(endpointUrl: string): boolean;
4
5
  export interface IUtil {
5
6
  NotSpecified: string;
@@ -219,3 +220,10 @@ export interface IDateTimeUtils {
219
220
  * A utility class that helps getting time related parameters
220
221
  */
221
222
  export declare const DateTimeUtils: IDateTimeUtils;
223
+ /**
224
+ * Creates a IDistributedTraceContext from an optional telemetryTrace
225
+ * @param telemetryTrace - The telemetryTrace instance that is being wrapped
226
+ * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
227
+ * @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
228
+ */
229
+ export declare function createDistributedTraceContextFromTrace(telemetryTrace?: ITelemetryTrace, parentCtx?: IDistributedTraceContext): IDistributedTraceContext;
@@ -1,4 +1,4 @@
1
- export { IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper, IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint } from "./Util";
1
+ export { IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper, IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from "./Util";
2
2
  export { parseConnectionString, ConnectionStringParser } from "./ConnectionStringParser";
3
3
  export { FieldType } from "./Enums";
4
4
  export { IRequestHeaders, RequestHeaders, eRequestHeaders } from "./RequestResponseHeaders";
@@ -48,12 +48,10 @@ export { ITelemetryTrace, ITraceState } from "./Interfaces/Context/ITelemetryTra
48
48
  export { IRequestContext } from "./Interfaces/IRequestContext";
49
49
  export { eDistributedTracingModes, DistributedTracingModes } from "./Enums";
50
50
  export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
51
- export { isBeaconsSupported as isBeaconApiSupported } from "@microsoft/applicationinsights-core-js";
51
+ export { isBeaconsSupported as isBeaconApiSupported, ITraceParent, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "@microsoft/applicationinsights-core-js";
52
52
  export { createDomEvent } from "./DomHelperFuncs";
53
53
  export { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from "./StorageHelperFuncs";
54
54
  export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
55
- export { ITraceParent } from "./Interfaces/ITraceParent";
56
- export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "./W3cTraceParent";
57
55
  export declare const PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
58
56
  export declare const BreezeChannelIdentifier = "AppInsightsChannelPlugin";
59
57
  export declare const AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.24.0"
8
+ "packageVersion": "7.24.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,8 +0,0 @@
1
- /*
2
- * Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-09
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- */
5
-
6
-
7
- export {};
8
- //# sourceMappingURL=ITraceParent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ITraceParent.js.map","sources":["ITraceParent.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=ITraceParent.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}