@sentry/react-native 5.0.0-alpha.9 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/CHANGELOG.md +134 -3
  2. package/README.md +1 -1
  3. package/RNSentry.podspec +5 -5
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +100 -21
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
  8. package/dist/js/NativeRNSentry.d.ts +36 -3
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/breadcrumb.d.ts +11 -0
  12. package/dist/js/breadcrumb.d.ts.map +1 -0
  13. package/dist/js/breadcrumb.js +34 -0
  14. package/dist/js/breadcrumb.js.map +1 -0
  15. package/dist/js/client.d.ts +4 -5
  16. package/dist/js/client.d.ts.map +1 -1
  17. package/dist/js/client.js +22 -35
  18. package/dist/js/client.js.map +1 -1
  19. package/dist/js/index.d.ts +1 -0
  20. package/dist/js/index.d.ts.map +1 -1
  21. package/dist/js/index.js +1 -0
  22. package/dist/js/index.js.map +1 -1
  23. package/dist/js/integrations/debugsymbolicator.d.ts +1 -1
  24. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  25. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  26. package/dist/js/integrations/devicecontext.d.ts +2 -2
  27. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  28. package/dist/js/integrations/devicecontext.js +45 -11
  29. package/dist/js/integrations/devicecontext.js.map +1 -1
  30. package/dist/js/integrations/eventorigin.d.ts +1 -1
  31. package/dist/js/integrations/eventorigin.d.ts.map +1 -1
  32. package/dist/js/integrations/eventorigin.js.map +1 -1
  33. package/dist/js/integrations/modulesloader.d.ts +1 -1
  34. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  35. package/dist/js/integrations/modulesloader.js +8 -2
  36. package/dist/js/integrations/modulesloader.js.map +1 -1
  37. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +1 -1
  38. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  39. package/dist/js/integrations/reactnativeerrorhandlers.js +4 -3
  40. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  41. package/dist/js/integrations/reactnativeinfo.d.ts +1 -1
  42. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  43. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  44. package/dist/js/integrations/release.d.ts +1 -1
  45. package/dist/js/integrations/release.d.ts.map +1 -1
  46. package/dist/js/integrations/release.js.map +1 -1
  47. package/dist/js/integrations/screenshot.d.ts +23 -0
  48. package/dist/js/integrations/screenshot.d.ts.map +1 -0
  49. package/dist/js/integrations/screenshot.js +39 -0
  50. package/dist/js/integrations/screenshot.js.map +1 -0
  51. package/dist/js/integrations/sdkinfo.d.ts +1 -1
  52. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  53. package/dist/js/integrations/sdkinfo.js.map +1 -1
  54. package/dist/js/measurements.d.ts +4 -0
  55. package/dist/js/measurements.d.ts.map +1 -1
  56. package/dist/js/measurements.js +11 -0
  57. package/dist/js/measurements.js.map +1 -1
  58. package/dist/js/misc.d.ts +1 -1
  59. package/dist/js/misc.d.ts.map +1 -1
  60. package/dist/js/misc.js.map +1 -1
  61. package/dist/js/options.d.ts +18 -11
  62. package/dist/js/options.d.ts.map +1 -1
  63. package/dist/js/options.js.map +1 -1
  64. package/dist/js/scope.d.ts +1 -1
  65. package/dist/js/scope.d.ts.map +1 -1
  66. package/dist/js/scope.js +4 -2
  67. package/dist/js/scope.js.map +1 -1
  68. package/dist/js/sdk.d.ts +4 -3
  69. package/dist/js/sdk.d.ts.map +1 -1
  70. package/dist/js/sdk.js +11 -6
  71. package/dist/js/sdk.js.map +1 -1
  72. package/dist/js/tools/ModulesCollector.d.ts +10 -1
  73. package/dist/js/tools/ModulesCollector.d.ts.map +1 -1
  74. package/dist/js/tools/ModulesCollector.js +51 -1
  75. package/dist/js/tools/ModulesCollector.js.map +1 -1
  76. package/dist/js/tools/collectModules.js +6 -27
  77. package/dist/js/tools/collectModules.js.map +1 -1
  78. package/dist/js/touchevents.d.ts +4 -0
  79. package/dist/js/touchevents.d.ts.map +1 -1
  80. package/dist/js/touchevents.js +10 -5
  81. package/dist/js/touchevents.js.map +1 -1
  82. package/dist/js/tracing/nativeframes.d.ts +2 -2
  83. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  84. package/dist/js/tracing/nativeframes.js.map +1 -1
  85. package/dist/js/tracing/reactnativenavigation.d.ts +4 -3
  86. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  87. package/dist/js/tracing/reactnativenavigation.js +1 -1
  88. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  89. package/dist/js/tracing/reactnativetracing.d.ts +5 -5
  90. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  91. package/dist/js/tracing/reactnativetracing.js +1 -1
  92. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  93. package/dist/js/tracing/reactnavigation.d.ts +3 -2
  94. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  95. package/dist/js/tracing/reactnavigation.js +1 -1
  96. package/dist/js/tracing/reactnavigation.js.map +1 -1
  97. package/dist/js/tracing/reactnavigationv4.d.ts +4 -3
  98. package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
  99. package/dist/js/tracing/reactnavigationv4.js +1 -1
  100. package/dist/js/tracing/reactnavigationv4.js.map +1 -1
  101. package/dist/js/tracing/routingInstrumentation.d.ts +3 -3
  102. package/dist/js/tracing/routingInstrumentation.d.ts.map +1 -1
  103. package/dist/js/tracing/routingInstrumentation.js.map +1 -1
  104. package/dist/js/tracing/stalltracking.d.ts +2 -2
  105. package/dist/js/tracing/stalltracking.d.ts.map +1 -1
  106. package/dist/js/tracing/stalltracking.js.map +1 -1
  107. package/dist/js/tracing/types.d.ts +1 -1
  108. package/dist/js/tracing/types.d.ts.map +1 -1
  109. package/dist/js/tracing/types.js.map +1 -1
  110. package/dist/js/tracing/utils.d.ts +2 -2
  111. package/dist/js/tracing/utils.d.ts.map +1 -1
  112. package/dist/js/tracing/utils.js.map +1 -1
  113. package/dist/js/transports/TextEncoder.d.ts +1 -1
  114. package/dist/js/transports/TextEncoder.d.ts.map +1 -1
  115. package/dist/js/transports/TextEncoder.js.map +1 -1
  116. package/dist/js/transports/native.d.ts +7 -3
  117. package/dist/js/transports/native.d.ts.map +1 -1
  118. package/dist/js/transports/native.js +10 -1
  119. package/dist/js/transports/native.js.map +1 -1
  120. package/dist/js/user.d.ts +1 -1
  121. package/dist/js/user.d.ts.map +1 -1
  122. package/dist/js/user.js.map +1 -1
  123. package/dist/js/utils/envelope.d.ts +1 -1
  124. package/dist/js/utils/envelope.d.ts.map +1 -1
  125. package/dist/js/utils/envelope.js.map +1 -1
  126. package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -0
  127. package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -0
  128. package/dist/js/utils/ignorerequirecyclelogs.js +15 -0
  129. package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -0
  130. package/dist/js/utils/outcome.d.ts +1 -1
  131. package/dist/js/utils/outcome.d.ts.map +1 -1
  132. package/dist/js/utils/outcome.js.map +1 -1
  133. package/dist/js/utils/safe.d.ts +1 -1
  134. package/dist/js/utils/safe.d.ts.map +1 -1
  135. package/dist/js/utils/safe.js.map +1 -1
  136. package/dist/js/utils/worldwide.d.ts +1 -1
  137. package/dist/js/utils/worldwide.d.ts.map +1 -1
  138. package/dist/js/utils/worldwide.js.map +1 -1
  139. package/dist/js/version.d.ts +1 -1
  140. package/dist/js/version.d.ts.map +1 -1
  141. package/dist/js/version.js +1 -1
  142. package/dist/js/version.js.map +1 -1
  143. package/dist/js/wrapper.d.ts +9 -3
  144. package/dist/js/wrapper.d.ts.map +1 -1
  145. package/dist/js/wrapper.js +30 -6
  146. package/dist/js/wrapper.js.map +1 -1
  147. package/ios/RNSentry.h +5 -0
  148. package/ios/RNSentry.mm +80 -49
  149. package/package.json +24 -23
  150. package/scripts/collect-modules.sh +1 -1
  151. package/sentry.gradle +46 -15
  152. package/src/js/NativeRNSentry.ts +38 -3
  153. package/ios/RNSentry.xcodeproj/project.pbxproj +0 -472
  154. package/ios/RNSentry.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  155. package/ios/RNSentry.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,136 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0-beta.1
4
+
5
+ - Latest changes from 4.14.0
6
+
7
+ ### Breaking changes
8
+
9
+ - Option `enableAutoPerformanceTracking` renamed to `enableAutoPerformanceTracing`
10
+ - Option `enableOutOfMemoryTracking` renamed to `enableWatchdogTerminationTracking`
11
+
12
+ ### Features
13
+
14
+ - Sync `tags`, `extra`, `fingerprint`, `level`, `environment` and `breadcrumbs` from `sentry-cocoa` during event processing. ([#2713](https://github.com/getsentry/sentry-react-native/pull/2713))
15
+ - `breadcrumb.level` value `log` is transformed to `debug` when syncing with native layers.
16
+ - Remove `breadcrumb.level` value `critical` transformation to `fatal`.
17
+ - Default `breadcrumb.level` is `info`
18
+
19
+ ### Dependencies
20
+
21
+ - Bump Cocoa SDK from v7.31.5 to v8.0.0 ([#2756](https://github.com/getsentry/sentry-react-native/pull/2756))
22
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#800)
23
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.5...8.0.0)
24
+ - Bump Android SDK from v6.12.1 to v6.13.0 ([#2790](https://github.com/getsentry/sentry-react-native/pull/2790))
25
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6130)
26
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.12.1...6.13.0)
27
+
28
+ ## 4.14.0
29
+
30
+ ### Features
31
+
32
+ - Add support for RNGP introduced in React Native 0.71.0 ([#2759](https://github.com/getsentry/sentry-react-native/pull/2759))
33
+
34
+ ### Fixes
35
+
36
+ - Take screenshot runs on UI thread on Android ([#2743](https://github.com/getsentry/sentry-react-native/pull/2743))
37
+
38
+ ### Dependencies
39
+
40
+ - Bump Android SDK from v6.11.0 to v6.12.1 ([#2755](https://github.com/getsentry/sentry-react-native/pull/2755))
41
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6121)
42
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.11.0...6.12.1)
43
+ - Bump JavaScript SDK from v7.29.0 to v7.32.1 ([#2738](https://github.com/getsentry/sentry-react-native/pull/2738), [#2777](https://github.com/getsentry/sentry-react-native/pull/2777))
44
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7321)
45
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.29.0...7.32.1)
46
+
47
+ ## 5.0.0-alpha.11
48
+
49
+ - Latest changes from 4.13.0
50
+
51
+ ### Breaking changes
52
+
53
+ - Message event current stack trace moved from exception to threads ([#2694](https://github.com/getsentry/sentry-react-native/pull/2694))
54
+ - `touchEventBoundaryProps.labelName` property instead of default `accessibilityLabel` fallback ([#2712](https://github.com/getsentry/sentry-react-native/pull/2712))
55
+
56
+ ### Fixes
57
+
58
+ - Unreachable fallback to fetch transport if native is not available ([#2695](https://github.com/getsentry/sentry-react-native/pull/2695))
59
+
60
+ ## 4.13.0
61
+
62
+ ### Fixes
63
+
64
+ - Missing `originalException` in `beforeSend` for events from react native error handler ([#2706](https://github.com/getsentry/sentry-react-native/pull/2706))
65
+ - ModulesLoader integration returns original event if native is not available and event modules overwrite native modules ([#2730](https://github.com/getsentry/sentry-react-native/pull/2730))
66
+
67
+ ### Dependencies
68
+
69
+ - Bump Cocoa SDK from v7.31.3 to v7.31.5 ([#2699](https://github.com/getsentry/sentry-react-native/pull/2699), [#2714](https://github.com/getsentry/sentry-react-native/pull/2714))
70
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/8.0.0/CHANGELOG.md#7315)
71
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.3...7.31.5)
72
+ - Bump JavaScript SDK from v7.26.0 to v7.29.0 ([#2705](https://github.com/getsentry/sentry-react-native/pull/2705), [#2709](https://github.com/getsentry/sentry-react-native/pull/2709), [#2715](https://github.com/getsentry/sentry-react-native/pull/2715), [#2736](https://github.com/getsentry/sentry-react-native/pull/2736))
73
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7290)
74
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.26.0...7.29.0)
75
+ - Bump Android SDK from v6.9.2 to v6.11.0 ([#2704](https://github.com/getsentry/sentry-react-native/pull/2704), [#2724](https://github.com/getsentry/sentry-react-native/pull/2724))
76
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6110)
77
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.9.2...6.11.0)
78
+
79
+ ## 4.12.0
80
+
81
+ ### Features
82
+
83
+ - Add `lastEventId` method to the API ([#2675](https://github.com/getsentry/sentry-react-native/pull/2675))
84
+
85
+ ### Fix
86
+
87
+ - `Sentry.startTransaction` doesn't require `op` ([#2691](https://github.com/getsentry/sentry-react-native/pull/2691))
88
+
89
+ ### Dependencies
90
+
91
+ - Bump Cocoa SDK from v7.31.2 to v7.31.3 ([#2647](https://github.com/getsentry/sentry-react-native/pull/2647))
92
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/8.0.0/CHANGELOG.md#7313)
93
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.2...7.31.3)
94
+ - Bump JavaScript SDK from v7.21.1 to v7.26.0 ([#2672](https://github.com/getsentry/sentry-react-native/pull/2672), [#2648](https://github.com/getsentry/sentry-react-native/pull/2648), [#2692](https://github.com/getsentry/sentry-react-native/pull/2692))
95
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7260)
96
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.21.1...7.26.0)
97
+ - Bump Android SDK from v6.9.1 to v6.9.2 ([#2677](https://github.com/getsentry/sentry-react-native/pull/2677))
98
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#692)
99
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.9.1...6.9.2)
100
+
101
+ ## 5.0.0-alpha.10
102
+
103
+ - Latest changes from 4.11.0
104
+
105
+ ### Dependencies
106
+
107
+ - Bump CLI from v1.74.4 to v2.10.0 ([#2669](https://github.com/getsentry/sentry-react-native/pull/2669))
108
+ - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2100)
109
+ - [diff](https://github.com/getsentry/sentry-cli/compare/1.74.4...2.10.0)
110
+
111
+ ## 4.11.0
112
+
113
+ ### Features
114
+
115
+ - Screenshots ([#2610](https://github.com/getsentry/sentry-react-native/pull/2610))
116
+
117
+ ## 4.10.1
118
+
119
+ ### Fixes
120
+
121
+ - Bump Wizard from v1.2.17 to v1.4.0 ([#2645](https://github.com/getsentry/sentry-react-native/pull/2645))
122
+ - [changelog](https://github.com/getsentry/sentry-wizard/blob/master/CHANGELOG.md#140)
123
+ - [diff](https://github.com/getsentry/sentry-wizard/compare/v1.2.17...v1.4.0)
124
+ - Android builds without ext config, auto create assets dir for modules ([#2652](https://github.com/getsentry/sentry-react-native/pull/2652))
125
+ - Exit gracefully if source map file for collecting modules doesn't exist ([#2655](https://github.com/getsentry/sentry-react-native/pull/2655))
126
+ - Create only one clean-up tasks for modules collection ([#2657](https://github.com/getsentry/sentry-react-native/pull/2657))
127
+
128
+ ### Dependencies
129
+
130
+ - Bump Android SDK from v6.8.0 to v6.9.1 ([#2653](https://github.com/getsentry/sentry-react-native/pull/2653))
131
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#691)
132
+ - [diff](https://github.com/getsentry/sentry-java/compare/6.8.0...6.9.1)
133
+
3
134
  ## 5.0.0-alpha.9
4
135
 
5
136
  - Latest changes from 4.10.0
@@ -1007,10 +1138,10 @@ This release is a breaking change an code changes are necessary.
1007
1138
  New way to import and init the SDK:
1008
1139
 
1009
1140
  ```js
1010
- import * as Sentry from "@sentry/react-native";
1141
+ import * as Sentry from '@sentry/react-native';
1011
1142
 
1012
1143
  Sentry.init({
1013
- dsn: "DSN",
1144
+ dsn: 'DSN',
1014
1145
  });
1015
1146
  ```
1016
1147
 
@@ -1245,7 +1376,7 @@ We decided to deactivate stack trace merging by default on iOS since it seems to
1245
1376
  To activate it set:
1246
1377
 
1247
1378
  ```js
1248
- Sentry.config("___DSN___", {
1379
+ Sentry.config('___DSN___', {
1249
1380
  deactivateStacktraceMerging: false,
1250
1381
  });
1251
1382
  ```
package/README.md CHANGED
@@ -13,7 +13,7 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he
13
13
  # Sentry SDK for React Native
14
14
 
15
15
  [![Build & Test](https://github.com/getsentry/sentry-react-native/actions/workflows/buildandtest.yml/badge.svg)](https://github.com/getsentry/sentry-react-native/actions/workflows/buildandtest.yml)
16
- [![E2E Tests](https://img.shields.io/github/workflow/status/getsentry/sentry-react-native/End-to-End%20Tests?label=E2E%20Tests)](https://github.com/getsentry/sentry-react-native/actions?query=workflow%3A"End-to-End%20Tests")
16
+ [![E2E Tests](https://img.shields.io/github/actions/workflow/status/getsentry/sentry-react-native/.github/workflows/e2e.yml?branch=main)](https://github.com/getsentry/sentry-react-native/actions?query=workflow%3A"End-to-End%20Tests")
17
17
  [![npm version](https://img.shields.io/npm/v/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
18
18
  [![npm dm](https://img.shields.io/npm/dm/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
19
19
  [![npm dt](https://img.shields.io/npm/dt/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
package/RNSentry.podspec CHANGED
@@ -12,16 +12,16 @@ Pod::Spec.new do |s|
12
12
  s.homepage = "https://github.com/getsentry/sentry-react-native"
13
13
  s.source = { :git => 'https://github.com/getsentry/sentry-react-native.git', :tag => "#{s.version}"}
14
14
 
15
- s.ios.deployment_target = "12.4"
16
- s.osx.deployment_target = "10.10"
17
- s.tvos.deployment_target = "12.4"
15
+ s.ios.deployment_target = "11.0"
16
+ s.osx.deployment_target = "10.13"
17
+ s.tvos.deployment_target = "11.0"
18
18
 
19
19
  s.preserve_paths = '*.js'
20
20
 
21
21
  s.dependency 'React-Core'
22
- s.dependency 'Sentry/HybridSDK', '7.31.2'
22
+ s.dependency 'Sentry/HybridSDK', '8.0.0'
23
23
 
24
- s.source_files = 'ios/RNSentry.{h,mm}'
24
+ s.source_files = 'ios/**/*.{h,mm}'
25
25
  s.public_header_files = 'ios/RNSentry.h'
26
26
 
27
27
  # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
@@ -42,5 +42,5 @@ android {
42
42
 
43
43
  dependencies {
44
44
  implementation 'com.facebook.react:react-native:+'
45
- api 'io.sentry:sentry-android:6.8.0'
45
+ api 'io.sentry:sentry-android:6.13.0'
46
46
  }
@@ -1,5 +1,7 @@
1
1
  package io.sentry.react;
2
2
 
3
+ import static io.sentry.android.core.internal.util.ScreenshotUtils.takeScreenshot;
4
+
3
5
  import android.app.Activity;
4
6
  import android.content.Context;
5
7
  import android.content.pm.PackageInfo;
@@ -16,7 +18,12 @@ import com.facebook.react.bridge.ReactApplicationContext;
16
18
  import com.facebook.react.bridge.ReadableArray;
17
19
  import com.facebook.react.bridge.ReadableMap;
18
20
  import com.facebook.react.bridge.ReadableMapKeySetIterator;
21
+ import com.facebook.react.bridge.UiThreadUtil;
22
+ import com.facebook.react.bridge.WritableArray;
19
23
  import com.facebook.react.bridge.WritableMap;
24
+ import com.facebook.react.bridge.WritableNativeArray;
25
+ import com.facebook.react.bridge.WritableNativeMap;
26
+ import com.facebook.react.module.annotations.ReactModule;
20
27
 
21
28
  import java.io.BufferedInputStream;
22
29
  import java.io.File;
@@ -24,24 +31,30 @@ import java.io.FileNotFoundException;
24
31
  import java.io.FileOutputStream;
25
32
  import java.io.InputStream;
26
33
  import java.nio.charset.Charset;
27
- import java.util.Date;
28
34
  import java.util.HashMap;
29
35
  import java.util.List;
30
36
  import java.util.Map;
31
37
  import java.util.UUID;
32
- import java.util.logging.Level;
33
- import java.util.logging.Logger;
38
+ import java.util.concurrent.CountDownLatch;
39
+ import java.util.concurrent.TimeUnit;
34
40
 
35
41
  import io.sentry.Breadcrumb;
42
+ import io.sentry.DateUtils;
36
43
  import io.sentry.HubAdapter;
44
+ import io.sentry.ILogger;
37
45
  import io.sentry.Integration;
38
46
  import io.sentry.Sentry;
47
+ import io.sentry.SentryDate;
39
48
  import io.sentry.SentryEvent;
40
49
  import io.sentry.SentryLevel;
41
50
  import io.sentry.UncaughtExceptionHandlerIntegration;
51
+ import io.sentry.android.core.AndroidLogger;
42
52
  import io.sentry.android.core.AnrIntegration;
43
53
  import io.sentry.android.core.AppStartState;
54
+ import io.sentry.android.core.BuildInfoProvider;
55
+ import io.sentry.android.core.CurrentActivityHolder;
44
56
  import io.sentry.android.core.NdkIntegration;
57
+ import io.sentry.android.core.ScreenshotEventProcessor;
45
58
  import io.sentry.android.core.SentryAndroid;
46
59
  import io.sentry.protocol.SdkVersion;
47
60
  import io.sentry.protocol.SentryException;
@@ -52,7 +65,8 @@ public class RNSentryModuleImpl {
52
65
 
53
66
  public static final String NAME = "RNSentry";
54
67
 
55
- private static final Logger logger = Logger.getLogger("react-native-sentry");
68
+ private static final ILogger logger = new AndroidLogger(NAME);
69
+ private static final BuildInfoProvider buildInfo = new BuildInfoProvider(logger);
56
70
  private static final String modulesPath = "modules.json";
57
71
  private static final Charset UTF_8 = Charset.forName("UTF-8");
58
72
 
@@ -60,6 +74,7 @@ public class RNSentryModuleImpl {
60
74
  private final PackageInfo packageInfo;
61
75
  private FrameMetricsAggregator frameMetricsAggregator = null;
62
76
  private boolean androidXAvailable;
77
+ private ScreenshotEventProcessor screenshotEventProcessor;
63
78
 
64
79
  private static boolean didFetchAppStart;
65
80
 
@@ -68,6 +83,8 @@ public class RNSentryModuleImpl {
68
83
  // 16ms (slower than 60fps) to constitute slow frames.
69
84
  private static final int SLOW_FRAME_THRESHOLD = 16;
70
85
 
86
+ private static final int SCREENSHOT_TIMEOUT_SECONDS = 2;
87
+
71
88
  public RNSentryModuleImpl(ReactApplicationContext reactApplicationContext) {
72
89
  packageInfo = getPackageInfo(reactApplicationContext);
73
90
  this.reactApplicationContext = reactApplicationContext;
@@ -86,11 +103,10 @@ public class RNSentryModuleImpl {
86
103
  SentryAndroid.init(this.getReactApplicationContext(), options -> {
87
104
  if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
88
105
  options.setDebug(true);
89
- logger.setLevel(Level.INFO);
90
106
  }
91
107
  if (rnOptions.hasKey("dsn") && rnOptions.getString("dsn") != null) {
92
108
  String dsn = rnOptions.getString("dsn");
93
- logger.info(String.format("Starting with DSN: '%s'", dsn));
109
+ logger.log(SentryLevel.INFO, String.format("Starting with DSN: '%s'", dsn));
94
110
  options.setDsn(dsn);
95
111
  } else {
96
112
  // SentryAndroid needs an empty string fallback for the dsn.
@@ -134,6 +150,9 @@ public class RNSentryModuleImpl {
134
150
  // by default we hide.
135
151
  options.setAttachThreads(rnOptions.getBoolean("attachThreads"));
136
152
  }
153
+ if (rnOptions.hasKey("attachScreenshot")) {
154
+ options.setAttachScreenshot(rnOptions.getBoolean("attachScreenshot"));
155
+ }
137
156
  if (rnOptions.hasKey("sendDefaultPii")) {
138
157
  options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
139
158
  }
@@ -169,8 +188,13 @@ public class RNSentryModuleImpl {
169
188
  }
170
189
  }
171
190
  }
191
+ logger.log(SentryLevel.INFO, String.format("Native Integrations '%s'", options.getIntegrations()));
172
192
 
173
- logger.info(String.format("Native Integrations '%s'", options.getIntegrations()));
193
+ final CurrentActivityHolder currentActivityHolder = CurrentActivityHolder.getInstance();
194
+ final Activity currentActivity = getCurrentActivity();
195
+ if (currentActivity != null) {
196
+ currentActivityHolder.setActivity(currentActivity);
197
+ }
174
198
  });
175
199
 
176
200
  promise.resolve(true);
@@ -193,7 +217,7 @@ public class RNSentryModuleImpl {
193
217
  } catch (FileNotFoundException e) {
194
218
  promise.resolve(null);
195
219
  } catch (Throwable e) {
196
- logger.warning("Fetching JS Modules failed.");
220
+ logger.log(SentryLevel.WARNING, "Fetching JS Modules failed.");
197
221
  promise.resolve(null);
198
222
  }
199
223
  }
@@ -208,21 +232,21 @@ public class RNSentryModuleImpl {
208
232
 
209
233
  public void fetchNativeAppStart(Promise promise) {
210
234
  final AppStartState appStartInstance = AppStartState.getInstance();
211
- final Date appStartTime = appStartInstance.getAppStartTime();
235
+ final SentryDate appStartTime = appStartInstance.getAppStartTime();
212
236
  final Boolean isColdStart = appStartInstance.isColdStart();
213
237
 
214
238
  if (appStartTime == null) {
215
- logger.warning("App start won't be sent due to missing appStartTime.");
239
+ logger.log(SentryLevel.WARNING, "App start won't be sent due to missing appStartTime.");
216
240
  promise.resolve(null);
217
241
  } else if (isColdStart == null) {
218
- logger.warning("App start won't be sent due to missing isColdStart.");
242
+ logger.log(SentryLevel.WARNING, "App start won't be sent due to missing isColdStart.");
219
243
  promise.resolve(null);
220
244
  } else {
221
- final double appStartTimestamp = (double) appStartTime.getTime();
245
+ final double appStartTimestampMs = DateUtils.nanosToMillis(appStartTime.nanoTimestamp());
222
246
 
223
247
  WritableMap appStart = Arguments.createMap();
224
248
 
225
- appStart.putDouble("appStartTime", appStartTimestamp);
249
+ appStart.putDouble("appStartTime", appStartTimestampMs);
226
250
  appStart.putBoolean("isColdStart", isColdStart);
227
251
  appStart.putBoolean("didFetchAppStart", didFetchAppStart);
228
252
 
@@ -280,7 +304,7 @@ public class RNSentryModuleImpl {
280
304
 
281
305
  promise.resolve(map);
282
306
  } catch (Throwable ignored) {
283
- logger.warning("Error fetching native frames.");
307
+ logger.log(SentryLevel.WARNING, "Error fetching native frames.");
284
308
  promise.resolve(null);
285
309
  }
286
310
  }
@@ -296,7 +320,7 @@ public class RNSentryModuleImpl {
296
320
  final String outboxPath = HubAdapter.getInstance().getOptions().getOutboxPath();
297
321
 
298
322
  if (outboxPath == null) {
299
- logger.severe(
323
+ logger.log(SentryLevel.ERROR,
300
324
  "Error retrieving outboxPath. Envelope will not be sent. Is the Android SDK initialized?");
301
325
  } else {
302
326
  File installation = new File(outboxPath, UUID.randomUUID().toString());
@@ -305,16 +329,71 @@ public class RNSentryModuleImpl {
305
329
  }
306
330
  }
307
331
  } catch (Throwable ignored) {
308
- logger.severe("Error while writing envelope to outbox.");
332
+ logger.log(SentryLevel.ERROR, "Error while writing envelope to outbox.");
309
333
  }
310
334
  promise.resolve(true);
311
335
  }
312
336
 
337
+ public void captureScreenshot(Promise promise) {
338
+
339
+ final Activity activity = getCurrentActivity();
340
+ if (activity == null) {
341
+ logger.log(SentryLevel.WARNING, "CurrentActivity is null, can't capture screenshot.");
342
+ promise.resolve(null);
343
+ return;
344
+ }
345
+
346
+ final byte[] raw = takeScreenshotOnUiThread(activity);
347
+
348
+ if (raw == null) {
349
+ logger.log(SentryLevel.WARNING, "Screenshot is null, screen was not captured.");
350
+ promise.resolve(null);
351
+ return;
352
+ }
353
+
354
+ final WritableNativeArray data = new WritableNativeArray();
355
+ for (final byte b : raw) {
356
+ data.pushInt(b);
357
+ }
358
+ final WritableMap screenshot = new WritableNativeMap();
359
+ screenshot.putString("contentType", "image/png");
360
+ screenshot.putArray("data", data);
361
+ screenshot.putString("filename", "screenshot.png");
362
+
363
+ final WritableArray screenshotsArray = new WritableNativeArray();
364
+ screenshotsArray.pushMap(screenshot);
365
+ promise.resolve(screenshotsArray);
366
+ }
367
+
368
+ private static byte[] takeScreenshotOnUiThread(Activity activity) {
369
+ CountDownLatch doneSignal = new CountDownLatch(1);
370
+ final byte[][] bytesWrapper = {{}}; // wrapper to be able to set the value in the runnable
371
+ final Runnable runTakeScreenshot = () -> {
372
+ bytesWrapper[0] = takeScreenshot(activity, logger, buildInfo);
373
+ doneSignal.countDown();
374
+ };
375
+
376
+ if (UiThreadUtil.isOnUiThread()) {
377
+ runTakeScreenshot.run();
378
+ } else {
379
+ UiThreadUtil.runOnUiThread(runTakeScreenshot);
380
+ }
381
+
382
+ try {
383
+ doneSignal.await(SCREENSHOT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
384
+ } catch (InterruptedException e) {
385
+ logger.log(SentryLevel.ERROR, "Screenshot process was interrupted.");
386
+ return null;
387
+ }
388
+
389
+ return bytesWrapper[0];
390
+ }
391
+
313
392
  private static PackageInfo getPackageInfo(Context ctx) {
314
393
  try {
315
394
  return ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
316
395
  } catch (PackageManager.NameNotFoundException e) {
317
- logger.warning("Error getting package info.");
396
+ logger.log(SentryLevel.WARNING, "Error getting package info.");
318
397
  return null;
319
398
  }
320
399
  }
@@ -469,17 +548,17 @@ public class RNSentryModuleImpl {
469
548
  try {
470
549
  frameMetricsAggregator.add(currentActivity);
471
550
 
472
- logger.info("FrameMetricsAggregator installed.");
551
+ logger.log(SentryLevel.INFO, "FrameMetricsAggregator installed.");
473
552
  } catch (Throwable ignored) {
474
553
  // throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
475
554
  // this is a best effort since we can't reproduce it
476
- logger.severe("Error adding Activity to frameMetricsAggregator.");
555
+ logger.log(SentryLevel.ERROR, "Error adding Activity to frameMetricsAggregator.");
477
556
  }
478
557
  } else {
479
- logger.info("currentActivity isn't available.");
558
+ logger.log(SentryLevel.INFO, "currentActivity isn't available.");
480
559
  }
481
560
  } else {
482
- logger.warning("androidx.core' isn't available as a dependency.");
561
+ logger.log(SentryLevel.WARNING, "androidx.core' isn't available as a dependency.");
483
562
  }
484
563
  }
485
564
 
@@ -57,6 +57,11 @@ public class RNSentryModule extends NativeRNSentrySpec {
57
57
  this.impl.captureEnvelope(rawBytes, options, promise);
58
58
  }
59
59
 
60
+ @Override
61
+ public void captureScreenshot(Promise promise) {
62
+ this.impl.captureScreenshot(promise);
63
+ }
64
+
60
65
  @Override
61
66
  public void setUser(final ReadableMap user, final ReadableMap otherUserKeys) {
62
67
  this.impl.setUser(user, otherUserKeys);
@@ -57,6 +57,11 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
57
57
  this.impl.captureEnvelope(rawBytes, options, promise);
58
58
  }
59
59
 
60
+ @ReactMethod
61
+ public void captureScreenshot(Promise promise) {
62
+ this.impl.captureScreenshot(promise);
63
+ }
64
+
60
65
  @ReactMethod
61
66
  public void setUser(final ReadableMap user, final ReadableMap otherUserKeys) {
62
67
  this.impl.setUser(user, otherUserKeys);
@@ -1,11 +1,12 @@
1
- import { Package } from '@sentry/types';
2
- import { TurboModule } from 'react-native';
1
+ import type { Package } from '@sentry/types';
2
+ import type { TurboModule } from 'react-native';
3
3
  import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
4
  export interface Spec extends TurboModule {
5
5
  addBreadcrumb(breadcrumb: UnsafeObject): void;
6
6
  captureEnvelope(bytes: number[], options: {
7
7
  store: boolean;
8
8
  }): Promise<boolean>;
9
+ captureScreenshot(): Promise<NativeScreenshot[]>;
9
10
  clearBreadcrumbs(): void;
10
11
  crash(): void;
11
12
  closeNativeSdk(): Promise<void>;
@@ -38,8 +39,40 @@ export declare type NativeReleaseResponse = {
38
39
  id: string;
39
40
  version: string;
40
41
  };
42
+ /**
43
+ * This type describes serialized scope from sentry-cocoa. (This is not used for Android)
44
+ * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m
45
+ */
41
46
  export declare type NativeDeviceContextsResponse = {
42
- [key: string]: Record<string, unknown>;
47
+ [key: string]: unknown;
48
+ tags?: Record<string, string>;
49
+ extra?: Record<string, unknown>;
50
+ context?: Record<string, Record<string, unknown>>;
51
+ user?: {
52
+ userId?: string;
53
+ email?: string;
54
+ username?: string;
55
+ ipAddress?: string;
56
+ segment?: string;
57
+ data?: Record<string, unknown>;
58
+ };
59
+ dist?: string;
60
+ environment?: string;
61
+ fingerprint?: string[];
62
+ level?: string;
63
+ breadcrumbs?: {
64
+ level?: string;
65
+ timestamp?: string;
66
+ category?: string;
67
+ type?: string;
68
+ message?: string;
69
+ data?: Record<string, unknown>;
70
+ }[];
71
+ };
72
+ export declare type NativeScreenshot = {
73
+ data: number[];
74
+ contentType: string;
75
+ filename: string;
43
76
  };
44
77
  declare const _default: Spec;
45
78
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAI9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9C,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE;QACP,KAAK,EAAE,OAAO,CAAC;KAChB,GACA,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,gBAAgB,IAAI,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,2BAA2B,IAAI,IAAI,CAAC;IACpC,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrD,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,yBAAyB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACnE,mBAAmB,IAAI,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAA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,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAA;;AAGD,wBAAkE"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwDhE,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import { Package } from '@sentry/types';\nimport { TurboModule, TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: number[],\n options: {\n store: boolean,\n },\n ): Promise<boolean>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(\n defaultUserKeys: UnsafeObject | null,\n otherUserKeys: UnsafeObject | null\n ): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n}\n\nexport type NativeAppStartResponse = {\n isColdStart: boolean;\n appStartTime: number;\n didFetchAppStart: boolean;\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\nexport type NativeDeviceContextsResponse = {\n [key: string]: Record<string, unknown>;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
1
+ {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA0FnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule} from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: number[],\n options: {\n store: boolean,\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[]>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(\n defaultUserKeys: UnsafeObject | null,\n otherUserKeys: UnsafeObject | null\n ): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n}\n\nexport type NativeAppStartResponse = {\n isColdStart: boolean;\n appStartTime: number;\n didFetchAppStart: boolean;\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa. (This is not used for Android)\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n context?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n}\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Breadcrumb, SeverityLevel } from '@sentry/types';
2
+ export declare const DEFAULT_BREADCRUMB_LEVEL: SeverityLevel;
3
+ declare type BreadcrumbCandidate = {
4
+ [K in keyof Partial<Breadcrumb>]: unknown;
5
+ };
6
+ /**
7
+ * Convert plain object to a valid Breadcrumb
8
+ */
9
+ export declare function breadcrumbFromObject(candidate: BreadcrumbCandidate): Breadcrumb;
10
+ export {};
11
+ //# sourceMappingURL=breadcrumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/js/breadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,aAAsB,CAAC;AAE9D,aAAK,mBAAmB,GAAG;KACxB,CAAC,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO;CAC1C,CAAA;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,mBAAmB,GAAG,UAAU,CA6B/E"}
@@ -0,0 +1,34 @@
1
+ import { severityLevelFromString } from '@sentry/utils';
2
+ export const DEFAULT_BREADCRUMB_LEVEL = 'info';
3
+ /**
4
+ * Convert plain object to a valid Breadcrumb
5
+ */
6
+ export function breadcrumbFromObject(candidate) {
7
+ const breadcrumb = {};
8
+ if (typeof candidate.type === 'string') {
9
+ breadcrumb.type = candidate.type;
10
+ }
11
+ if (typeof candidate.level === 'string') {
12
+ breadcrumb.level = severityLevelFromString(candidate.level);
13
+ }
14
+ if (typeof candidate.event_id === 'string') {
15
+ breadcrumb.event_id = candidate.event_id;
16
+ }
17
+ if (typeof candidate.category === 'string') {
18
+ breadcrumb.category = candidate.category;
19
+ }
20
+ if (typeof candidate.message === 'string') {
21
+ breadcrumb.message = candidate.message;
22
+ }
23
+ if (typeof candidate.data === 'object' && candidate.data !== null) {
24
+ breadcrumb.data = candidate.data;
25
+ }
26
+ if (typeof candidate.timestamp === 'string') {
27
+ const timestamp = Date.parse(candidate.timestamp);
28
+ if (!isNaN(timestamp)) {
29
+ breadcrumb.timestamp = timestamp;
30
+ }
31
+ }
32
+ return breadcrumb;
33
+ }
34
+ //# sourceMappingURL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AAE;YACrB,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;SAClC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { Breadcrumb, SeverityLevel } from '@sentry/types';\nimport { severityLevelFromString } from '@sentry/utils';\n\nexport const DEFAULT_BREADCRUMB_LEVEL: SeverityLevel = 'info';\n\ntype BreadcrumbCandidate = {\n [K in keyof Partial<Breadcrumb>]: unknown;\n}\n\n/**\n * Convert plain object to a valid Breadcrumb\n */\nexport function breadcrumbFromObject(candidate: BreadcrumbCandidate): Breadcrumb {\n const breadcrumb: Breadcrumb = {};\n\n if (typeof candidate.type === 'string') {\n breadcrumb.type = candidate.type;\n }\n if (typeof candidate.level === 'string') {\n breadcrumb.level = severityLevelFromString(candidate.level);\n }\n if (typeof candidate.event_id === 'string') {\n breadcrumb.event_id = candidate.event_id;\n }\n if (typeof candidate.category === 'string') {\n breadcrumb.category = candidate.category;\n }\n if (typeof candidate.message === 'string') {\n breadcrumb.message = candidate.message;\n }\n if (typeof candidate.data === 'object' && candidate.data !== null) {\n breadcrumb.data = candidate.data;\n }\n if (typeof candidate.timestamp === 'string') {\n const timestamp = Date.parse(candidate.timestamp)\n if (!isNaN(timestamp)) {\n breadcrumb.timestamp = timestamp;\n }\n }\n\n return breadcrumb;\n}\n"]}