@sentry/react-native 4.5.0 → 4.6.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.
- package/CHANGELOG.md +44 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModule.java +47 -48
- package/dist/js/client.d.ts +12 -3
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +60 -7
- package/dist/js/client.js.map +1 -1
- package/dist/js/definitions.d.ts +1 -1
- package/dist/js/definitions.d.ts.map +1 -1
- package/dist/js/definitions.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- 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/sdk.d.ts +21 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +45 -2
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts +7 -0
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +1 -0
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +5 -1
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +2 -2
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/reactnavigationv4.d.ts +5 -1
- package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigationv4.js.map +1 -1
- package/dist/js/utils/envelope.d.ts +2 -0
- package/dist/js/utils/envelope.d.ts.map +1 -1
- package/dist/js/utils/envelope.js +2 -1
- package/dist/js/utils/envelope.js.map +1 -1
- 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/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +12 -3
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.m +8 -4
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.6.1
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Make `configureScope` callback safe [#2510](https://github.com/getsentry/sentry-react-native/pull/2510)
|
|
8
|
+
- Allows collecting app start and slow/frozen frames if Native SDK is inited manually [#2517](https://github.com/getsentry/sentry-react-native/pull/2517)
|
|
9
|
+
- Nested breadcrumb data on android was not treated correctly [#2519](https://github.com/getsentry/sentry-react-native/pull/2519)
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
- Bump JavaScript SDK from v7.14.0 to v7.14.2 ([#2511](https://github.com/getsentry/sentry-react-native/pull/2511), [#2526](https://github.com/getsentry/sentry-react-native/pull/2526))
|
|
14
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7142)
|
|
15
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.14.0...7.14.2)
|
|
16
|
+
- Bump Cocoa SDK from v7.27.0 to v7.27.1 ([#2521](https://github.com/getsentry/sentry-react-native/pull/2521))
|
|
17
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7271)
|
|
18
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.27.0...7.27.1)
|
|
19
|
+
- Bump Android SDK from v6.4.2 to v6.4.3 ([#2520](https://github.com/getsentry/sentry-react-native/pull/2520))
|
|
20
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#643)
|
|
21
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.2...6.4.3)
|
|
22
|
+
|
|
23
|
+
## 4.6.0
|
|
24
|
+
|
|
25
|
+
### Fixes
|
|
26
|
+
|
|
27
|
+
- SDK Gracefully downgrades when callback throws an error ([#2502](https://github.com/getsentry/sentry-react-native/pull/2502))
|
|
28
|
+
- React Navigation v5 ignores when current route is undefined after state changed. ([#2484](https://github.com/getsentry/sentry-react-native/pull/2484))
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
- Add ClientReports ([#2496](https://github.com/getsentry/sentry-react-native/pull/2496))
|
|
33
|
+
|
|
34
|
+
### Sentry Self-hosted Compatibility
|
|
35
|
+
|
|
36
|
+
- 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.
|
|
37
|
+
|
|
38
|
+
### Dependencies
|
|
39
|
+
|
|
40
|
+
- 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))
|
|
41
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7270)
|
|
42
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.25.1...7.27.0)
|
|
43
|
+
- Bump JavaScript SDK from v7.13.0 to v7.14.0 ([#2504](https://github.com/getsentry/sentry-react-native/pull/2504))
|
|
44
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7140)
|
|
45
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.13.0...7.14.0)
|
|
46
|
+
|
|
3
47
|
## 4.5.0
|
|
4
48
|
|
|
5
49
|
### Features
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -9,7 +9,6 @@ import android.util.SparseIntArray;
|
|
|
9
9
|
import androidx.core.app.FrameMetricsAggregator;
|
|
10
10
|
|
|
11
11
|
import com.facebook.react.bridge.Arguments;
|
|
12
|
-
import com.facebook.react.bridge.LifecycleEventListener;
|
|
13
12
|
import com.facebook.react.bridge.Promise;
|
|
14
13
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
15
14
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
@@ -22,8 +21,6 @@ import com.facebook.react.module.annotations.ReactModule;
|
|
|
22
21
|
|
|
23
22
|
import java.io.File;
|
|
24
23
|
import java.io.FileOutputStream;
|
|
25
|
-
import java.io.UnsupportedEncodingException;
|
|
26
|
-
import java.nio.charset.Charset;
|
|
27
24
|
import java.util.Date;
|
|
28
25
|
import java.util.HashMap;
|
|
29
26
|
import java.util.List;
|
|
@@ -32,17 +29,17 @@ import java.util.UUID;
|
|
|
32
29
|
import java.util.logging.Level;
|
|
33
30
|
import java.util.logging.Logger;
|
|
34
31
|
|
|
35
|
-
import io.sentry.SentryEvent;
|
|
36
|
-
import io.sentry.android.core.AnrIntegration;
|
|
37
|
-
import io.sentry.android.core.AppStartState;
|
|
38
|
-
import io.sentry.android.core.NdkIntegration;
|
|
39
|
-
import io.sentry.android.core.SentryAndroid;
|
|
40
32
|
import io.sentry.Breadcrumb;
|
|
41
33
|
import io.sentry.HubAdapter;
|
|
42
34
|
import io.sentry.Integration;
|
|
43
35
|
import io.sentry.Sentry;
|
|
36
|
+
import io.sentry.SentryEvent;
|
|
44
37
|
import io.sentry.SentryLevel;
|
|
45
38
|
import io.sentry.UncaughtExceptionHandlerIntegration;
|
|
39
|
+
import io.sentry.android.core.AnrIntegration;
|
|
40
|
+
import io.sentry.android.core.AppStartState;
|
|
41
|
+
import io.sentry.android.core.NdkIntegration;
|
|
42
|
+
import io.sentry.android.core.SentryAndroid;
|
|
46
43
|
import io.sentry.protocol.SdkVersion;
|
|
47
44
|
import io.sentry.protocol.SentryException;
|
|
48
45
|
import io.sentry.protocol.SentryPackage;
|
|
@@ -55,9 +52,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
55
52
|
|
|
56
53
|
private static final Logger logger = Logger.getLogger("react-native-sentry");
|
|
57
54
|
|
|
58
|
-
private PackageInfo packageInfo
|
|
55
|
+
private final PackageInfo packageInfo;
|
|
59
56
|
private FrameMetricsAggregator frameMetricsAggregator = null;
|
|
60
|
-
private boolean androidXAvailable
|
|
57
|
+
private boolean androidXAvailable;
|
|
61
58
|
|
|
62
59
|
private static boolean didFetchAppStart;
|
|
63
60
|
|
|
@@ -76,13 +73,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
76
73
|
return NAME;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
@Override
|
|
80
|
-
public Map<String, Object> getConstants() {
|
|
81
|
-
final Map<String, Object> constants = new HashMap<>();
|
|
82
|
-
constants.put("nativeClientAvailable", true);
|
|
83
|
-
constants.put("nativeTransport", true);
|
|
84
|
-
return constants;
|
|
85
|
-
}
|
|
86
76
|
|
|
87
77
|
@ReactMethod
|
|
88
78
|
public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
|
|
@@ -99,6 +89,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
99
89
|
// SentryAndroid needs an empty string fallback for the dsn.
|
|
100
90
|
options.setDsn("");
|
|
101
91
|
}
|
|
92
|
+
if (rnOptions.hasKey("sendClientReports")) {
|
|
93
|
+
options.setSendClientReports(rnOptions.getBoolean("sendClientReports"));
|
|
94
|
+
}
|
|
102
95
|
if (rnOptions.hasKey("maxBreadcrumbs")) {
|
|
103
96
|
options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
|
|
104
97
|
}
|
|
@@ -137,29 +130,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
137
130
|
if (rnOptions.hasKey("sendDefaultPii")) {
|
|
138
131
|
options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
|
|
139
132
|
}
|
|
140
|
-
if (rnOptions.hasKey("enableAutoPerformanceTracking")
|
|
141
|
-
&& rnOptions.getBoolean("enableAutoPerformanceTracking")) {
|
|
142
|
-
androidXAvailable = checkAndroidXAvailability();
|
|
143
|
-
|
|
144
|
-
if (androidXAvailable) {
|
|
145
|
-
frameMetricsAggregator = new FrameMetricsAggregator();
|
|
146
|
-
final Activity currentActivity = getCurrentActivity();
|
|
147
|
-
|
|
148
|
-
if (frameMetricsAggregator != null && currentActivity != null) {
|
|
149
|
-
try {
|
|
150
|
-
frameMetricsAggregator.add(currentActivity);
|
|
151
|
-
} catch (Throwable ignored) {
|
|
152
|
-
// throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
|
|
153
|
-
// this is a best effort since we can't reproduce it
|
|
154
|
-
logger.warning("Error adding Activity to frameMetricsAggregator.");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
logger.warning("androidx.core' isn't available as a dependency.");
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
this.disableNativeFramesTracking();
|
|
162
|
-
}
|
|
163
133
|
|
|
164
134
|
options.setBeforeSend((event, hint) -> {
|
|
165
135
|
// React native internally throws a JavascriptException
|
|
@@ -359,7 +329,10 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
359
329
|
String key = it.nextKey();
|
|
360
330
|
String value = otherUserKeys.getString(key);
|
|
361
331
|
|
|
362
|
-
|
|
332
|
+
// other is ConcurrentHashMap and can't have null values
|
|
333
|
+
if (value != null) {
|
|
334
|
+
otherUserKeysMap.put(key, value);
|
|
335
|
+
}
|
|
363
336
|
}
|
|
364
337
|
|
|
365
338
|
userInstance.setOthers(otherUserKeysMap);
|
|
@@ -411,13 +384,13 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
411
384
|
}
|
|
412
385
|
|
|
413
386
|
if (breadcrumb.hasKey("data")) {
|
|
414
|
-
ReadableMap data = breadcrumb.getMap("data");
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
387
|
+
final ReadableMap data = breadcrumb.getMap("data");
|
|
388
|
+
for(final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
389
|
+
final Object value = entry.getValue();
|
|
390
|
+
// data is ConcurrentHashMap and can't have null values
|
|
391
|
+
if (value != null) {
|
|
392
|
+
breadcrumbInstance.setData(entry.getKey(), entry.getValue());
|
|
393
|
+
}
|
|
421
394
|
}
|
|
422
395
|
}
|
|
423
396
|
|
|
@@ -467,6 +440,32 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
467
440
|
promise.resolve(true);
|
|
468
441
|
}
|
|
469
442
|
|
|
443
|
+
@ReactMethod
|
|
444
|
+
public void enableNativeFramesTracking() {
|
|
445
|
+
androidXAvailable = checkAndroidXAvailability();
|
|
446
|
+
|
|
447
|
+
if (androidXAvailable) {
|
|
448
|
+
frameMetricsAggregator = new FrameMetricsAggregator();
|
|
449
|
+
final Activity currentActivity = getCurrentActivity();
|
|
450
|
+
|
|
451
|
+
if (frameMetricsAggregator != null && currentActivity != null) {
|
|
452
|
+
try {
|
|
453
|
+
frameMetricsAggregator.add(currentActivity);
|
|
454
|
+
|
|
455
|
+
logger.info("FrameMetricsAggregator installed.");
|
|
456
|
+
} catch (Throwable ignored) {
|
|
457
|
+
// throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
|
|
458
|
+
// this is a best effort since we can't reproduce it
|
|
459
|
+
logger.severe("Error adding Activity to frameMetricsAggregator.");
|
|
460
|
+
}
|
|
461
|
+
} else {
|
|
462
|
+
logger.info("currentActivity isn't available.");
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
logger.warning("androidx.core' isn't available as a dependency.");
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
470
469
|
@ReactMethod
|
|
471
470
|
public void disableNativeFramesTracking() {
|
|
472
471
|
if (isFrameMetricsAggregatorAvailable()) {
|
package/dist/js/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '@sentry/core';
|
|
2
|
-
import { Event, EventHint, SeverityLevel, UserFeedback } 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.
|
|
@@ -36,12 +37,20 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
|
|
|
36
37
|
*/
|
|
37
38
|
captureUserFeedback(feedback: UserFeedback): void;
|
|
38
39
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
* @inheritdoc
|
|
41
|
+
*/
|
|
42
|
+
protected _sendEnvelope(envelope: Envelope): void;
|
|
43
|
+
/**
|
|
44
|
+
* Starts native client with dsn and options
|
|
45
|
+
*/
|
|
41
46
|
private _initNativeSdk;
|
|
42
47
|
/**
|
|
43
48
|
* If the user is in development mode, and the native nagger is enabled then it will show an alert.
|
|
44
49
|
*/
|
|
45
50
|
private _showCannotConnectDialog;
|
|
51
|
+
/**
|
|
52
|
+
* Attaches a client report from outcomes to the envelope.
|
|
53
|
+
*/
|
|
54
|
+
private _attachClientReportTo;
|
|
46
55
|
}
|
|
47
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,11 +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';
|
|
6
7
|
import { defaultSdkInfo } from './integrations/sdkinfo';
|
|
7
8
|
import { NativeTransport } from './transports/native';
|
|
8
|
-
import { createUserFeedbackEnvelope } from './utils/envelope';
|
|
9
|
+
import { createUserFeedbackEnvelope, items } from './utils/envelope';
|
|
10
|
+
import { mergeOutcomes } from './utils/outcome';
|
|
9
11
|
import { NATIVE } from './wrapper';
|
|
10
12
|
/**
|
|
11
13
|
* The Sentry React Native SDK Client.
|
|
@@ -30,6 +32,7 @@ export class ReactNativeClient extends BaseClient {
|
|
|
30
32
|
options._metadata = options._metadata || {};
|
|
31
33
|
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
|
|
32
34
|
super(options);
|
|
35
|
+
this._outcomesBuffer = [];
|
|
33
36
|
// This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning
|
|
34
37
|
// YellowBox deprecated and replaced with with LogBox in RN 0.63
|
|
35
38
|
if (LogBox) {
|
|
@@ -90,10 +93,40 @@ export class ReactNativeClient extends BaseClient {
|
|
|
90
93
|
this._sendEnvelope(envelope);
|
|
91
94
|
}
|
|
92
95
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
*/
|
|
95
128
|
_initNativeSdk() {
|
|
96
|
-
var _a, _b
|
|
129
|
+
var _a, _b;
|
|
97
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
131
|
let didCallNativeInit = false;
|
|
99
132
|
try {
|
|
@@ -101,10 +134,15 @@ export class ReactNativeClient extends BaseClient {
|
|
|
101
134
|
}
|
|
102
135
|
catch (_) {
|
|
103
136
|
this._showCannotConnectDialog();
|
|
104
|
-
(_b = (_a = this._options).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, { didCallNativeInit: false });
|
|
105
|
-
return;
|
|
106
137
|
}
|
|
107
|
-
|
|
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
|
+
}
|
|
108
146
|
});
|
|
109
147
|
}
|
|
110
148
|
/**
|
|
@@ -115,5 +153,20 @@ export class ReactNativeClient extends BaseClient {
|
|
|
115
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.');
|
|
116
154
|
}
|
|
117
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
|
+
}
|
|
118
171
|
}
|
|
119
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;AAQ1C,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,MAAM,k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AAE,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 {\n Event,\n EventHint,\n SeverityLevel,\n Transport,\n UserFeedback,\n} from '@sentry/types';\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 } from './utils/envelope';\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 options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\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 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 * 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,OAAgC,EAAE,WAAuB,EAAa,EAAE;gBAC3F,IAAI,MAAM,CAAC,0BAA0B,EAAE,EAAE;oBACvC,OAAO,IAAI,eAAe,EAAE,CAAC;iBAC9B;gBACD,OAAO,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAClD,CAAC,CAAC;SACH;QACD,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QA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C,CAAC;SACN;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACpC;QAED,IAAI,yBAAyB,EAAE;YAC7B,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,mEAAmE;SAC/F;IACH,CAAC;IAED;;OAEG;IACW,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;aACjC;oBAAS;gBACR,IAAI;oBACF,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,EAAE;iBAChD;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;iBAC9D;aACF;;KACF;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;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;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
|
@@ -22,7 +22,6 @@ interface SerializedObject {
|
|
|
22
22
|
[key: string]: string;
|
|
23
23
|
}
|
|
24
24
|
export interface SentryNativeBridgeModule {
|
|
25
|
-
nativeClientAvailable: boolean;
|
|
26
25
|
addBreadcrumb(breadcrumb: Breadcrumb): void;
|
|
27
26
|
captureEnvelope(bytes: number[], options: {
|
|
28
27
|
store: boolean;
|
|
@@ -31,6 +30,7 @@ export interface SentryNativeBridgeModule {
|
|
|
31
30
|
crash(): void;
|
|
32
31
|
closeNativeSdk(): PromiseLike<void>;
|
|
33
32
|
disableNativeFramesTracking(): void;
|
|
33
|
+
enableNativeFramesTracking(): void;
|
|
34
34
|
fetchNativeRelease(): Promise<{
|
|
35
35
|
build: string;
|
|
36
36
|
id: string;
|
|
@@ -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;CACxC,CAAC;AAEF,UAAU,gBAAgB;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;
|
|
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;IACn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AG,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
|
|
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\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 enableNativeFramesTracking(): 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
1
|
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage,
|
|
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, captureUserFeedback, } 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,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,
|
|
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, captureUserFeedback, } 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":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,
|
|
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"]}
|
package/dist/js/sdk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Hub } from '@sentry/hub';
|
|
2
|
+
import { Scope, UserFeedback } from '@sentry/types';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { ReactNativeOptions, ReactNativeWrapperOptions } from './options';
|
|
4
5
|
/**
|
|
@@ -39,4 +40,23 @@ export declare function close(): Promise<void>;
|
|
|
39
40
|
* Captures user feedback and sends it to Sentry.
|
|
40
41
|
*/
|
|
41
42
|
export declare function captureUserFeedback(feedback: UserFeedback): void;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new scope with and executes the given operation within.
|
|
45
|
+
* The scope is automatically removed once the operation
|
|
46
|
+
* finishes or throws.
|
|
47
|
+
*
|
|
48
|
+
* This is essentially a convenience function for:
|
|
49
|
+
*
|
|
50
|
+
* pushScope();
|
|
51
|
+
* callback();
|
|
52
|
+
* popScope();
|
|
53
|
+
*
|
|
54
|
+
* @param callback that will be enclosed into push/popScope.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withScope(callback: (scope: Scope) => void): ReturnType<Hub['withScope']>;
|
|
57
|
+
/**
|
|
58
|
+
* Callback to set context information onto the scope.
|
|
59
|
+
* @param callback Callback function that receives Scope.
|
|
60
|
+
*/
|
|
61
|
+
export declare function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']>;
|
|
42
62
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/js/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.t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