@microsoft/applicationinsights-core-js 3.4.0-nightlybeta3.2602-27 → 3.4.1

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 (258) hide show
  1. package/browser/es5/applicationinsights-core-js.cjs.js +997 -114
  2. package/browser/es5/applicationinsights-core-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-core-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-core-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-core-js.gbl.js +999 -116
  6. package/browser/es5/applicationinsights-core-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-core-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-core-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-core-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-core-js.js +999 -116
  11. package/browser/es5/applicationinsights-core-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-core-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-core-js.min.js.map +1 -1
  14. package/dist/es5/index.js +997 -114
  15. package/dist/es5/index.js.map +1 -1
  16. package/dist/es5/index.min.js +2 -2
  17. package/dist/es5/index.min.js.map +1 -1
  18. package/dist-es5/__DynamicConstants.js +44 -27
  19. package/dist-es5/__DynamicConstants.js.map +1 -1
  20. package/dist-es5/config/ConfigDefaultHelpers.js +1 -1
  21. package/dist-es5/config/ConfigDefaults.js +1 -1
  22. package/dist-es5/config/DynamicConfig.js +1 -1
  23. package/dist-es5/config/DynamicProperty.js +1 -1
  24. package/dist-es5/config/DynamicState.js +1 -1
  25. package/dist-es5/config/DynamicSupport.js +1 -1
  26. package/dist-es5/constants/Constants.js +1 -1
  27. package/dist-es5/constants/InternalConstants.js +4 -1
  28. package/dist-es5/constants/InternalConstants.js.map +1 -1
  29. package/dist-es5/core/AggregationError.js +1 -1
  30. package/dist-es5/core/AppInsightsCore.js +13 -13
  31. package/dist-es5/core/AppInsightsCore.js.map +1 -1
  32. package/dist-es5/core/AsyncUtils.js +1 -1
  33. package/dist-es5/core/BaseTelemetryPlugin.js +1 -1
  34. package/dist-es5/core/CookieMgr.js +1 -1
  35. package/dist-es5/core/DbgExtensionUtils.js +1 -1
  36. package/dist-es5/core/InstrumentHooks.js +1 -1
  37. package/dist-es5/core/NotificationManager.js +1 -1
  38. package/dist-es5/core/PerfManager.js +1 -1
  39. package/dist-es5/core/ProcessTelemetryContext.js +3 -3
  40. package/dist-es5/core/ProcessTelemetryContext.js.map +1 -1
  41. package/dist-es5/core/ResponseHelpers.js +1 -1
  42. package/dist-es5/core/SenderPostManager.js +1 -1
  43. package/dist-es5/core/StatsBeat.js +9 -9
  44. package/dist-es5/core/StatsBeat.js.map +1 -1
  45. package/dist-es5/core/TelemetryHelpers.js +3 -3
  46. package/dist-es5/core/TelemetryHelpers.js.map +1 -1
  47. package/dist-es5/core/TelemetryInitializerPlugin.js +1 -1
  48. package/dist-es5/core/UnloadHandlerContainer.js +1 -1
  49. package/dist-es5/core/UnloadHookContainer.js +3 -3
  50. package/dist-es5/core/UnloadHookContainer.js.map +1 -1
  51. package/dist-es5/diagnostics/DiagnosticLogger.js +3 -3
  52. package/dist-es5/diagnostics/DiagnosticLogger.js.map +1 -1
  53. package/dist-es5/diagnostics/ThrottleMgr.js +1 -1
  54. package/dist-es5/enums/EnumHelperFuncs.js +1 -1
  55. package/dist-es5/enums/W3CTraceFlags.js +1 -1
  56. package/dist-es5/enums/ai/DependencyTypes.js +1 -1
  57. package/dist-es5/enums/ai/Enums.js +1 -1
  58. package/dist-es5/enums/ai/EventsDiscardedReason.js +1 -1
  59. package/dist-es5/enums/ai/FeatureOptInEnums.js +1 -1
  60. package/dist-es5/enums/ai/InitActiveStatusEnum.js +1 -1
  61. package/dist-es5/enums/ai/LoggingEnums.js +1 -1
  62. package/dist-es5/enums/ai/SendRequestReason.js +1 -1
  63. package/dist-es5/enums/ai/StatsType.js +1 -1
  64. package/dist-es5/enums/ai/TelemetryUnloadReason.js +1 -1
  65. package/dist-es5/enums/ai/TelemetryUpdateReason.js +1 -1
  66. package/dist-es5/enums/ai/TraceHeadersMode.js +1 -1
  67. package/dist-es5/enums/ai/UrlRedactionOptions.js +36 -0
  68. package/dist-es5/enums/ai/UrlRedactionOptions.js.map +1 -0
  69. package/dist-es5/enums/ext/Enums.js +78 -0
  70. package/dist-es5/enums/ext/Enums.js.map +1 -0
  71. package/dist-es5/enums/otel/OTelSamplingDecision.js +1 -1
  72. package/dist-es5/enums/otel/OTelSpanKind.js +1 -1
  73. package/dist-es5/enums/otel/OTelSpanStatus.js +1 -1
  74. package/dist-es5/enums/otel/eAttributeChangeOp.js +1 -1
  75. package/dist-es5/ext/AppInsightsExtCore.js +98 -0
  76. package/dist-es5/ext/AppInsightsExtCore.js.map +1 -0
  77. package/dist-es5/ext/ValueSanitizer.js +260 -0
  78. package/dist-es5/ext/ValueSanitizer.js.map +1 -0
  79. package/dist-es5/ext/extSpanUtils.js +312 -0
  80. package/dist-es5/ext/extSpanUtils.js.map +1 -0
  81. package/dist-es5/ext/extUtils.js +412 -0
  82. package/dist-es5/ext/extUtils.js.map +1 -0
  83. package/dist-es5/index.js +14 -1
  84. package/dist-es5/index.js.map +1 -1
  85. package/dist-es5/interfaces/IException.js +1 -1
  86. package/dist-es5/interfaces/IOTelHrTime.js +1 -1
  87. package/dist-es5/interfaces/ai/ConnectionString.js +1 -1
  88. package/dist-es5/interfaces/ai/IAppInsights.js +1 -1
  89. package/dist-es5/interfaces/ai/IAppInsightsCore.js +1 -1
  90. package/dist-es5/interfaces/ai/IChannelControls.js +1 -1
  91. package/dist-es5/interfaces/ai/IChannelControlsHost.js +1 -1
  92. package/dist-es5/interfaces/ai/IConfig.js +1 -1
  93. package/dist-es5/interfaces/ai/IConfiguration.js +1 -1
  94. package/dist-es5/interfaces/ai/ICookieMgr.js +1 -1
  95. package/dist-es5/interfaces/ai/ICorrelationConfig.js +1 -1
  96. package/dist-es5/interfaces/ai/IDbgExtension.js +1 -1
  97. package/dist-es5/interfaces/ai/IDependencyTelemetry.js +1 -1
  98. package/dist-es5/interfaces/ai/IDiagnosticLogger.js +1 -1
  99. package/dist-es5/interfaces/ai/IDistributedTraceContext.js +1 -1
  100. package/dist-es5/interfaces/ai/IEventTelemetry.js +1 -1
  101. package/dist-es5/interfaces/ai/IExceptionConfig.js +1 -1
  102. package/dist-es5/interfaces/ai/IExceptionTelemetry.js +1 -1
  103. package/dist-es5/interfaces/ai/IFeatureOptIn.js +1 -1
  104. package/dist-es5/interfaces/ai/IInstrumentHooks.js +1 -1
  105. package/dist-es5/interfaces/ai/IMetricTelemetry.js +1 -1
  106. package/dist-es5/interfaces/ai/INetworkStatsbeat.js +1 -1
  107. package/dist-es5/interfaces/ai/INotificationListener.js +1 -1
  108. package/dist-es5/interfaces/ai/INotificationManager.js +1 -1
  109. package/dist-es5/interfaces/ai/IPageViewPerformanceTelemetry.js +1 -1
  110. package/dist-es5/interfaces/ai/IPageViewTelemetry.js +1 -1
  111. package/dist-es5/interfaces/ai/IPartC.js +1 -1
  112. package/dist-es5/interfaces/ai/IPerfEvent.js +1 -1
  113. package/dist-es5/interfaces/ai/IPerfManager.js +1 -1
  114. package/dist-es5/interfaces/ai/IProcessTelemetryContext.js +1 -1
  115. package/dist-es5/interfaces/ai/IPropertiesPlugin.js +1 -1
  116. package/dist-es5/interfaces/ai/IRequestContext.js +1 -1
  117. package/dist-es5/interfaces/ai/IRequestTelemetry.js +1 -1
  118. package/dist-es5/interfaces/ai/ISenderPostManager.js +1 -1
  119. package/dist-es5/interfaces/ai/IStatsBeat.js +1 -1
  120. package/dist-es5/interfaces/ai/IStatsEventData.js +1 -1
  121. package/dist-es5/interfaces/ai/IStatsMgr.js +1 -1
  122. package/dist-es5/interfaces/ai/IStorageBuffer.js +1 -1
  123. package/dist-es5/interfaces/ai/ITelemetryContext.js +1 -1
  124. package/dist-es5/interfaces/ai/ITelemetryInitializers.js +1 -1
  125. package/dist-es5/interfaces/ai/ITelemetryItem.js +1 -1
  126. package/dist-es5/interfaces/ai/ITelemetryPlugin.js +1 -1
  127. package/dist-es5/interfaces/ai/ITelemetryPluginChain.js +1 -1
  128. package/dist-es5/interfaces/ai/ITelemetryUnloadState.js +1 -1
  129. package/dist-es5/interfaces/ai/ITelemetryUpdateState.js +1 -1
  130. package/dist-es5/interfaces/ai/IThrottleMgr.js +1 -1
  131. package/dist-es5/interfaces/ai/ITraceParent.js +1 -1
  132. package/dist-es5/interfaces/ai/ITraceProvider.js +1 -1
  133. package/dist-es5/interfaces/ai/ITraceTelemetry.js +1 -1
  134. package/dist-es5/interfaces/ai/IUnloadHook.js +1 -1
  135. package/dist-es5/interfaces/ai/IUnloadableComponent.js +1 -1
  136. package/dist-es5/interfaces/ai/IW3cTraceState.js +1 -1
  137. package/dist-es5/interfaces/ai/IXDomainRequest.js +1 -1
  138. package/dist-es5/interfaces/ai/IXHROverride.js +1 -1
  139. package/dist-es5/interfaces/ai/PartAExtensions.js +1 -1
  140. package/dist-es5/interfaces/ai/context/IApplication.js +1 -1
  141. package/dist-es5/interfaces/ai/context/IDevice.js +1 -1
  142. package/dist-es5/interfaces/ai/context/IInternal.js +1 -1
  143. package/dist-es5/interfaces/ai/context/ILocation.js +1 -1
  144. package/dist-es5/interfaces/ai/context/IOperatingSystem.js +1 -1
  145. package/dist-es5/interfaces/ai/context/ISample.js +1 -1
  146. package/dist-es5/interfaces/ai/context/ISession.js +1 -1
  147. package/dist-es5/interfaces/ai/context/ISessionManager.js +1 -1
  148. package/dist-es5/interfaces/ai/context/ITelemetryTrace.js +1 -1
  149. package/dist-es5/interfaces/ai/context/IUser.js +1 -1
  150. package/dist-es5/interfaces/ai/context/IWeb.js +1 -1
  151. package/dist-es5/interfaces/ai/contracts/AvailabilityData.js +1 -1
  152. package/dist-es5/interfaces/ai/contracts/ContextTagKeys.js +1 -1
  153. package/dist-es5/interfaces/ai/contracts/DataPointType.js +1 -1
  154. package/dist-es5/interfaces/ai/contracts/DependencyKind.js +1 -1
  155. package/dist-es5/interfaces/ai/contracts/DependencySourceType.js +1 -1
  156. package/dist-es5/interfaces/ai/contracts/IBase.js +1 -1
  157. package/dist-es5/interfaces/ai/contracts/IData.js +1 -1
  158. package/dist-es5/interfaces/ai/contracts/IDataPoint.js +1 -1
  159. package/dist-es5/interfaces/ai/contracts/IDomain.js +1 -1
  160. package/dist-es5/interfaces/ai/contracts/IEventData.js +1 -1
  161. package/dist-es5/interfaces/ai/contracts/IExceptionData.js +1 -1
  162. package/dist-es5/interfaces/ai/contracts/IExceptionDetails.js +1 -1
  163. package/dist-es5/interfaces/ai/contracts/IMessageData.js +1 -1
  164. package/dist-es5/interfaces/ai/contracts/IMetricData.js +1 -1
  165. package/dist-es5/interfaces/ai/contracts/IPageViewData.js +1 -1
  166. package/dist-es5/interfaces/ai/contracts/IPageViewPerfData.js +1 -1
  167. package/dist-es5/interfaces/ai/contracts/IRemoteDependencyData.js +1 -1
  168. package/dist-es5/interfaces/ai/contracts/IStackFrame.js +1 -1
  169. package/dist-es5/interfaces/ai/contracts/SeverityLevel.js +1 -1
  170. package/dist-es5/interfaces/ai/telemetry/IEnvelope.js +1 -1
  171. package/dist-es5/interfaces/ai/telemetry/ISerializable.js +1 -1
  172. package/dist-es5/interfaces/config/IConfigDefaults.js +1 -1
  173. package/dist-es5/interfaces/config/IDynamicConfigHandler.js +1 -1
  174. package/dist-es5/interfaces/config/IDynamicPropertyHandler.js +1 -1
  175. package/dist-es5/interfaces/config/IDynamicWatcher.js +1 -1
  176. package/dist-es5/interfaces/config/_IDynamicConfigHandlerState.js +1 -1
  177. package/dist-es5/interfaces/ext/DataModels.js +6 -0
  178. package/dist-es5/interfaces/ext/DataModels.js.map +1 -0
  179. package/dist-es5/interfaces/otel/IOTelApi.js +1 -1
  180. package/dist-es5/interfaces/otel/IOTelApiCtx.js +1 -1
  181. package/dist-es5/interfaces/otel/IOTelAttributes.js +1 -1
  182. package/dist-es5/interfaces/otel/attribute/IAttributeContainer.js +1 -1
  183. package/dist-es5/interfaces/otel/config/IOTelAttributeLimits.js +1 -1
  184. package/dist-es5/interfaces/otel/config/IOTelConfig.js +1 -1
  185. package/dist-es5/interfaces/otel/config/IOTelErrorHandlers.js +1 -1
  186. package/dist-es5/interfaces/otel/config/IOTelSpanLimits.js +1 -1
  187. package/dist-es5/interfaces/otel/config/IOTelTraceCfg.js +1 -1
  188. package/dist-es5/interfaces/otel/trace/IOTelSpan.js +1 -1
  189. package/dist-es5/interfaces/otel/trace/IOTelSpanContext.js +1 -1
  190. package/dist-es5/interfaces/otel/trace/IOTelSpanCtx.js +1 -1
  191. package/dist-es5/interfaces/otel/trace/IOTelSpanOptions.js +1 -1
  192. package/dist-es5/interfaces/otel/trace/IOTelSpanStatus.js +1 -1
  193. package/dist-es5/interfaces/otel/trace/IOTelTraceApi.js +1 -1
  194. package/dist-es5/interfaces/otel/trace/IOTelTraceState.js +1 -1
  195. package/dist-es5/interfaces/otel/trace/IOTelTracer.js +1 -1
  196. package/dist-es5/interfaces/otel/trace/IOTelTracerOptions.js +1 -1
  197. package/dist-es5/interfaces/otel/trace/IOTelTracerProvider.js +1 -1
  198. package/dist-es5/interfaces/otel/trace/IReadableSpan.js +1 -1
  199. package/dist-es5/internal/EventHelpers.js +5 -5
  200. package/dist-es5/internal/EventHelpers.js.map +1 -1
  201. package/dist-es5/internal/attributeHelpers.js +1 -1
  202. package/dist-es5/internal/commonUtils.js +1 -1
  203. package/dist-es5/internal/handleErrors.js +1 -1
  204. package/dist-es5/internal/noopHelpers.js +1 -1
  205. package/dist-es5/internal/timeHelpers.js +1 -1
  206. package/dist-es5/otel/api/OTelApi.js +1 -1
  207. package/dist-es5/otel/api/errors/OTelError.js +1 -1
  208. package/dist-es5/otel/api/errors/OTelInvalidAttributeError.js +1 -1
  209. package/dist-es5/otel/api/errors/OTelSpanError.js +1 -1
  210. package/dist-es5/otel/api/trace/span.js +4 -4
  211. package/dist-es5/otel/api/trace/span.js.map +1 -1
  212. package/dist-es5/otel/api/trace/spanContext.js +1 -1
  213. package/dist-es5/otel/api/trace/traceApi.js +1 -1
  214. package/dist-es5/otel/api/trace/traceProvider.js +3 -3
  215. package/dist-es5/otel/api/trace/traceProvider.js.map +1 -1
  216. package/dist-es5/otel/api/trace/traceState.js +1 -1
  217. package/dist-es5/otel/api/trace/tracer.js +1 -1
  218. package/dist-es5/otel/api/trace/tracerProvider.js +1 -1
  219. package/dist-es5/otel/api/trace/utils.js +1 -1
  220. package/dist-es5/otel/attribute/SemanticConventions.js +1 -1
  221. package/dist-es5/otel/attribute/attributeContainer.js +1 -1
  222. package/dist-es5/telemetry/ConnectionStringParser.js +1 -1
  223. package/dist-es5/telemetry/RequestResponseHeaders.js +1 -1
  224. package/dist-es5/telemetry/TelemetryItemCreator.js +1 -1
  225. package/dist-es5/telemetry/W3cTraceState.js +1 -1
  226. package/dist-es5/telemetry/ai/Common/Data.js +3 -2
  227. package/dist-es5/telemetry/ai/Common/Data.js.map +1 -1
  228. package/dist-es5/telemetry/ai/Common/DataPoint.js +1 -1
  229. package/dist-es5/telemetry/ai/Common/DataSanitizer.js +1 -1
  230. package/dist-es5/telemetry/ai/Common/Envelope.js +1 -1
  231. package/dist-es5/telemetry/ai/DataTypes.js +1 -1
  232. package/dist-es5/telemetry/ai/EnvelopeTypes.js +1 -1
  233. package/dist-es5/telemetry/ai/Event.js +1 -1
  234. package/dist-es5/telemetry/ai/Exception.js +1 -1
  235. package/dist-es5/telemetry/ai/Metric.js +1 -1
  236. package/dist-es5/telemetry/ai/PageView.js +1 -1
  237. package/dist-es5/telemetry/ai/PageViewPerformance.js +1 -1
  238. package/dist-es5/telemetry/ai/RemoteDependencyData.js +1 -1
  239. package/dist-es5/telemetry/ai/Trace.js +1 -1
  240. package/dist-es5/utils/CoreUtils.js +1 -1
  241. package/dist-es5/utils/DataCacheHelper.js +2 -2
  242. package/dist-es5/utils/DataCacheHelper.js.map +1 -1
  243. package/dist-es5/utils/DomHelperFuncs.js +1 -1
  244. package/dist-es5/utils/EnvUtils.js +16 -5
  245. package/dist-es5/utils/EnvUtils.js.map +1 -1
  246. package/dist-es5/utils/HelperFuncs.js +4 -4
  247. package/dist-es5/utils/HelperFuncs.js.map +1 -1
  248. package/dist-es5/utils/Offline.js +1 -1
  249. package/dist-es5/utils/RandomHelper.js +1 -1
  250. package/dist-es5/utils/StorageHelperFuncs.js +1 -1
  251. package/dist-es5/utils/TraceParent.js +5 -5
  252. package/dist-es5/utils/TraceParent.js.map +1 -1
  253. package/dist-es5/utils/UrlHelperFuncs.js +1 -1
  254. package/dist-es5/utils/Util.js +4 -4
  255. package/dist-es5/utils/Util.js.map +1 -1
  256. package/package.json +75 -78
  257. package/types/applicationinsights-core-js.d.ts +830 -11
  258. package/types/applicationinsights-core-js.namespaced.d.ts +829 -10
@@ -1 +1 @@
1
- {"version":3,"file":"HelperFuncs.js.map","sources":["HelperFuncs.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjProto } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, asString as asString21, createCachedValue, getKnownSymbol, isArray, isBoolean, isError, isFunction, isNullOrUndefined, isNumber, isObject, isPlainObject, isString, isUndefined, mathFloor, mathRound, newSymbol, objCreate, objDeepFreeze, objDefine, objForEachKey, objGetPrototypeOf, objHasOwn, objSetPrototypeOf, safe, strIndexOf, strSplit, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_CONCAT, _DYN_GET_ALL_RESPONSE_HEA6, _DYN_IDENTIFIER, _DYN_LENGTH, _DYN_NAME, _DYN_REPLACE, _DYN_SPLIT, _DYN_STATUS, _DYN_SUBSTRING, _DYN_TO_LOWER_CASE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"../constants/InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minification\r\nvar strGetPrototypeOf = \"getPrototypeOf\";\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\nvar _ProtoNameTag;\r\nexport var _getObjProto = Object[strGetPrototypeOf];\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name - The name to validate\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return strIndexOf(value, search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function toISOString(date) {\r\n return date && date.toISOString() || STR_EMPTY;\r\n}\r\nexport var deepFreeze = objDeepFreeze;\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 =\\> will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -\\> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (objHasOwn(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n objDefine(target, field, {\r\n g: function () {\r\n return source[field];\r\n },\r\n s: function (theValue) {\r\n source[field] = theValue;\r\n }\r\n });\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults - Simple helper\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * Set the type of the object by defining the toStringTag well known symbol, this will impact the\r\n * Object.prototype.toString.call() results for the object. And can be used to identify the type\r\n * in the debug output and also in the DevTools watchers window when inspecting the object etc.\r\n * @param target - The object to set the toStringTag symbol on\r\n * @param nameOrFunc - The name or function to use for the toStringTag\r\n * @returns The target object\r\n */\r\nexport function setObjStringTag(target, nameOrFunc) {\r\n safe(objDefine, [target, getKnownSymbol(11 /* WellKnownSymbols.toStringTag */), isFunction(nameOrFunc) ? { g: nameOrFunc, e: false } : { v: nameOrFunc, w: false, e: false }]);\r\n return target;\r\n}\r\n/**\r\n * Introduce an intermediate prototype to the target object and that sets the toStringTag on that prototype,\r\n * this avoids directly modifying the target object and also allows multiple different \"types\" to be\r\n * applied to the same target object if required.\r\n * This is done as a best effort approach and may not always succeed due to security / object model restrictions\r\n * So if it fails then it will fallback to just defining the toStringTag on the target object, which also may fail\r\n * resulting in no change.\r\n * @param target - The object to set the toStringTag symbol on\r\n * @param name - The name or function to use for the toStringTag\r\n * @returns The target object\r\n */\r\nexport function setProtoTypeName(target, name) {\r\n if (target) {\r\n var proto_1 = _getObjProto(target);\r\n var done_1 = false;\r\n if (proto_1) {\r\n // Set the target's prototype to the new intermediate prototype\r\n safe(function () {\r\n // Create a new intermediate prototype that extends the current prototype\r\n var newProto = setObjStringTag(objCreate(proto_1), name);\r\n if (!_ProtoNameTag) {\r\n // Note: Using a cached value instead of a lazy value as we want to ensure that the namespace is consistent\r\n // across multiple calls as the `getLazy()` supports runtime invalidation via `setBypassLazyCache()` which would\r\n // result in different namespaces being returned.\r\n _ProtoNameTag = createCachedValue(newSymbol(\"ai$ProtoName\"));\r\n }\r\n // Tag this new prototype\r\n objDefine(newProto, _ProtoNameTag.v, {\r\n v: true,\r\n w: false,\r\n e: false\r\n });\r\n objSetPrototypeOf(target, newProto);\r\n done_1 = true;\r\n });\r\n }\r\n if (!done_1) {\r\n // Either no prototype or we failed to set it so just define the toStringTag on the target\r\n safe(setObjStringTag, [target, name]);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Update the introduced intermediate prototype name of the target object.\r\n * @param target - The object to look for the prototype name and update\r\n * @param name - The updated name to apply\r\n * @returns The target Object\r\n */\r\nexport function updateProtoTypeName(target, name) {\r\n if (_ProtoNameTag) {\r\n // Find the Parent Proto\r\n while (target && target !== ObjProto && !target[_ProtoNameTag.v]) {\r\n var protoTarget = objGetPrototypeOf(target);\r\n if (target === protoTarget) {\r\n // Break out of any recursive case (happens on some runtimes) where the prototype of an\r\n // object is the same prototype\r\n break;\r\n }\r\n target = protoTarget;\r\n }\r\n if (target[_ProtoNameTag.v]) {\r\n // Found it so update\r\n safe(setObjStringTag, [target, name]);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && objHasOwn(arg, prop));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\nexport var asString = asString21;\r\n/**\r\n * Checks if the feature is enabled on not. If the feature is not defined, it will return the default state if provided or undefined.\r\n * If the feature is defined, it will check the mode and return true if the mode is enable or false if the mode is disable.\r\n * @param feature - The feature name to check\r\n * @param cfg - The configuration object to check the feature state against\r\n * @param sdkDefaultState - Optional default state to return if the feature is not defined\r\n * @returns True if the feature is enabled, false if the feature is disabled, or undefined if the feature is not defined and no default state is provided.\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isFeatureEnabled(feature, cfg, sdkDefaultState) {\r\n var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature];\r\n if (feature && ft) {\r\n var mode = ft.mode;\r\n // NOTE: None will be considered as true\r\n if (mode === 3 /* FeatureOptInMode.enable */) {\r\n return true;\r\n }\r\n else if (mode === 2 /* FeatureOptInMode.disable */) {\r\n return false;\r\n }\r\n }\r\n // Return the default state if provided or undefined\r\n return sdkDefaultState;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return null;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + getResponseText(xdr) || STR_EMPTY;\r\n }\r\n return message;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr[_DYN_STATUS /* @min:%2estatus */] + \",Response:\" + getResponseText(xhr) || xhr.response || STR_EMPTY;\r\n }\r\n return message;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports][_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports[_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n* Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n* @internal\r\n*/\r\n// tslint:disable-next-line: align\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString)[_DYN_SPLIT /* @min:%2esplit */](/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = strIndexOf(headerEntry, \": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n var value = strTrim(headerEntry[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n}\r\n/**\r\n* append the XHR headers.\r\n* @internal\r\n*/\r\nexport function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr.getResponseHeader) {\r\n var value = xhr.getResponseHeader(name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n}\r\nvar STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nvar STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nvar STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\n/**\r\n* get the XHR getAllResponseHeaders.\r\n* @internal\r\n*/\r\nexport function _getAllResponseHeaders(xhr, isOneDs) {\r\n var theHeaders = {};\r\n if (!xhr[_DYN_GET_ALL_RESPONSE_HEA6 /* @min:%2egetAllResponseHeaders */]) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n if (!!isOneDs) {\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);\r\n }\r\n }\r\n else {\r\n theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA6 /* @min:%2egetAllResponseHeaders */]());\r\n }\r\n return theHeaders;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function stringToBoolOrDefault(str, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n if (str === undefined || str === null) {\r\n return defaultValue;\r\n }\r\n return str.toString()[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"true\";\r\n}\r\n/**\r\n * Convert ms to c# time span format\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function msToTimeSpan(totalms) {\r\n if (isTimeSpan(totalms)) {\r\n // Already in time span format\r\n return totalms;\r\n }\r\n if (isNaN(totalms) || totalms < 0) {\r\n totalms = 0;\r\n }\r\n totalms = mathRound(totalms);\r\n var ms = STR_EMPTY + totalms % 1000;\r\n var sec = STR_EMPTY + mathFloor(totalms / 1000) % 60;\r\n var min = STR_EMPTY + mathFloor(totalms / (1000 * 60)) % 60;\r\n var hour = STR_EMPTY + mathFloor(totalms / (1000 * 60 * 60)) % 24;\r\n var days = mathFloor(totalms / (1000 * 60 * 60 * 24));\r\n ms = ms[_DYN_LENGTH /* @min:%2elength */] === 1 ? \"00\" + ms : ms[_DYN_LENGTH /* @min:%2elength */] === 2 ? \"0\" + ms : ms;\r\n sec = sec[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + sec : sec;\r\n min = min[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + min : min;\r\n hour = hour[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + hour : hour;\r\n return (days > 0 ? days + \".\" : STR_EMPTY) + hour + \":\" + min + \":\" + sec + \".\" + ms;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getExtensionByName(extensions, identifier) {\r\n var extension = null;\r\n arrForEach(extensions, function (value) {\r\n if (value[_DYN_IDENTIFIER /* @min:%2eidentifier */] === identifier) {\r\n extension = value;\r\n return -1;\r\n }\r\n });\r\n return extension;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isCrossOriginError(message, url, lineNumber, columnNumber, error) {\r\n return !error && isString(message) && (message === \"Script error.\" || message === \"Script error\");\r\n}\r\n/**\r\n * A helper method to determine whether the provided value is in a ISO time span format (DD.HH:MM:SS.MMMMMM)\r\n * @param value - The value to check\r\n * @returns True if the value is in a time span format; false otherwise\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isTimeSpan(value) {\r\n var result = false;\r\n if (isString(value)) {\r\n var parts = strSplit(value, \":\");\r\n if (parts[_DYN_LENGTH /* @min:%2elength */] === 3) {\r\n // Looks like a candidate, now validate each part\r\n var daysHours = strSplit(parts[0], \".\");\r\n if (daysHours[_DYN_LENGTH /* @min:%2elength */] === 2) {\r\n result = !isNaN(parseInt(daysHours[0] || \"0\")) && !isNaN(parseInt(daysHours[1] || \"0\"));\r\n }\r\n else {\r\n result = !isNaN(parseInt(daysHours[0] || \"0\"));\r\n }\r\n result = result && !isNaN(parseInt(parts[1] || \"0\"));\r\n var secondsParts = strSplit(parts[2], \".\");\r\n if (secondsParts[_DYN_LENGTH /* @min:%2elength */] === 2) {\r\n result = result && !isNaN(parseInt(secondsParts[0] || \"0\")) && !isNaN(parseInt(secondsParts[1] || \"0\"));\r\n }\r\n else {\r\n result = result && !isNaN(parseInt(secondsParts[0] || \"0\"));\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=HelperFuncs.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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":"HelperFuncs.js.map","sources":["HelperFuncs.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjProto } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, asString as asString21, createCachedValue, getKnownSymbol, isArray, isBoolean, isError, isFunction, isNullOrUndefined, isNumber, isObject, isPlainObject, isString, isUndefined, mathFloor, mathRound, newSymbol, objCreate, objDeepFreeze, objDefine, objForEachKey, objGetPrototypeOf, objHasOwn, objSetPrototypeOf, safe, strIndexOf, strSplit, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_CONCAT, _DYN_GET_ALL_RESPONSE_HEA7, _DYN_IDENTIFIER, _DYN_LENGTH, _DYN_NAME, _DYN_REPLACE, _DYN_SPLIT, _DYN_STATUS, _DYN_SUBSTRING, _DYN_TO_LOWER_CASE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"../constants/InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minification\r\nvar strGetPrototypeOf = \"getPrototypeOf\";\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\nvar _ProtoNameTag;\r\nexport var _getObjProto = Object[strGetPrototypeOf];\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name - The name to validate\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return strIndexOf(value, search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function toISOString(date) {\r\n return date && date.toISOString() || STR_EMPTY;\r\n}\r\nexport var deepFreeze = objDeepFreeze;\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 =\\> will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -\\> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (objHasOwn(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n objDefine(target, field, {\r\n g: function () {\r\n return source[field];\r\n },\r\n s: function (theValue) {\r\n source[field] = theValue;\r\n }\r\n });\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults - Simple helper\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * Set the type of the object by defining the toStringTag well known symbol, this will impact the\r\n * Object.prototype.toString.call() results for the object. And can be used to identify the type\r\n * in the debug output and also in the DevTools watchers window when inspecting the object etc.\r\n * @param target - The object to set the toStringTag symbol on\r\n * @param nameOrFunc - The name or function to use for the toStringTag\r\n * @returns The target object\r\n */\r\nexport function setObjStringTag(target, nameOrFunc) {\r\n safe(objDefine, [target, getKnownSymbol(11 /* WellKnownSymbols.toStringTag */), isFunction(nameOrFunc) ? { g: nameOrFunc, e: false } : { v: nameOrFunc, w: false, e: false }]);\r\n return target;\r\n}\r\n/**\r\n * Introduce an intermediate prototype to the target object and that sets the toStringTag on that prototype,\r\n * this avoids directly modifying the target object and also allows multiple different \"types\" to be\r\n * applied to the same target object if required.\r\n * This is done as a best effort approach and may not always succeed due to security / object model restrictions\r\n * So if it fails then it will fallback to just defining the toStringTag on the target object, which also may fail\r\n * resulting in no change.\r\n * @param target - The object to set the toStringTag symbol on\r\n * @param name - The name or function to use for the toStringTag\r\n * @returns The target object\r\n */\r\nexport function setProtoTypeName(target, name) {\r\n if (target) {\r\n var proto_1 = _getObjProto(target);\r\n var done_1 = false;\r\n if (proto_1) {\r\n // Set the target's prototype to the new intermediate prototype\r\n safe(function () {\r\n // Create a new intermediate prototype that extends the current prototype\r\n var newProto = setObjStringTag(objCreate(proto_1), name);\r\n if (!_ProtoNameTag) {\r\n // Note: Using a cached value instead of a lazy value as we want to ensure that the namespace is consistent\r\n // across multiple calls as the `getLazy()` supports runtime invalidation via `setBypassLazyCache()` which would\r\n // result in different namespaces being returned.\r\n _ProtoNameTag = createCachedValue(newSymbol(\"ai$ProtoName\"));\r\n }\r\n // Tag this new prototype\r\n objDefine(newProto, _ProtoNameTag.v, {\r\n v: true,\r\n w: false,\r\n e: false\r\n });\r\n objSetPrototypeOf(target, newProto);\r\n done_1 = true;\r\n });\r\n }\r\n if (!done_1) {\r\n // Either no prototype or we failed to set it so just define the toStringTag on the target\r\n safe(setObjStringTag, [target, name]);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Update the introduced intermediate prototype name of the target object.\r\n * @param target - The object to look for the prototype name and update\r\n * @param name - The updated name to apply\r\n * @returns The target Object\r\n */\r\nexport function updateProtoTypeName(target, name) {\r\n if (_ProtoNameTag) {\r\n // Find the Parent Proto\r\n while (target && target !== ObjProto && !target[_ProtoNameTag.v]) {\r\n var protoTarget = objGetPrototypeOf(target);\r\n if (target === protoTarget) {\r\n // Break out of any recursive case (happens on some runtimes) where the prototype of an\r\n // object is the same prototype\r\n break;\r\n }\r\n target = protoTarget;\r\n }\r\n if (target[_ProtoNameTag.v]) {\r\n // Found it so update\r\n safe(setObjStringTag, [target, name]);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && objHasOwn(arg, prop));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\nexport var asString = asString21;\r\n/**\r\n * Checks if the feature is enabled on not. If the feature is not defined, it will return the default state if provided or undefined.\r\n * If the feature is defined, it will check the mode and return true if the mode is enable or false if the mode is disable.\r\n * @param feature - The feature name to check\r\n * @param cfg - The configuration object to check the feature state against\r\n * @param sdkDefaultState - Optional default state to return if the feature is not defined\r\n * @returns True if the feature is enabled, false if the feature is disabled, or undefined if the feature is not defined and no default state is provided.\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isFeatureEnabled(feature, cfg, sdkDefaultState) {\r\n var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature];\r\n if (feature && ft) {\r\n var mode = ft.mode;\r\n // NOTE: None will be considered as true\r\n if (mode === 3 /* FeatureOptInMode.enable */) {\r\n return true;\r\n }\r\n else if (mode === 2 /* FeatureOptInMode.disable */) {\r\n return false;\r\n }\r\n }\r\n // Return the default state if provided or undefined\r\n return sdkDefaultState;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return null;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + getResponseText(xdr) || STR_EMPTY;\r\n }\r\n return message;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr[_DYN_STATUS /* @min:%2estatus */] + \",Response:\" + getResponseText(xhr) || xhr.response || STR_EMPTY;\r\n }\r\n return message;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports][_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports[_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n* Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n* @internal\r\n*/\r\n// tslint:disable-next-line: align\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString)[_DYN_SPLIT /* @min:%2esplit */](/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = strIndexOf(headerEntry, \": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n var value = strTrim(headerEntry[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n}\r\n/**\r\n* append the XHR headers.\r\n* @internal\r\n*/\r\nexport function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr.getResponseHeader) {\r\n var value = xhr.getResponseHeader(name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n}\r\nvar STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nvar STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nvar STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\n/**\r\n* get the XHR getAllResponseHeaders.\r\n* @internal\r\n*/\r\nexport function _getAllResponseHeaders(xhr, isOneDs) {\r\n var theHeaders = {};\r\n if (!xhr[_DYN_GET_ALL_RESPONSE_HEA7 /* @min:%2egetAllResponseHeaders */]) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n if (!!isOneDs) {\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);\r\n }\r\n }\r\n else {\r\n theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA7 /* @min:%2egetAllResponseHeaders */]());\r\n }\r\n return theHeaders;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function stringToBoolOrDefault(str, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n if (str === undefined || str === null) {\r\n return defaultValue;\r\n }\r\n return str.toString()[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"true\";\r\n}\r\n/**\r\n * Convert ms to c# time span format\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function msToTimeSpan(totalms) {\r\n if (isTimeSpan(totalms)) {\r\n // Already in time span format\r\n return totalms;\r\n }\r\n if (isNaN(totalms) || totalms < 0) {\r\n totalms = 0;\r\n }\r\n totalms = mathRound(totalms);\r\n var ms = STR_EMPTY + totalms % 1000;\r\n var sec = STR_EMPTY + mathFloor(totalms / 1000) % 60;\r\n var min = STR_EMPTY + mathFloor(totalms / (1000 * 60)) % 60;\r\n var hour = STR_EMPTY + mathFloor(totalms / (1000 * 60 * 60)) % 24;\r\n var days = mathFloor(totalms / (1000 * 60 * 60 * 24));\r\n ms = ms[_DYN_LENGTH /* @min:%2elength */] === 1 ? \"00\" + ms : ms[_DYN_LENGTH /* @min:%2elength */] === 2 ? \"0\" + ms : ms;\r\n sec = sec[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + sec : sec;\r\n min = min[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + min : min;\r\n hour = hour[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + hour : hour;\r\n return (days > 0 ? days + \".\" : STR_EMPTY) + hour + \":\" + min + \":\" + sec + \".\" + ms;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function getExtensionByName(extensions, identifier) {\r\n var extension = null;\r\n arrForEach(extensions, function (value) {\r\n if (value[_DYN_IDENTIFIER /* @min:%2eidentifier */] === identifier) {\r\n extension = value;\r\n return -1;\r\n }\r\n });\r\n return extension;\r\n}\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isCrossOriginError(message, url, lineNumber, columnNumber, error) {\r\n return !error && isString(message) && (message === \"Script error.\" || message === \"Script error\");\r\n}\r\n/**\r\n * A helper method to determine whether the provided value is in a ISO time span format (DD.HH:MM:SS.MMMMMM)\r\n * @param value - The value to check\r\n * @returns True if the value is in a time span format; false otherwise\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isTimeSpan(value) {\r\n var result = false;\r\n if (isString(value)) {\r\n var parts = strSplit(value, \":\");\r\n if (parts[_DYN_LENGTH /* @min:%2elength */] === 3) {\r\n // Looks like a candidate, now validate each part\r\n var daysHours = strSplit(parts[0], \".\");\r\n if (daysHours[_DYN_LENGTH /* @min:%2elength */] === 2) {\r\n result = !isNaN(parseInt(daysHours[0] || \"0\")) && !isNaN(parseInt(daysHours[1] || \"0\"));\r\n }\r\n else {\r\n result = !isNaN(parseInt(daysHours[0] || \"0\"));\r\n }\r\n result = result && !isNaN(parseInt(parts[1] || \"0\"));\r\n var secondsParts = strSplit(parts[2], \".\");\r\n if (secondsParts[_DYN_LENGTH /* @min:%2elength */] === 2) {\r\n result = result && !isNaN(parseInt(secondsParts[0] || \"0\")) && !isNaN(parseInt(secondsParts[1] || \"0\"));\r\n }\r\n else {\r\n result = result && !isNaN(parseInt(secondsParts[0] || \"0\"));\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=HelperFuncs.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
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 - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
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 - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,12 +1,12 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { arrForEach, isArray, isNullOrUndefined, isString, strIndexOf, strLeft, strTrim } from "@nevware21/ts-utils";
8
- import { _DYN_GET_ATTRIBUTE, _DYN_LENGTH, _DYN_PUSH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TO_STRING, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN_VERSION } from "../__DynamicConstants";
9
- import { STR_EMPTY } from "../constants/InternalConstants";
8
+ import { _DYN_GET_ATTRIBUTE, _DYN_LENGTH, _DYN_PUSH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TO_STRING, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from "../__DynamicConstants";
9
+ import { STR_EMPTY, STR_VERSION } from "../constants/InternalConstants";
10
10
  import { generateW3CId } from "./CoreUtils";
11
11
  import { findMetaTag, findNamedServerTiming } from "./EnvUtils";
12
12
  // using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string
@@ -126,7 +126,7 @@ export function isValidSpanId(value) {
126
126
  /*#__NO_SIDE_EFFECTS__*/
127
127
  export function isValidTraceParent(value) {
128
128
  if (!value ||
129
- !_isValid(value[_DYN_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||
129
+ !_isValid(value[STR_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||
130
130
  !_isValid(value[_DYN_TRACE_ID /* @min:%2etraceId */], 32, INVALID_TRACE_ID) ||
131
131
  !_isValid(value[_DYN_SPAN_ID /* @min:%2espanId */], 16, INVALID_SPAN_ID) ||
132
132
  !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]), 2)) {
@@ -164,7 +164,7 @@ export function formatTraceParent(value) {
164
164
  if (!_isValid(flags, 2)) {
165
165
  flags = "01";
166
166
  }
167
- var version = value[_DYN_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;
167
+ var version = value[STR_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;
168
168
  if (version !== "00" && version !== "ff") {
169
169
  // Reduce version to "00"
170
170
  version = DEFAULT_VERSION;
@@ -1 +1 @@
1
- {"version":3,"file":"TraceParent.js.map","sources":["TraceParent.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { arrForEach, isArray, isNullOrUndefined, isString, strIndexOf, strLeft, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_GET_ATTRIBUTE, _DYN_LENGTH, _DYN_PUSH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TO_STRING, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN_VERSION } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"../constants/InternalConstants\";\r\nimport { generateW3CId } from \"./CoreUtils\";\r\nimport { findMetaTag, findNamedServerTiming } from \"./EnvUtils\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]{1,64})?$/i;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nexport var INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nexport var INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value[_DYN_LENGTH /* @min:%2elength */] === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/i);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value[_DYN_TO_STRING /* @min:%2etoString */](16);\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n return {\r\n version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n spanId: isValidSpanId(spanId) ? spanId : strLeft(generateW3CId(), 16),\r\n traceFlags: (!isNullOrUndefined(flags) && flags >= 0 && flags <= 0xFF ? flags : 1 /* eW3CTraceFlags.Sampled */)\r\n };\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value - The value to be parsed\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function parseTraceParent(value, selectIdx) {\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || STR_EMPTY;\r\n }\r\n if (!value || !isString(value) || value[_DYN_LENGTH /* @min:%2elength */] > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n if (strIndexOf(value, \",\") !== -1) {\r\n var values = value[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n value = values[selectIdx > 0 && values[_DYN_LENGTH /* @min:%2elength */] > selectIdx ? selectIdx : 0];\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n TRACE_PARENT_REGEX.lastIndex = 0;\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return {\r\n version: (match[1] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceId: (match[2] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n spanId: (match[3] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceFlags: parseInt(match[4], 16)\r\n };\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value[_DYN_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||\r\n !_isValid(value[_DYN_TRACE_ID /* @min:%2etraceId */], 32, INVALID_TRACE_ID) ||\r\n !_isValid(value[_DYN_SPAN_ID /* @min:%2espanId */], 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value[_DYN_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version.toLowerCase(), \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID).toLowerCase(), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID).toLowerCase(), \"-\").concat(flags.toLowerCase());\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function findW3cTraceParent(selectIdx) {\r\n var name = \"traceparent\";\r\n var traceParent = parseTraceParent(findMetaTag(name), selectIdx);\r\n if (!traceParent) {\r\n traceParent = parseTraceParent(findNamedServerTiming(name), selectIdx);\r\n }\r\n return traceParent;\r\n}\r\n/**\r\n * Find all script tags in the provided document and return the information about them.\r\n * @param doc - The document to search for script tags\r\n * @returns\r\n */\r\nexport function findAllScripts(doc) {\r\n var scripts = doc.getElementsByTagName(\"script\");\r\n var result = [];\r\n arrForEach(scripts, function (script) {\r\n var src = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"src\");\r\n if (src) {\r\n var crossOrigin = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"crossorigin\");\r\n var async = script.hasAttribute(\"async\") === true;\r\n var defer = script.hasAttribute(\"defer\") === true;\r\n var referrerPolicy = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"referrerpolicy\");\r\n var info = { url: src };\r\n if (crossOrigin) {\r\n info.crossOrigin = crossOrigin;\r\n }\r\n if (async) {\r\n info.async = async;\r\n }\r\n if (defer) {\r\n info.defer = defer;\r\n }\r\n if (referrerPolicy) {\r\n info.referrerPolicy = referrerPolicy;\r\n }\r\n result[_DYN_PUSH /* @min:%2epush */](info);\r\n }\r\n });\r\n return result;\r\n}\r\n//# sourceMappingURL=TraceParent.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"}
1
+ {"version":3,"file":"TraceParent.js.map","sources":["TraceParent.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { arrForEach, isArray, isNullOrUndefined, isString, strIndexOf, strLeft, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_GET_ATTRIBUTE, _DYN_LENGTH, _DYN_PUSH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TO_STRING, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY, STR_VERSION } from \"../constants/InternalConstants\";\r\nimport { generateW3CId } from \"./CoreUtils\";\r\nimport { findMetaTag, findNamedServerTiming } from \"./EnvUtils\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]{1,64})?$/i;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nexport var INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nexport var INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value[_DYN_LENGTH /* @min:%2elength */] === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/i);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value[_DYN_TO_STRING /* @min:%2etoString */](16);\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n return {\r\n version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n spanId: isValidSpanId(spanId) ? spanId : strLeft(generateW3CId(), 16),\r\n traceFlags: (!isNullOrUndefined(flags) && flags >= 0 && flags <= 0xFF ? flags : 1 /* eW3CTraceFlags.Sampled */)\r\n };\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value - The value to be parsed\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function parseTraceParent(value, selectIdx) {\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || STR_EMPTY;\r\n }\r\n if (!value || !isString(value) || value[_DYN_LENGTH /* @min:%2elength */] > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n if (strIndexOf(value, \",\") !== -1) {\r\n var values = value[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n value = values[selectIdx > 0 && values[_DYN_LENGTH /* @min:%2elength */] > selectIdx ? selectIdx : 0];\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n TRACE_PARENT_REGEX.lastIndex = 0;\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return {\r\n version: (match[1] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceId: (match[2] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n spanId: (match[3] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceFlags: parseInt(match[4], 16)\r\n };\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value[STR_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||\r\n !_isValid(value[_DYN_TRACE_ID /* @min:%2etraceId */], 32, INVALID_TRACE_ID) ||\r\n !_isValid(value[_DYN_SPAN_ID /* @min:%2espanId */], 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\n/*#__NO_SIDE_EFFECTS__*/\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value[STR_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version.toLowerCase(), \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID).toLowerCase(), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID).toLowerCase(), \"-\").concat(flags.toLowerCase());\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function findW3cTraceParent(selectIdx) {\r\n var name = \"traceparent\";\r\n var traceParent = parseTraceParent(findMetaTag(name), selectIdx);\r\n if (!traceParent) {\r\n traceParent = parseTraceParent(findNamedServerTiming(name), selectIdx);\r\n }\r\n return traceParent;\r\n}\r\n/**\r\n * Find all script tags in the provided document and return the information about them.\r\n * @param doc - The document to search for script tags\r\n * @returns\r\n */\r\nexport function findAllScripts(doc) {\r\n var scripts = doc.getElementsByTagName(\"script\");\r\n var result = [];\r\n arrForEach(scripts, function (script) {\r\n var src = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"src\");\r\n if (src) {\r\n var crossOrigin = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"crossorigin\");\r\n var async = script.hasAttribute(\"async\") === true;\r\n var defer = script.hasAttribute(\"defer\") === true;\r\n var referrerPolicy = script[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"referrerpolicy\");\r\n var info = { url: src };\r\n if (crossOrigin) {\r\n info.crossOrigin = crossOrigin;\r\n }\r\n if (async) {\r\n info.async = async;\r\n }\r\n if (defer) {\r\n info.defer = defer;\r\n }\r\n if (referrerPolicy) {\r\n info.referrerPolicy = referrerPolicy;\r\n }\r\n result[_DYN_PUSH /* @min:%2epush */](info);\r\n }\r\n });\r\n return result;\r\n}\r\n//# sourceMappingURL=TraceParent.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"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,11 +1,11 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Core, 3.4.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { arrForEach, arrIndexOf, getPerformance, isNullOrUndefined, strIndexOf, utcNow as dateNow } from "@nevware21/ts-utils";
8
- import { _DYN_CORRELATION_HEADER_E7, _DYN_HOST, _DYN_LENGTH, _DYN_NAME, _DYN_PATHNAME, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from "../__DynamicConstants";
8
+ import { _DYN_CORRELATION_HEADER_E8, _DYN_HOST, _DYN_LENGTH, _DYN_NAME, _DYN_PATHNAME, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from "../__DynamicConstants";
9
9
  import { DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH } from "../constants/Constants";
10
10
  import { STR_EMPTY } from "../constants/InternalConstants";
11
11
  import { createDistributedTraceContext } from "../core/TelemetryHelpers";
@@ -39,9 +39,9 @@ export function correlationIdCanIncludeCorrelationHeader(config, requestUrl, cur
39
39
  if (!requestUrl || (config && config.disableCorrelationHeaders)) {
40
40
  return false;
41
41
  }
42
- if (config && config[_DYN_CORRELATION_HEADER_E7 /* @min:%2ecorrelationHeaderExcludePatterns */]) {
42
+ if (config && config[_DYN_CORRELATION_HEADER_E8 /* @min:%2ecorrelationHeaderExcludePatterns */]) {
43
43
  for (var i = 0; i < config.correlationHeaderExcludePatterns[_DYN_LENGTH /* @min:%2elength */]; i++) {
44
- if (config[_DYN_CORRELATION_HEADER_E7 /* @min:%2ecorrelationHeaderExcludePatterns */][i].test(requestUrl)) {
44
+ if (config[_DYN_CORRELATION_HEADER_E8 /* @min:%2ecorrelationHeaderExcludePatterns */][i].test(requestUrl)) {
45
45
  return false;
46
46
  }
47
47
  }
@@ -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 { arrForEach, arrIndexOf, getPerformance, isNullOrUndefined, strIndexOf, utcNow as dateNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CORRELATION_HEADER_E7, _DYN_HOST, _DYN_LENGTH, _DYN_NAME, _DYN_PATHNAME, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from \"../__DynamicConstants\";\r\nimport { DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH } from \"../constants/Constants\";\r\nimport { STR_EMPTY } from \"../constants/InternalConstants\";\r\nimport { createDistributedTraceContext } from \"../core/TelemetryHelpers\";\r\nimport { RequestHeaders } from \"../telemetry/RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"../telemetry/ai/Common/DataSanitizer\";\r\nimport { urlParseFullHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH,\r\n \"https://breeze.aimon.applicationinsights.io\" + DEFAULT_BREEZE_PATH,\r\n \"https://dc-int.services.visualstudio.com\" + DEFAULT_BREEZE_PATH\r\n];\r\nvar _correlationIdPrefix = \"cid-v1:\";\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return arrIndexOf(_internalEndpoints, endpointUrl[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]()) !== -1;\r\n}\r\nexport function correlationIdSetPrefix(prefix) {\r\n _correlationIdPrefix = prefix;\r\n}\r\nexport function correlationIdGetPrefix() {\r\n return _correlationIdPrefix;\r\n}\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\nexport function correlationIdCanIncludeCorrelationHeader(config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config[_DYN_CORRELATION_HEADER_E7 /* @min:%2ecorrelationHeaderExcludePatterns */]) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (config[_DYN_CORRELATION_HEADER_E7 /* @min:%2ecorrelationHeaderExcludePatterns */][i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n if (requestHost && (strIndexOf(requestHost, \":443\") !== -1 || strIndexOf(requestHost, \":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) || \"\")[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\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[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains[_DYN_LENGTH /* @min:%2elength */]; 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[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\n/**\r\n * Combines target appId and target role name from response header.\r\n */\r\nexport function correlationIdGetCorrelationContext(responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = correlationIdGetCorrelationContextValue(responseHeader, RequestHeaders[1 /* eRequestHeaders.requestContextTargetKey */]);\r\n if (correlationId && correlationId !== _correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n}\r\n/**\r\n * Gets key from correlation response header\r\n */\r\nexport function correlationIdGetCorrelationContextValue(responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n for (var i = 0; i < keyValues[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n var keyValue = keyValues[i][_DYN_SPLIT /* @min:%2esplit */](\"=\");\r\n if (keyValue[_DYN_LENGTH /* @min:%2elength */] === 2 && keyValue[0] === key) {\r\n return keyValue[1];\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[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl[_DYN_HOST /* @min:%2ehost */];\r\n if (!name) {\r\n if (parsedUrl[_DYN_PATHNAME /* @min:%2epathname */] != null) {\r\n var pathName = (parsedUrl.pathname[_DYN_LENGTH /* @min:%2elength */] === 0) ? \"/\" : parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\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 * 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 * @deprecated This function is deprecated and will be removed in a future version. Use the createDistributedTraceContext function instead and set the necessary properties\r\n * on the context object directly.\r\n */\r\nexport function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {\r\n var traceCtx = createDistributedTraceContext(parentCtx);\r\n if (telemetryTrace) {\r\n traceCtx.pageName = telemetryTrace[_DYN_NAME /* @min:%2ename */] || traceCtx.pageName || STR_EMPTY; // The name of the page\r\n traceCtx[_DYN_TRACE_ID /* @min:%2etraceId */] = telemetryTrace.traceID || traceCtx[_DYN_TRACE_ID /* @min:%2etraceId */] || STR_EMPTY; // 16 byte hex string\r\n traceCtx[_DYN_SPAN_ID /* @min:%2espanId */] = telemetryTrace.parentID || traceCtx[_DYN_SPAN_ID /* @min:%2espanId */] || STR_EMPTY; // 8 byte hex string\r\n traceCtx[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = (!isNullOrUndefined(telemetryTrace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]) ? telemetryTrace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] : traceCtx[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]) || 0; // 1 byte hex string\r\n }\r\n return traceCtx;\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"}
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 { arrForEach, arrIndexOf, getPerformance, isNullOrUndefined, strIndexOf, utcNow as dateNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CORRELATION_HEADER_E8, _DYN_HOST, _DYN_LENGTH, _DYN_NAME, _DYN_PATHNAME, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID } from \"../__DynamicConstants\";\r\nimport { DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH } from \"../constants/Constants\";\r\nimport { STR_EMPTY } from \"../constants/InternalConstants\";\r\nimport { createDistributedTraceContext } from \"../core/TelemetryHelpers\";\r\nimport { RequestHeaders } from \"../telemetry/RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"../telemetry/ai/Common/DataSanitizer\";\r\nimport { urlParseFullHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH,\r\n \"https://breeze.aimon.applicationinsights.io\" + DEFAULT_BREEZE_PATH,\r\n \"https://dc-int.services.visualstudio.com\" + DEFAULT_BREEZE_PATH\r\n];\r\nvar _correlationIdPrefix = \"cid-v1:\";\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return arrIndexOf(_internalEndpoints, endpointUrl[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]()) !== -1;\r\n}\r\nexport function correlationIdSetPrefix(prefix) {\r\n _correlationIdPrefix = prefix;\r\n}\r\nexport function correlationIdGetPrefix() {\r\n return _correlationIdPrefix;\r\n}\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\nexport function correlationIdCanIncludeCorrelationHeader(config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config[_DYN_CORRELATION_HEADER_E8 /* @min:%2ecorrelationHeaderExcludePatterns */]) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (config[_DYN_CORRELATION_HEADER_E8 /* @min:%2ecorrelationHeaderExcludePatterns */][i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n if (requestHost && (strIndexOf(requestHost, \":443\") !== -1 || strIndexOf(requestHost, \":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) || \"\")[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\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[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains[_DYN_LENGTH /* @min:%2elength */]; 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[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\n/**\r\n * Combines target appId and target role name from response header.\r\n */\r\nexport function correlationIdGetCorrelationContext(responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = correlationIdGetCorrelationContextValue(responseHeader, RequestHeaders[1 /* eRequestHeaders.requestContextTargetKey */]);\r\n if (correlationId && correlationId !== _correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n}\r\n/**\r\n * Gets key from correlation response header\r\n */\r\nexport function correlationIdGetCorrelationContextValue(responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n for (var i = 0; i < keyValues[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n var keyValue = keyValues[i][_DYN_SPLIT /* @min:%2esplit */](\"=\");\r\n if (keyValue[_DYN_LENGTH /* @min:%2elength */] === 2 && keyValue[0] === key) {\r\n return keyValue[1];\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[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl[_DYN_HOST /* @min:%2ehost */];\r\n if (!name) {\r\n if (parsedUrl[_DYN_PATHNAME /* @min:%2epathname */] != null) {\r\n var pathName = (parsedUrl.pathname[_DYN_LENGTH /* @min:%2elength */] === 0) ? \"/\" : parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\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 * 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 * @deprecated This function is deprecated and will be removed in a future version. Use the createDistributedTraceContext function instead and set the necessary properties\r\n * on the context object directly.\r\n */\r\nexport function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {\r\n var traceCtx = createDistributedTraceContext(parentCtx);\r\n if (telemetryTrace) {\r\n traceCtx.pageName = telemetryTrace[_DYN_NAME /* @min:%2ename */] || traceCtx.pageName || STR_EMPTY; // The name of the page\r\n traceCtx[_DYN_TRACE_ID /* @min:%2etraceId */] = telemetryTrace.traceID || traceCtx[_DYN_TRACE_ID /* @min:%2etraceId */] || STR_EMPTY; // 16 byte hex string\r\n traceCtx[_DYN_SPAN_ID /* @min:%2espanId */] = telemetryTrace.parentID || traceCtx[_DYN_SPAN_ID /* @min:%2espanId */] || STR_EMPTY; // 8 byte hex string\r\n traceCtx[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = (!isNullOrUndefined(telemetryTrace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]) ? telemetryTrace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] : traceCtx[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]) || 0; // 1 byte hex string\r\n }\r\n return traceCtx;\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"}
package/package.json CHANGED
@@ -1,78 +1,75 @@
1
- {
2
- "name": "@microsoft/applicationinsights-core-js",
3
- "author": "Microsoft Application Insights Team",
4
- "version": "3.4.0-nightlybeta3.2602-27",
5
- "description": "Microsoft Application Insights Core Javascript SDK",
6
- "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
7
- "keywords": [
8
- "azure",
9
- "cloud",
10
- "script errors",
11
- "microsoft",
12
- "application insights",
13
- "browser performance monitoring",
14
- "web analytics"
15
- ],
16
- "main": "dist/es5/index.js",
17
- "module": "dist-es5/index.js",
18
- "types": "types/applicationinsights-core-js.d.ts",
19
- "scripts": {
20
- "clean": "git clean -xdf",
21
- "build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
22
- "build:esm": "grunt core",
23
- "build:browser": "rollup -c rollup.config.js --bundleConfigAsCjs",
24
- "rebuild": "npm run build",
25
- "test": "grunt coreunittest",
26
- "mintest": "grunt core-mintest",
27
- "perftest": "grunt coreperftest",
28
- "lint": "tslint -p tsconfig.json",
29
- "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Core Javascript SDK\"",
30
- "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
31
- "ai-min": "grunt core-min",
32
- "ai-restore": "grunt core-restore",
33
- "npm-pack": "npm pack",
34
- "api-docs": "typedoc"
35
- },
36
- "repository": {
37
- "type": "git",
38
- "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/shared/AppInsightsCore"
39
- },
40
- "license": "MIT",
41
- "sideEffects": false,
42
- "devDependencies": {
43
- "@microsoft/ai-test-framework": "0.0.1",
44
- "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
45
- "@microsoft/applicationinsights-rollup-es5": "1.0.2",
46
- "@microsoft/api-extractor": "^7.40.0",
47
- "grunt": "^1.6.1",
48
- "grunt-cli": "^1.5.0",
49
- "@nevware21/grunt-ts-plugin": "^0.5.1",
50
- "@nevware21/grunt-eslint-ts": "^0.5.1",
51
- "globby": "^11.0.0",
52
- "magic-string": "^0.25.7",
53
- "pako": "^2.0.3",
54
- "@rollup/plugin-commonjs": "^24.0.0",
55
- "@rollup/plugin-node-resolve": "^15.0.1",
56
- "@rollup/plugin-replace": "^5.0.2",
57
- "rollup": "^3.20.0",
58
- "rollup-plugin-cleanup": "^3.2.1",
59
- "rollup-plugin-sourcemaps": "^0.6.3",
60
- "typedoc": "^0.26.6",
61
- "typescript": "^4.9.3",
62
- "tslib": "^2.0.0",
63
- "qunit": "^2.11.2",
64
- "sinon": "^7.3.1"
65
- },
66
- "peerDependencies": {
67
- "tslib": ">= 1.0.0"
68
- },
69
- "dependencies": {
70
- "@microsoft/applicationinsights-shims": "3.0.1",
71
- "@microsoft/dynamicproto-js": "^2.0.3",
72
- "@nevware21/ts-utils": ">= 0.12.6 < 2.x",
73
- "@nevware21/ts-async": ">= 0.5.5 < 2.x"
74
- },
75
- "publishConfig": {
76
- "tag": "nightlybeta3"
77
- }
78
- }
1
+ {
2
+ "name": "@microsoft/applicationinsights-core-js",
3
+ "author": "Microsoft Application Insights Team",
4
+ "version": "3.4.1",
5
+ "description": "Microsoft Application Insights Core Javascript SDK",
6
+ "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
7
+ "keywords": [
8
+ "azure",
9
+ "cloud",
10
+ "script errors",
11
+ "microsoft",
12
+ "application insights",
13
+ "browser performance monitoring",
14
+ "web analytics"
15
+ ],
16
+ "main": "dist/es5/index.js",
17
+ "module": "dist-es5/index.js",
18
+ "types": "types/applicationinsights-core-js.d.ts",
19
+ "scripts": {
20
+ "clean": "git clean -xdf",
21
+ "build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
22
+ "build:esm": "grunt core",
23
+ "build:browser": "rollup -c rollup.config.js --bundleConfigAsCjs",
24
+ "rebuild": "npm run build",
25
+ "test": "grunt coreunittest",
26
+ "mintest": "grunt core-mintest",
27
+ "perftest": "grunt coreperftest",
28
+ "lint": "tslint -p tsconfig.json",
29
+ "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Core Javascript SDK\"",
30
+ "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
31
+ "ai-min": "grunt core-min",
32
+ "ai-restore": "grunt core-restore",
33
+ "npm-pack": "npm pack",
34
+ "api-docs": "typedoc"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/shared/AppInsightsCore"
39
+ },
40
+ "license": "MIT",
41
+ "sideEffects": false,
42
+ "devDependencies": {
43
+ "@microsoft/ai-test-framework": "0.0.1",
44
+ "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
45
+ "@microsoft/applicationinsights-rollup-es5": "1.0.2",
46
+ "@microsoft/api-extractor": "^7.40.0",
47
+ "grunt": "^1.6.1",
48
+ "grunt-cli": "^1.5.0",
49
+ "@nevware21/grunt-ts-plugin": "^0.5.1",
50
+ "@nevware21/grunt-eslint-ts": "^0.5.1",
51
+ "globby": "^11.0.0",
52
+ "magic-string": "^0.25.7",
53
+ "pako": "^2.0.3",
54
+ "@rollup/plugin-commonjs": "^24.0.0",
55
+ "@rollup/plugin-node-resolve": "^15.0.1",
56
+ "@rollup/plugin-replace": "^5.0.2",
57
+ "rollup": "^3.20.0",
58
+ "rollup-plugin-cleanup": "^3.2.1",
59
+ "rollup-plugin-sourcemaps": "^0.6.3",
60
+ "typedoc": "^0.26.6",
61
+ "typescript": "^4.9.3",
62
+ "tslib": "^2.0.0",
63
+ "qunit": "^2.11.2",
64
+ "sinon": "^7.3.1"
65
+ },
66
+ "peerDependencies": {
67
+ "tslib": ">= 1.0.0"
68
+ },
69
+ "dependencies": {
70
+ "@microsoft/applicationinsights-shims": "3.0.1",
71
+ "@microsoft/dynamicproto-js": "^2.0.3",
72
+ "@nevware21/ts-utils": ">= 0.12.6 < 2.x",
73
+ "@nevware21/ts-async": ">= 0.5.5 < 2.x"
74
+ }
75
+ }