@datadog/mobile-react-native 2.4.1 → 2.4.3

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 (434) hide show
  1. package/DatadogSDKReactNative.podspec +6 -6
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +6 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +31 -24
  5. package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +63 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  7. package/android/src/main/kotlin/com/datadog/reactnative/UiThreadExecutor.kt +25 -0
  8. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  9. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  10. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +29 -0
  11. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +12 -4
  12. package/android/src/test/kotlin/com/datadog/tools/unit/TestUiThreadExecutor.kt +16 -0
  13. package/datadog-sourcemaps.gradle +3 -5
  14. package/ios/Sources/DdRum.mm +4 -3
  15. package/ios/Sources/DdRumImplementation.swift +15 -2
  16. package/ios/Sources/SdkVersion.swift +1 -1
  17. package/lib/commonjs/DdSdkReactNative.js +107 -145
  18. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  19. package/lib/commonjs/DdSdkReactNativeConfiguration.js +54 -119
  20. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  21. package/lib/commonjs/InternalLog.js +8 -19
  22. package/lib/commonjs/InternalLog.js.map +1 -1
  23. package/lib/commonjs/ProxyConfiguration.js +3 -15
  24. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  25. package/lib/commonjs/SdkVerbosity.js +3 -7
  26. package/lib/commonjs/SdkVerbosity.js.map +1 -1
  27. package/lib/commonjs/TrackingConsent.js +3 -7
  28. package/lib/commonjs/TrackingConsent.js.map +1 -1
  29. package/lib/commonjs/index.js +50 -66
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/logs/DdLogs.js +103 -123
  32. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  33. package/lib/commonjs/logs/eventMapper.js +4 -11
  34. package/lib/commonjs/logs/eventMapper.js.map +1 -1
  35. package/lib/commonjs/logs/types.js +4 -0
  36. package/lib/commonjs/logs/types.js.map +1 -1
  37. package/lib/commonjs/nativeModulesTypes.js +4 -3
  38. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  39. package/lib/commonjs/polyfills.js +1 -4
  40. package/lib/commonjs/polyfills.js.map +1 -1
  41. package/lib/commonjs/rum/DdAttributes.js +26 -0
  42. package/lib/commonjs/rum/DdAttributes.js.map +1 -0
  43. package/lib/commonjs/rum/DdRum.js +143 -208
  44. package/lib/commonjs/rum/DdRum.js.map +1 -1
  45. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +5 -8
  46. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -1
  47. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +3 -7
  48. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -1
  49. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +5 -8
  50. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -1
  51. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +68 -89
  52. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  53. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +13 -46
  54. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  55. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +52 -66
  56. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  57. package/lib/commonjs/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  58. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -4
  59. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  60. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -6
  61. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  62. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js +18 -19
  63. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  64. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -21
  65. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  66. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +32 -55
  67. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  68. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -9
  69. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  70. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +15 -41
  71. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  72. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -13
  73. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  74. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +5 -10
  75. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  76. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +16 -35
  77. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  78. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -5
  79. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  80. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -7
  81. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  82. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -10
  83. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  84. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -58
  85. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  86. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +4 -26
  87. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  88. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -11
  89. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  90. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +4 -0
  91. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  92. package/lib/commonjs/rum/types.js +15 -27
  93. package/lib/commonjs/rum/types.js.map +1 -1
  94. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +20 -30
  95. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  96. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -1
  97. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +112 -144
  98. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  99. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js +19 -22
  100. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  101. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -15
  102. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  103. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +9 -16
  104. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  105. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js +2 -8
  106. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  107. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +8 -25
  108. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  109. package/lib/commonjs/sdk/DdSdk.js +2 -4
  110. package/lib/commonjs/sdk/DdSdk.js.map +1 -1
  111. package/lib/commonjs/sdk/EventMappers/EventMapper.js +31 -51
  112. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
  113. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +9 -24
  114. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -1
  115. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +6 -38
  116. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  117. package/lib/commonjs/sdk/GlobalState/GlobalState.js +6 -11
  118. package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
  119. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -28
  120. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  121. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -1
  122. package/lib/commonjs/specs/NativeDdLogs.js +4 -6
  123. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
  124. package/lib/commonjs/specs/NativeDdRum.js +4 -6
  125. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  126. package/lib/commonjs/specs/NativeDdSdk.js +4 -6
  127. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  128. package/lib/commonjs/specs/NativeDdTrace.js +4 -6
  129. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
  130. package/lib/commonjs/trace/DdTrace.js +17 -29
  131. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  132. package/lib/commonjs/types.js +4 -3
  133. package/lib/commonjs/types.js.map +1 -1
  134. package/lib/commonjs/utils/Timer.js +7 -22
  135. package/lib/commonjs/utils/Timer.js.map +1 -1
  136. package/lib/commonjs/utils/argsUtils.js +3 -11
  137. package/lib/commonjs/utils/argsUtils.js.map +1 -1
  138. package/lib/commonjs/utils/errorUtils.js +9 -22
  139. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  140. package/lib/commonjs/utils/jsUtils.js +1 -2
  141. package/lib/commonjs/utils/jsUtils.js.map +1 -1
  142. package/lib/commonjs/utils/longTasksUtils.js +2 -7
  143. package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
  144. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js +9 -15
  145. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  146. package/lib/commonjs/utils/time-provider/TimeProvider.js +1 -11
  147. package/lib/commonjs/utils/time-provider/TimeProvider.js.map +1 -1
  148. package/lib/commonjs/version.js +1 -2
  149. package/lib/commonjs/version.js.map +1 -1
  150. package/lib/module/DdSdkReactNative.js +104 -116
  151. package/lib/module/DdSdkReactNative.js.map +1 -1
  152. package/lib/module/DdSdkReactNativeConfiguration.js +49 -101
  153. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  154. package/lib/module/InternalLog.js +4 -15
  155. package/lib/module/InternalLog.js.map +1 -1
  156. package/lib/module/ProxyConfiguration.js +3 -14
  157. package/lib/module/ProxyConfiguration.js.map +1 -1
  158. package/lib/module/SdkVerbosity.js +3 -4
  159. package/lib/module/SdkVerbosity.js.map +1 -1
  160. package/lib/module/TrackingConsent.js +3 -4
  161. package/lib/module/TrackingConsent.js.map +1 -1
  162. package/lib/module/index.js +2 -2
  163. package/lib/module/index.js.map +1 -1
  164. package/lib/module/logs/DdLogs.js +98 -117
  165. package/lib/module/logs/DdLogs.js.map +1 -1
  166. package/lib/module/logs/eventMapper.js +3 -1
  167. package/lib/module/logs/eventMapper.js.map +1 -1
  168. package/lib/module/logs/types.js +1 -1
  169. package/lib/module/logs/types.js.map +1 -1
  170. package/lib/module/nativeModulesTypes.js +5 -1
  171. package/lib/module/nativeModulesTypes.js.map +1 -1
  172. package/lib/module/polyfills.js +1 -3
  173. package/lib/module/polyfills.js.map +1 -1
  174. package/lib/module/rum/DdAttributes.js +20 -0
  175. package/lib/module/rum/DdAttributes.js.map +1 -0
  176. package/lib/module/rum/DdRum.js +138 -185
  177. package/lib/module/rum/DdRum.js.map +1 -1
  178. package/lib/module/rum/eventMappers/actionEventMapper.js +5 -5
  179. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -1
  180. package/lib/module/rum/eventMappers/errorEventMapper.js +3 -4
  181. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -1
  182. package/lib/module/rum/eventMappers/resourceEventMapper.js +5 -5
  183. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -1
  184. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +64 -79
  185. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  186. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +7 -36
  187. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  188. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +49 -54
  189. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  190. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  191. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -2
  192. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  193. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -4
  194. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  195. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js +16 -14
  196. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  197. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +2 -12
  198. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  199. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +33 -45
  200. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  201. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -4
  202. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  203. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +2 -10
  204. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  205. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -5
  206. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  207. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +1 -0
  208. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  209. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +12 -30
  210. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  211. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -3
  212. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  213. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -4
  214. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  215. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -5
  216. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  217. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +20 -48
  218. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  219. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +2 -20
  220. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  221. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -9
  222. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  223. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +1 -1
  224. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  225. package/lib/module/rum/types.js +14 -18
  226. package/lib/module/rum/types.js.map +1 -1
  227. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +20 -28
  228. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  229. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -1
  230. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +108 -137
  231. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  232. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js +14 -18
  233. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  234. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -13
  235. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  236. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +5 -14
  237. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  238. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js +1 -0
  239. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  240. package/lib/module/sdk/DatadogProvider/DatadogProvider.js +6 -14
  241. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  242. package/lib/module/sdk/DdSdk.js +1 -1
  243. package/lib/module/sdk/DdSdk.js.map +1 -1
  244. package/lib/module/sdk/EventMappers/EventMapper.js +27 -41
  245. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
  246. package/lib/module/sdk/EventMappers/utils/deepClone.js +9 -22
  247. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -1
  248. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +5 -29
  249. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  250. package/lib/module/sdk/GlobalState/GlobalState.js +6 -9
  251. package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
  252. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -26
  253. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  254. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -1
  255. package/lib/module/specs/NativeDdLogs.js +2 -0
  256. package/lib/module/specs/NativeDdLogs.js.map +1 -1
  257. package/lib/module/specs/NativeDdRum.js +2 -0
  258. package/lib/module/specs/NativeDdRum.js.map +1 -1
  259. package/lib/module/specs/NativeDdSdk.js +2 -0
  260. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  261. package/lib/module/specs/NativeDdTrace.js +2 -0
  262. package/lib/module/specs/NativeDdTrace.js.map +1 -1
  263. package/lib/module/trace/DdTrace.js +12 -19
  264. package/lib/module/trace/DdTrace.js.map +1 -1
  265. package/lib/module/types.js +5 -1
  266. package/lib/module/types.js.map +1 -1
  267. package/lib/module/utils/Timer.js +3 -20
  268. package/lib/module/utils/Timer.js.map +1 -1
  269. package/lib/module/utils/argsUtils.js +3 -5
  270. package/lib/module/utils/argsUtils.js.map +1 -1
  271. package/lib/module/utils/errorUtils.js +6 -9
  272. package/lib/module/utils/errorUtils.js.map +1 -1
  273. package/lib/module/utils/jsUtils.js +1 -0
  274. package/lib/module/utils/jsUtils.js.map +1 -1
  275. package/lib/module/utils/longTasksUtils.js +2 -5
  276. package/lib/module/utils/longTasksUtils.js.map +1 -1
  277. package/lib/module/utils/time-provider/DefaultTimeProvider.js +5 -13
  278. package/lib/module/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  279. package/lib/module/utils/time-provider/TimeProvider.js +1 -9
  280. package/lib/module/utils/time-provider/TimeProvider.js.map +1 -1
  281. package/lib/module/version.js +1 -1
  282. package/lib/module/version.js.map +1 -1
  283. package/lib/typescript/DdSdkReactNative.d.ts +1 -0
  284. package/lib/typescript/DdSdkReactNative.d.ts.map +1 -0
  285. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -0
  286. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +1 -0
  287. package/lib/typescript/InternalLog.d.ts +1 -0
  288. package/lib/typescript/InternalLog.d.ts.map +1 -0
  289. package/lib/typescript/ProxyConfiguration.d.ts +1 -0
  290. package/lib/typescript/ProxyConfiguration.d.ts.map +1 -0
  291. package/lib/typescript/SdkVerbosity.d.ts +1 -0
  292. package/lib/typescript/SdkVerbosity.d.ts.map +1 -0
  293. package/lib/typescript/TrackingConsent.d.ts +1 -0
  294. package/lib/typescript/TrackingConsent.d.ts.map +1 -0
  295. package/lib/typescript/index.d.ts +1 -0
  296. package/lib/typescript/index.d.ts.map +1 -0
  297. package/lib/typescript/logs/DdLogs.d.ts +1 -0
  298. package/lib/typescript/logs/DdLogs.d.ts.map +1 -0
  299. package/lib/typescript/logs/eventMapper.d.ts +1 -0
  300. package/lib/typescript/logs/eventMapper.d.ts.map +1 -0
  301. package/lib/typescript/logs/types.d.ts +6 -1
  302. package/lib/typescript/logs/types.d.ts.map +1 -0
  303. package/lib/typescript/nativeModulesTypes.d.ts +3 -1
  304. package/lib/typescript/nativeModulesTypes.d.ts.map +1 -0
  305. package/lib/typescript/rum/DdAttributes.d.ts +14 -0
  306. package/lib/typescript/rum/DdAttributes.d.ts.map +1 -0
  307. package/lib/typescript/rum/DdRum.d.ts +3 -2
  308. package/lib/typescript/rum/DdRum.d.ts.map +1 -0
  309. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +1 -0
  310. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts.map +1 -0
  311. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +3 -0
  312. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -0
  313. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +1 -0
  314. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts.map +1 -0
  315. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
  316. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -0
  317. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -0
  318. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts.map +1 -0
  319. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -0
  320. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -0
  321. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +1 -0
  322. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts.map +1 -0
  323. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +1 -0
  324. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts.map +1 -0
  325. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +1 -0
  326. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts.map +1 -0
  327. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +2 -1
  328. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts.map +1 -0
  329. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +1 -0
  330. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -0
  331. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +1 -0
  332. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -0
  333. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -0
  334. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -0
  335. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +1 -0
  336. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -0
  337. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
  338. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -0
  339. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +1 -0
  340. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts.map +1 -0
  341. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -0
  342. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts.map +1 -0
  343. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -0
  344. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts.map +1 -0
  345. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +1 -0
  346. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts.map +1 -0
  347. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +1 -0
  348. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts.map +1 -0
  349. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -0
  350. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -0
  351. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -0
  352. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts.map +1 -0
  353. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -0
  354. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -0
  355. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -0
  356. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -0
  357. package/lib/typescript/rum/types.d.ts +1 -0
  358. package/lib/typescript/rum/types.d.ts.map +1 -0
  359. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +1 -0
  360. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -0
  361. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -0
  362. package/lib/typescript/sdk/AttributesSingleton/types.d.ts.map +1 -0
  363. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +1 -0
  364. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts.map +1 -0
  365. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +1 -0
  366. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -0
  367. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +1 -0
  368. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts.map +1 -0
  369. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +1 -0
  370. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts.map +1 -0
  371. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +1 -0
  372. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts.map +1 -0
  373. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +1 -0
  374. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -0
  375. package/lib/typescript/sdk/DdSdk.d.ts +1 -0
  376. package/lib/typescript/sdk/DdSdk.d.ts.map +1 -0
  377. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -0
  378. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -0
  379. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +1 -0
  380. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts.map +1 -0
  381. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +1 -0
  382. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +1 -0
  383. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +1 -0
  384. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -0
  385. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +1 -0
  386. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -0
  387. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -0
  388. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -0
  389. package/lib/typescript/specs/NativeDdLogs.d.ts +1 -0
  390. package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -0
  391. package/lib/typescript/specs/NativeDdRum.d.ts +3 -1
  392. package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -0
  393. package/lib/typescript/specs/NativeDdSdk.d.ts +1 -0
  394. package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -0
  395. package/lib/typescript/specs/NativeDdTrace.d.ts +1 -0
  396. package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -0
  397. package/lib/typescript/trace/DdTrace.d.ts +1 -0
  398. package/lib/typescript/trace/DdTrace.d.ts.map +1 -0
  399. package/lib/typescript/types.d.ts +1 -0
  400. package/lib/typescript/types.d.ts.map +1 -0
  401. package/lib/typescript/utils/Timer.d.ts +1 -0
  402. package/lib/typescript/utils/Timer.d.ts.map +1 -0
  403. package/lib/typescript/utils/argsUtils.d.ts +1 -0
  404. package/lib/typescript/utils/argsUtils.d.ts.map +1 -0
  405. package/lib/typescript/utils/errorUtils.d.ts +1 -0
  406. package/lib/typescript/utils/errorUtils.d.ts.map +1 -0
  407. package/lib/typescript/utils/jsUtils.d.ts +1 -0
  408. package/lib/typescript/utils/jsUtils.d.ts.map +1 -0
  409. package/lib/typescript/utils/longTasksUtils.d.ts +1 -0
  410. package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -0
  411. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts +1 -0
  412. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts.map +1 -0
  413. package/lib/typescript/utils/time-provider/TimeProvider.d.ts +1 -0
  414. package/lib/typescript/utils/time-provider/TimeProvider.d.ts.map +1 -0
  415. package/lib/typescript/version.d.ts +2 -1
  416. package/lib/typescript/version.d.ts.map +1 -0
  417. package/package.json +3 -3
  418. package/src/__tests__/DdSdkReactNative.test.tsx +2 -1
  419. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +32 -16
  420. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +17 -15
  421. package/src/logs/DdLogs.ts +25 -8
  422. package/src/logs/__tests__/DdLogs.test.ts +122 -0
  423. package/src/logs/types.ts +5 -1
  424. package/src/nativeModulesTypes.ts +3 -1
  425. package/src/rum/DdAttributes.ts +20 -0
  426. package/src/rum/DdRum.ts +11 -6
  427. package/src/rum/__tests__/DdRum.test.ts +40 -4
  428. package/src/rum/eventMappers/errorEventMapper.ts +2 -0
  429. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +33 -10
  430. package/src/rum/instrumentation/interactionTracking/getJsxRuntime.ts +10 -3
  431. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -1
  432. package/src/specs/NativeDdRum.ts +3 -1
  433. package/src/version.ts +1 -1
  434. package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +0 -41
@@ -1 +1 @@
1
- {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,uBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,eAbF,EAcEC,SAdF,EAeEC,iBAfF,EAgBEC,qBAhBF,EAiBEC,eAjBF,EAsBEC,yBAtBF,EA8BEC,kBA9BF,EA+BEC,yBA/BF,EAgCEC,SAhCF,EAiCEC,WAjCF,EA0CEC,WA1CF,EA2CEC,eA3CF,EA+CEC,iBA/CF,EAgDEC,oBAhDF,EAiDT;AAAA,SAhDWzB,WAgDX,GAhDWA,WAgDX;AAAA,SA/CWC,GA+CX,GA/CWA,GA+CX;AAAA,SA9CWC,aA8CX,GA9CWA,aA8CX;AAAA,SA7CWC,wBA6CX,GA7CWA,wBA6CX;AAAA,SA5CWC,yBA4CX,GA5CWA,yBA4CX;AAAA,SA3CWC,mBA2CX,GA3CWA,mBA2CX;AAAA,SA1CWC,UA0CX,GA1CWA,UA0CX;AAAA,SAzCWC,IAyCX,GAzCWA,IAyCX;AAAA,SAxCWC,eAwCX,GAxCWA,eAwCX;AAAA,SAvCWC,uBAuCX,GAvCWA,uBAuCX;AAAA,SAtCWC,mBAsCX,GAtCWA,mBAsCX;AAAA,SArCWC,qBAqCX,GArCWA,qBAqCX;AAAA,SApCWC,eAoCX,GApCWA,eAoCX;AAAA,SAnCWC,SAmCX,GAnCWA,SAmCX;AAAA,SAlCWC,iBAkCX,GAlCWA,iBAkCX;AAAA,SAjCWC,qBAiCX,GAjCWA,qBAiCX;AAAA,SAhCWC,eAgCX,GAhCWA,eAgCX;AAAA,SA3BWC,yBA2BX,GA3BWA,yBA2BX;AAAA,SAnBWC,kBAmBX,GAnBWA,kBAmBX;AAAA,SAlBWC,yBAkBX,GAlBWA,yBAkBX;AAAA,SAjBWC,SAiBX,GAjBWA,SAiBX;AAAA,SAhBWC,WAgBX,GAhBWA,WAgBX;AAAA,SAPWC,WAOX,GAPWA,WAOX;AAAA,SANWC,eAMX,GANWA,eAMX;AAAA,SAFWC,iBAEX,GAFWA,iBAEX;AAAA,SADWC,oBACX,GADWA,oBACX;AAAE;;AAlDwB;AAqDhC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfiguration: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly uploadFrequency: string,\n readonly batchSize: string,\n readonly trackFrustrations: boolean,\n readonly trackBackgroundEvents: boolean,\n readonly customEndpoints: {\n rum?: string;\n trace?: string;\n logs?: string;\n },\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n reactVersion: string;\n reactNativeVersion: string;\n },\n readonly nativeViewTracking: boolean,\n readonly nativeInteractionTracking: boolean,\n readonly verbosity: string | undefined,\n readonly proxyConfig:\n | {\n type: string;\n address: string;\n port: number;\n username?: string;\n password?: string;\n }\n | undefined,\n readonly serviceName: string | undefined,\n readonly firstPartyHosts: {\n match: string;\n propagatorTypes: string[];\n }[],\n readonly bundleLogsWithRum: boolean,\n readonly bundleLogsWithTraces: boolean\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
1
+ {"version":3,"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces","exports"],"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yBAAkC,GAAlCA,yBAAkC;IAAA,KAClCC,SAA6B,GAA7BA,SAA6B;IAAA,KAC7BC,WAQM,GARNA,WAQM;IAAA,KACNC,WAA+B,GAA/BA,WAA+B;IAAA,KAC/BC,eAGN,GAHMA,eAGN;IAAA,KACMC,iBAA0B,GAA1BA,iBAA0B;IAAA,KAC1BC,oBAA6B,GAA7BA,oBAA6B;EACvC;AACP;;AAEA;AACA;AACA;;AA2BA;AACA;AACA;AAFAC,OAAA,CAAA5B,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -4,51 +4,43 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _DefaultTimeProvider = require("./time-provider/DefaultTimeProvider");
9
-
10
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ /*
9
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
11
+ * Copyright 2016-Present Datadog, Inc.
12
+ */
11
13
 
12
14
  const START_LABEL = '__start';
13
15
  const STOP_LABEL = '__stop';
16
+
14
17
  /**
15
18
  * Simple timer which records time ticks. Shouldn't be re-used once stopped.
16
19
  * All timestamps/durations returned are in milliseconds.
17
20
  */
18
-
19
21
  class Timer {
22
+ times = {};
20
23
  constructor(timeProvider = new _DefaultTimeProvider.DefaultTimeProvider()) {
21
- _defineProperty(this, "timeProvider", void 0);
22
-
23
- _defineProperty(this, "times", {});
24
-
25
24
  this.timeProvider = timeProvider;
26
25
  }
27
-
28
26
  get startTime() {
29
27
  return this.times[START_LABEL].unix;
30
28
  }
31
-
32
29
  get stopTime() {
33
30
  return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);
34
31
  }
35
-
36
32
  start() {
37
33
  this.recordTick(START_LABEL);
38
34
  }
39
-
40
35
  stop() {
41
36
  this.recordTick(STOP_LABEL);
42
37
  }
43
-
44
38
  recordTick(label) {
45
39
  this.times[label] = this.timeProvider.getTimestamp();
46
40
  }
47
-
48
41
  hasTickFor(label) {
49
42
  return label in this.times;
50
43
  }
51
-
52
44
  durationBetween(startLabel, endLabel) {
53
45
  this.checkLabelExists(startLabel);
54
46
  this.checkLabelExists(endLabel);
@@ -56,31 +48,24 @@ class Timer {
56
48
  const endTick = this.times[endLabel];
57
49
  return this.durationBetweenTicks(startTick, endTick);
58
50
  }
59
-
60
51
  timeAt(label) {
61
52
  this.checkLabelExists(label);
62
53
  return this.startTime + this.durationBetween(START_LABEL, label);
63
54
  }
64
-
65
55
  reset() {
66
56
  this.times = {};
67
57
  }
68
-
69
58
  durationBetweenTicks(start, end) {
70
59
  if (start.reactNative != null && end.reactNative != null) {
71
60
  return end.reactNative - start.reactNative;
72
61
  }
73
-
74
62
  return end.unix - start.unix;
75
63
  }
76
-
77
64
  checkLabelExists(label) {
78
65
  if (!this.hasTickFor(label)) {
79
66
  throw new Error(`Label ${label} is not registered`);
80
67
  }
81
68
  }
82
-
83
69
  }
84
-
85
70
  exports.default = Timer;
86
71
  //# sourceMappingURL=Timer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Timer.ts"],"names":["START_LABEL","STOP_LABEL","Timer","constructor","timeProvider","DefaultTimeProvider","startTime","times","unix","stopTime","durationBetween","start","recordTick","stop","label","getTimestamp","hasTickFor","startLabel","endLabel","checkLabelExists","startTick","endTick","durationBetweenTicks","timeAt","reset","end","reactNative","Error"],"mappings":";;;;;;;AAMA;;;;AAGA,MAAMA,WAAW,GAAG,SAApB;AACA,MAAMC,UAAU,GAAG,QAAnB;AAEA;AACA;AACA;AACA;;AACe,MAAMC,KAAN,CAAY;AAIvBC,EAAAA,WAAW,CAACC,YAA0B,GAAG,IAAIC,wCAAJ,EAA9B,EAAyD;AAAA;;AAAA,mCAFzB,EAEyB;;AAChE,SAAKD,YAAL,GAAoBA,YAApB;AACH;;AAEY,MAAT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,GAAG,CAACC,WAAJ,GAAkBf,KAAK,CAACe,WAA/B;AACH;;AACD,WAAOD,GAAG,CAACjB,IAAJ,GAAWG,KAAK,CAACH,IAAxB;AACH;;AAEOW,EAAAA,gBAAgB,CAACL,KAAD,EAAgB;AACpC,QAAI,CAAC,KAAKE,UAAL,CAAgBF,KAAhB,CAAL,EAA6B;AACzB,YAAM,IAAIa,KAAJ,CAAW,SAAQb,KAAM,oBAAzB,CAAN;AACH;AACJ;;AA/DsB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { DefaultTimeProvider } from './time-provider/DefaultTimeProvider';\nimport type { TimeProvider, Timestamp } from './time-provider/TimeProvider';\n\nconst START_LABEL = '__start';\nconst STOP_LABEL = '__stop';\n\n/**\n * Simple timer which records time ticks. Shouldn't be re-used once stopped.\n * All timestamps/durations returned are in milliseconds.\n */\nexport default class Timer {\n private timeProvider: TimeProvider;\n private times: Record<string, Timestamp> = {};\n\n constructor(timeProvider: TimeProvider = new DefaultTimeProvider()) {\n this.timeProvider = timeProvider;\n }\n\n get startTime(): number {\n return this.times[START_LABEL].unix;\n }\n\n get stopTime(): number {\n return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);\n }\n\n start(): void {\n this.recordTick(START_LABEL);\n }\n\n stop(): void {\n this.recordTick(STOP_LABEL);\n }\n\n recordTick(label: string): void {\n this.times[label] = this.timeProvider.getTimestamp();\n }\n\n hasTickFor(label: string): boolean {\n return label in this.times;\n }\n\n durationBetween(startLabel: string, endLabel: string): number {\n this.checkLabelExists(startLabel);\n this.checkLabelExists(endLabel);\n\n const startTick = this.times[startLabel];\n const endTick = this.times[endLabel];\n\n return this.durationBetweenTicks(startTick, endTick);\n }\n\n timeAt(label: string): number {\n this.checkLabelExists(label);\n\n return this.startTime + this.durationBetween(START_LABEL, label);\n }\n\n reset(): void {\n this.times = {};\n }\n\n private durationBetweenTicks(start: Timestamp, end: Timestamp): number {\n if (start.reactNative != null && end.reactNative != null) {\n return end.reactNative - start.reactNative;\n }\n return end.unix - start.unix;\n }\n\n private checkLabelExists(label: string) {\n if (!this.hasTickFor(label)) {\n throw new Error(`Label ${label} is not registered`);\n }\n }\n}\n"]}
1
+ {"version":3,"names":["_DefaultTimeProvider","require","START_LABEL","STOP_LABEL","Timer","times","constructor","timeProvider","DefaultTimeProvider","startTime","unix","stopTime","durationBetween","start","recordTick","stop","label","getTimestamp","hasTickFor","startLabel","endLabel","checkLabelExists","startTick","endTick","durationBetweenTicks","timeAt","reset","end","reactNative","Error","exports","default"],"sourceRoot":"../../../src","sources":["utils/Timer.ts"],"mappings":";;;;;;AAMA,IAAAA,oBAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAKA,MAAMC,WAAW,GAAG,SAAS;AAC7B,MAAMC,UAAU,GAAG,QAAQ;;AAE3B;AACA;AACA;AACA;AACe,MAAMC,KAAK,CAAC;EAEfC,KAAK,GAA8B,CAAC,CAAC;EAE7CC,WAAWA,CAACC,YAA0B,GAAG,IAAIC,wCAAmB,CAAC,CAAC,EAAE;IAChE,IAAI,CAACD,YAAY,GAAGA,YAAY;EACpC;EAEA,IAAIE,SAASA,CAAA,EAAW;IACpB,OAAO,IAAI,CAACJ,KAAK,CAACH,WAAW,CAAC,CAACQ,IAAI;EACvC;EAEA,IAAIC,QAAQA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACF,SAAS,GAAG,IAAI,CAACG,eAAe,CAACV,WAAW,EAAEC,UAAU,CAAC;EACzE;EAEAU,KAAKA,CAAA,EAAS;IACV,IAAI,CAACC,UAAU,CAACZ,WAAW,CAAC;EAChC;EAEAa,IAAIA,CAAA,EAAS;IACT,IAAI,CAACD,UAAU,CAACX,UAAU,CAAC;EAC/B;EAEAW,UAAUA,CAACE,KAAa,EAAQ;IAC5B,IAAI,CAACX,KAAK,CAACW,KAAK,CAAC,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ty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.validateContext = void 0;
7
-
8
7
  var _InternalLog = require("../InternalLog");
9
-
10
8
  var _SdkVerbosity = require("../SdkVerbosity");
11
-
12
9
  /* eslint-disable @typescript-eslint/ban-ts-comment */
13
-
14
10
  /*
15
11
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
16
12
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
17
13
  * Copyright 2016-Present Datadog, Inc.
18
14
  */
15
+
19
16
  const validateContext = context => {
20
17
  if (!context) {
21
18
  return {};
22
- } // eslint-disable-next-line eqeqeq
23
-
19
+ }
24
20
 
21
+ // eslint-disable-next-line eqeqeq
25
22
  if (context.constructor == Object) {
26
23
  return context;
27
24
  }
28
-
29
25
  if (Array.isArray(context)) {
30
26
  _InternalLog.InternalLog.log("The given context is an array, it will be nested in 'context' property inside a new object.", _SdkVerbosity.SdkVerbosity.WARN);
31
-
32
27
  return {
33
28
  context
34
29
  };
35
30
  }
36
-
37
31
  _InternalLog.InternalLog.log(`The given context (${context}) is invalid - it must be an object. Context will be empty.`, _SdkVerbosity.SdkVerbosity.ERROR);
38
-
39
32
  return {};
40
33
  };
41
-
42
34
  exports.validateContext = validateContext;
43
35
  //# sourceMappingURL=argsUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["argsUtils.ts"],"names":["validateContext","context","constructor","Object","Array","isArray","InternalLog","log","SdkVerbosity","WARN","ERROR"],"mappings":";;;;;;;AAOA;;AACA;;AARA;;AACA;AACA;AACA;AACA;AACA;AAKO,MAAMA,eAAe,GAAIC,OAAD,IAAkB;AAC7C,MAAI,CAACA,OAAL,EAAc;AACV,WAAO,EAAP;AACH,GAH4C,CAK7C;;;AACA,MAAIA,OAAO,CAACC,WAAR,IAAuBC,MAA3B,EAAmC;AAC/B,WAAOF,OAAP;AACH;;AAED,MAAIG,KAAK,CAACC,OAAN,CAAcJ,OAAd,CAAJ,EAA4B;AACxBK,6BAAYC,GAAZ,CACI,6FADJ,EAEIC,2BAAaC,IAFjB;;AAIA,WAAO;AAAER,MAAAA;AAAF,KAAP;AACH;;AAEDK,2BAAYC,GAAZ,CACK,sBAAqBN,OAAQ,6DADlC,EAEIO,2BAAaE,KAFjB;;AAKA,SAAO,EAAP;AACH,CAxBM","sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\n\nexport const validateContext = (context: any) => {\n if (!context) {\n return {};\n }\n\n // eslint-disable-next-line eqeqeq\n if (context.constructor == Object) {\n return context;\n }\n\n if (Array.isArray(context)) {\n InternalLog.log(\n \"The given context is an array, it will be nested in 'context' property inside a new object.\",\n SdkVerbosity.WARN\n );\n return { context };\n }\n\n InternalLog.log(\n `The given context (${context}) is invalid - it must be an object. Context will be empty.`,\n SdkVerbosity.ERROR\n );\n\n return {};\n};\n"]}
1
+ {"version":3,"names":["_InternalLog","require","_SdkVerbosity","validateContext","context","constructor","Object","Array","isArray","InternalLog","log","SdkVerbosity","WARN","ERROR","exports"],"sourceRoot":"../../../src","sources":["utils/argsUtils.ts"],"mappings":";;;;;;AAOA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAME,eAAe,GAAIC,OAAY,IAAK;EAC7C,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,CAAC,CAAC;EACb;;EAEA;EACA,IAAIA,OAAO,CAACC,WAAW,IAAIC,MAAM,EAAE;IAC/B,OAAOF,OAAO;EAClB;EAEA,IAAIG,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;IACxBK,wBAAW,CAACC,GAAG,CACX,6FAA6F,EAC7FC,0BAAY,CAACC,IACjB,CAAC;IACD,OAAO;MAAER;IAAQ,CAAC;EACtB;EAEAK,wBAAW,CAACC,GAAG,CACX,sBAAsBN,OAAO,6DAA6D,EAC1FO,0BAAY,CAACE,KACjB,CAAC;EAED,OAAO,CAAC,CAAC;AACb,CAAC;AAACC,OAAA,CAAAX,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -3,23 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getErrorName = exports.getErrorStackTrace = exports.getErrorMessage = exports.DEFAULT_ERROR_NAME = exports.EMPTY_STACK_TRACE = exports.EMPTY_MESSAGE = void 0;
7
-
6
+ exports.getErrorStackTrace = exports.getErrorName = exports.getErrorMessage = exports.EMPTY_STACK_TRACE = exports.EMPTY_MESSAGE = exports.DEFAULT_ERROR_NAME = void 0;
8
7
  /*
9
8
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
9
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
11
10
  * Copyright 2016-Present Datadog, Inc.
12
11
  */
13
- const EMPTY_MESSAGE = 'Unknown Error';
14
- exports.EMPTY_MESSAGE = EMPTY_MESSAGE;
15
- const EMPTY_STACK_TRACE = '';
16
- exports.EMPTY_STACK_TRACE = EMPTY_STACK_TRACE;
17
- const DEFAULT_ERROR_NAME = 'Error';
18
- exports.DEFAULT_ERROR_NAME = DEFAULT_ERROR_NAME;
19
12
 
13
+ const EMPTY_MESSAGE = exports.EMPTY_MESSAGE = 'Unknown Error';
14
+ const EMPTY_STACK_TRACE = exports.EMPTY_STACK_TRACE = '';
15
+ const DEFAULT_ERROR_NAME = exports.DEFAULT_ERROR_NAME = 'Error';
20
16
  const getErrorMessage = error => {
21
17
  let message = EMPTY_MESSAGE;
22
-
23
18
  if (error === undefined || error === null) {
24
19
  message = EMPTY_MESSAGE;
25
20
  } else if (typeof error === 'object' && 'message' in error) {
@@ -27,9 +22,9 @@ const getErrorMessage = error => {
27
22
  } else {
28
23
  message = String(error);
29
24
  }
30
-
31
25
  return message;
32
26
  };
27
+
33
28
  /**
34
29
  * Will extract the stack from the error, taking the first key found among:
35
30
  * `stacktrace`, `stack`, `componentStack` (component tree for component errors,
@@ -38,13 +33,9 @@ const getErrorMessage = error => {
38
33
  * In last resort and if `sourceURL`, `line` and `column` are present, it will
39
34
  * generate a stack from this information.
40
35
  */
41
-
42
-
43
36
  exports.getErrorMessage = getErrorMessage;
44
-
45
37
  const getErrorStackTrace = error => {
46
38
  let stack = EMPTY_STACK_TRACE;
47
-
48
39
  try {
49
40
  if (error === undefined || error === null) {
50
41
  stack = EMPTY_STACK_TRACE;
@@ -61,28 +52,24 @@ const getErrorStackTrace = error => {
61
52
  stack = `at ${error.sourceURL}:${error.line}:${error.column}`;
62
53
  }
63
54
  }
64
- } catch (e) {// Do nothing
55
+ } catch (e) {
56
+ // Do nothing
65
57
  }
66
-
67
58
  return stack;
68
59
  };
69
-
70
60
  exports.getErrorStackTrace = getErrorStackTrace;
71
-
72
61
  const getErrorName = error => {
73
62
  try {
74
63
  if (typeof error !== 'object' || error === null) {
75
64
  return DEFAULT_ERROR_NAME;
76
65
  }
77
-
78
66
  if (typeof error.name === 'string') {
79
67
  return error.name;
80
68
  }
81
- } catch (e) {// Do nothing
69
+ } catch (e) {
70
+ // Do nothing
82
71
  }
83
-
84
72
  return DEFAULT_ERROR_NAME;
85
73
  };
86
-
87
74
  exports.getErrorName = getErrorName;
88
75
  //# sourceMappingURL=errorUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["errorUtils.ts"],"names":["EMPTY_MESSAGE","EMPTY_STACK_TRACE","DEFAULT_ERROR_NAME","getErrorMessage","error","message","undefined","String","getErrorStackTrace","stack","stacktrace","componentStack","sourceURL","line","column","e","getErrorName","name"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEO,MAAMA,aAAa,GAAG,eAAtB;;AACA,MAAMC,iBAAiB,GAAG,EAA1B;;AACA,MAAMC,kBA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AK,GAAI,MAAKL,KAAK,CAACQ,SAAU,IAAGR,KAAK,CAACS,IAAK,IAAGT,KAAK,CAACU,MAAO,EAA5D;AACH;AACJ;AACJ,GApBD,CAoBE,OAAOC,CAAP,EAAU,CACR;AACH;;AACD,SAAON,KAAP;AACH,CA3BM;;;;AA6BA,MAAMO,YAAY,GAAIZ,KAAD,IAA4B;AACpD,MAAI;AACA,QAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,KAAK,IAA3C,EAAiD;AAC7C,aAAOF,kBAAP;AACH;;AACD,QAAI,OAAQE,KAAD,CAAea,IAAtB,KAA+B,QAAnC,EAA6C;AACzC,aAAQb,KAAD,CAAea,IAAtB;AACH;AACJ,GAPD,CAOE,OAAOF,CAAP,EAAU,CACR;AACH;;AACD,SAAOb,kBAAP;AACH,CAZM","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nexport const EMPTY_MESSAGE = 'Unknown Error';\nexport const EMPTY_STACK_TRACE = '';\nexport const DEFAULT_ERROR_NAME = 'Error';\n\nexport const getErrorMessage = (error: any | undefined): string => {\n let message = EMPTY_MESSAGE;\n if (error === undefined || error === null) {\n message = EMPTY_MESSAGE;\n } else if (typeof error === 'object' && 'message' in error) {\n message = String(error.message);\n } else {\n message = String(error);\n }\n\n return message;\n};\n\n/**\n * Will extract the stack from the error, taking the first key found among:\n * `stacktrace`, `stack`, `componentStack` (component tree for component errors,\n * which contains only native components names in production).\n *\n * In last resort and if `sourceURL`, `line` and `column` are present, it will\n * generate a stack from this information.\n */\nexport const getErrorStackTrace = (error: any | undefined): string => {\n let stack = EMPTY_STACK_TRACE;\n\n try {\n if (error === undefined || error === null) {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'string') {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'object') {\n if ('stacktrace' in error) {\n stack = String(error.stacktrace);\n } else if ('stack' in error) {\n stack = String(error.stack);\n } else if ('componentStack' in error) {\n stack = String(error.componentStack);\n } else if (\n 'sourceURL' in error &&\n 'line' in error &&\n 'column' in error\n ) {\n stack = `at ${error.sourceURL}:${error.line}:${error.column}`;\n }\n }\n } catch (e) {\n // Do nothing\n }\n return stack;\n};\n\nexport const getErrorName = (error: unknown): string => {\n try {\n if (typeof error !== 'object' || error === null) {\n return DEFAULT_ERROR_NAME;\n }\n if (typeof (error as any).name === 'string') {\n return (error as any).name;\n }\n } catch (e) {\n // Do nothing\n }\n return DEFAULT_ERROR_NAME;\n};\n"]}
1
+ {"version":3,"names":["EMPTY_MESSAGE","exports","EMPTY_STACK_TRACE","DEFAULT_ERROR_NAME","getErrorMessage","error","message","undefined","String","getErrorStackTrace","stack","stacktrace","componentStack","sourceURL","line","column","e","getErrorName","name"],"sourceRoot":"../../../src","sources":["utils/errorUtils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,eAAe;AACrC,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,EAAE;AAC5B,MAAMC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,GAAG,OAAO;AAElC,MAAMC,eAAe,GAAIC,KAAsB,IAAa;EAC/D,IAAIC,OAAO,GAAGN,aAAa;EAC3B,IAAIK,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACvCC,OAAO,GAAGN,aAAa;EAC3B,CAAC,MAAM,IAAI,OAAOK,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAIA,KAAK,EAAE;IACxDC,OAAO,GAAGE,MAAM,CAACH,KAAK,CAACC,OAAO,CAAC;EACnC,CAAC,MAAM;IACHA,OAAO,GAAGE,MAAM,CAACH,KAAK,CAAC;EAC3B;EAEA,OAAOC,OAAO;AAClB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA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OAAQb,KAAK,CAASa,IAAI;IAC9B;EACJ,CAAC,CAAC,OAAOF,CAAC,EAAE;IACR;EAAA;EAEJ,OAAOb,kBAAkB;AAC7B,CAAC;AAACF,OAAA,CAAAgB,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.executeWithDelay = void 0;
7
-
8
7
  /*
9
8
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
9
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
11
10
  * Copyright 2016-Present Datadog, Inc.
12
11
  */
12
+
13
13
  const executeWithDelay = async (callback, delay) => {
14
14
  return new Promise((resolve, reject) => {
15
15
  setTimeout(() => {
@@ -21,6 +21,5 @@ const executeWithDelay = async (callback, delay) => {
21
21
  }, delay);
22
22
  });
23
23
  };
24
-
25
24
  exports.executeWithDelay = executeWithDelay;
26
25
  //# sourceMappingURL=jsUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["jsUtils.ts"],"names":["executeWithDelay","callback","delay","Promise","resolve","reject","setTimeout","e"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEO,MAAMA,gBAAgB,GAAG,OAC5BC,QAD4B,EAE5BC,KAF4B,KAGf;AACb,SAAO,IAAIC,OAAJ,CAAe,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACvCC,IAAAA,UAAU,CAAC,MAAM;AACb,UAAI;AACAF,QAAAA,OAAO,CAACH,QAAQ,EAAT,CAAP;AACH,OAFD,CAEE,OAAOM,CAAP,EAAU;AACRF,QAAAA,MAAM,CAACE,CAAD,CAAN;AACH;AACJ,KANS,EAMPL,KANO,CAAV;AAOH,GARM,CAAP;AASH,CAbM","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nexport const executeWithDelay = async <T>(\n callback: () => T,\n delay: number\n): Promise<T> => {\n return new Promise<T>((resolve, reject) => {\n setTimeout(() => {\n try {\n resolve(callback());\n } catch (e) {\n reject(e);\n }\n }, delay);\n });\n};\n"]}
1
+ {"version":3,"names":["executeWithDelay","callback","delay","Promise","resolve","reject","setTimeout","e","exports"],"sourceRoot":"../../../src","sources":["utils/jsUtils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,gBAAgB,GAAG,MAAAA,CAC5BC,QAAiB,EACjBC,KAAa,KACA;EACb,OAAO,IAAIC,OAAO,CAAI,CAACC,OAAO,EAAEC,MAAM,KAAK;IACvCC,UAAU,CAAC,MAAM;MACb,IAAI;QACAF,OAAO,CAACH,QAAQ,CAAC,CAAC,CAAC;MACvB,CAAC,CAAC,OAAOM,CAAC,EAAE;QACRF,MAAM,CAACE,CAAC,CAAC;MACb;IACJ,CAAC,EAAEL,KAAK,CAAC;EACb,CAAC,CAAC;AACN,CAAC;AAACM,OAAA,CAAAR,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -4,37 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.adaptLongTaskThreshold = void 0;
7
-
8
7
  /**
9
8
  * 100ms is the lower bound for a noticeable long task event.
10
9
  */
11
10
  const MIN_LONG_TASK_THRESHOLD_MS = 100;
11
+
12
12
  /**
13
13
  * 5000ms is considered an Application Not Responding (ANR) event.
14
14
  */
15
-
16
15
  const MAX_LONG_TASK_THRESHOLD_MS = 5000;
16
+
17
17
  /**
18
18
  * Makes sure the long task threshold value is above 100 and below 5000.
19
19
  * Also makes sure it is a number, passing `0` if it is `false`, as the React Native
20
20
  * bridge cannot handle values with dual types.
21
21
  */
22
-
23
22
  const adaptLongTaskThreshold = longTaskThreshold => {
24
23
  if (!longTaskThreshold) {
25
24
  return 0;
26
25
  }
27
-
28
26
  if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) {
29
27
  return MIN_LONG_TASK_THRESHOLD_MS;
30
28
  }
31
-
32
29
  if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) {
33
30
  return MAX_LONG_TASK_THRESHOLD_MS;
34
31
  }
35
-
36
32
  return longTaskThreshold;
37
33
  };
38
-
39
34
  exports.adaptLongTaskThreshold = adaptLongTaskThreshold;
40
35
  //# sourceMappingURL=longTasksUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["longTasksUtils.ts"],"names":["MIN_LONG_TASK_THRESHOLD_MS","MAX_LONG_TASK_THRESHOLD_MS","adaptLongTaskThreshold","longTaskThreshold"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA,MAAMA,0BAA0B,GAAG,GAAnC;AAEA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,IAAnC;AAEA;AACA;AACA;AACA;AACA;;AACO,MAAMC,sBAAsB,GAC/BC,iBADkC,IAEzB;AACT,MAAI,CAACA,iBAAL,EAAwB;AACpB,WAAO,CAAP;AACH;;AACD,MAAIA,iBAAiB,GAAGH,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AACD,MAAIG,iBAAiB,GAAGF,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AAED,SAAOE,iBAAP;AACH,CAdM","sourcesContent":["/**\n * 100ms is the lower bound for a noticeable long task event.\n */\nconst MIN_LONG_TASK_THRESHOLD_MS = 100;\n\n/**\n * 5000ms is considered an Application Not Responding (ANR) event.\n */\nconst MAX_LONG_TASK_THRESHOLD_MS = 5000;\n\n/**\n * Makes sure the long task threshold value is above 100 and below 5000.\n * Also makes sure it is a number, passing `0` if it is `false`, as the React Native\n * bridge cannot handle values with dual types.\n */\nexport const adaptLongTaskThreshold = (\n longTaskThreshold: number | false\n): number => {\n if (!longTaskThreshold) {\n return 0;\n }\n if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) {\n return MIN_LONG_TASK_THRESHOLD_MS;\n }\n if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) {\n return MAX_LONG_TASK_THRESHOLD_MS;\n }\n\n return longTaskThreshold;\n};\n"]}
1
+ {"version":3,"names":["MIN_LONG_TASK_THRESHOLD_MS","MAX_LONG_TASK_THRESHOLD_MS","adaptLongTaskThreshold","longTaskThreshold","exports"],"sourceRoot":"../../../src","sources":["utils/longTasksUtils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA,MAAMA,0BAA0B,GAAG,GAAG;;AAEtC;AACA;AACA;AACA,MAAMC,0BAA0B,GAAG,IAAI;;AAEvC;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAC/BC,iBAAiC,IACxB;EACT,IAAI,CAACA,iBAAiB,EAAE;IACpB,OAAO,CAAC;EACZ;EACA,IAAIA,iBAAiB,GAAGH,0BAA0B,EAAE;IAChD,OAAOA,0BAA0B;EACrC;EACA,IAAIG,iBAAiB,GAAGF,0BAA0B,EAAE;IAChD,OAAOA,0BAA0B;EACrC;EAEA,OAAOE,iBAAiB;AAC5B,CAAC;AAACC,OAAA,CAAAF,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -4,38 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DefaultTimeProvider = void 0;
7
-
8
7
  var _TimeProvider = require("./TimeProvider");
9
-
10
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ /*
9
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
11
+ * Copyright 2016-Present Datadog, Inc.
12
+ */
11
13
 
12
14
  class DefaultTimeProvider extends _TimeProvider.TimeProvider {
13
- constructor(...args) {
14
- super(...args);
15
-
16
- _defineProperty(this, "canUsePerformanceNow", // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
- // @ts-ignore
18
- global.performance && typeof performance.now === 'function');
19
- }
20
-
15
+ canUsePerformanceNow =
16
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
+ // @ts-ignore
18
+ global.performance && typeof performance.now === 'function';
21
19
  getTimestamp() {
22
20
  return {
23
21
  unix: Date.now(),
24
22
  reactNative: this.performanceNow()
25
23
  };
26
24
  }
27
-
28
25
  performanceNow() {
29
26
  if (this.canUsePerformanceNow) {
30
27
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
31
28
  // @ts-ignore
32
29
  return performance.now();
33
30
  }
34
-
35
31
  return null;
36
32
  }
37
-
38
33
  }
39
-
40
34
  exports.DefaultTimeProvider = DefaultTimeProvider;
41
35
  //# sourceMappingURL=DefaultTimeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DefaultTimeProvider.tsx"],"names":["DefaultTimeProvider","TimeProvider","global","performance","now","getTimestamp","unix","Date","reactNative","performanceNow","canUsePerformanceNow"],"mappings":";;;;;;;AAMA;;;;AAGO,MAAMA,mBAAN,SAAkCC,0BAAlC,CAA+C;AAAA;AAAA;;AAAA,kDAE9C;AACA;AACAC,IAAAA,MAAM,CAACC,WAAP,IAAsB,OAAOA,WAAW,CAACC,GAAnB,KAA2B,UAJH;AAAA;;AAMlDC,EAAAA,YAAY,GAAc;AACtB,WAAO;AACHC,MAAAA,IAAI,EAAEC,IAAI,CAACH,GAAL,EADH;AAEHI,MAAAA,WAAW,EAAE,KAAKC,cAAL;AAFV,KAAP;AAIH;;AAEOA,EAAAA,cAAc,GAAkB;AACpC,QAAI,KAAKC,oBAAT,EAA+B;AAC3B;AACA;AACA,aAAOP,WAAW,CAACC,GAAZ,EAAP;AACH;;AACD,WAAO,IAAP;AACH;;AApBiD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { TimeProvider } from './TimeProvider';\nimport type { Timestamp } from './TimeProvider';\n\nexport class DefaultTimeProvider extends TimeProvider {\n private canUsePerformanceNow =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n global.performance && typeof performance.now === 'function';\n\n getTimestamp(): Timestamp {\n return {\n unix: Date.now(),\n reactNative: this.performanceNow()\n };\n }\n\n private performanceNow(): number | null {\n if (this.canUsePerformanceNow) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return performance.now();\n }\n return null;\n }\n}\n"]}
1
+ {"version":3,"names":["_TimeProvider","require","DefaultTimeProvider","TimeProvider","canUsePerformanceNow","global","performance","now","getTimestamp","unix","Date","reactNative","performanceNow","exports"],"sourceRoot":"../../../../src","sources":["utils/time-provider/DefaultTimeProvider.tsx"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAKO,MAAMC,mBAAmB,SAASC,0BAAY,CAAC;EAC1CC,oBAAoB;EACxB;EACA;EACAC,MAAM,CAACC,WAAW,IAAI,OAAOA,WAAW,CAACC,GAAG,KAAK,UAAU;EAE/DC,YAAYA,CAAA,EAAc;IACtB,OAAO;MACHC,IAAI,EAAEC,IAAI,CAACH,GAAG,CAAC,CAAC;MAChBI,WAAW,EAAE,IAAI,CAACC,cAAc,CAAC;IACrC,CAAC;EACL;EAEQA,cAAcA,CAAA,EAAkB;IACpC,IAAI,IAAI,CAACR,oBAAoB,EAAE;MAC3B;MACA;MACA,OAAOE,WAAW,CAACC,GAAG,CAAC,CAAC;IAC5B;IACA,OAAO,IAAI;EACf;AACJ;AAACM,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TimeProvider = void 0;
7
-
8
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
-
10
7
  /*
11
8
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
12
9
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
@@ -23,33 +20,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
23
20
  */
24
21
  class TimeProvider {
25
22
  /** Keeps an average offset between the unix time and the provided timestamp. */
26
- constructor() {
27
- _defineProperty(this, "baseOffset", void 0);
28
23
 
24
+ constructor() {
29
25
  const timestamp = this.getTimestamp();
30
-
31
26
  if (timestamp.reactNative == null) {
32
27
  this.baseOffset = 0;
33
28
  } else {
34
29
  this.baseOffset = timestamp.unix - timestamp.reactNative;
35
30
  }
36
31
  }
37
-
38
32
  now() {
39
33
  const timestamp = this.getTimestamp();
40
-
41
34
  if (timestamp.reactNative != null && this.baseOffset === 0) {
42
35
  this.baseOffset = timestamp.unix - timestamp.reactNative;
43
36
  }
44
-
45
37
  if (timestamp.reactNative == null || this.baseOffset === 0) {
46
38
  return timestamp.unix;
47
39
  } else {
48
40
  return this.baseOffset + timestamp.reactNative;
49
41
  }
50
42
  }
51
-
52
43
  }
53
-
54
44
  exports.TimeProvider = TimeProvider;
55
45
  //# sourceMappingURL=TimeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["TimeProvider.tsx"],"names":["TimeProvider","constructor","timestamp","getTimestamp","reactNative","baseOffset","unix","now"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AASA;AACA;AACA;AACA;AACO,MAAeA,YAAf,CAA4B;AAC/B;AAGAC,EAAAA,WAAW,GAAG;AAAA;;AACV,UAAMC,SAAS,GAAG,KAAKC,YAAL,EAAlB;;AACA,QAAID,SAAS,CAACE,WAAV,IAAyB,IAA7B,EAAmC;AAC/B,WAAKC,UAAL,GAAkB,CAAlB;AACH,KAFD,MAEO;AACH,WAAKA,UAAL,GAAkBH,SAAS,CAACI,IAAV,GAAiBJ,SAAS,CAACE,WAA7C;AACH;AACJ;;AAIDG,EAAAA,GAAG,GAAW;AACV,UAAML,SAAS,GAAG,KAAKC,YAAL,EAAlB;;AAEA,QAAID,SAAS,CAACE,WAAV,IAAyB,IAAzB,IAAiC,KAAKC,UAAL,KAAoB,CAAzD,EAA4D;AACxD,WAAKA,UAAL,GAAkBH,SAAS,CAACI,IAAV,GAAiBJ,SAAS,CAACE,WAA7C;AACH;;AAED,QAAIF,SAAS,CAACE,WAAV,IAAyB,IAAzB,IAAiC,KAAKC,UAAL,KAAoB,CAAzD,EAA4D;AACxD,aAAOH,SAAS,CAACI,IAAjB;AACH,KAFD,MAEO;AACH,aAAO,KAAKD,UAAL,GAAkBH,SAAS,CAACE,WAAnC;AACH;AACJ;;AA3B8B","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A Timestamp structure holding the\n */\nexport type Timestamp = {\n // Result of Date API. Unix timestamp in ms.\n unix: number;\n // Result of performance.now API. Timestamp in ms (with microsecond precision)\n // since JS context start.\n reactNative: number | null;\n};\n\n/**\n * Simple class providing timestamps in milliseconds.\n * If available, it will use the `performance.now()` method, and will fallback on `Date.now()` otherwise.\n */\nexport abstract class TimeProvider {\n /** Keeps an average offset between the unix time and the provided timestamp. */\n protected baseOffset: number;\n\n constructor() {\n const timestamp = this.getTimestamp();\n if (timestamp.reactNative == null) {\n this.baseOffset = 0;\n } else {\n this.baseOffset = timestamp.unix - timestamp.reactNative;\n }\n }\n\n abstract getTimestamp(): Timestamp;\n\n now(): number {\n const timestamp = this.getTimestamp();\n\n if (timestamp.reactNative != null && this.baseOffset === 0) {\n this.baseOffset = timestamp.unix - timestamp.reactNative;\n }\n\n if (timestamp.reactNative == null || this.baseOffset === 0) {\n return timestamp.unix;\n } else {\n return this.baseOffset + timestamp.reactNative;\n }\n }\n}\n"]}
1
+ {"version":3,"names":["TimeProvider","constructor","timestamp","getTimestamp","reactNative","baseOffset","unix","now","exports"],"sourceRoot":"../../../../src","sources":["utils/time-provider/TimeProvider.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AASA;AACA;AACA;AACA;AACO,MAAeA,YAAY,CAAC;EAC/B;;EAGAC,WAAWA,CAAA,EAAG;IACV,MAAMC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;IACrC,IAAID,SAAS,CAACE,WAAW,IAAI,IAAI,EAAE;MAC/B,IAAI,CAACC,UAAU,GAAG,CAAC;IACvB,CAAC,MAAM;MACH,IAAI,CAACA,UAAU,GAAGH,SAAS,CAACI,IAAI,GAAGJ,SAAS,CAACE,WAAW;IAC5D;EACJ;EAIAG,GAAGA,CAAA,EAAW;IACV,MAAML,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;IAErC,IAAID,SAAS,CAACE,WAAW,IAAI,IAAI,IAAI,IAAI,CAACC,UAAU,KAAK,CAAC,EAAE;MACxD,IAAI,CAACA,UAAU,GAAGH,SAAS,CAACI,IAAI,GAAGJ,SAAS,CAACE,WAAW;IAC5D;IAEA,IAAIF,SAAS,CAACE,WAAW,IAAI,IAAI,IAAI,IAAI,CAACC,UAAU,KAAK,CAAC,EAAE;MACxD,OAAOH,SAAS,CAACI,IAAI;IACzB,CAAC,MAAM;MACH,OAAO,IAAI,CAACD,UAAU,GAAGH,SAAS,CAACE,WAAW;IAClD;EACJ;AACJ;AAACI,OAAA,CAAAR,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -5,6 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = '2.4.1';
9
- exports.version = version;
8
+ const version = exports.version = '2.4.3';
10
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.4.1';\n"]}
1
+ {"version":3,"names":["version","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,OAAO","ignoreList":[]}