@sentry/react-native 6.15.0 → 7.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +11 -14
  3. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  4. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  5. package/dist/js/NativeRNSentry.js.map +1 -1
  6. package/dist/js/client.d.ts.map +1 -1
  7. package/dist/js/client.js +5 -1
  8. package/dist/js/client.js.map +1 -1
  9. package/dist/js/feedback/FeedbackButton.d.ts.map +1 -1
  10. package/dist/js/feedback/FeedbackButton.js +1 -1
  11. package/dist/js/feedback/FeedbackButton.js.map +1 -1
  12. package/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  13. package/dist/js/feedback/FeedbackWidget.d.ts.map +1 -1
  14. package/dist/js/feedback/FeedbackWidget.js +60 -46
  15. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  16. package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +1 -1
  17. package/dist/js/feedback/FeedbackWidget.styles.js.map +1 -1
  18. package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +1 -1
  19. package/dist/js/feedback/FeedbackWidget.theme.js.map +1 -1
  20. package/dist/js/feedback/FeedbackWidget.types.d.ts +30 -30
  21. package/dist/js/feedback/FeedbackWidget.types.d.ts.map +1 -1
  22. package/dist/js/feedback/FeedbackWidget.types.js.map +1 -1
  23. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
  24. package/dist/js/feedback/FeedbackWidgetManager.js +6 -3
  25. package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
  26. package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -1
  27. package/dist/js/feedback/FeedbackWidgetProvider.js +9 -10
  28. package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
  29. package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -1
  30. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  31. package/dist/js/feedback/defaults.d.ts +1 -1
  32. package/dist/js/feedback/defaults.d.ts.map +1 -1
  33. package/dist/js/feedback/defaults.js.map +1 -1
  34. package/dist/js/feedback/integration.d.ts +1 -1
  35. package/dist/js/feedback/integration.d.ts.map +1 -1
  36. package/dist/js/feedback/integration.js +1 -1
  37. package/dist/js/feedback/integration.js.map +1 -1
  38. package/dist/js/feedback/lazy.d.ts.map +1 -1
  39. package/dist/js/feedback/lazy.js.map +1 -1
  40. package/dist/js/feedback/utils.d.ts.map +1 -1
  41. package/dist/js/feedback/utils.js +2 -2
  42. package/dist/js/feedback/utils.js.map +1 -1
  43. package/dist/js/index.d.ts +3 -3
  44. package/dist/js/index.d.ts.map +1 -1
  45. package/dist/js/index.js +2 -2
  46. package/dist/js/index.js.map +1 -1
  47. package/dist/js/integrations/appRegistry.d.ts.map +1 -1
  48. package/dist/js/integrations/appRegistry.js.map +1 -1
  49. package/dist/js/integrations/breadcrumbs.d.ts +47 -0
  50. package/dist/js/integrations/breadcrumbs.d.ts.map +1 -0
  51. package/dist/js/integrations/breadcrumbs.js +15 -0
  52. package/dist/js/integrations/breadcrumbs.js.map +1 -0
  53. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  54. package/dist/js/integrations/debugsymbolicator.js +2 -1
  55. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  56. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  57. package/dist/js/integrations/debugsymbolicatorutils.js +12 -2
  58. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  59. package/dist/js/integrations/default.d.ts.map +1 -1
  60. package/dist/js/integrations/default.js +9 -5
  61. package/dist/js/integrations/default.js.map +1 -1
  62. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  63. package/dist/js/integrations/devicecontext.js.map +1 -1
  64. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  65. package/dist/js/integrations/expocontext.js.map +1 -1
  66. package/dist/js/integrations/exports.d.ts +2 -1
  67. package/dist/js/integrations/exports.d.ts.map +1 -1
  68. package/dist/js/integrations/exports.js +2 -1
  69. package/dist/js/integrations/exports.js.map +1 -1
  70. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  71. package/dist/js/integrations/modulesloader.js.map +1 -1
  72. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  73. package/dist/js/integrations/nativelinkederrors.js +4 -3
  74. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  75. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
  76. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  77. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
  78. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  79. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  80. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  81. package/dist/js/integrations/release.d.ts.map +1 -1
  82. package/dist/js/integrations/release.js.map +1 -1
  83. package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
  84. package/dist/js/integrations/rewriteframes.js.map +1 -1
  85. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  86. package/dist/js/integrations/screenshot.js +3 -3
  87. package/dist/js/integrations/screenshot.js.map +1 -1
  88. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  89. package/dist/js/integrations/sdkinfo.js.map +1 -1
  90. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  91. package/dist/js/integrations/spotlight.js +8 -4
  92. package/dist/js/integrations/spotlight.js.map +1 -1
  93. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  94. package/dist/js/integrations/viewhierarchy.js +2 -1
  95. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  96. package/dist/js/options.d.ts +8 -1
  97. package/dist/js/options.d.ts.map +1 -1
  98. package/dist/js/options.js.map +1 -1
  99. package/dist/js/profiling/cache.d.ts +1 -1
  100. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  101. package/dist/js/profiling/convertHermesProfile.js +18 -5
  102. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  103. package/dist/js/profiling/debugid.d.ts.map +1 -1
  104. package/dist/js/profiling/debugid.js +9 -1
  105. package/dist/js/profiling/debugid.js.map +1 -1
  106. package/dist/js/profiling/hermes.d.ts +1 -1
  107. package/dist/js/profiling/hermes.d.ts.map +1 -1
  108. package/dist/js/profiling/hermes.js.map +1 -1
  109. package/dist/js/profiling/integration.d.ts.map +1 -1
  110. package/dist/js/profiling/integration.js +2 -1
  111. package/dist/js/profiling/integration.js.map +1 -1
  112. package/dist/js/profiling/types.d.ts.map +1 -1
  113. package/dist/js/profiling/types.js.map +1 -1
  114. package/dist/js/profiling/utils.d.ts.map +1 -1
  115. package/dist/js/profiling/utils.js +15 -17
  116. package/dist/js/profiling/utils.js.map +1 -1
  117. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  118. package/dist/js/replay/CustomMask.js +1 -1
  119. package/dist/js/replay/CustomMask.js.map +1 -1
  120. package/dist/js/replay/browserReplay.d.ts +13 -1
  121. package/dist/js/replay/browserReplay.d.ts.map +1 -1
  122. package/dist/js/replay/browserReplay.js +26 -0
  123. package/dist/js/replay/browserReplay.js.map +1 -1
  124. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  125. package/dist/js/replay/mobilereplay.js +2 -7
  126. package/dist/js/replay/mobilereplay.js.map +1 -1
  127. package/dist/js/replay/networkUtils.d.ts.map +1 -1
  128. package/dist/js/replay/networkUtils.js +4 -11
  129. package/dist/js/replay/networkUtils.js.map +1 -1
  130. package/dist/js/replay/replayInterface.d.ts +52 -0
  131. package/dist/js/replay/replayInterface.d.ts.map +1 -0
  132. package/dist/js/replay/replayInterface.js +2 -0
  133. package/dist/js/replay/replayInterface.js.map +1 -0
  134. package/dist/js/replay/xhrUtils.d.ts.map +1 -1
  135. package/dist/js/replay/xhrUtils.js.map +1 -1
  136. package/dist/js/scopeSync.d.ts.map +1 -1
  137. package/dist/js/scopeSync.js +7 -1
  138. package/dist/js/scopeSync.js.map +1 -1
  139. package/dist/js/sdk.d.ts +1 -6
  140. package/dist/js/sdk.d.ts.map +1 -1
  141. package/dist/js/sdk.js +3 -16
  142. package/dist/js/sdk.js.map +1 -1
  143. package/dist/js/tools/ModulesCollector.js +1 -0
  144. package/dist/js/tools/ModulesCollector.js.map +1 -1
  145. package/dist/js/tools/collectModules.js +1 -0
  146. package/dist/js/tools/collectModules.js.map +1 -1
  147. package/dist/js/tools/enableLogger.js +1 -0
  148. package/dist/js/tools/enableLogger.js.map +1 -1
  149. package/dist/js/tools/metroMiddleware.js +2 -1
  150. package/dist/js/tools/metroMiddleware.js.map +1 -1
  151. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  152. package/dist/js/tools/metroconfig.js +6 -4
  153. package/dist/js/tools/metroconfig.js.map +1 -1
  154. package/dist/js/tools/sentryBabelTransformer.js +1 -0
  155. package/dist/js/tools/sentryBabelTransformer.js.map +1 -1
  156. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
  157. package/dist/js/tools/sentryBabelTransformerUtils.js +2 -1
  158. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  159. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  160. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  161. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  162. package/dist/js/tools/utils.js +1 -0
  163. package/dist/js/tools/utils.js.map +1 -1
  164. package/dist/js/tools/vendor/expo/expoconfig.js +1 -0
  165. package/dist/js/tools/vendor/expo/expoconfig.js.map +1 -1
  166. package/dist/js/tools/vendor/metro/metroBabelTransformer.js +1 -0
  167. package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -1
  168. package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
  169. package/dist/js/tools/vendor/metro/utils.js +1 -0
  170. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  171. package/dist/js/touchevents.d.ts.map +1 -1
  172. package/dist/js/touchevents.js +4 -0
  173. package/dist/js/touchevents.js.map +1 -1
  174. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  175. package/dist/js/tracing/gesturetracing.js.map +1 -1
  176. package/dist/js/tracing/integrations/appStart.d.ts +1 -1
  177. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  178. package/dist/js/tracing/integrations/appStart.js +10 -3
  179. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  180. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
  181. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  182. package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  183. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  184. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  185. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  186. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +14 -10
  187. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  188. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
  189. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  190. package/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  191. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  192. package/dist/js/tracing/onSpanEndUtils.js +2 -1
  193. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  194. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  195. package/dist/js/tracing/reactnativenavigation.js +1 -1
  196. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  197. package/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  198. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  199. package/dist/js/tracing/reactnativeprofiler.js +2 -1
  200. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  201. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  202. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  203. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  204. package/dist/js/tracing/reactnavigation.js +5 -4
  205. package/dist/js/tracing/reactnavigation.js.map +1 -1
  206. package/dist/js/tracing/span.d.ts.map +1 -1
  207. package/dist/js/tracing/span.js +5 -5
  208. package/dist/js/tracing/span.js.map +1 -1
  209. package/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  210. package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
  211. package/dist/js/tracing/timeToDisplayFallback.js.map +1 -1
  212. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  213. package/dist/js/tracing/timetodisplay.js +13 -13
  214. package/dist/js/tracing/timetodisplay.js.map +1 -1
  215. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  216. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  217. package/dist/js/tracing/utils.d.ts.map +1 -1
  218. package/dist/js/tracing/utils.js.map +1 -1
  219. package/dist/js/transports/encodePolyfill.d.ts +4 -0
  220. package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
  221. package/dist/js/transports/encodePolyfill.js +17 -3
  222. package/dist/js/transports/encodePolyfill.js.map +1 -1
  223. package/dist/js/transports/native.d.ts.map +1 -1
  224. package/dist/js/transports/native.js.map +1 -1
  225. package/dist/js/utils/AsyncExpiringMap.d.ts.map +1 -1
  226. package/dist/js/utils/AsyncExpiringMap.js +8 -4
  227. package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
  228. package/dist/js/utils/carrier.d.ts +5 -0
  229. package/dist/js/utils/carrier.d.ts.map +1 -0
  230. package/dist/js/utils/carrier.js +11 -0
  231. package/dist/js/utils/carrier.js.map +1 -0
  232. package/dist/js/utils/encode.d.ts +5 -0
  233. package/dist/js/utils/encode.d.ts.map +1 -0
  234. package/dist/js/utils/encode.js +13 -0
  235. package/dist/js/utils/encode.js.map +1 -0
  236. package/dist/js/utils/envelope.d.ts.map +1 -1
  237. package/dist/js/utils/envelope.js +1 -2
  238. package/dist/js/utils/envelope.js.map +1 -1
  239. package/dist/js/utils/environment.d.ts.map +1 -1
  240. package/dist/js/utils/environment.js +5 -6
  241. package/dist/js/utils/environment.js.map +1 -1
  242. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  243. package/dist/js/utils/rnlibraries.js.map +1 -1
  244. package/dist/js/utils/safe.d.ts.map +1 -1
  245. package/dist/js/utils/safe.js.map +1 -1
  246. package/dist/js/utils/worldwide.d.ts +3 -2
  247. package/dist/js/utils/worldwide.d.ts.map +1 -1
  248. package/dist/js/utils/worldwide.js.map +1 -1
  249. package/dist/js/vendor/base64-js/fromByteArray.d.ts.map +1 -1
  250. package/dist/js/vendor/base64-js/fromByteArray.js +6 -0
  251. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  252. package/dist/js/version.d.ts +1 -1
  253. package/dist/js/version.d.ts.map +1 -1
  254. package/dist/js/version.js +1 -1
  255. package/dist/js/version.js.map +1 -1
  256. package/dist/js/wrapper.d.ts.map +1 -1
  257. package/dist/js/wrapper.js +10 -8
  258. package/dist/js/wrapper.js.map +1 -1
  259. package/ios/RNSentryVersion.m +1 -1
  260. package/package.json +9 -10
  261. package/plugin/build/withSentry.js +3 -3
  262. package/plugin/build/withSentryAndroidGradlePlugin.js +3 -3
  263. package/scripts/expo-upload-sourcemaps.js +2 -2
  264. package/src/js/NativeRNSentry.ts +0 -1
  265. package/ts3.8/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  266. package/ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts +30 -30
  267. package/ts3.8/dist/js/feedback/defaults.d.ts +1 -1
  268. package/ts3.8/dist/js/feedback/integration.d.ts +1 -1
  269. package/ts3.8/dist/js/index.d.ts +3 -3
  270. package/ts3.8/dist/js/integrations/breadcrumbs.d.ts +47 -0
  271. package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
  272. package/ts3.8/dist/js/options.d.ts +8 -1
  273. package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
  274. package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
  275. package/ts3.8/dist/js/replay/browserReplay.d.ts +13 -1
  276. package/ts3.8/dist/js/replay/replayInterface.d.ts +52 -0
  277. package/ts3.8/dist/js/sdk.d.ts +1 -6
  278. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +1 -1
  279. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  280. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  281. package/ts3.8/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  282. package/ts3.8/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  283. package/ts3.8/dist/js/transports/encodePolyfill.d.ts +4 -0
  284. package/ts3.8/dist/js/utils/carrier.d.ts +5 -0
  285. package/ts3.8/dist/js/utils/encode.d.ts +5 -0
  286. package/ts3.8/dist/js/utils/worldwide.d.ts +3 -2
  287. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/js/profiling/integration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EACL,qBAA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AM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,KAAK,uBAAuB,CAAC;aAC9D,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,iCACV,MAAM,KACT,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,IACxC,CAAC;KACN,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, Integration, Span, ThreadCpuProfile } from '@sentry/core';\nimport { getActiveSpan, getClient, logger, spanIsSampled, uuid4 } from '@sentry/core';\nimport { Platform } from 'react-native';\n\nimport type { ReactNativeClient } from '../client';\nimport { isHermesEnabled } from '../utils/environment';\nimport { isRootSpan } from '../utils/span';\nimport { NATIVE } from '../wrapper';\nimport { PROFILE_QUEUE } from './cache';\nimport { MAX_PROFILE_DURATION_MS } from './constants';\nimport { convertToSentryProfile } from './convertHermesProfile';\nimport type { NativeAndroidProfileEvent, NativeProfileEvent } from './nativeTypes';\nimport type { AndroidCombinedProfileEvent, CombinedProfileEvent, HermesProfileEvent, ProfileEvent } from './types';\nimport {\n addProfilesToEnvelope,\n createHermesProfilingEvent,\n enrichCombinedProfileWithEventContext,\n findProfiledTransactionsFromEnvelope,\n} from './utils';\n\nconst INTEGRATION_NAME = 'HermesProfiling';\n\nconst MS_TO_NS: number = 1e6;\n\nexport interface HermesProfilingOptions {\n /**\n * Enable or disable profiling of native (iOS and Android) threads\n *\n * @default true\n */\n platformProfilers?: boolean;\n}\n\nconst defaultOptions: Required<HermesProfilingOptions> = {\n platformProfilers: true,\n};\n\n/**\n * Profiling integration creates a profile for each transaction and adds it to the event envelope.\n *\n * @experimental\n */\nexport const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = defaultOptions): Integration => {\n const usePlatformProfilers = initOptions.platformProfilers ?? true;\n let _currentProfile:\n | {\n span_id: string;\n profile_id: string;\n startTimestampNs: number;\n }\n | undefined;\n let _currentProfileTimeout: ReturnType<typeof setTimeout> | undefined;\n let isReady: boolean = false;\n\n const setupOnce = (): void => {\n if (isReady) {\n return;\n }\n isReady = true;\n\n if (!isHermesEnabled()) {\n logger.log('[Profiling] Hermes is not enabled, not adding profiling integration.');\n return;\n }\n\n const client = getClient();\n\n if (!client || typeof client.on !== 'function') {\n return;\n }\n\n _startCurrentProfileForActiveTransaction();\n client.on('spanStart', _startCurrentProfile);\n\n client.on('spanEnd', _finishCurrentProfileForSpan);\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (!PROFILE_QUEUE.size()) {\n return;\n }\n\n const profiledTransactions = findProfiledTransactionsFromEnvelope(envelope);\n if (!profiledTransactions.length) {\n logger.log('[Profiling] no profiled transactions found in envelope');\n return;\n }\n\n const profilesToAddToEnvelope: ProfileEvent[] = [];\n for (const profiledTransaction of profiledTransactions) {\n const profile = _createProfileEventFor(profiledTransaction);\n if (profile) {\n profilesToAddToEnvelope.push(profile);\n }\n }\n addProfilesToEnvelope(envelope, profilesToAddToEnvelope);\n });\n };\n\n const _startCurrentProfileForActiveTransaction = (): void => {\n if (_currentProfile) {\n return;\n }\n const activeSpan = getActiveSpan();\n activeSpan && _startCurrentProfile(activeSpan);\n };\n\n const _startCurrentProfile = (activeSpan: Span): void => {\n if (!isRootSpan(activeSpan)) {\n return;\n }\n\n _finishCurrentProfile();\n\n const shouldStartProfiling = _shouldStartProfiling(activeSpan);\n if (!shouldStartProfiling) {\n return;\n }\n\n _currentProfileTimeout = setTimeout(_finishCurrentProfile, MAX_PROFILE_DURATION_MS);\n _startNewProfile(activeSpan);\n };\n\n const _shouldStartProfiling = (activeSpan: Span): boolean => {\n if (!spanIsSampled(activeSpan)) {\n logger.log('[Profiling] Transaction is not sampled, skipping profiling');\n return false;\n }\n\n const client = getClient<ReactNativeClient>();\n const options = client && client.getOptions();\n\n const profilesSampleRate =\n options && typeof options.profilesSampleRate === 'number' ? options.profilesSampleRate : undefined;\n if (profilesSampleRate === undefined) {\n logger.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.');\n return false;\n }\n\n // Check if we should sample this profile\n if (Math.random() > profilesSampleRate) {\n logger.log('[Profiling] Skip profiling transaction due to sampling.');\n return false;\n }\n\n return true;\n };\n\n /**\n * Starts a new profile and links it to the transaction.\n */\n const _startNewProfile = (activeSpan: Span): void => {\n const profileStartTimestampNs = startProfiling(usePlatformProfilers);\n if (!profileStartTimestampNs) {\n return;\n }\n\n _currentProfile = {\n span_id: activeSpan.spanContext().spanId,\n profile_id: uuid4(),\n startTimestampNs: profileStartTimestampNs,\n };\n activeSpan.setAttribute('profile_id', _currentProfile.profile_id);\n logger.log('[Profiling] started profiling: ', _currentProfile.profile_id);\n };\n\n /**\n * Stops current profile if the ending span is the currently profiled span.\n */\n const _finishCurrentProfileForSpan = (span: Span): void => {\n if (!isRootSpan(span)) {\n return;\n }\n\n if (span.spanContext().spanId !== _currentProfile?.span_id) {\n logger.log(\n `[Profiling] Span (${span.spanContext().spanId}) ended is not the currently profiled span (${\n _currentProfile?.span_id\n }). Not stopping profiling.`,\n );\n return;\n }\n\n _finishCurrentProfile();\n };\n\n /**\n * Stops profiling and adds the profile to the queue to be processed on beforeEnvelope.\n */\n const _finishCurrentProfile = (): void => {\n _clearCurrentProfileTimeout();\n if (_currentProfile === undefined) {\n return;\n }\n\n const profile = stopProfiling(_currentProfile.startTimestampNs);\n if (!profile) {\n logger.warn('[Profiling] Stop failed. Cleaning up...');\n _currentProfile = undefined;\n return;\n }\n\n PROFILE_QUEUE.add(_currentProfile.profile_id, profile);\n\n logger.log('[Profiling] finished profiling: ', _currentProfile.profile_id);\n _currentProfile = undefined;\n };\n\n const _createProfileEventFor = (profiledTransaction: Event): ProfileEvent | null => {\n const profile_id = profiledTransaction?.contexts?.trace?.data?.profile_id;\n\n if (typeof profile_id !== 'string') {\n logger.log('[Profiling] cannot find profile for a transaction without a profile context');\n return null;\n }\n\n // Remove the profile from the transaction context before sending, relay will take care of the rest.\n if (profiledTransaction?.contexts?.trace?.data?.profile_id) {\n delete profiledTransaction.contexts.trace.data.profile_id;\n }\n\n const profile = PROFILE_QUEUE.get(profile_id);\n PROFILE_QUEUE.delete(profile_id);\n\n if (!profile) {\n logger.log(`[Profiling] cannot find profile ${profile_id} for transaction ${profiledTransaction.event_id}`);\n return null;\n }\n\n const profileWithEvent = enrichCombinedProfileWithEventContext(profile_id, profile, profiledTransaction);\n logger.log(`[Profiling] Created profile ${profile_id} for transaction ${profiledTransaction.event_id}`);\n\n return profileWithEvent;\n };\n\n const _clearCurrentProfileTimeout = (): void => {\n _currentProfileTimeout !== undefined && clearTimeout(_currentProfileTimeout);\n _currentProfileTimeout = undefined;\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce,\n };\n};\n\n/**\n * Starts Profilers and returns the timestamp when profiling started in nanoseconds.\n */\nexport function startProfiling(platformProfilers: boolean): number | null {\n const started = NATIVE.startProfiling(platformProfilers);\n if (!started) {\n return null;\n }\n\n return Date.now() * MS_TO_NS;\n}\n\n/**\n * Stops Profilers and returns collected combined profile.\n */\nexport function stopProfiling(\n profileStartTimestampNs: number,\n): CombinedProfileEvent | AndroidCombinedProfileEvent | null {\n const collectedProfiles = NATIVE.stopProfiling();\n if (!collectedProfiles) {\n return null;\n }\n const profileEndTimestampNs = Date.now() * MS_TO_NS;\n\n const hermesProfile = convertToSentryProfile(collectedProfiles.hermesProfile);\n if (!hermesProfile) {\n return null;\n }\n\n const hermesProfileEvent = createHermesProfilingEvent(hermesProfile);\n if (!hermesProfileEvent) {\n return null;\n }\n\n if (collectedProfiles.androidProfile) {\n const durationNs = profileEndTimestampNs - profileStartTimestampNs;\n return createAndroidWithHermesProfile(hermesProfileEvent, collectedProfiles.androidProfile, durationNs);\n } else if (collectedProfiles.nativeProfile) {\n return addNativeProfileToHermesProfile(hermesProfileEvent, collectedProfiles.nativeProfile);\n }\n\n return hermesProfileEvent;\n}\n\n/**\n * Creates Android profile event with attached javascript profile.\n */\nexport function createAndroidWithHermesProfile(\n hermes: HermesProfileEvent,\n nativeAndroid: NativeAndroidProfileEvent,\n durationNs: number,\n): AndroidCombinedProfileEvent {\n return {\n ...nativeAndroid,\n platform: 'android',\n js_profile: hermes.profile,\n duration_ns: durationNs.toString(10),\n active_thread_id: hermes.transaction.active_thread_id,\n };\n}\n\n/**\n * Merges Hermes and Native profile events into one.\n */\nexport function addNativeProfileToHermesProfile(\n hermes: HermesProfileEvent,\n native: NativeProfileEvent,\n): CombinedProfileEvent {\n return {\n ...hermes,\n profile: addNativeThreadCpuProfileToHermes(hermes.profile, native.profile, hermes.transaction.active_thread_id),\n ...(native.debug_meta?.images ? { debug_meta: { images: native.debug_meta.images } } : {}),\n measurements: native.measurements,\n };\n}\n\n/**\n * Merges Hermes And Native profiles into one.\n */\nexport function addNativeThreadCpuProfileToHermes(\n hermes: ThreadCpuProfile,\n native: ThreadCpuProfile,\n hermes_active_thread_id: string | undefined,\n): CombinedProfileEvent['profile'] {\n // assumes thread ids are unique\n hermes.thread_metadata = { ...native.thread_metadata, ...hermes.thread_metadata };\n // assumes queue ids are unique\n hermes.queue_metadata = { ...native.queue_metadata, ...hermes.queue_metadata };\n\n // recalculate frames and stacks using offset\n const framesOffset = hermes.frames.length;\n const stacksOffset = hermes.stacks.length;\n\n if (native.frames) {\n for (const frame of native.frames) {\n hermes.frames.push({\n function: frame.function,\n instruction_addr: frame.instruction_addr,\n platform: Platform.OS === 'ios' ? 'cocoa' : undefined,\n });\n }\n }\n hermes.stacks = [\n ...(hermes.stacks || []),\n ...(native.stacks || []).map(stack => stack.map(frameId => frameId + framesOffset)),\n ];\n hermes.samples = [\n ...(hermes.samples || []),\n ...(native.samples || [])\n .filter(sample => sample.thread_id !== hermes_active_thread_id)\n .map(sample => ({\n ...sample,\n stack_id: stacksOffset + sample.stack_id,\n })),\n ];\n\n return hermes;\n}\n"]}
1
+ {"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/js/profiling/integration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,S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AAC,CAAC,SAAS;aACtD,CAAC,CAAC;SACJ;KACF;IACD,MAAM,CAAC,MAAM,GAAG;QACd,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;QACxB,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC;KACpF,CAAC;IACF,MAAM,CAAC,OAAO,GAAG;QACf,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;aACtB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,KAAK,uBAAuB,CAAC;aAC9D,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,iCACV,MAAM,KACT,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,IACxC,CAAC;KACN,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, Integration, Span, ThreadCpuProfile } from '@sentry/core';\nimport { getActiveSpan, getClient, logger, spanIsSampled, uuid4 } from '@sentry/core';\nimport { Platform } from 'react-native';\nimport type { ReactNativeClient } from '../client';\nimport { isHermesEnabled } from '../utils/environment';\nimport { isRootSpan } from '../utils/span';\nimport { NATIVE } from '../wrapper';\nimport { PROFILE_QUEUE } from './cache';\nimport { MAX_PROFILE_DURATION_MS } from './constants';\nimport { convertToSentryProfile } from './convertHermesProfile';\nimport type { NativeAndroidProfileEvent, NativeProfileEvent } from './nativeTypes';\nimport type { AndroidCombinedProfileEvent, CombinedProfileEvent, HermesProfileEvent, ProfileEvent } from './types';\nimport {\n addProfilesToEnvelope,\n createHermesProfilingEvent,\n enrichCombinedProfileWithEventContext,\n findProfiledTransactionsFromEnvelope,\n} from './utils';\n\nconst INTEGRATION_NAME = 'HermesProfiling';\n\nconst MS_TO_NS: number = 1e6;\n\nexport interface HermesProfilingOptions {\n /**\n * Enable or disable profiling of native (iOS and Android) threads\n *\n * @default true\n */\n platformProfilers?: boolean;\n}\n\nconst defaultOptions: Required<HermesProfilingOptions> = {\n platformProfilers: true,\n};\n\n/**\n * Profiling integration creates a profile for each transaction and adds it to the event envelope.\n *\n * @experimental\n */\nexport const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = defaultOptions): Integration => {\n const usePlatformProfilers = initOptions.platformProfilers ?? true;\n let _currentProfile:\n | {\n span_id: string;\n profile_id: string;\n startTimestampNs: number;\n }\n | undefined;\n let _currentProfileTimeout: ReturnType<typeof setTimeout> | undefined;\n let isReady: boolean = false;\n\n const setupOnce = (): void => {\n if (isReady) {\n return;\n }\n isReady = true;\n\n if (!isHermesEnabled()) {\n logger.log('[Profiling] Hermes is not enabled, not adding profiling integration.');\n return;\n }\n\n const client = getClient();\n\n if (!client || typeof client.on !== 'function') {\n return;\n }\n\n _startCurrentProfileForActiveTransaction();\n client.on('spanStart', _startCurrentProfile);\n\n client.on('spanEnd', _finishCurrentProfileForSpan);\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (!PROFILE_QUEUE.size()) {\n return;\n }\n\n const profiledTransactions = findProfiledTransactionsFromEnvelope(envelope);\n if (!profiledTransactions.length) {\n logger.log('[Profiling] no profiled transactions found in envelope');\n return;\n }\n\n const profilesToAddToEnvelope: ProfileEvent[] = [];\n for (const profiledTransaction of profiledTransactions) {\n const profile = _createProfileEventFor(profiledTransaction);\n if (profile) {\n profilesToAddToEnvelope.push(profile);\n }\n }\n addProfilesToEnvelope(envelope, profilesToAddToEnvelope);\n });\n };\n\n const _startCurrentProfileForActiveTransaction = (): void => {\n if (_currentProfile) {\n return;\n }\n const activeSpan = getActiveSpan();\n activeSpan && _startCurrentProfile(activeSpan);\n };\n\n const _startCurrentProfile = (activeSpan: Span): void => {\n if (!isRootSpan(activeSpan)) {\n return;\n }\n\n _finishCurrentProfile();\n\n const shouldStartProfiling = _shouldStartProfiling(activeSpan);\n if (!shouldStartProfiling) {\n return;\n }\n\n _currentProfileTimeout = setTimeout(_finishCurrentProfile, MAX_PROFILE_DURATION_MS);\n _startNewProfile(activeSpan);\n };\n\n const _shouldStartProfiling = (activeSpan: Span): boolean => {\n if (!spanIsSampled(activeSpan)) {\n logger.log('[Profiling] Transaction is not sampled, skipping profiling');\n return false;\n }\n\n const client = getClient<ReactNativeClient>();\n const options = client?.getOptions?.();\n\n const profilesSampleRate =\n options && typeof options.profilesSampleRate === 'number' ? options.profilesSampleRate : undefined;\n if (profilesSampleRate === undefined) {\n logger.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.');\n return false;\n }\n\n // Check if we should sample this profile\n if (Math.random() > profilesSampleRate) {\n logger.log('[Profiling] Skip profiling transaction due to sampling.');\n return false;\n }\n\n return true;\n };\n\n /**\n * Starts a new profile and links it to the transaction.\n */\n const _startNewProfile = (activeSpan: Span): void => {\n const profileStartTimestampNs = startProfiling(usePlatformProfilers);\n if (!profileStartTimestampNs) {\n return;\n }\n\n _currentProfile = {\n span_id: activeSpan.spanContext().spanId,\n profile_id: uuid4(),\n startTimestampNs: profileStartTimestampNs,\n };\n activeSpan.setAttribute('profile_id', _currentProfile.profile_id);\n logger.log('[Profiling] started profiling: ', _currentProfile.profile_id);\n };\n\n /**\n * Stops current profile if the ending span is the currently profiled span.\n */\n const _finishCurrentProfileForSpan = (span: Span): void => {\n if (!isRootSpan(span)) {\n return;\n }\n\n if (span.spanContext().spanId !== _currentProfile?.span_id) {\n logger.log(\n `[Profiling] Span (${span.spanContext().spanId}) ended is not the currently profiled span (${\n _currentProfile?.span_id\n }). Not stopping profiling.`,\n );\n return;\n }\n\n _finishCurrentProfile();\n };\n\n /**\n * Stops profiling and adds the profile to the queue to be processed on beforeEnvelope.\n */\n const _finishCurrentProfile = (): void => {\n _clearCurrentProfileTimeout();\n if (_currentProfile === undefined) {\n return;\n }\n\n const profile = stopProfiling(_currentProfile.startTimestampNs);\n if (!profile) {\n logger.warn('[Profiling] Stop failed. Cleaning up...');\n _currentProfile = undefined;\n return;\n }\n\n PROFILE_QUEUE.add(_currentProfile.profile_id, profile);\n\n logger.log('[Profiling] finished profiling: ', _currentProfile.profile_id);\n _currentProfile = undefined;\n };\n\n const _createProfileEventFor = (profiledTransaction: Event): ProfileEvent | null => {\n const profile_id = profiledTransaction?.contexts?.trace?.data?.profile_id;\n\n if (typeof profile_id !== 'string') {\n logger.log('[Profiling] cannot find profile for a transaction without a profile context');\n return null;\n }\n\n // Remove the profile from the transaction context before sending, relay will take care of the rest.\n if (profiledTransaction?.contexts?.trace?.data?.profile_id) {\n delete profiledTransaction.contexts.trace.data.profile_id;\n }\n\n const profile = PROFILE_QUEUE.get(profile_id);\n PROFILE_QUEUE.delete(profile_id);\n\n if (!profile) {\n logger.log(`[Profiling] cannot find profile ${profile_id} for transaction ${profiledTransaction.event_id}`);\n return null;\n }\n\n const profileWithEvent = enrichCombinedProfileWithEventContext(profile_id, profile, profiledTransaction);\n logger.log(`[Profiling] Created profile ${profile_id} for transaction ${profiledTransaction.event_id}`);\n\n return profileWithEvent;\n };\n\n const _clearCurrentProfileTimeout = (): void => {\n _currentProfileTimeout !== undefined && clearTimeout(_currentProfileTimeout);\n _currentProfileTimeout = undefined;\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce,\n };\n};\n\n/**\n * Starts Profilers and returns the timestamp when profiling started in nanoseconds.\n */\nexport function startProfiling(platformProfilers: boolean): number | null {\n const started = NATIVE.startProfiling(platformProfilers);\n if (!started) {\n return null;\n }\n\n return Date.now() * MS_TO_NS;\n}\n\n/**\n * Stops Profilers and returns collected combined profile.\n */\nexport function stopProfiling(\n profileStartTimestampNs: number,\n): CombinedProfileEvent | AndroidCombinedProfileEvent | null {\n const collectedProfiles = NATIVE.stopProfiling();\n if (!collectedProfiles) {\n return null;\n }\n const profileEndTimestampNs = Date.now() * MS_TO_NS;\n\n const hermesProfile = convertToSentryProfile(collectedProfiles.hermesProfile);\n if (!hermesProfile) {\n return null;\n }\n\n const hermesProfileEvent = createHermesProfilingEvent(hermesProfile);\n if (!hermesProfileEvent) {\n return null;\n }\n\n if (collectedProfiles.androidProfile) {\n const durationNs = profileEndTimestampNs - profileStartTimestampNs;\n return createAndroidWithHermesProfile(hermesProfileEvent, collectedProfiles.androidProfile, durationNs);\n } else if (collectedProfiles.nativeProfile) {\n return addNativeProfileToHermesProfile(hermesProfileEvent, collectedProfiles.nativeProfile);\n }\n\n return hermesProfileEvent;\n}\n\n/**\n * Creates Android profile event with attached javascript profile.\n */\nexport function createAndroidWithHermesProfile(\n hermes: HermesProfileEvent,\n nativeAndroid: NativeAndroidProfileEvent,\n durationNs: number,\n): AndroidCombinedProfileEvent {\n return {\n ...nativeAndroid,\n platform: 'android',\n js_profile: hermes.profile,\n duration_ns: durationNs.toString(10),\n active_thread_id: hermes.transaction.active_thread_id,\n };\n}\n\n/**\n * Merges Hermes and Native profile events into one.\n */\nexport function addNativeProfileToHermesProfile(\n hermes: HermesProfileEvent,\n native: NativeProfileEvent,\n): CombinedProfileEvent {\n return {\n ...hermes,\n profile: addNativeThreadCpuProfileToHermes(hermes.profile, native.profile, hermes.transaction.active_thread_id),\n ...(native.debug_meta?.images ? { debug_meta: { images: native.debug_meta.images } } : {}),\n measurements: native.measurements,\n };\n}\n\n/**\n * Merges Hermes And Native profiles into one.\n */\nexport function addNativeThreadCpuProfileToHermes(\n hermes: ThreadCpuProfile,\n native: ThreadCpuProfile,\n hermes_active_thread_id: string | undefined,\n): CombinedProfileEvent['profile'] {\n // assumes thread ids are unique\n hermes.thread_metadata = { ...native.thread_metadata, ...hermes.thread_metadata };\n // assumes queue ids are unique\n hermes.queue_metadata = { ...native.queue_metadata, ...hermes.queue_metadata };\n\n // recalculate frames and stacks using offset\n const framesOffset = hermes.frames.length;\n const stacksOffset = hermes.stacks.length;\n\n if (native.frames) {\n for (const frame of native.frames) {\n hermes.frames.push({\n function: frame.function,\n instruction_addr: frame.instruction_addr,\n platform: Platform.OS === 'ios' ? 'cocoa' : undefined,\n });\n }\n }\n hermes.stacks = [\n ...(hermes.stacks || []),\n ...(native.stacks || []).map(stack => stack.map(frameId => frameId + framesOffset)),\n ];\n hermes.samples = [\n ...(hermes.samples || []),\n ...(native.samples || [])\n .filter(sample => sample.thread_id !== hermes_active_thread_id)\n .map(sample => ({\n ...sample,\n stack_id: stacksOffset + sample.stack_id,\n })),\n ];\n\n return hermes;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/js/profiling/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE3G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,gBAAgB,CAAC;IAC1B,WAAW,EAAE;QACX,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAKF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,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BAAkB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/js/profiling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DebugImage, MeasurementUnit, Profile, ThreadCpuFrame, ThreadCpuProfile } from '@sentry/core';\n\nimport type { NativeProfileEvent } from './nativeTypes';\n\nexport interface RawThreadCpuProfile extends ThreadCpuProfile {\n frames: ThreadCpuFrame[];\n profile_id?: string;\n active_thread_id: string;\n}\n\nexport type HermesProfileEvent = {\n platform: 'javascript';\n version: '1';\n profile: ThreadCpuProfile;\n transaction: {\n active_thread_id: string;\n };\n};\n\n/*\n * Android profile with javascript without transaction metadata\n */\nexport type AndroidCombinedProfileEvent = {\n platform: 'android';\n /**\n * Proguard debug meta image uuid\n */\n build_id?: string | undefined;\n sampled_profile: string;\n js_profile: ThreadCpuProfile;\n android_api_level: number;\n duration_ns: string;\n active_thread_id: string;\n};\n\n/*\n * Complete Android profile with javascript and transaction metadata\n */\nexport type AndroidProfileEvent = {\n sampled_profile: string;\n /**\n * Currently used only for JS\n */\n debug_meta?: {\n images: DebugImage[];\n };\n js_profile: ThreadCpuProfile;\n\n android_api_level: number;\n /**\n * Proguard debug meta image uuid\n */\n build_id: string;\n\n device_cpu_frequencies: number[];\n device_is_emulator: boolean;\n device_locale: string;\n device_manufacturer: string;\n device_model: string;\n device_os_name: string;\n device_os_version: string;\n\n device_physical_memory_bytes: string;\n\n environment: string;\n\n platform: 'android';\n profile_id: string;\n\n timestamp: string;\n\n release: string;\n dist: string;\n\n version_code: string;\n version_name: string;\n\n transaction_id: string;\n transaction_name: string;\n trace_id: string;\n duration_ns: string;\n active_thread_id: string;\n\n measurements?: Record<\n string,\n {\n unit: MeasurementUnit;\n values: {\n elapsed_since_start_ns: number;\n value: number;\n }[];\n }\n >;\n\n transaction_metadata?: Record<string, string>;\n transaction_tags?: Record<string, string>;\n};\n\nexport type ProfileEvent = Profile | AndroidProfileEvent;\n\nexport type CombinedProfileEvent = HermesProfileEvent & Partial<NativeProfileEvent>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/js/profiling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DebugImage, MeasurementUnit, Profile, ThreadCpuFrame, ThreadCpuProfile } from '@sentry/core';\nimport type { NativeProfileEvent } from './nativeTypes';\n\nexport interface RawThreadCpuProfile extends ThreadCpuProfile {\n frames: ThreadCpuFrame[];\n profile_id?: string;\n active_thread_id: string;\n}\n\nexport type HermesProfileEvent = {\n platform: 'javascript';\n version: '1';\n profile: ThreadCpuProfile;\n transaction: {\n active_thread_id: string;\n };\n};\n\n/*\n * Android profile with javascript without transaction metadata\n */\nexport type AndroidCombinedProfileEvent = {\n platform: 'android';\n /**\n * Proguard debug meta image uuid\n */\n build_id?: string | undefined;\n sampled_profile: string;\n js_profile: ThreadCpuProfile;\n android_api_level: number;\n duration_ns: string;\n active_thread_id: string;\n};\n\n/*\n * Complete Android profile with javascript and transaction metadata\n */\nexport type AndroidProfileEvent = {\n sampled_profile: string;\n /**\n * Currently used only for JS\n */\n debug_meta?: {\n images: DebugImage[];\n };\n js_profile: ThreadCpuProfile;\n\n android_api_level: number;\n /**\n * Proguard debug meta image uuid\n */\n build_id: string;\n\n device_cpu_frequencies: number[];\n device_is_emulator: boolean;\n device_locale: string;\n device_manufacturer: string;\n device_model: string;\n device_os_name: string;\n device_os_version: string;\n\n device_physical_memory_bytes: string;\n\n environment: string;\n\n platform: 'android';\n profile_id: string;\n\n timestamp: string;\n\n release: string;\n dist: string;\n\n version_code: string;\n version_name: string;\n\n transaction_id: string;\n transaction_name: string;\n trace_id: string;\n duration_ns: string;\n active_thread_id: string;\n\n measurements?: Record<\n string,\n {\n unit: MeasurementUnit;\n values: {\n elapsed_since_start_ns: number;\n value: number;\n }[];\n }\n >;\n\n transaction_metadata?: Record<string, string>;\n transaction_tags?: Record<string, string>;\n};\n\nexport type ProfileEvent = Profile | AndroidProfileEvent;\n\nexport type CombinedProfileEvent = HermesProfileEvent & Partial<NativeProfileEvent>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/profiling/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKtE,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,IAAI,mBAAmB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAWjH;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAqBhF;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAAG,2BAA2B,EAC3D,KAAK,EAAE,KAAK,GACX,YAAY,GAAG,IAAI,CAoDrB;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,2BAA2B,EACpC,KAAK,EAAE,KAAK,GACX,mBAAmB,GAAG,IAAI,CAuC5B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAS3F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,QAAQ,CAU5F"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/profiling/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAItE,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,IAAI,mBAAmB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAWjH;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAqBhF;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAAG,2BAA2B,EAC3D,KAAK,EAAE,KAAK,GACX,YAAY,GAAG,IAAI,CAoDrB;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,2BAA2B,EACpC,KAAK,EAAE,KAAK,GACX,mBAAmB,GAAG,IAAI,CAmC5B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAS3F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,QAAQ,CAU5F"}
@@ -46,17 +46,18 @@ export function findProfiledTransactionsFromEnvelope(envelope) {
46
46
  * @returns {ProfileEvent | null}
47
47
  */
48
48
  export function enrichCombinedProfileWithEventContext(profile_id, profile, event) {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
49
50
  if ('js_profile' in profile) {
50
51
  return enrichAndroidProfileWithEventContext(profile_id, profile, event);
51
52
  }
52
53
  if (!profile.profile || !isValidProfile(profile.profile)) {
53
54
  return null;
54
55
  }
55
- const trace_id = (event.contexts && event.contexts.trace && event.contexts.trace.trace_id) || '';
56
+ const trace_id = ((_b = (_a = event.contexts) === null || _a === void 0 ? void 0 : _a.trace) === null || _b === void 0 ? void 0 : _b.trace_id) || '';
56
57
  // Log a warning if the profile has an invalid traceId (should be uuidv4).
57
58
  // All profiles and transactions are rejected if this is the case and we want to
58
59
  // warn users that this is happening if they enable debug flag
59
- if (trace_id && trace_id.length !== 32) {
60
+ if ((trace_id === null || trace_id === void 0 ? void 0 : trace_id.length) !== 32) {
60
61
  if (__DEV__) {
61
62
  logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);
62
63
  }
@@ -65,35 +66,32 @@ export function enrichCombinedProfileWithEventContext(profile_id, profile, event
65
66
  name: 'hermes',
66
67
  version: '', // TODO: get hermes version
67
68
  }, timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(), release: event.release || '', environment: event.environment || getDefaultEnvironment(), os: {
68
- name: (event.contexts && event.contexts.os && event.contexts.os.name) || '',
69
- version: (event.contexts && event.contexts.os && event.contexts.os.version) || '',
70
- build_number: (event.contexts && event.contexts.os && event.contexts.os.build) || '',
69
+ name: ((_d = (_c = event.contexts) === null || _c === void 0 ? void 0 : _c.os) === null || _d === void 0 ? void 0 : _d.name) || '',
70
+ version: ((_f = (_e = event.contexts) === null || _e === void 0 ? void 0 : _e.os) === null || _f === void 0 ? void 0 : _f.version) || '',
71
+ build_number: ((_h = (_g = event.contexts) === null || _g === void 0 ? void 0 : _g.os) === null || _h === void 0 ? void 0 : _h.build) || '',
71
72
  }, device: {
72
- locale: (event.contexts && event.contexts.device && event.contexts.device.locale) || '',
73
- model: (event.contexts && event.contexts.device && event.contexts.device.model) || '',
74
- manufacturer: (event.contexts && event.contexts.device && event.contexts.device.manufacturer) || '',
75
- architecture: (event.contexts && event.contexts.device && event.contexts.device.arch) || '',
76
- is_emulator: (event.contexts && event.contexts.device && event.contexts.device.simulator) || false,
73
+ locale: (((_j = event.contexts) === null || _j === void 0 ? void 0 : _j.device) && event.contexts.device.locale) || '',
74
+ model: ((_l = (_k = event.contexts) === null || _k === void 0 ? void 0 : _k.device) === null || _l === void 0 ? void 0 : _l.model) || '',
75
+ manufacturer: ((_o = (_m = event.contexts) === null || _m === void 0 ? void 0 : _m.device) === null || _o === void 0 ? void 0 : _o.manufacturer) || '',
76
+ architecture: ((_q = (_p = event.contexts) === null || _p === void 0 ? void 0 : _p.device) === null || _q === void 0 ? void 0 : _q.arch) || '',
77
+ is_emulator: ((_s = (_r = event.contexts) === null || _r === void 0 ? void 0 : _r.device) === null || _s === void 0 ? void 0 : _s.simulator) || false,
77
78
  }, transaction: {
78
79
  name: event.transaction || '',
79
80
  id: event.event_id || '',
80
81
  trace_id,
81
- active_thread_id: (profile.transaction && profile.transaction.active_thread_id) || '',
82
+ active_thread_id: ((_t = profile.transaction) === null || _t === void 0 ? void 0 : _t.active_thread_id) || '',
82
83
  }, debug_meta: {
83
- images: [...getDebugMetadata(), ...((profile.debug_meta && profile.debug_meta.images) || [])],
84
+ images: [...getDebugMetadata(), ...(((_u = profile.debug_meta) === null || _u === void 0 ? void 0 : _u.images) || [])],
84
85
  } });
85
86
  }
86
87
  /**
87
88
  * Creates Android profiling envelope item.
88
89
  */
89
90
  export function enrichAndroidProfileWithEventContext(profile_id, profile, event) {
91
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
90
92
  return Object.assign(Object.assign({}, profile), { debug_meta: {
91
93
  images: getDebugMetadata(),
92
- }, build_id: profile.build_id || '', device_cpu_frequencies: [], device_is_emulator: (event.contexts && event.contexts.device && event.contexts.device.simulator) || false, device_locale: (event.contexts && event.contexts.device && event.contexts.device.locale) || '', device_manufacturer: (event.contexts && event.contexts.device && event.contexts.device.manufacturer) || '', device_model: (event.contexts && event.contexts.device && event.contexts.device.model) || '', device_os_name: (event.contexts && event.contexts.os && event.contexts.os.name) || '', device_os_version: (event.contexts && event.contexts.os && event.contexts.os.version) || '', device_physical_memory_bytes: (event.contexts &&
93
- event.contexts.device &&
94
- event.contexts.device.memory_size &&
95
- Number(event.contexts.device.memory_size).toString(10)) ||
96
- '', environment: event.environment || getDefaultEnvironment(), profile_id, timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(), release: event.release || '', dist: event.dist || '', transaction_id: event.event_id || '', transaction_name: event.transaction || '', trace_id: (event.contexts && event.contexts.trace && event.contexts.trace.trace_id) || '', version_name: event.release || '', version_code: event.dist || '' });
94
+ }, build_id: profile.build_id || '', device_cpu_frequencies: [], device_is_emulator: ((_b = (_a = event.contexts) === null || _a === void 0 ? void 0 : _a.device) === null || _b === void 0 ? void 0 : _b.simulator) || false, device_locale: (((_c = event.contexts) === null || _c === void 0 ? void 0 : _c.device) && event.contexts.device.locale) || '', device_manufacturer: ((_e = (_d = event.contexts) === null || _d === void 0 ? void 0 : _d.device) === null || _e === void 0 ? void 0 : _e.manufacturer) || '', device_model: ((_g = (_f = event.contexts) === null || _f === void 0 ? void 0 : _f.device) === null || _g === void 0 ? void 0 : _g.model) || '', device_os_name: ((_j = (_h = event.contexts) === null || _h === void 0 ? void 0 : _h.os) === null || _j === void 0 ? void 0 : _j.name) || '', device_os_version: ((_l = (_k = event.contexts) === null || _k === void 0 ? void 0 : _k.os) === null || _l === void 0 ? void 0 : _l.version) || '', device_physical_memory_bytes: (((_o = (_m = event.contexts) === null || _m === void 0 ? void 0 : _m.device) === null || _o === void 0 ? void 0 : _o.memory_size) && Number(event.contexts.device.memory_size).toString(10)) || '', environment: event.environment || getDefaultEnvironment(), profile_id, timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(), release: event.release || '', dist: event.dist || '', transaction_id: event.event_id || '', transaction_name: event.transaction || '', trace_id: ((_q = (_p = event.contexts) === null || _p === void 0 ? void 0 : _p.trace) === null || _q === void 0 ? void 0 : _q.trace_id) || '', version_name: event.release || '', version_code: event.dist || '' });
97
95
  }
98
96
  /**
99
97
  * Creates profiling event compatible carrier Object from raw Hermes profile.
@@ -1 +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;QACP,WAAW,EAAE;YACX,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;SAC3C;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,QAAwB;IAChF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,QAAQ,CAAC;KACjB;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,oCAAoC;QACpC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, ThreadCpuProfile } from '@sentry/core';\nimport { forEachEnvelopeItem, logger } from '@sentry/core';\n\nimport { getDefaultEnvironment } from '../utils/environment';\nimport { getDebugMetadata } from './debugid';\nimport type {\n AndroidCombinedProfileEvent,\n AndroidProfileEvent,\n CombinedProfileEvent,\n HermesProfileEvent,\n ProfileEvent,\n RawThreadCpuProfile,\n} from './types';\n\n/**\n *\n */\nexport function isValidProfile(profile: ThreadCpuProfile): profile is RawThreadCpuProfile & { profile_id: string } {\n if (profile.samples.length <= 1) {\n if (__DEV__) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n logger.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n return true;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n // First item is the type\n for (let j = 1; j < item.length; j++) {\n const event = item[j];\n\n // @ts-expect-error accessing private property\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (event.contexts?.trace?.data?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {ProfileEvent | null}\n */\nexport function enrichCombinedProfileWithEventContext(\n profile_id: string,\n profile: CombinedProfileEvent | AndroidCombinedProfileEvent,\n event: Event,\n): ProfileEvent | null {\n if ('js_profile' in profile) {\n return enrichAndroidProfileWithEventContext(profile_id, profile, event);\n }\n\n if (!profile.profile || !isValidProfile(profile.profile)) {\n return null;\n }\n\n const trace_id = (event.contexts && event.contexts.trace && event.contexts.trace.trace_id) || '';\n\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id && trace_id.length !== 32) {\n if (__DEV__) {\n logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n }\n\n return {\n ...profile,\n event_id: profile_id,\n runtime: {\n name: 'hermes',\n version: '', // TODO: get hermes version\n },\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n release: event.release || '',\n environment: event.environment || getDefaultEnvironment(),\n os: {\n name: (event.contexts && event.contexts.os && event.contexts.os.name) || '',\n version: (event.contexts && event.contexts.os && event.contexts.os.version) || '',\n build_number: (event.contexts && event.contexts.os && event.contexts.os.build) || '',\n },\n device: {\n locale: (event.contexts && event.contexts.device && (event.contexts.device.locale as string)) || '',\n model: (event.contexts && event.contexts.device && event.contexts.device.model) || '',\n manufacturer: (event.contexts && event.contexts.device && event.contexts.device.manufacturer) || '',\n architecture: (event.contexts && event.contexts.device && event.contexts.device.arch) || '',\n is_emulator: (event.contexts && event.contexts.device && event.contexts.device.simulator) || false,\n },\n transaction: {\n name: event.transaction || '',\n id: event.event_id || '',\n trace_id,\n active_thread_id: (profile.transaction && profile.transaction.active_thread_id) || '',\n },\n debug_meta: {\n images: [...getDebugMetadata(), ...((profile.debug_meta && profile.debug_meta.images) || [])],\n },\n };\n}\n\n/**\n * Creates Android profiling envelope item.\n */\nexport function enrichAndroidProfileWithEventContext(\n profile_id: string,\n profile: AndroidCombinedProfileEvent,\n event: Event,\n): AndroidProfileEvent | null {\n return {\n ...profile,\n debug_meta: {\n images: getDebugMetadata(),\n },\n build_id: profile.build_id || '',\n\n device_cpu_frequencies: [],\n device_is_emulator: (event.contexts && event.contexts.device && event.contexts.device.simulator) || false,\n device_locale: (event.contexts && event.contexts.device && (event.contexts.device.locale as string)) || '',\n device_manufacturer: (event.contexts && event.contexts.device && event.contexts.device.manufacturer) || '',\n device_model: (event.contexts && event.contexts.device && event.contexts.device.model) || '',\n device_os_name: (event.contexts && event.contexts.os && event.contexts.os.name) || '',\n device_os_version: (event.contexts && event.contexts.os && event.contexts.os.version) || '',\n\n device_physical_memory_bytes:\n (event.contexts &&\n event.contexts.device &&\n event.contexts.device.memory_size &&\n Number(event.contexts.device.memory_size).toString(10)) ||\n '',\n\n environment: event.environment || getDefaultEnvironment(),\n\n profile_id,\n\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n\n release: event.release || '',\n dist: event.dist || '',\n\n transaction_id: event.event_id || '',\n transaction_name: event.transaction || '',\n trace_id: (event.contexts && event.contexts.trace && event.contexts.trace.trace_id) || '',\n\n version_name: event.release || '',\n version_code: event.dist || '',\n };\n}\n\n/**\n * Creates profiling event compatible carrier Object from raw Hermes profile.\n */\nexport function createHermesProfilingEvent(profile: RawThreadCpuProfile): HermesProfileEvent {\n return {\n platform: 'javascript',\n version: '1',\n profile,\n transaction: {\n active_thread_id: profile.active_thread_id,\n },\n };\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: Envelope, profiles: ProfileEvent[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n // @ts-expect-error untyped envelope\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/profiling/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;QAC/B,IAAI,OAAO,EAAE;YACX,6EAA6E;YAC7E,8EAA8E;YAC9E,gEAAgE;YAChE,MAAM,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;SACtF;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,QAAkB;IACrE,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,mBAAmB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;QAC3C,IAAI,IAAI,KAAK,aAAa,EAAE;YAC1B,OAAO;SACR;QAED,yBAAyB;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEtB,8CAA8C;YAC9C,sEAAsE;YACtE,IAAI,MAAA,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,0CAAE,IAAI,0CAAE,UAAU,EAAE;gBAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAU,CAAC,CAAC;aAC/B;SACF;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;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,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EACpC,gBAAgB,EAAE,KAAK,CAAC,WAAW,IAAI,EAAE,EACzC,QAAQ,EAAE,CAAA,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,0CAAE,QAAQ,KAAI,EAAE,EAE/C,YAAY,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE,EACjC,YAAY,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,IAC9B;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA4B;IACrE,OAAO;QACL,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,GAAG;QACZ,OAAO;QACP,WAAW,EAAE;YACX,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;SAC3C;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,QAAwB;IAChF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,QAAQ,CAAC;KACjB;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,oCAAoC;QACpC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, ThreadCpuProfile } from '@sentry/core';\nimport { forEachEnvelopeItem, logger } from '@sentry/core';\nimport { getDefaultEnvironment } from '../utils/environment';\nimport { getDebugMetadata } from './debugid';\nimport type {\n AndroidCombinedProfileEvent,\n AndroidProfileEvent,\n CombinedProfileEvent,\n HermesProfileEvent,\n ProfileEvent,\n RawThreadCpuProfile,\n} from './types';\n\n/**\n *\n */\nexport function isValidProfile(profile: ThreadCpuProfile): profile is RawThreadCpuProfile & { profile_id: string } {\n if (profile.samples.length <= 1) {\n if (__DEV__) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n logger.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n return true;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n // First item is the type\n for (let j = 1; j < item.length; j++) {\n const event = item[j];\n\n // @ts-expect-error accessing private property\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (event.contexts?.trace?.data?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {ProfileEvent | null}\n */\nexport function enrichCombinedProfileWithEventContext(\n profile_id: string,\n profile: CombinedProfileEvent | AndroidCombinedProfileEvent,\n event: Event,\n): ProfileEvent | null {\n if ('js_profile' in profile) {\n return enrichAndroidProfileWithEventContext(profile_id, profile, event);\n }\n\n if (!profile.profile || !isValidProfile(profile.profile)) {\n return null;\n }\n\n const trace_id = event.contexts?.trace?.trace_id || '';\n\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n if (__DEV__) {\n logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n }\n\n return {\n ...profile,\n event_id: profile_id,\n runtime: {\n name: 'hermes',\n version: '', // TODO: get hermes version\n },\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n release: event.release || '',\n environment: event.environment || getDefaultEnvironment(),\n os: {\n name: event.contexts?.os?.name || '',\n version: event.contexts?.os?.version || '',\n build_number: event.contexts?.os?.build || '',\n },\n device: {\n locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n model: event.contexts?.device?.model || '',\n manufacturer: event.contexts?.device?.manufacturer || '',\n architecture: event.contexts?.device?.arch || '',\n is_emulator: event.contexts?.device?.simulator || false,\n },\n transaction: {\n name: event.transaction || '',\n id: event.event_id || '',\n trace_id,\n active_thread_id: profile.transaction?.active_thread_id || '',\n },\n debug_meta: {\n images: [...getDebugMetadata(), ...(profile.debug_meta?.images || [])],\n },\n };\n}\n\n/**\n * Creates Android profiling envelope item.\n */\nexport function enrichAndroidProfileWithEventContext(\n profile_id: string,\n profile: AndroidCombinedProfileEvent,\n event: Event,\n): AndroidProfileEvent | null {\n return {\n ...profile,\n debug_meta: {\n images: getDebugMetadata(),\n },\n build_id: profile.build_id || '',\n\n device_cpu_frequencies: [],\n device_is_emulator: event.contexts?.device?.simulator || false,\n device_locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n device_manufacturer: event.contexts?.device?.manufacturer || '',\n device_model: event.contexts?.device?.model || '',\n device_os_name: event.contexts?.os?.name || '',\n device_os_version: event.contexts?.os?.version || '',\n\n device_physical_memory_bytes:\n (event.contexts?.device?.memory_size && Number(event.contexts.device.memory_size).toString(10)) || '',\n\n environment: event.environment || getDefaultEnvironment(),\n\n profile_id,\n\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n\n release: event.release || '',\n dist: event.dist || '',\n\n transaction_id: event.event_id || '',\n transaction_name: event.transaction || '',\n trace_id: event.contexts?.trace?.trace_id || '',\n\n version_name: event.release || '',\n version_code: event.dist || '',\n };\n}\n\n/**\n * Creates profiling event compatible carrier Object from raw Hermes profile.\n */\nexport function createHermesProfilingEvent(profile: RawThreadCpuProfile): HermesProfileEvent {\n return {\n platform: 'javascript',\n version: '1',\n profile,\n transaction: {\n active_thread_id: profile.active_thread_id,\n },\n };\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: Envelope, profiles: ProfileEvent[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n // @ts-expect-error untyped envelope\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomMask.d.ts","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwB7D,QAAA,MAAM,YAAY,cAAe,SAAS,KAAG,MAAM,YAGlD,CAAC;AAEF,QAAA,MAAM,cAAc,cAAe,SAAS,KAAG,MAAM,YAGpD,CAAC;AAIF,QAAA,MAAM,IAAI,2DAWN,CAAA;AAEJ,QAAA,MAAM,MAAM,2DAWR,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"CustomMask.d.ts","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAuB7D,QAAA,MAAM,YAAY,cAAe,SAAS,KAAG,MAAM,YAGlD,CAAC;AAEF,QAAA,MAAM,cAAc,cAAe,SAAS,KAAG,MAAM,YAGpD,CAAC;AAIF,QAAA,MAAM,IAAI,2DAWN,CAAA;AAEJ,QAAA,MAAM,MAAM,2DAWR,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -22,7 +22,7 @@ const UnmaskFallback = (viewProps) => {
22
22
  warn('Unmask');
23
23
  return React.createElement(View, Object.assign({}, viewProps));
24
24
  };
25
- const hasViewManagerConfig = (nativeComponentName) => UIManager.hasViewManagerConfig && UIManager.hasViewManagerConfig(nativeComponentName);
25
+ const hasViewManagerConfig = (nativeComponentName) => { var _a; return (_a = UIManager.hasViewManagerConfig) === null || _a === void 0 ? void 0 : _a.call(UIManager, nativeComponentName); };
26
26
  const Mask = (() => {
27
27
  if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) {
28
28
  logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`);
@@ -1 +1 @@
1
- {"version":3,"file":"CustomMask.js","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,uBAAuB,GAGzB,OAAO,CAAC,gEAAgE,CAAC,CAAC;AAE9E,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAEzD,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,yBAAyB,SAAS,2DAA2D,SAAS,+EAA+E,CAAC;AAEzO,MAAM,IAAI,GAAG,CAAC,SAAiB,EAAQ,EAAE;IACvC,UAAU,CAAC,GAAG,EAAE;QACd,gGAAgG;QAChG,4CAA4C;QAC5C,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAsB,EAAE;IAChE,IAAI,CAAC,MAAM,CAAC,CAAC;IACb,OAAO,oBAAC,IAAI,oBAAK,SAAS,EAAI,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAsB,EAAE;IAClE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACf,OAAO,oBAAC,IAAI,oBAAK,SAAS,EAAI,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,mBAA2B,EAAW,EAAE,CAAC,SAAS,CAAC,oBAAoB,IAAI,SAAS,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;AAE7J,MAAM,IAAI,GAAG,CAAC,GAA8D,EAAE;IAC5E,IAAI,QAAQ,EAAE,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,EAAE;QAChE,MAAM,CAAC,IAAI,CAAC,oCAAoC,uBAAuB,GAAG,CAAC,CAAC;QAC5E,OAAO,YAAY,CAAC;KACrB;IAED,qDAAqD;IACrD,8KAA8K;IAC9K,OAAO,uBAAuB,CAAC,GAAG,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC;QACjE,eAAe,EAAE,uBAAuB;KACzC,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,EAAE,CAAA;AAEJ,MAAM,MAAM,GAAG,CAAC,GAA8D,EAAE;IAC9E,IAAI,QAAQ,EAAE,IAAI,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,EAAE;QAClE,MAAM,CAAC,IAAI,CAAC,oCAAoC,yBAAyB,GAAG,CAAC,CAAC;QAC9E,OAAO,cAAc,CAAC;KACvB;IAED,qDAAqD;IACrD,8KAA8K;IAC9K,OAAO,uBAAuB,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;QACnE,eAAe,EAAE,yBAAyB;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { logger } from '@sentry/core';\nimport * as React from 'react';\nimport type { HostComponent, ViewProps } from 'react-native';\nimport { UIManager, View } from 'react-native';\n\nimport { isExpoGo } from '../utils/environment';\n\nconst NativeComponentRegistry: {\n get<T, C extends Record<string, unknown>>(componentName: string, createViewConfig: () => C): HostComponent<T>;\n// eslint-disable-next-line @typescript-eslint/no-var-requires\n} = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\n\nconst MaskNativeComponentName = 'RNSentryReplayMask';\nconst UnmaskNativeComponentName = 'RNSentryReplayUnmask';\n\nconst warnMessage = (component: string): string => `[SentrySessionReplay] ${component} component is not supported on the current platform. If ${component} should be supported, please ensure that the application build is up to date.`;\n\nconst warn = (component: string): void => {\n setTimeout(() => {\n // Missing mask component could cause leaking PII, we have to ensure that the warning is visible\n // even if the app is running without debug.\n // eslint-disable-next-line no-console\n console.warn(warnMessage(component));\n }, 0);\n};\n\nconst MaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Mask');\n return <View {...viewProps} />;\n};\n\nconst UnmaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Unmask');\n return <View {...viewProps} />;\n};\n\nconst hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager.hasViewManagerConfig && UIManager.hasViewManagerConfig(nativeComponentName);\n\nconst Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`);\n return MaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(MaskNativeComponentName, () => ({\n uiViewClassName: MaskNativeComponentName,\n }));\n})()\n\nconst Unmask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`);\n return UnmaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(UnmaskNativeComponentName, () => ({\n uiViewClassName: UnmaskNativeComponentName,\n }));\n})();\n\nexport { Mask, Unmask, MaskFallback, UnmaskFallback };\n"]}
1
+ {"version":3,"file":"CustomMask.js","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,uBAAuB,GAGzB,OAAO,CAAC,gEAAgE,CAAC,CAAC;AAE9E,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAEzD,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,yBAAyB,SAAS,2DAA2D,SAAS,+EAA+E,CAAC;AAEzO,MAAM,IAAI,GAAG,CAAC,SAAiB,EAAQ,EAAE;IACvC,UAAU,CAAC,GAAG,EAAE;QACd,gGAAgG;QAChG,4CAA4C;QAC5C,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAsB,EAAE;IAChE,IAAI,CAAC,MAAM,CAAC,CAAC;IACb,OAAO,oBAAC,IAAI,oBAAK,SAAS,EAAI,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAsB,EAAE;IAClE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACf,OAAO,oBAAC,IAAI,oBAAK,SAAS,EAAI,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,mBAA2B,EAAW,EAAE,WAAC,OAAA,MAAA,SAAS,CAAC,oBAAoB,0DAAG,mBAAmB,CAAC,CAAA,EAAA,CAAC;AAE7H,MAAM,IAAI,GAAG,CAAC,GAA8D,EAAE;IAC5E,IAAI,QAAQ,EAAE,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,EAAE;QAChE,MAAM,CAAC,IAAI,CAAC,oCAAoC,uBAAuB,GAAG,CAAC,CAAC;QAC5E,OAAO,YAAY,CAAC;KACrB;IAED,qDAAqD;IACrD,8KAA8K;IAC9K,OAAO,uBAAuB,CAAC,GAAG,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC;QACjE,eAAe,EAAE,uBAAuB;KACzC,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,EAAE,CAAA;AAEJ,MAAM,MAAM,GAAG,CAAC,GAA8D,EAAE;IAC9E,IAAI,QAAQ,EAAE,IAAI,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,EAAE;QAClE,MAAM,CAAC,IAAI,CAAC,oCAAoC,yBAAyB,GAAG,CAAC,CAAC;QAC9E,OAAO,cAAc,CAAC;KACvB;IAED,qDAAqD;IACrD,8KAA8K;IAC9K,OAAO,uBAAuB,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;QACnE,eAAe,EAAE,yBAAyB;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { logger } from '@sentry/core';\nimport * as React from 'react';\nimport type { HostComponent, ViewProps } from 'react-native';\nimport { UIManager, View } from 'react-native';\nimport { isExpoGo } from '../utils/environment';\n\nconst NativeComponentRegistry: {\n get<T, C extends Record<string, unknown>>(componentName: string, createViewConfig: () => C): HostComponent<T>;\n// eslint-disable-next-line @typescript-eslint/no-var-requires\n} = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\n\nconst MaskNativeComponentName = 'RNSentryReplayMask';\nconst UnmaskNativeComponentName = 'RNSentryReplayUnmask';\n\nconst warnMessage = (component: string): string => `[SentrySessionReplay] ${component} component is not supported on the current platform. If ${component} should be supported, please ensure that the application build is up to date.`;\n\nconst warn = (component: string): void => {\n setTimeout(() => {\n // Missing mask component could cause leaking PII, we have to ensure that the warning is visible\n // even if the app is running without debug.\n // eslint-disable-next-line no-console\n console.warn(warnMessage(component));\n }, 0);\n};\n\nconst MaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Mask');\n return <View {...viewProps} />;\n};\n\nconst UnmaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Unmask');\n return <View {...viewProps} />;\n};\n\nconst hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager.hasViewManagerConfig?.(nativeComponentName);\n\nconst Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`);\n return MaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(MaskNativeComponentName, () => ({\n uiViewClassName: MaskNativeComponentName,\n }));\n})()\n\nconst Unmask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`);\n return UnmaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(UnmaskNativeComponentName, () => ({\n uiViewClassName: UnmaskNativeComponentName,\n }));\n})();\n\nexport { Mask, Unmask, MaskFallback, UnmaskFallback };\n"]}
@@ -1,4 +1,16 @@
1
1
  import { replayIntegration } from '@sentry/react';
2
- declare const browserReplayIntegration: (options?: Parameters<typeof replayIntegration>[0]) => ReturnType<typeof replayIntegration>;
2
+ import type { Replay } from './replayInterface';
3
+ /**
4
+ * ReplayConfiguration for browser replay integration.
5
+ *
6
+ * See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.
7
+ */
8
+ type ReplayConfiguration = Parameters<typeof replayIntegration>[0];
9
+ /**
10
+ * Browser Replay integration for React Native.
11
+ *
12
+ * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.
13
+ */
14
+ declare const browserReplayIntegration: (options?: ReplayConfiguration) => Replay;
3
15
  export { browserReplayIntegration };
4
16
  //# sourceMappingURL=browserReplay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserReplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,QAAA,MAAM,wBAAwB,aACnB,WAAW,wBAAwB,CAAC,CAAC,CAAC,CAAC,KAC/C,WAAW,wBAAwB,CAMrC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"browserReplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAKnE;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,aAAa,mBAAmB,KAAQ,MAYrE,CAAC;AAgBF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,6 +1,32 @@
1
1
  import { replayIntegration } from '@sentry/react';
2
+ import { notWeb } from '../utils/environment';
3
+ // https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109
4
+ const INTEGRATION_NAME = 'Replay';
5
+ /**
6
+ * Browser Replay integration for React Native.
7
+ *
8
+ * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.
9
+ */
2
10
  const browserReplayIntegration = (options = {}) => {
11
+ if (notWeb()) {
12
+ // This is required because `replayIntegration` browser check doesn't
13
+ // work for React Native.
14
+ return browserReplayIntegrationNoop();
15
+ }
3
16
  return replayIntegration(Object.assign(Object.assign({}, options), { mask: ['.sentry-react-native-mask', ...(options.mask || [])], unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])] }));
4
17
  };
18
+ const browserReplayIntegrationNoop = () => {
19
+ return {
20
+ name: INTEGRATION_NAME,
21
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
22
+ start: () => { },
23
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
24
+ startBuffering: () => { },
25
+ stop: () => Promise.resolve(),
26
+ flush: () => Promise.resolve(),
27
+ getReplayId: () => undefined,
28
+ getRecordingMode: () => undefined,
29
+ };
30
+ };
5
31
  export { browserReplayIntegration };
6
32
  //# sourceMappingURL=browserReplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,wBAAwB,GAAG,CAC/B,UAAmD,EAAE,EACf,EAAE;IACxC,OAAO,iBAAiB,iCACnB,OAAO,KACV,IAAI,EAAE,CAAC,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAC5D,MAAM,EAAE,CAAC,kEAAkE,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IACvG,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import { replayIntegration } from '@sentry/react';\n\nconst browserReplayIntegration = (\n options: Parameters<typeof replayIntegration>[0] = {},\n): ReturnType<typeof replayIntegration> => {\n return replayIntegration({\n ...options,\n mask: ['.sentry-react-native-mask', ...(options.mask || [])],\n unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],\n });\n};\n\nexport { browserReplayIntegration };\n"]}
1
+ {"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,gJAAgJ;AAChJ,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAA+B,EAAE,EAAU,EAAE;IAC7E,IAAI,MAAM,EAAE,EAAE;QACZ,qEAAqE;QACrE,yBAAyB;QACzB,OAAO,4BAA4B,EAAE,CAAC;KACvC;IAED,OAAO,iBAAiB,iCACnB,OAAO,KACV,IAAI,EAAE,CAAC,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAC5D,MAAM,EAAE,CAAC,kEAAkE,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IACvG,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,GAAW,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,gEAAgE;QAChE,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;QACf,gEAAgE;QAChE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import { replayIntegration } from '@sentry/react';\nimport { notWeb } from '../utils/environment';\nimport type { Replay } from './replayInterface';\n\n/**\n * ReplayConfiguration for browser replay integration.\n *\n * See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.\n */\ntype ReplayConfiguration = Parameters<typeof replayIntegration>[0];\n\n// https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109\nconst INTEGRATION_NAME = 'Replay';\n\n/**\n * Browser Replay integration for React Native.\n *\n * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.\n */\nconst browserReplayIntegration = (options: ReplayConfiguration = {}): Replay => {\n if (notWeb()) {\n // This is required because `replayIntegration` browser check doesn't\n // work for React Native.\n return browserReplayIntegrationNoop();\n }\n\n return replayIntegration({\n ...options,\n mask: ['.sentry-react-native-mask', ...(options.mask || [])],\n unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],\n });\n};\n\nconst browserReplayIntegrationNoop = (): Replay => {\n return {\n name: INTEGRATION_NAME,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n start: () => {},\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n startBuffering: () => {},\n stop: () => Promise.resolve(),\n flush: () => Promise.resolve(),\n getReplayId: () => undefined,\n getRecordingMode: () => undefined,\n };\n};\n\nexport { browserReplayIntegration };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;AASvF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAwBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAuE3F,CAAC"}
1
+ {"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;AAQvF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAwBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAoE3F,CAAC"}
@@ -57,8 +57,9 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
57
57
  }
58
58
  const options = mergeOptions(initOptions);
59
59
  function processEvent(event) {
60
+ var _a;
60
61
  return __awaiter(this, void 0, void 0, function* () {
61
- const hasException = event.exception && event.exception.values && event.exception.values.length > 0;
62
+ const hasException = ((_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) && event.exception.values.length > 0;
62
63
  if (!hasException) {
63
64
  // Event is not an error, will not capture replay
64
65
  return event;
@@ -96,9 +97,6 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
96
97
  // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45
97
98
  return {
98
99
  name: MOBILE_REPLAY_INTEGRATION_NAME,
99
- setupOnce() {
100
- /* Noop */
101
- },
102
100
  setup,
103
101
  processEvent,
104
102
  options: options,
@@ -107,9 +105,6 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
107
105
  const mobileReplayIntegrationNoop = () => {
108
106
  return {
109
107
  name: MOBILE_REPLAY_INTEGRATION_NAME,
110
- setupOnce() {
111
- /* Noop */
112
- },
113
108
  options: defaultOptions,
114
109
  };
115
110
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["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MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, Integration } from '@sentry/core';\nimport { logger } from '@sentry/core';\n\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n */\n enableFastViewRendering?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): Required<MobileReplayOptions> {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n options: defaultOptions,\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aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, Integration } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n */\n enableFastViewRendering?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): Required<MobileReplayOptions> {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";;AAGA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAiCjE"}
1
+ {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";;AAEA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAiCjE"}
@@ -1,5 +1,4 @@
1
- import { RN_GLOBAL_OBJ } from '../utils/worldwide';
2
- import { utf8ToBytes } from '../vendor';
1
+ import { encodeUTF8 } from '../utils/encode';
3
2
  /** Convert a Content-Length header to number/undefined. */
4
3
  export function parseContentLengthHeader(header) {
5
4
  if (!header) {
@@ -15,14 +14,14 @@ export function getBodySize(body) {
15
14
  }
16
15
  try {
17
16
  if (typeof body === 'string') {
18
- return _encode(body).length;
17
+ return encodeUTF8(body).length;
19
18
  }
20
19
  if (body instanceof URLSearchParams) {
21
- return _encode(body.toString()).length;
20
+ return encodeUTF8(body.toString()).length;
22
21
  }
23
22
  if (body instanceof FormData) {
24
23
  const formDataStr = _serializeFormData(body);
25
- return _encode(formDataStr).length;
24
+ return encodeUTF8(formDataStr).length;
26
25
  }
27
26
  if (body instanceof Blob) {
28
27
  return body.size;
@@ -37,12 +36,6 @@ export function getBodySize(body) {
37
36
  }
38
37
  return undefined;
39
38
  }
40
- function _encode(input) {
41
- if (RN_GLOBAL_OBJ.TextEncoder) {
42
- return new RN_GLOBAL_OBJ.TextEncoder().encode(input);
43
- }
44
- return utf8ToBytes(input);
45
- }
46
39
  function _serializeFormData(formData) {
47
40
  // This is a bit simplified, but gives us a decent estimate
48
41
  // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,2DAA2D;AAC3D,MAAM,UAAU,wBAAwB,CAAC,MAAiC;IACxE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAID,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,SAAS,CAAC;KAClB;IAED,IAAI;QACF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;SAC7B;QAED,IAAI,IAAI,YAAY,eAAe,EAAE;YACnC,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;SACxC;QAED,IAAI,IAAI,YAAY,QAAQ,EAAE;YAC5B,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;SACpC;QAED,IAAI,IAAI,YAAY,IAAI,EAAE;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC;SAClB;QAED,IAAI,IAAI,YAAY,WAAW,EAAE;YAC/B,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;QAED,6DAA6D;KAC9D;IAAC,WAAM;QACN,wBAAwB;KACzB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,aAAa,CAAC,WAAW,EAAE;QAC7B,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAkB;IAC5C,2DAA2D;IAC3D,iFAAiF;IACjF,2LAA2L;IAC3L,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { utf8ToBytes } from '../vendor';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return _encode(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return _encode(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return _encode(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _encode(input: string): number[] | Uint8Array {\n if (RN_GLOBAL_OBJ.TextEncoder) {\n return new RN_GLOBAL_OBJ.TextEncoder().encode(input);\n }\n return utf8ToBytes(input);\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
1
+ {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,2DAA2D;AAC3D,MAAM,UAAU,wBAAwB,CAAC,MAAiC;IACxE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAID,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,SAAS,CAAC;KAClB;IAED,IAAI;QACF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;SAChC;QAED,IAAI,IAAI,YAAY,eAAe,EAAE;YACnC,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;SAC3C;QAED,IAAI,IAAI,YAAY,QAAQ,EAAE;YAC5B,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;SACvC;QAED,IAAI,IAAI,YAAY,IAAI,EAAE;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC;SAClB;QAED,IAAI,IAAI,YAAY,WAAW,EAAE;YAC/B,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;QAED,6DAA6D;KAC9D;IAAC,WAAM;QACN,wBAAwB;KACzB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAkB;IAC5C,2DAA2D;IAC3D,iFAAiF;IACjF,2LAA2L;IAC3L,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import { encodeUTF8 } from '../utils/encode';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return encodeUTF8(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return encodeUTF8(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return encodeUTF8(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
@@ -0,0 +1,52 @@
1
+ import type { Integration, ReplayRecordingMode } from '@sentry/core';
2
+ /**
3
+ * Common interface for React Native Replay integrations.
4
+ *
5
+ * Both browser and mobile replay integrations should implement this interface
6
+ * to allow user manually control the replay.
7
+ */
8
+ export interface Replay extends Integration {
9
+ /**
10
+ * Start a replay regardless of sampling rate. Calling this will always
11
+ * create a new session. Will log a message if replay is already in progress.
12
+ *
13
+ * Creates or loads a session, attaches listeners to varying events (DOM,
14
+ * PerformanceObserver, Recording, Sentry SDK, etc)
15
+ */
16
+ start(): void;
17
+ /**
18
+ * Start replay buffering. Buffers until `flush()` is called or, if
19
+ * `replaysOnErrorSampleRate` > 0, until an error occurs.
20
+ */
21
+ startBuffering(): void;
22
+ /**
23
+ * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
24
+ * does not support a teardown
25
+ */
26
+ stop(): Promise<void>;
27
+ /**
28
+ * If not in "session" recording mode, flush event buffer which will create a new replay.
29
+ * If replay is not enabled, a new session replay is started.
30
+ * Unless `continueRecording` is false, the replay will continue to record and
31
+ * behave as a "session"-based replay.
32
+ *
33
+ * Otherwise, queue up a flush.
34
+ */
35
+ flush(options?: {
36
+ continueRecording?: boolean;
37
+ }): Promise<void>;
38
+ /**
39
+ * Get the current session ID.
40
+ */
41
+ getReplayId(): string | undefined;
42
+ /**
43
+ * Get the current recording mode. This can be either `session` or `buffer`.
44
+ *
45
+ * `session`: Recording the whole session, sending it continuously
46
+ * `buffer`: Always keeping the last 60s of recording, requires:
47
+ * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
48
+ * - or calling `flush()` to send the replay
49
+ */
50
+ getRecordingMode(): ReplayRecordingMode | undefined;
51
+ }
52
+ //# sourceMappingURL=replayInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replayInterface.d.ts","sourceRoot":"","sources":["../../../src/js/replay/replayInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAIrE;;;;;GAKG;AACH,MAAM,WAAW,MAAO,SAAQ,WAAW;IACzC;;;;;;OAMG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;OAGG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhE;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAAC;IAElC;;;;;;;OAOG;IACH,gBAAgB,IAAI,mBAAmB,GAAG,SAAS,CAAC;CACrD"}