@sentry/react-native 5.0.0-alpha.3 → 5.0.0-alpha.5
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.
- package/CHANGELOG.md +96 -6
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModule.java +12 -12
- package/dist/js/client.d.ts +16 -3
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +76 -6
- package/dist/js/client.js.map +1 -1
- package/dist/js/definitions.d.ts +2 -4
- package/dist/js/definitions.d.ts.map +1 -1
- package/dist/js/definitions.js.map +1 -1
- package/dist/js/index.d.ts +3 -3
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +2 -2
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +3 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/sdkinfo.d.ts +4 -1
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js +14 -7
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/misc.d.ts +9 -0
- package/dist/js/misc.d.ts.map +1 -0
- package/dist/js/misc.js +17 -0
- package/dist/js/misc.js.map +1 -0
- package/dist/js/options.d.ts +27 -6
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/scope.d.ts +9 -1
- package/dist/js/scope.d.ts.map +1 -1
- package/dist/js/scope.js +12 -0
- package/dist/js/scope.js.map +1 -1
- package/dist/js/sdk.d.ts +25 -0
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +73 -18
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +14 -5
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +10 -6
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js +2 -2
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +1 -2
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js +2 -10
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/TextEncoder.d.ts +3 -0
- package/dist/js/transports/TextEncoder.d.ts.map +1 -0
- package/dist/js/transports/TextEncoder.js +12 -0
- package/dist/js/transports/TextEncoder.js.map +1 -0
- package/dist/js/utils/envelope.d.ts +12 -0
- package/dist/js/utils/envelope.d.ts.map +1 -0
- package/dist/js/utils/envelope.js +21 -0
- package/dist/js/utils/envelope.js.map +1 -0
- package/dist/js/utils/outcome.d.ts +6 -0
- package/dist/js/utils/outcome.d.ts.map +1 -0
- package/dist/js/utils/outcome.js +19 -0
- package/dist/js/utils/outcome.js.map +1 -0
- package/dist/js/utils/safe.d.ts +18 -0
- package/dist/js/utils/safe.d.ts.map +1 -0
- package/dist/js/utils/safe.js +46 -0
- package/dist/js/utils/safe.js.map +1 -0
- package/dist/js/vendor/buffer/index.d.ts +2 -0
- package/dist/js/vendor/buffer/index.d.ts.map +1 -0
- package/dist/js/vendor/buffer/index.js +2 -0
- package/dist/js/vendor/buffer/index.js.map +1 -0
- package/dist/js/vendor/buffer/utf8ToBytes.d.ts +10 -0
- package/dist/js/vendor/buffer/utf8ToBytes.d.ts.map +1 -0
- package/dist/js/vendor/buffer/utf8ToBytes.js +82 -0
- package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -0
- package/dist/js/vendor/index.d.ts +2 -0
- package/dist/js/vendor/index.d.ts.map +1 -0
- package/dist/js/vendor/index.js +2 -0
- package/dist/js/vendor/index.js.map +1 -0
- package/dist/js/version.d.ts +2 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +2 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +3 -2
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +62 -57
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.m +22 -35
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Make `configureScope` callback safe [#2510](https://github.com/getsentry/sentry-react-native/pull/2510)
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- Bump JavaScript SDK from v7.14.0 to v7.14.1 ([#2511](https://github.com/getsentry/sentry-react-native/pull/2511))
|
|
12
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7141)
|
|
13
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.14.0...7.14.1)
|
|
14
|
+
- Bump Cocoa SDK from v7.27.0 to v7.27.1 ([#2521](https://github.com/getsentry/sentry-react-native/pull/2521))
|
|
15
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7271)
|
|
16
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.27.0...7.27.1)
|
|
17
|
+
- Bump Android SDK from v6.4.2 to v6.4.3 ([#2520](https://github.com/getsentry/sentry-react-native/pull/2520))
|
|
18
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#643)
|
|
19
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.2...6.4.3)
|
|
20
|
+
|
|
21
|
+
## 4.6.0
|
|
22
|
+
|
|
23
|
+
### Fixes
|
|
24
|
+
|
|
25
|
+
- SDK Gracefully downgrades when callback throws an error ([#2502](https://github.com/getsentry/sentry-react-native/pull/2502))
|
|
26
|
+
- React Navigation v5 ignores when current route is undefined after state changed. ([#2484](https://github.com/getsentry/sentry-react-native/pull/2484))
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- Add ClientReports ([#2496](https://github.com/getsentry/sentry-react-native/pull/2496))
|
|
31
|
+
|
|
32
|
+
### Sentry Self-hosted Compatibility
|
|
33
|
+
|
|
34
|
+
- Starting with version `4.6.0` of the `@sentry/react-native` package, [Sentry's self hosted version >= v21.9.0](https://github.com/getsentry/self-hosted/releases) is required or you have to manually disable sending client reports via the `sendClientReports` option. This only applies to self-hosted Sentry. If you are using [sentry.io](https://sentry.io), no action is needed.
|
|
35
|
+
|
|
36
|
+
### Dependencies
|
|
37
|
+
|
|
38
|
+
- Bump Cocoa SDK from v7.25.1 to v7.27.0 ([#2500](https://github.com/getsentry/sentry-react-native/pull/2500), [#2506](https://github.com/getsentry/sentry-react-native/pull/2506))
|
|
39
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7270)
|
|
40
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.25.1...7.27.0)
|
|
41
|
+
- Bump JavaScript SDK from v7.13.0 to v7.14.0 ([#2504](https://github.com/getsentry/sentry-react-native/pull/2504))
|
|
42
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7140)
|
|
43
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.13.0...7.14.0)
|
|
44
|
+
|
|
45
|
+
## 5.0.0-alpha.4
|
|
46
|
+
|
|
47
|
+
- Latest changes from 4.5.0
|
|
48
|
+
|
|
49
|
+
### Breaking changes
|
|
50
|
+
|
|
51
|
+
- New ReactNativeTracingOptions idleTimeoutMs and finalTimeoutMs replacing idleTimeout and maxTransactionDuration respectively ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))
|
|
52
|
+
|
|
53
|
+
## 4.5.0
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- Add user feedback ([#2486](https://github.com/getsentry/sentry-react-native/pull/2486))
|
|
58
|
+
- Add typings for app hang functionality ([#2479](https://github.com/getsentry/sentry-react-native/pull/2479))
|
|
59
|
+
|
|
60
|
+
### Fixes
|
|
61
|
+
|
|
62
|
+
- Update warm/cold start span ops ([#2487](https://github.com/getsentry/sentry-react-native/pull/2487))
|
|
63
|
+
- Detect hard crash the same as native sdks ([#2480](https://github.com/getsentry/sentry-react-native/pull/2480))
|
|
64
|
+
- Integrations factory receives default integrations ([#2494](https://github.com/getsentry/sentry-react-native/pull/2494))
|
|
65
|
+
|
|
66
|
+
### Dependencies
|
|
67
|
+
|
|
68
|
+
- Bump Android SDK from v6.4.1 to v6.4.2 ([#2485](https://github.com/getsentry/sentry-react-native/pull/2485))
|
|
69
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#642)
|
|
70
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.1...6.4.2)
|
|
71
|
+
- Bump JavaScript SDK from v7.12.1 to v7.13.0 ([#2478](https://github.com/getsentry/sentry-react-native/pull/2478))
|
|
72
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7130)
|
|
73
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.12.1...7.13.0)
|
|
74
|
+
|
|
75
|
+
## 4.4.0
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
- Add attachments support ([#2463](https://github.com/getsentry/sentry-react-native/pull/2463))
|
|
80
|
+
|
|
81
|
+
## 4.3.1
|
|
82
|
+
|
|
83
|
+
### Fixes
|
|
84
|
+
|
|
85
|
+
- ReactNativeTracingOptions maxTransactionDuration is in seconds ([#2469](https://github.com/getsentry/sentry-react-native/pull/2469))
|
|
86
|
+
|
|
87
|
+
### Dependencies
|
|
88
|
+
|
|
89
|
+
- Bump Cocoa SDK from v7.24.1 to v7.25.1 ([#2465](https://github.com/getsentry/sentry-react-native/pull/2465))
|
|
90
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7251)
|
|
91
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.24.1...7.25.1)
|
|
92
|
+
|
|
3
93
|
## 5.0.0-alpha.3
|
|
4
94
|
|
|
5
95
|
- Latest changes from 4.3.x
|
|
@@ -14,12 +104,6 @@
|
|
|
14
104
|
|
|
15
105
|
### Features
|
|
16
106
|
|
|
17
|
-
- Bump Android SDK from v6.3.1 to v6.4.1 ([#2437](https://github.com/getsentry/sentry-react-native/pull/2437))
|
|
18
|
-
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#641)
|
|
19
|
-
- [diff](https://github.com/getsentry/sentry-java/compare/6.3.1...6.4.1)
|
|
20
|
-
- Bump JavaScript SDK from v7.9.0 to v7.12.1 ([#2451](https://github.com/getsentry/sentry-react-native/pull/2451))
|
|
21
|
-
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7121)
|
|
22
|
-
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.9.0...7.12.1)
|
|
23
107
|
- Add Transaction Source for Dynamic Sampling Context ([#2454](https://github.com/getsentry/sentry-react-native/pull/2454))
|
|
24
108
|
|
|
25
109
|
### Dependencies
|
|
@@ -27,6 +111,12 @@
|
|
|
27
111
|
- Bump Cocoa SDK from v7.23.0 to v7.24.1 ([#2456](https://github.com/getsentry/sentry-react-native/pull/2456))
|
|
28
112
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7241)
|
|
29
113
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.23.0...7.24.1)
|
|
114
|
+
- Bump Android SDK from v6.3.1 to v6.4.1 ([#2437](https://github.com/getsentry/sentry-react-native/pull/2437))
|
|
115
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#641)
|
|
116
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.3.1...6.4.1)
|
|
117
|
+
- Bump JavaScript SDK from v7.9.0 to v7.12.1 ([#2451](https://github.com/getsentry/sentry-react-native/pull/2451))
|
|
118
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7121)
|
|
119
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.9.0...7.12.1)
|
|
30
120
|
|
|
31
121
|
## 4.2.4
|
|
32
122
|
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -14,6 +14,7 @@ import com.facebook.react.bridge.Promise;
|
|
|
14
14
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
15
15
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
16
16
|
import com.facebook.react.bridge.ReactMethod;
|
|
17
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
17
18
|
import com.facebook.react.bridge.ReadableMap;
|
|
18
19
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
19
20
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -98,6 +99,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
98
99
|
// SentryAndroid needs an empty string fallback for the dsn.
|
|
99
100
|
options.setDsn("");
|
|
100
101
|
}
|
|
102
|
+
if (rnOptions.hasKey("sendClientReports")) {
|
|
103
|
+
options.setSendClientReports(rnOptions.getBoolean("sendClientReports"));
|
|
104
|
+
}
|
|
101
105
|
if (rnOptions.hasKey("maxBreadcrumbs")) {
|
|
102
106
|
options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
|
|
103
107
|
}
|
|
@@ -292,7 +296,12 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
292
296
|
}
|
|
293
297
|
|
|
294
298
|
@ReactMethod
|
|
295
|
-
public void captureEnvelope(
|
|
299
|
+
public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
|
|
300
|
+
byte bytes[] = new byte[rawBytes.size()];
|
|
301
|
+
for (int i = 0; i < rawBytes.size(); i++) {
|
|
302
|
+
bytes[i] = (byte) rawBytes.getInt(i);
|
|
303
|
+
}
|
|
304
|
+
|
|
296
305
|
try {
|
|
297
306
|
final String outboxPath = HubAdapter.getInstance().getOptions().getOutboxPath();
|
|
298
307
|
|
|
@@ -302,24 +311,15 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
302
311
|
} else {
|
|
303
312
|
File installation = new File(outboxPath, UUID.randomUUID().toString());
|
|
304
313
|
try (FileOutputStream out = new FileOutputStream(installation)) {
|
|
305
|
-
out.write(
|
|
314
|
+
out.write(bytes);
|
|
306
315
|
}
|
|
307
316
|
}
|
|
308
317
|
} catch (Throwable ignored) {
|
|
309
|
-
logger.severe("Error
|
|
318
|
+
logger.severe("Error while writing envelope to outbox.");
|
|
310
319
|
}
|
|
311
320
|
promise.resolve(true);
|
|
312
321
|
}
|
|
313
322
|
|
|
314
|
-
@ReactMethod
|
|
315
|
-
public void getStringBytesLength(String payload, Promise promise) {
|
|
316
|
-
try {
|
|
317
|
-
promise.resolve(payload.getBytes("UTF-8").length);
|
|
318
|
-
} catch (UnsupportedEncodingException e) {
|
|
319
|
-
promise.reject(e);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
323
|
private static PackageInfo getPackageInfo(Context ctx) {
|
|
324
324
|
try {
|
|
325
325
|
return ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
|
package/dist/js/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '@sentry/core';
|
|
2
|
-
import { Event, EventHint, SeverityLevel } from '@sentry/types';
|
|
2
|
+
import { Envelope, Event, EventHint, SeverityLevel, UserFeedback } from '@sentry/types';
|
|
3
3
|
import { ReactNativeClientOptions } from './options';
|
|
4
4
|
/**
|
|
5
5
|
* The Sentry React Native SDK Client.
|
|
@@ -8,6 +8,7 @@ import { ReactNativeClientOptions } from './options';
|
|
|
8
8
|
* @see SentryClient for usage documentation.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
|
|
11
|
+
private _outcomesBuffer;
|
|
11
12
|
private readonly _browserClient;
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new React Native SDK instance.
|
|
@@ -32,12 +33,24 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
|
|
|
32
33
|
*/
|
|
33
34
|
close(): PromiseLike<boolean>;
|
|
34
35
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
* Sends user feedback to Sentry.
|
|
37
|
+
*/
|
|
38
|
+
captureUserFeedback(feedback: UserFeedback): void;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritdoc
|
|
41
|
+
*/
|
|
42
|
+
protected _sendEnvelope(envelope: Envelope): void;
|
|
43
|
+
/**
|
|
44
|
+
* Starts native client with dsn and options
|
|
45
|
+
*/
|
|
37
46
|
private _initNativeSdk;
|
|
38
47
|
/**
|
|
39
48
|
* If the user is in development mode, and the native nagger is enabled then it will show an alert.
|
|
40
49
|
*/
|
|
41
50
|
private _showCannotConnectDialog;
|
|
51
|
+
/**
|
|
52
|
+
* Attaches a client report from outcomes to the envelope.
|
|
53
|
+
*/
|
|
54
|
+
private _attachClientReportTo;
|
|
42
55
|
}
|
|
43
56
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAGL,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EAEb,YAAY,EACb,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAMrD;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IAEzE,OAAO,CAAC,eAAe,CAAY;IAEnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAE/C;;;OAGG;gBACiB,OAAO,EAAE,wBAAwB;IAsCrD;;OAEG;IACI,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAIrF;;OAEG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAIxG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;OAEG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAYxD;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA6BjD;;OAEG;YACW,cAAc;IAgB5B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { BrowserClient, defaultStackParser, makeFetchTransport } from '@sentry/browser';
|
|
3
3
|
import { BaseClient } from '@sentry/core';
|
|
4
|
+
import { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';
|
|
4
5
|
// @ts-ignore LogBox introduced in RN 0.63
|
|
5
6
|
import { Alert, LogBox, YellowBox } from 'react-native';
|
|
7
|
+
import { defaultSdkInfo } from './integrations/sdkinfo';
|
|
6
8
|
import { NativeTransport } from './transports/native';
|
|
9
|
+
import { createUserFeedbackEnvelope, items } from './utils/envelope';
|
|
10
|
+
import { mergeOutcomes } from './utils/outcome';
|
|
7
11
|
import { NATIVE } from './wrapper';
|
|
8
12
|
/**
|
|
9
13
|
* The Sentry React Native SDK Client.
|
|
@@ -25,7 +29,10 @@ export class ReactNativeClient extends BaseClient {
|
|
|
25
29
|
return makeFetchTransport(options, nativeFetch);
|
|
26
30
|
};
|
|
27
31
|
}
|
|
32
|
+
options._metadata = options._metadata || {};
|
|
33
|
+
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
|
|
28
34
|
super(options);
|
|
35
|
+
this._outcomesBuffer = [];
|
|
29
36
|
// This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning
|
|
30
37
|
// YellowBox deprecated and replaced with with LogBox in RN 0.63
|
|
31
38
|
if (LogBox) {
|
|
@@ -39,8 +46,10 @@ export class ReactNativeClient extends BaseClient {
|
|
|
39
46
|
this._browserClient = new BrowserClient({
|
|
40
47
|
dsn: options.dsn,
|
|
41
48
|
transport: options.transport,
|
|
49
|
+
transportOptions: options.transportOptions,
|
|
42
50
|
stackParser: options.stackParser || defaultStackParser,
|
|
43
51
|
integrations: [],
|
|
52
|
+
_metadata: options._metadata,
|
|
44
53
|
});
|
|
45
54
|
void this._initNativeSdk();
|
|
46
55
|
}
|
|
@@ -73,10 +82,51 @@ export class ReactNativeClient extends BaseClient {
|
|
|
73
82
|
});
|
|
74
83
|
}
|
|
75
84
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
* Sends user feedback to Sentry.
|
|
86
|
+
*/
|
|
87
|
+
captureUserFeedback(feedback) {
|
|
88
|
+
const envelope = createUserFeedbackEnvelope(feedback, {
|
|
89
|
+
metadata: this._options._metadata,
|
|
90
|
+
dsn: this.getDsn(),
|
|
91
|
+
tunnel: this._options.tunnel,
|
|
92
|
+
});
|
|
93
|
+
this._sendEnvelope(envelope);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @inheritdoc
|
|
97
|
+
*/
|
|
98
|
+
_sendEnvelope(envelope) {
|
|
99
|
+
const outcomes = this._clearOutcomes();
|
|
100
|
+
this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);
|
|
101
|
+
if (this._options.sendClientReports) {
|
|
102
|
+
this._attachClientReportTo(this._outcomesBuffer, envelope);
|
|
103
|
+
}
|
|
104
|
+
let shouldClearOutcomesBuffer = true;
|
|
105
|
+
if (this._transport && this._dsn) {
|
|
106
|
+
this._transport.send(envelope)
|
|
107
|
+
.then(null, reason => {
|
|
108
|
+
if (reason instanceof SentryError) { // SentryError is thrown by SyncPromise
|
|
109
|
+
shouldClearOutcomesBuffer = false;
|
|
110
|
+
// If this is called asynchronously we want the _outcomesBuffer to be cleared
|
|
111
|
+
logger.error('SentryError while sending event, keeping outcomes buffer:', reason);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
logger.error('Error while sending event:', reason);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
logger.error('Transport disabled');
|
|
120
|
+
}
|
|
121
|
+
if (shouldClearOutcomesBuffer) {
|
|
122
|
+
this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Starts native client with dsn and options
|
|
127
|
+
*/
|
|
78
128
|
_initNativeSdk() {
|
|
79
|
-
var _a, _b
|
|
129
|
+
var _a, _b;
|
|
80
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
131
|
let didCallNativeInit = false;
|
|
82
132
|
try {
|
|
@@ -84,10 +134,15 @@ export class ReactNativeClient extends BaseClient {
|
|
|
84
134
|
}
|
|
85
135
|
catch (_) {
|
|
86
136
|
this._showCannotConnectDialog();
|
|
87
|
-
(_b = (_a = this._options).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, { didCallNativeInit: false });
|
|
88
|
-
return;
|
|
89
137
|
}
|
|
90
|
-
|
|
138
|
+
finally {
|
|
139
|
+
try {
|
|
140
|
+
(_b = (_a = this._options).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, { didCallNativeInit });
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
logger.error('The OnReady callback threw an error: ', error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
91
146
|
});
|
|
92
147
|
}
|
|
93
148
|
/**
|
|
@@ -98,5 +153,20 @@ export class ReactNativeClient extends BaseClient {
|
|
|
98
153
|
Alert.alert('Sentry', 'Warning, could not connect to Sentry native SDK.\nIf you do not want to use the native component please pass `enableNative: false` in the options.\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.');
|
|
99
154
|
}
|
|
100
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Attaches a client report from outcomes to the envelope.
|
|
158
|
+
*/
|
|
159
|
+
_attachClientReportTo(outcomes, envelope) {
|
|
160
|
+
if (outcomes.length > 0) {
|
|
161
|
+
const clientReportItem = [
|
|
162
|
+
{ type: 'client_report' },
|
|
163
|
+
{
|
|
164
|
+
timestamp: dateTimestampInSeconds(),
|
|
165
|
+
discarded_events: outcomes,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
envelope[items].push(clientReportItem);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
101
171
|
}
|
|
102
172
|
//# sourceMappingURL=client.js.map
|
package/dist/js/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,0CAA0C;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,WA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AED;;;OAGG;IACI,WAAW;QAChB,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,KAAK;QACV,oGAAoG;QACpG,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,MAAe,EAAE,EAAE;YAC5C,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAyB,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;KAEC;IACa,cAAc;;;YAC1B,IAAI,iBAAiB,GAAG,KAAK,CAAC;YAE9B,IAAI;gBACF,iBAAiB,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC/D;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,wBAAwB,EAAE,CAAC;gBAEhC,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE;gBAEtD,OAAO;aACR;YACD,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,EAAE;;KAChD;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,qOAAqO,CACtO,CAAC;SACH;IACH,CAAC;CACF","sourcesContent":["import { BrowserClient, defaultStackParser, makeFetchTransport } from '@sentry/browser';\nimport { BrowserTransportOptions } from '@sentry/browser/types/transports/types';\nimport { FetchImpl } from '@sentry/browser/types/transports/utils';\nimport { BaseClient } from '@sentry/core';\nimport { Event, EventHint, SeverityLevel, Transport } from '@sentry/types';\n// @ts-ignore LogBox introduced in RN 0.63\nimport { Alert, LogBox, YellowBox } from 'react-native';\n\nimport { ReactNativeClientOptions } from './options';\nimport { NativeTransport } from './transports/native';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n\n private readonly _browserClient: BrowserClient;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n if (!options.transport) {\n options.transport = (options: BrowserTransportOptions, nativeFetch?: FetchImpl): Transport => {\n if (NATIVE.isNativeTransportAvailable()) {\n return new NativeTransport();\n }\n return makeFetchTransport(options, nativeFetch);\n };\n }\n super(options);\n\n // This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning\n // YellowBox deprecated and replaced with with LogBox in RN 0.63\n if (LogBox) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n LogBox.ignoreLogs(['Require cycle:']);\n } else {\n // eslint-disable-next-line deprecation/deprecation\n YellowBox.ignoreWarnings(['Require cycle:']);\n }\n\n this._browserClient = new BrowserClient({\n dsn: options.dsn,\n transport: options.transport,\n stackParser: options.stackParser || defaultStackParser,\n integrations: [],\n });\n\n void this._initNativeSdk();\n }\n\n\n /**\n * @inheritDoc\n */\n public eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike<Event> {\n return this._browserClient.eventFromException(_exception, _hint);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(_message: string, _level?: SeverityLevel, _hint?: EventHint): PromiseLike<Event> {\n return this._browserClient.eventFromMessage(_message, _level, _hint);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Starts native client with dsn and options\n */\n private async _initNativeSdk(): Promise<void> {\n let didCallNativeInit = false;\n\n try {\n didCallNativeInit = await NATIVE.initNativeSdk(this._options);\n } catch (_) {\n this._showCannotConnectDialog();\n\n this._options.onReady?.({ didCallNativeInit: false });\n\n return;\n }\n this._options.onReady?.({ didCallNativeInit });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.'\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,0CAA0C;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAoC;IAMzE;;;OAGG;IACF,YAAmB,OAAiC;QAClD,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,OAAO,CAAC,SAAS,GAAG,CAAC,OAAg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BACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { BrowserClient, defaultStackParser, makeFetchTransport } from '@sentry/browser';\nimport { BrowserTransportOptions } from '@sentry/browser/types/transports/types';\nimport { FetchImpl } from '@sentry/browser/types/transports/utils';\nimport { BaseClient } from '@sentry/core';\nimport {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n Transport,\n UserFeedback,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';\n// @ts-ignore LogBox introduced in RN 0.63\nimport { Alert, LogBox, YellowBox } from 'react-native';\n\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { ReactNativeClientOptions } from './options';\nimport { NativeTransport } from './transports/native';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { mergeOutcomes } from './utils/outcome';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n\n private _outcomesBuffer: Outcome[];\n\n private readonly _browserClient: BrowserClient;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n if (!options.transport) {\n options.transport = (options: BrowserTransportOptions, nativeFetch?: FetchImpl): Transport => {\n if (NATIVE.isNativeTransportAvailable()) {\n return new NativeTransport();\n }\n return makeFetchTransport(options, nativeFetch);\n };\n }\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n super(options);\n\n this._outcomesBuffer = [];\n\n // This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning\n // YellowBox deprecated and replaced with with LogBox in RN 0.63\n if (LogBox) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n LogBox.ignoreLogs(['Require cycle:']);\n } else {\n // eslint-disable-next-line deprecation/deprecation\n YellowBox.ignoreWarnings(['Require cycle:']);\n }\n\n this._browserClient = new BrowserClient({\n dsn: options.dsn,\n transport: options.transport,\n transportOptions: options.transportOptions,\n stackParser: options.stackParser || defaultStackParser,\n integrations: [],\n _metadata: options._metadata,\n });\n\n void this._initNativeSdk();\n }\n\n\n /**\n * @inheritDoc\n */\n public eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike<Event> {\n return this._browserClient.eventFromException(_exception, _hint);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(_message: string, _level?: SeverityLevel, _hint?: EventHint): PromiseLike<Event> {\n return this._browserClient.eventFromMessage(_message, _level, _hint);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(\n feedback,\n {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: this._options.tunnel,\n },\n );\n this._sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n protected _sendEnvelope(envelope: Envelope): void {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._transport && this._dsn) {\n this._transport.send(envelope)\n .then(null, reason => {\n if (reason instanceof SentryError) { // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n }\n\n /**\n * Starts native client with dsn and options\n */\n private async _initNativeSdk(): Promise<void> {\n let didCallNativeInit = false;\n\n try {\n didCallNativeInit = await NATIVE.initNativeSdk(this._options);\n } catch (_) {\n this._showCannotConnectDialog();\n } finally {\n try {\n this._options.onReady?.({ didCallNativeInit });\n } catch (error) {\n logger.error('The OnReady callback threw an error: ', error);\n }\n }\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.'\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
package/dist/js/definitions.d.ts
CHANGED
|
@@ -24,9 +24,8 @@ interface SerializedObject {
|
|
|
24
24
|
export interface SentryNativeBridgeModule {
|
|
25
25
|
nativeClientAvailable: boolean;
|
|
26
26
|
addBreadcrumb(breadcrumb: Breadcrumb): void;
|
|
27
|
-
captureEnvelope(
|
|
28
|
-
|
|
29
|
-
payload: Record<string, unknown>;
|
|
27
|
+
captureEnvelope(bytes: number[], options: {
|
|
28
|
+
store: boolean;
|
|
30
29
|
}): PromiseLike<boolean>;
|
|
31
30
|
clearBreadcrumbs(): void;
|
|
32
31
|
crash(): void;
|
|
@@ -41,7 +40,6 @@ export interface SentryNativeBridgeModule {
|
|
|
41
40
|
fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse>;
|
|
42
41
|
fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;
|
|
43
42
|
fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;
|
|
44
|
-
getStringBytesLength(str: string): Promise<number>;
|
|
45
43
|
initNativeSdk(options: ReactNativeOptions): Promise<boolean>;
|
|
46
44
|
setUser(defaultUserKeys: SerializedObject | null, otherUserKeys: SerializedObject | null): void;
|
|
47
45
|
setContext(key: string, value: SerializedObject | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/js/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,sBAAsB,GAAG;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,4BAA4B,GAAG;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC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,CAAC;IACxB,gBAAgB,IAAI,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,cAAc,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,2BAA2B,IAAI,IAAI,CAAC;IACpC,kBAAkB,IAAI,OAAO,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,kBAAkB,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3C,yBAAyB,IAAI,WAAW,CAAC,4BAA4B,CAAC,CAAC;IACvE,mBAAmB,IAAI,WAAW,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAClE,iBAAiB,IAAI,WAAW,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC9D,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7D,OAAO,CACL,eAAe,EAAE,gBAAgB,GAAG,IAAI,EACxC,aAAa,EAAE,gBAAgB,GAAG,IAAI,GACrC,IAAI,CAAC;IACR,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/js/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { Breadcrumb, Package } from '@sentry/types';\n\nimport { ReactNativeOptions } from './options';\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\ninterface SerializedObject {\n [key: string]: string;\n}\n\nexport interface SentryNativeBridgeModule {\n nativeClientAvailable: boolean;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n captureEnvelope(\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/js/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { Breadcrumb, Package } from '@sentry/types';\n\nimport { ReactNativeOptions } from './options';\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\ninterface SerializedObject {\n [key: string]: string;\n}\n\nexport interface SentryNativeBridgeModule {\n nativeClientAvailable: boolean;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n captureEnvelope(\n bytes: number[],\n options: {\n store: boolean,\n },\n ): PromiseLike<boolean>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): PromiseLike<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<{\n build: string;\n id: string;\n version: string;\n }>;\n fetchNativeSdkInfo(): PromiseLike<Package>;\n fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse>;\n fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;\n fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;\n initNativeSdk(options: ReactNativeOptions): Promise<boolean>;\n setUser(\n defaultUserKeys: SerializedObject | null,\n otherUserKeys: SerializedObject | null\n ): void;\n setContext(key: string, value: SerializedObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n}\n"]}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage,
|
|
1
|
+
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
3
3
|
import '@sentry/tracing';
|
|
4
4
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
5
5
|
import * as Integrations from './integrations';
|
|
6
6
|
import { SDK_NAME, SDK_VERSION } from './version';
|
|
7
7
|
export { ReactNativeOptions } from './options';
|
|
8
8
|
export { ReactNativeClient } from './client';
|
|
9
|
-
export { init, wrap, setDist, setRelease, nativeCrash, flush, close, } from './sdk';
|
|
9
|
+
export { init, wrap, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, } from './sdk';
|
|
10
10
|
export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
|
|
11
11
|
export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, ReactNavigationTransactionContext, } from './tracing';
|
|
12
12
|
export { Integrations, SDK_NAME, SDK_VERSION };
|
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAItB,OAAO,iBAAiB,CAAC;AAMzB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI,EAEJ,OAAO,EAEP,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAEhC,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/js/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage,
|
|
1
|
+
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
2
2
|
// We need to import it so we patch the hub with global functions
|
|
3
3
|
// aka. this has side effects
|
|
4
4
|
import '@sentry/tracing';
|
|
@@ -13,7 +13,7 @@ export { init, wrap,
|
|
|
13
13
|
// eslint-disable-next-line deprecation/deprecation
|
|
14
14
|
setDist,
|
|
15
15
|
// eslint-disable-next-line deprecation/deprecation
|
|
16
|
-
setRelease, nativeCrash, flush, close, } from './sdk';
|
|
16
|
+
setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, } from './sdk';
|
|
17
17
|
export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
|
|
18
18
|
export { ReactNativeTracing, ReactNavigationV4Instrumentation,
|
|
19
19
|
// eslint-disable-next-line deprecation/deprecation
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,iEAAiE;AACjE,6BAA6B;AAC7B,OAAO,iBAAiB,CAAC;AAEzB,kGAAkG;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,qBAAqB,EAAE,CAAC;AAExB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI;AACJ,mDAAmD;AACnD,OAAO;AACP,mDAAmD;AACnD,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC;AAChC,mDAAmD;AACnD,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,GAEvB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startTransaction,\n} from '@sentry/core';\n\n// We need to import it so we patch the hub with global functions\n// aka. this has side effects\nimport '@sentry/tracing';\n\n// Add the React Native SDK's own tracing extensions, this needs to happen AFTER @sentry/tracing's\nimport { _addTracingExtensions } from './measurements';\n_addTracingExtensions();\n\nexport {\n Integrations as BrowserIntegrations,\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nimport * as Integrations from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\nexport { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport {\n init,\n wrap,\n // eslint-disable-next-line deprecation/deprecation\n setDist,\n // eslint-disable-next-line deprecation/deprecation\n setRelease,\n nativeCrash,\n flush,\n close,\n captureUserFeedback,\n withScope,\n configureScope,\n} from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n ReactNativeTracing,\n ReactNavigationV4Instrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n ReactNavigationInstrumentation,\n ReactNativeNavigationInstrumentation,\n RoutingInstrumentation,\n ReactNavigationTransactionContext,\n} from './tracing';\n\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAK3D,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAUD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC;IASrE;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAyCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAK3D,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAUD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC;IASrE;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAyCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,cAAc;CAoEvB"}
|
|
@@ -123,6 +123,7 @@ export class ReactNativeErrorHandlers {
|
|
|
123
123
|
}
|
|
124
124
|
const currentHub = getCurrentHub();
|
|
125
125
|
const client = currentHub.getClient();
|
|
126
|
+
const scope = currentHub.getScope();
|
|
126
127
|
if (!client) {
|
|
127
128
|
logger.error('Sentry client is missing, the error event might be lost.', error);
|
|
128
129
|
// If there is no client something is fishy, anyway we call the default handler
|
|
@@ -131,7 +132,8 @@ export class ReactNativeErrorHandlers {
|
|
|
131
132
|
}
|
|
132
133
|
const options = client.getOptions();
|
|
133
134
|
const event = yield client.eventFromException(error, {
|
|
134
|
-
originalException: error
|
|
135
|
+
originalException: error,
|
|
136
|
+
attachments: scope === null || scope === void 0 ? void 0 : scope.getAttachments(),
|
|
135
137
|
});
|
|
136
138
|
if (isFatal) {
|
|
137
139
|
event.level = 'fatal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAmB/E,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAkD;QATrE;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,0BAA0B;QAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE;YACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;gBACpC,IAAI,CAAC,gBAAgB,EAAE,CAAC;aACzB;YAED,IAAI,CA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,CAAC,MAAM,EAAE;oBACX,MAAM,CAAC,KAAK,CACV,0DAA0D,EAC1D,KAAK,CACN,CAAC;oBAEF,+EAA+E;oBAC/E,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBAE/B,OAAO;iBACR;gBAED,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;gBAEpC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE;oBACnD,iBAAiB,EAAE,KAAK;iBACzB,CAAC,CAAC;gBAEH,IAAI,OAAO,EAAE;oBACX,KAAK,CAAC,KAAK,GAAG,OAAwB,CAAC;oBAEvC,qBAAqB,CAAC,KAAK,EAAE;wBAC3B,OAAO,EAAE,KAAK;wBACd,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;iBACJ;gBAED,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAE/B,IAAI,CAAC,OAAO,EAAE;oBACZ,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBAC3D,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,gFAAgF;oBAChF,mCAAmC;oBACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AA7MD;;GAEG;AACW,2BAAE,GAAW,0BAA0B,CAAC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport { Integration, SeverityLevel } from '@sentry/types';\nimport { addExceptionMechanism, getGlobalObject, logger } from '@sentry/utils';\n\nimport { ReactNativeClient } from '../client';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const global: any;\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeErrorHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: Partial<ReactNativeErrorHandlersOptions>) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n if (this._options.patchGlobalPromise) {\n this._polyfillPromise();\n }\n\n this._attachUnhandledRejectionHandler();\n this._checkPromiseAndWarn();\n }\n }\n /**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\n private _polyfillPromise(): void {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n const {\n polyfillGlobal,\n } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n const Promise = require('promise/setimmediate/es6-extensions');\n\n // As of RN 0.67 only done and finally are used\n require('promise/setimmediate/done');\n require('promise/setimmediate/finally');\n\n polyfillGlobal('Promise', () => Promise);\n /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n }\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires\n } = require('promise/setimmediate/rejection-tracking');\n\n const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`\n );\n },\n onHandled: (id) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`\n );\n },\n };\n\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseAndWarn(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require('promise/setimmediate/es6-extensions');\n\n const _global = getGlobalObject<{ Promise: typeof Promise }>();\n\n if (Promise !== _global.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n } else {\n logger.log('Unhandled promise rejections will be caught by Sentry.');\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const defaultHandler =\n ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ErrorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log(\n 'Encountered multiple fatals in a row. The latest:',\n error\n );\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n\n if (!client) {\n logger.error(\n 'Sentry client is missing, the error event might be lost.',\n error\n );\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const event = await client.eventFromException(error, {\n originalException: error\n });\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n }\n\n currentHub.captureEvent(event);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAmB/E,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAkD;QATrE;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CA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K,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AA/MD;;GAEG;AACW,2BAAE,GAAW,0BAA0B,CAAC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport { Integration, SeverityLevel } from '@sentry/types';\nimport { addExceptionMechanism, getGlobalObject, logger } from '@sentry/utils';\n\nimport { ReactNativeClient } from '../client';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const global: any;\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeErrorHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: Partial<ReactNativeErrorHandlersOptions>) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n if (this._options.patchGlobalPromise) {\n this._polyfillPromise();\n }\n\n this._attachUnhandledRejectionHandler();\n this._checkPromiseAndWarn();\n }\n }\n /**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\n private _polyfillPromise(): void {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n const {\n polyfillGlobal,\n } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n const Promise = require('promise/setimmediate/es6-extensions');\n\n // As of RN 0.67 only done and finally are used\n require('promise/setimmediate/done');\n require('promise/setimmediate/finally');\n\n polyfillGlobal('Promise', () => Promise);\n /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n }\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires\n } = require('promise/setimmediate/rejection-tracking');\n\n const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`\n );\n },\n onHandled: (id) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`\n );\n },\n };\n\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseAndWarn(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require('promise/setimmediate/es6-extensions');\n\n const _global = getGlobalObject<{ Promise: typeof Promise }>();\n\n if (Promise !== _global.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n } else {\n logger.log('Unhandled promise rejections will be caught by Sentry.');\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const defaultHandler =\n ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ErrorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log(\n 'Encountered multiple fatals in a row. The latest:',\n error\n );\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n const scope = currentHub.getScope();\n\n if (!client) {\n logger.error(\n 'Sentry client is missing, the error event might be lost.',\n error\n );\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const event = await client.eventFromException(error, {\n originalException: error,\n attachments: scope?.getAttachments(),\n });\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n }\n\n currentHub.captureEvent(event);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { EventProcessor, Integration } from '@sentry/types';
|
|
1
|
+
import { EventProcessor, Integration, SdkInfo as SdkInfoType } from '@sentry/types';
|
|
2
|
+
declare type DefaultSdkInfo = Pick<Required<SdkInfoType>, 'name' | 'packages' | 'version'>;
|
|
3
|
+
export declare const defaultSdkInfo: DefaultSdkInfo;
|
|
2
4
|
/** Default SdkInfo instrumentation */
|
|
3
5
|
export declare class SdkInfo implements Integration {
|
|
4
6
|
/**
|
|
@@ -15,4 +17,5 @@ export declare class SdkInfo implements Integration {
|
|
|
15
17
|
*/
|
|
16
18
|
setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void;
|
|
17
19
|
}
|
|
20
|
+
export {};
|
|
18
21
|
//# sourceMappingURL=sdkinfo.d.ts.map
|