@sentry/react-native 5.25.0-alpha.2 → 5.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -63
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +87 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +7 -102
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +0 -10
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +0 -10
- package/dist/js/NativeRNSentry.d.ts +1 -3
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +0 -4
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +2 -12
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +26 -7
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +1 -9
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +1 -2
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +1 -2
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/index.d.ts +0 -1
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +0 -1
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/misc.d.ts +2 -0
- package/dist/js/misc.d.ts.map +1 -1
- package/dist/js/misc.js +4 -2
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +2 -24
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +30 -57
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/utils/environment.d.ts +0 -4
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +0 -8
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/error.d.ts +1 -0
- package/dist/js/utils/error.d.ts.map +1 -1
- package/dist/js/utils/error.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -6
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -7
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -25
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +9 -34
- package/ios/RNSentryBreadcrumb.h +4 -0
- package/ios/RNSentryBreadcrumb.m +19 -0
- package/package.json +1 -1
- package/sentry.gradle +1 -1
- package/src/js/NativeRNSentry.ts +1 -3
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -3
- package/ts3.8/dist/js/client.d.ts +0 -4
- package/ts3.8/dist/js/integrations/exports.d.ts +1 -2
- package/ts3.8/dist/js/integrations/index.d.ts +0 -1
- package/ts3.8/dist/js/misc.d.ts +2 -0
- package/ts3.8/dist/js/options.d.ts +2 -24
- package/ts3.8/dist/js/utils/environment.d.ts +0 -4
- package/ts3.8/dist/js/utils/error.d.ts +1 -0
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -6
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -7
- package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +0 -178
- package/dist/js/replay/mobilereplay.d.ts +0 -36
- package/dist/js/replay/mobilereplay.d.ts.map +0 -1
- package/dist/js/replay/mobilereplay.js +0 -99
- package/dist/js/replay/mobilereplay.js.map +0 -1
- package/dist/js/replay/networkUtils.d.ts +0 -8
- package/dist/js/replay/networkUtils.d.ts.map +0 -1
- package/dist/js/replay/networkUtils.js +0 -52
- package/dist/js/replay/networkUtils.js.map +0 -1
- package/dist/js/replay/xhrUtils.d.ts +0 -6
- package/dist/js/replay/xhrUtils.d.ts.map +0 -1
- package/dist/js/replay/xhrUtils.js +0 -31
- package/dist/js/replay/xhrUtils.js.map +0 -1
- package/dist/js/utils/clientutils.d.ts +0 -10
- package/dist/js/utils/clientutils.d.ts.map +0 -1
- package/dist/js/utils/clientutils.js +0 -9
- package/dist/js/utils/clientutils.js.map +0 -1
- package/ios/RNSentryReplay.h +0 -8
- package/ios/RNSentryReplay.m +0 -60
- package/ios/RNSentryReplayBreadcrumbConverter.h +0 -16
- package/ios/RNSentryReplayBreadcrumbConverter.m +0 -172
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +0 -36
- package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -8
- package/ts3.8/dist/js/replay/xhrUtils.d.ts +0 -6
- package/ts3.8/dist/js/utils/clientutils.d.ts +0 -10
package/ios/RNSentryBreadcrumb.m
CHANGED
|
@@ -30,4 +30,23 @@
|
|
|
30
30
|
return crumb;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
+ (NSString *_Nullable) getCurrentScreenFrom: (NSDictionary<NSString*, id> *_Nonnull) dict {
|
|
34
|
+
NSString *_Nullable maybeCategory = [dict valueForKey:@"category"];
|
|
35
|
+
if (![maybeCategory isEqualToString:@"navigation"]) {
|
|
36
|
+
return nil;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
NSDictionary<NSString*, id> *_Nullable maybeData = [dict valueForKey:@"data"];
|
|
40
|
+
if (![maybeData isKindOfClass:[NSDictionary class]]) {
|
|
41
|
+
return nil;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
NSString *_Nullable maybeCurrentScreen = [maybeData valueForKey:@"to"];
|
|
45
|
+
if (![maybeCurrentScreen isKindOfClass:[NSString class]]) {
|
|
46
|
+
return nil;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return maybeCurrentScreen;
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
@end
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "5.25.0
|
|
5
|
+
"version": "5.25.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
package/sentry.gradle
CHANGED
|
@@ -183,7 +183,7 @@ gradle.projectsEvaluated {
|
|
|
183
183
|
])
|
|
184
184
|
args.addAll(!config.flavorAware ? [] : [
|
|
185
185
|
"--url", sentryProps.get("defaults.url"),
|
|
186
|
-
"--auth-token", sentryProps.get("auth.token")
|
|
186
|
+
"--auth-token", sentryProps.get("auth.token") ?: System.getenv("SENTRY_AUTH_TOKEN")
|
|
187
187
|
])
|
|
188
188
|
args.addAll(["react-native", "gradle",
|
|
189
189
|
"--bundle", bundleOutput, // The path to a bundle that should be uploaded.
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Spec extends TurboModule {
|
|
|
13
13
|
captureEnvelope(
|
|
14
14
|
bytes: string,
|
|
15
15
|
options: {
|
|
16
|
-
|
|
16
|
+
hardCrashed: boolean;
|
|
17
17
|
},
|
|
18
18
|
): Promise<boolean>;
|
|
19
19
|
captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
|
|
@@ -44,8 +44,6 @@ export interface Spec extends TurboModule {
|
|
|
44
44
|
fetchNativePackageName(): string | undefined | null;
|
|
45
45
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
46
46
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
47
|
-
captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;
|
|
48
|
-
getCurrentReplayId(): string | undefined | null;
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
export type NativeStackFrame = {
|
|
@@ -6,7 +6,7 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
removeListeners: (id: number) => void;
|
|
7
7
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
8
8
|
captureEnvelope(bytes: string, options: {
|
|
9
|
-
|
|
9
|
+
hardCrashed: boolean;
|
|
10
10
|
}): Promise<boolean>;
|
|
11
11
|
captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
|
|
12
12
|
clearBreadcrumbs(): void;
|
|
@@ -39,8 +39,6 @@ export interface Spec extends TurboModule {
|
|
|
39
39
|
fetchNativePackageName(): string | undefined | null;
|
|
40
40
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
41
41
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
42
|
-
captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;
|
|
43
|
-
getCurrentReplayId(): string | undefined | null;
|
|
44
42
|
}
|
|
45
43
|
export type NativeStackFrame = {
|
|
46
44
|
platform: string;
|
|
@@ -35,10 +35,6 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
|
|
|
35
35
|
* Sends user feedback to Sentry.
|
|
36
36
|
*/
|
|
37
37
|
captureUserFeedback(feedback: UserFeedback): void;
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
init(): void;
|
|
42
38
|
/**
|
|
43
39
|
* Sets up the integrations
|
|
44
40
|
*/
|
|
@@ -12,6 +12,5 @@ export { screenshotIntegration } from './screenshot';
|
|
|
12
12
|
export { viewHierarchyIntegration } from './viewhierarchy';
|
|
13
13
|
export { expoContextIntegration } from './expocontext';
|
|
14
14
|
export { spotlightIntegration } from './spotlight';
|
|
15
|
-
export {
|
|
16
|
-
export { breadcrumbsIntegration, browserApiErrorsIntegration, dedupeIntegration, functionToStringIntegration, globalHandlersIntegration as browserGlobalHandlersIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration as browserLinkedErrorsIntegration, rewriteFramesIntegration, replayIntegration as browserReplayIntegration, } from '@sentry/react';
|
|
15
|
+
export { breadcrumbsIntegration, browserApiErrorsIntegration, dedupeIntegration, functionToStringIntegration, globalHandlersIntegration as browserGlobalHandlersIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration as browserLinkedErrorsIntegration, rewriteFramesIntegration, } from '@sentry/react';
|
|
17
16
|
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -12,5 +12,4 @@ export { Screenshot } from './screenshot';
|
|
|
12
12
|
export { ViewHierarchy } from './viewhierarchy';
|
|
13
13
|
export { ExpoContext } from './expocontext';
|
|
14
14
|
export { Spotlight } from './spotlight';
|
|
15
|
-
export { mobileReplayIntegration } from '../replay/mobilereplay';
|
|
16
15
|
//# sourceMappingURL=index.d.ts.map
|
package/ts3.8/dist/js/misc.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ type EnvelopeItemPayload = EnvelopeItem[1];
|
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the hard crash information from the event exceptions.
|
|
5
5
|
* No exceptions or undefined handled are not hard crashes.
|
|
6
|
+
*
|
|
7
|
+
* Hard crashes are only unhandled error, not user set unhandled mechanisms.
|
|
6
8
|
*/
|
|
7
9
|
export declare function isHardCrash(payload: EnvelopeItemPayload): boolean;
|
|
8
10
|
export {};
|
|
@@ -159,28 +159,6 @@ export interface BaseReactNativeOptions {
|
|
|
159
159
|
* from the function, no screenshot will be attached.
|
|
160
160
|
*/
|
|
161
161
|
beforeScreenshot?: (event: Event, hint: EventHint) => boolean;
|
|
162
|
-
/**
|
|
163
|
-
* Options which are in beta, or otherwise not guaranteed to be stable.
|
|
164
|
-
*/
|
|
165
|
-
_experiments?: {
|
|
166
|
-
[key: string]: unknown;
|
|
167
|
-
/**
|
|
168
|
-
* The sample rate for profiling
|
|
169
|
-
* 1.0 will profile all transactions and 0 will profile none.
|
|
170
|
-
*/
|
|
171
|
-
profilesSampleRate?: number;
|
|
172
|
-
/**
|
|
173
|
-
* The sample rate for session-long replays.
|
|
174
|
-
* 1.0 will record all sessions and 0 will record none.
|
|
175
|
-
*/
|
|
176
|
-
replaysSessionSampleRate?: number;
|
|
177
|
-
/**
|
|
178
|
-
* The sample rate for sessions that has had an error occur.
|
|
179
|
-
* This is independent of `sessionSampleRate`.
|
|
180
|
-
* 1.0 will record all sessions and 0 will record none.
|
|
181
|
-
*/
|
|
182
|
-
replaysOnErrorSampleRate?: number;
|
|
183
|
-
};
|
|
184
162
|
}
|
|
185
163
|
export interface ReactNativeTransportOptions extends BrowserTransportOptions {
|
|
186
164
|
/**
|
|
@@ -192,9 +170,9 @@ export interface ReactNativeTransportOptions extends BrowserTransportOptions {
|
|
|
192
170
|
* Configuration options for the Sentry ReactNative SDK.
|
|
193
171
|
* @see ReactNativeFrontend for more information.
|
|
194
172
|
*/
|
|
195
|
-
export interface ReactNativeOptions extends
|
|
173
|
+
export interface ReactNativeOptions extends Options<ReactNativeTransportOptions>, BaseReactNativeOptions {
|
|
196
174
|
}
|
|
197
|
-
export interface ReactNativeClientOptions extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel'
|
|
175
|
+
export interface ReactNativeClientOptions extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel'>, BaseReactNativeOptions {
|
|
198
176
|
}
|
|
199
177
|
export interface ReactNativeWrapperOptions {
|
|
200
178
|
/** Props for the root React profiler */
|
|
@@ -16,10 +16,6 @@ export declare function getExpoGoVersion(): string | undefined;
|
|
|
16
16
|
export declare function getExpoSdkVersion(): string | undefined;
|
|
17
17
|
/** Checks if the current platform is not web */
|
|
18
18
|
export declare function notWeb(): boolean;
|
|
19
|
-
/** Checks if the current platform is supported mobile platform (iOS or Android) */
|
|
20
|
-
export declare function isMobileOs(): boolean;
|
|
21
|
-
/** Checks if the current platform is not supported mobile platform (iOS or Android) */
|
|
22
|
-
export declare function notMobileOs(): boolean;
|
|
23
19
|
/** Returns Hermes Version if hermes is present in the runtime */
|
|
24
20
|
export declare function getHermesVersion(): string | undefined;
|
|
25
21
|
/** Returns default environment based on __DEV__ */
|
|
@@ -22,13 +22,7 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
|
22
22
|
};
|
|
23
23
|
__BUNDLE_START_TIME__?: number;
|
|
24
24
|
nativePerformanceNow?: () => number;
|
|
25
|
-
TextEncoder?: TextEncoder;
|
|
26
25
|
}
|
|
27
|
-
type TextEncoder = {
|
|
28
|
-
new (): TextEncoder;
|
|
29
|
-
encode(input?: string): Uint8Array;
|
|
30
|
-
};
|
|
31
26
|
/** Get's the global object for the current JavaScript runtime */
|
|
32
27
|
export declare const RN_GLOBAL_OBJ: ReactNativeInternalGlobal;
|
|
33
|
-
export {};
|
|
34
28
|
//# sourceMappingURL=worldwide.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
|
|
2
2
|
export declare const SDK_NAME = "sentry.javascript.react-native";
|
|
3
|
-
export declare const SDK_VERSION = "5.25.0
|
|
3
|
+
export declare const SDK_VERSION = "5.25.0";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -4,7 +4,6 @@ import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFrames
|
|
|
4
4
|
import type { ReactNativeClientOptions } from './options';
|
|
5
5
|
import type * as Hermes from './profiling/hermes';
|
|
6
6
|
import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';
|
|
7
|
-
import type { MobileReplayOptions } from './replay/mobilereplay';
|
|
8
7
|
/**
|
|
9
8
|
* Returns the RNSentry module. Dynamically resolves if NativeModule or TurboModule is used.
|
|
10
9
|
*/
|
|
@@ -14,9 +13,6 @@ export interface Screenshot {
|
|
|
14
13
|
contentType: string;
|
|
15
14
|
filename: string;
|
|
16
15
|
}
|
|
17
|
-
export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
|
|
18
|
-
mobileReplayOptions: MobileReplayOptions | undefined;
|
|
19
|
-
};
|
|
20
16
|
interface SentryNativeWrapper {
|
|
21
17
|
enableNative: boolean;
|
|
22
18
|
nativeIsReady: boolean;
|
|
@@ -33,7 +29,7 @@ interface SentryNativeWrapper {
|
|
|
33
29
|
};
|
|
34
30
|
_isModuleLoaded(module: Spec | undefined): module is Spec;
|
|
35
31
|
isNativeAvailable(): boolean;
|
|
36
|
-
initNativeSdk(options:
|
|
32
|
+
initNativeSdk(options: Partial<ReactNativeClientOptions>): PromiseLike<boolean>;
|
|
37
33
|
closeNativeSdk(): PromiseLike<void>;
|
|
38
34
|
sendEnvelope(envelope: Envelope): Promise<void>;
|
|
39
35
|
captureScreenshot(): Promise<Screenshot[] | null>;
|
|
@@ -67,8 +63,6 @@ interface SentryNativeWrapper {
|
|
|
67
63
|
*/
|
|
68
64
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;
|
|
69
65
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
70
|
-
captureReplay(isHardCrash: boolean): Promise<string | null>;
|
|
71
|
-
getCurrentReplayId(): string | null;
|
|
72
66
|
}
|
|
73
67
|
/**
|
|
74
68
|
* Our internal interface for calling native functions
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
package io.sentry.react;
|
|
2
|
-
|
|
3
|
-
import io.sentry.Breadcrumb;
|
|
4
|
-
import io.sentry.android.replay.DefaultReplayBreadcrumbConverter;
|
|
5
|
-
import io.sentry.rrweb.RRWebEvent;
|
|
6
|
-
import io.sentry.rrweb.RRWebBreadcrumbEvent;
|
|
7
|
-
import io.sentry.rrweb.RRWebSpanEvent;
|
|
8
|
-
|
|
9
|
-
import java.util.HashMap;
|
|
10
|
-
import org.jetbrains.annotations.NotNull;
|
|
11
|
-
import org.jetbrains.annotations.Nullable;
|
|
12
|
-
import org.jetbrains.annotations.TestOnly;
|
|
13
|
-
|
|
14
|
-
import java.util.List;
|
|
15
|
-
import java.util.Map;
|
|
16
|
-
|
|
17
|
-
public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadcrumbConverter {
|
|
18
|
-
public RNSentryReplayBreadcrumbConverter() {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Override
|
|
22
|
-
public @Nullable RRWebEvent convert(final @NotNull Breadcrumb breadcrumb) {
|
|
23
|
-
if (breadcrumb.getCategory() == null) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Do not add Sentry Event breadcrumbs to replay
|
|
28
|
-
if (breadcrumb.getCategory().equals("sentry.event") ||
|
|
29
|
-
breadcrumb.getCategory().equals("sentry.transaction")) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (breadcrumb.getCategory().equals("touch")) {
|
|
34
|
-
return convertTouchBreadcrumb(breadcrumb);
|
|
35
|
-
}
|
|
36
|
-
if (breadcrumb.getCategory().equals("navigation")) {
|
|
37
|
-
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
38
|
-
rrWebBreadcrumb.setCategory(breadcrumb.getCategory());
|
|
39
|
-
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
40
|
-
return rrWebBreadcrumb;
|
|
41
|
-
}
|
|
42
|
-
if (breadcrumb.getCategory().equals("xhr")) {
|
|
43
|
-
return convertNetworkBreadcrumb(breadcrumb);
|
|
44
|
-
}
|
|
45
|
-
if (breadcrumb.getCategory().equals("http")) {
|
|
46
|
-
// Drop native http breadcrumbs to avoid duplicates
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
RRWebEvent nativeBreadcrumb = super.convert(breadcrumb);
|
|
51
|
-
|
|
52
|
-
// ignore native navigation breadcrumbs
|
|
53
|
-
if (nativeBreadcrumb instanceof RRWebBreadcrumbEvent) {
|
|
54
|
-
final RRWebBreadcrumbEvent rrWebBreadcrumb = (RRWebBreadcrumbEvent) nativeBreadcrumb;
|
|
55
|
-
if (rrWebBreadcrumb.getCategory() != null && rrWebBreadcrumb.getCategory().equals("navigation")) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return nativeBreadcrumb;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@TestOnly
|
|
64
|
-
public @NotNull RRWebEvent convertTouchBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
65
|
-
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
66
|
-
|
|
67
|
-
rrWebBreadcrumb.setCategory("ui.tap");
|
|
68
|
-
|
|
69
|
-
rrWebBreadcrumb.setMessage(RNSentryReplayBreadcrumbConverter
|
|
70
|
-
.getTouchPathMessage(breadcrumb.getData("path")));
|
|
71
|
-
|
|
72
|
-
rrWebBreadcrumb.setLevel(breadcrumb.getLevel());
|
|
73
|
-
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
74
|
-
rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime());
|
|
75
|
-
rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0);
|
|
76
|
-
rrWebBreadcrumb.setBreadcrumbType("default");
|
|
77
|
-
return rrWebBreadcrumb;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@TestOnly
|
|
81
|
-
public static @Nullable String getTouchPathMessage(final @Nullable Object maybePath) {
|
|
82
|
-
if (!(maybePath instanceof List)) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
final @NotNull List path = (List) maybePath;
|
|
87
|
-
if (path.size() == 0) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
final @NotNull StringBuilder message = new StringBuilder();
|
|
92
|
-
for (int i = Math.min(3, path.size() - 1); i >= 0; i--) {
|
|
93
|
-
final @Nullable Object maybeItem = path.get(i);
|
|
94
|
-
if (!(maybeItem instanceof Map)) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
final @NotNull Map item = (Map) maybeItem;
|
|
99
|
-
final @Nullable Object maybeName = item.get("name");
|
|
100
|
-
final @Nullable Object maybeLabel = item.get("label");
|
|
101
|
-
boolean hasName = maybeName instanceof String;
|
|
102
|
-
boolean hasLabel = maybeLabel instanceof String;
|
|
103
|
-
if (!hasName && !hasLabel) {
|
|
104
|
-
return null; // This again should never be allowed in JS, but to be safe we check it here
|
|
105
|
-
}
|
|
106
|
-
if (hasLabel) {
|
|
107
|
-
message.append(maybeLabel);
|
|
108
|
-
} else { // hasName is true
|
|
109
|
-
message.append(maybeName);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
final @Nullable Object maybeElement = item.get("element");
|
|
113
|
-
final @Nullable Object maybeFile = item.get("file");
|
|
114
|
-
boolean hasElement = maybeElement instanceof String;
|
|
115
|
-
boolean hasFile = maybeFile instanceof String;
|
|
116
|
-
if (hasElement && hasFile) {
|
|
117
|
-
message.append('(')
|
|
118
|
-
.append(maybeElement)
|
|
119
|
-
.append(", ")
|
|
120
|
-
.append(maybeFile)
|
|
121
|
-
.append(')');
|
|
122
|
-
} else if (hasElement) {
|
|
123
|
-
message.append('(')
|
|
124
|
-
.append(maybeElement)
|
|
125
|
-
.append(')');
|
|
126
|
-
} else if (hasFile) {
|
|
127
|
-
message.append('(')
|
|
128
|
-
.append(maybeFile)
|
|
129
|
-
.append(')');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (i > 0) {
|
|
133
|
-
message.append(" > ");
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return message.toString();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
@TestOnly
|
|
141
|
-
public @Nullable RRWebEvent convertNetworkBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
142
|
-
final Double startTimestamp = breadcrumb.getData("start_timestamp") instanceof Number
|
|
143
|
-
? (Double) breadcrumb.getData("start_timestamp") : null;
|
|
144
|
-
final Double endTimestamp = breadcrumb.getData("end_timestamp") instanceof Number
|
|
145
|
-
? (Double) breadcrumb.getData("end_timestamp") : null;
|
|
146
|
-
final String url = breadcrumb.getData("url") instanceof String
|
|
147
|
-
? (String) breadcrumb.getData("url") : null;
|
|
148
|
-
|
|
149
|
-
if (startTimestamp == null || endTimestamp == null || url == null) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
final HashMap<String, Object> data = new HashMap<>();
|
|
154
|
-
if (breadcrumb.getData("method") instanceof String) {
|
|
155
|
-
data.put("method", breadcrumb.getData("method"));
|
|
156
|
-
}
|
|
157
|
-
if (breadcrumb.getData("status_code") instanceof Double) {
|
|
158
|
-
final Double statusCode = (Double) breadcrumb.getData("status_code");
|
|
159
|
-
if (statusCode > 0) {
|
|
160
|
-
data.put("statusCode", statusCode.intValue());
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (breadcrumb.getData("request_body_size") instanceof Double) {
|
|
164
|
-
data.put("requestBodySize", breadcrumb.getData("request_body_size"));
|
|
165
|
-
}
|
|
166
|
-
if (breadcrumb.getData("response_body_size") instanceof Double) {
|
|
167
|
-
data.put("responseBodySize", breadcrumb.getData("response_body_size"));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
final RRWebSpanEvent rrWebSpanEvent = new RRWebSpanEvent();
|
|
171
|
-
rrWebSpanEvent.setOp("resource.http");
|
|
172
|
-
rrWebSpanEvent.setStartTimestamp(startTimestamp / 1000.0);
|
|
173
|
-
rrWebSpanEvent.setEndTimestamp(endTimestamp / 1000.0);
|
|
174
|
-
rrWebSpanEvent.setDescription(url);
|
|
175
|
-
rrWebSpanEvent.setData(data);
|
|
176
|
-
return rrWebSpanEvent;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { IntegrationFnResult } from '@sentry/types';
|
|
2
|
-
export declare const MOBILE_REPLAY_INTEGRATION_NAME = "MobileReplay";
|
|
3
|
-
export interface MobileReplayOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Mask all text in recordings
|
|
6
|
-
*/
|
|
7
|
-
maskAllText?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Mask all text in recordings
|
|
10
|
-
*/
|
|
11
|
-
maskAllImages?: boolean;
|
|
12
|
-
}
|
|
13
|
-
type MobileReplayIntegration = IntegrationFnResult & {
|
|
14
|
-
options: Required<MobileReplayOptions>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* The Mobile Replay Integration, let's you adjust the default mobile replay options.
|
|
18
|
-
* To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.
|
|
19
|
-
*
|
|
20
|
-
* ```javascript
|
|
21
|
-
* Sentry.init({
|
|
22
|
-
* _experiments: {
|
|
23
|
-
* replaysOnErrorSampleRate: 1.0,
|
|
24
|
-
* replaysSessionSampleRate: 1.0,
|
|
25
|
-
* },
|
|
26
|
-
* integrations: [mobileReplayIntegration({
|
|
27
|
-
* // Adjust the default options
|
|
28
|
-
* })],
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @experimental
|
|
33
|
-
*/
|
|
34
|
-
export declare const mobileReplayIntegration: (initOptions?: MobileReplayOptions) => MobileReplayIntegration;
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=mobilereplay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAShG,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAOD,KAAK,uBAAuB,GAAG,mBAAmB,GAAG;IACnD,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAuE3F,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
|
-
import { logger } from '@sentry/utils';
|
|
3
|
-
import { isHardCrash } from '../misc';
|
|
4
|
-
import { hasHooks } from '../utils/clientutils';
|
|
5
|
-
import { isExpoGo, notMobileOs } from '../utils/environment';
|
|
6
|
-
import { NATIVE } from '../wrapper';
|
|
7
|
-
import { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';
|
|
8
|
-
export const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';
|
|
9
|
-
const defaultOptions = {
|
|
10
|
-
maskAllText: true,
|
|
11
|
-
maskAllImages: true,
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* The Mobile Replay Integration, let's you adjust the default mobile replay options.
|
|
15
|
-
* To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.
|
|
16
|
-
*
|
|
17
|
-
* ```javascript
|
|
18
|
-
* Sentry.init({
|
|
19
|
-
* _experiments: {
|
|
20
|
-
* replaysOnErrorSampleRate: 1.0,
|
|
21
|
-
* replaysSessionSampleRate: 1.0,
|
|
22
|
-
* },
|
|
23
|
-
* integrations: [mobileReplayIntegration({
|
|
24
|
-
* // Adjust the default options
|
|
25
|
-
* })],
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @experimental
|
|
30
|
-
*/
|
|
31
|
-
export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
32
|
-
if (isExpoGo()) {
|
|
33
|
-
logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \`expo prebuild\` to enable it.`);
|
|
34
|
-
}
|
|
35
|
-
if (notMobileOs()) {
|
|
36
|
-
logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);
|
|
37
|
-
}
|
|
38
|
-
if (isExpoGo() || notMobileOs()) {
|
|
39
|
-
return mobileReplayIntegrationNoop();
|
|
40
|
-
}
|
|
41
|
-
const options = Object.assign(Object.assign({}, defaultOptions), initOptions);
|
|
42
|
-
function processEvent(event) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const hasException = event.exception && event.exception.values && event.exception.values.length > 0;
|
|
45
|
-
if (!hasException) {
|
|
46
|
-
// Event is not an error, will not capture replay
|
|
47
|
-
return event;
|
|
48
|
-
}
|
|
49
|
-
const recordingReplayId = NATIVE.getCurrentReplayId();
|
|
50
|
-
if (recordingReplayId) {
|
|
51
|
-
logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`);
|
|
52
|
-
return event;
|
|
53
|
-
}
|
|
54
|
-
const replayId = yield NATIVE.captureReplay(isHardCrash(event));
|
|
55
|
-
if (!replayId) {
|
|
56
|
-
logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);
|
|
57
|
-
return event;
|
|
58
|
-
}
|
|
59
|
-
return event;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function setup(client) {
|
|
63
|
-
if (!hasHooks(client)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
client.on('createDsc', (dsc) => {
|
|
67
|
-
if (dsc.replay_id) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
// TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS
|
|
71
|
-
const currentReplayId = NATIVE.getCurrentReplayId();
|
|
72
|
-
if (currentReplayId) {
|
|
73
|
-
dsc.replay_id = currentReplayId;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);
|
|
77
|
-
}
|
|
78
|
-
// TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably
|
|
79
|
-
// https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45
|
|
80
|
-
return {
|
|
81
|
-
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
82
|
-
setupOnce() {
|
|
83
|
-
/* Noop */
|
|
84
|
-
},
|
|
85
|
-
setup,
|
|
86
|
-
processEvent,
|
|
87
|
-
options: options,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
const mobileReplayIntegrationNoop = () => {
|
|
91
|
-
return {
|
|
92
|
-
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
93
|
-
setupOnce() {
|
|
94
|
-
/* Noop */
|
|
95
|
-
},
|
|
96
|
-
options: defaultOptions,
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=mobilereplay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Client, DynamicSamplingContext, Event, IntegrationFnResult } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n */\n maskAllText?: boolean;\n\n /**\n * Mask all text in recordings\n */\n maskAllImages?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n};\n\ntype MobileReplayIntegration = IntegrationFnResult & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * _experiments: {\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * },\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = { ...defaultOptions, ...initOptions };\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n options: defaultOptions,\n };\n};\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-native" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
/** Convert a Content-Length header to number/undefined. */
|
|
4
|
-
export declare function parseContentLengthHeader(header: string | null | undefined): number | undefined;
|
|
5
|
-
export type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;
|
|
6
|
-
/** Get the size of a body. */
|
|
7
|
-
export declare function getBodySize(body: RequestBody): number | undefined;
|
|
8
|
-
//# sourceMappingURL=networkUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";;AAGA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAiCjE"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
2
|
-
import { utf8ToBytes } from '../vendor';
|
|
3
|
-
/** Convert a Content-Length header to number/undefined. */
|
|
4
|
-
export function parseContentLengthHeader(header) {
|
|
5
|
-
if (!header) {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
const size = parseInt(header, 10);
|
|
9
|
-
return isNaN(size) ? undefined : size;
|
|
10
|
-
}
|
|
11
|
-
/** Get the size of a body. */
|
|
12
|
-
export function getBodySize(body) {
|
|
13
|
-
if (!body) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
if (typeof body === 'string') {
|
|
18
|
-
return _encode(body).length;
|
|
19
|
-
}
|
|
20
|
-
if (body instanceof URLSearchParams) {
|
|
21
|
-
return _encode(body.toString()).length;
|
|
22
|
-
}
|
|
23
|
-
if (body instanceof FormData) {
|
|
24
|
-
const formDataStr = _serializeFormData(body);
|
|
25
|
-
return _encode(formDataStr).length;
|
|
26
|
-
}
|
|
27
|
-
if (body instanceof Blob) {
|
|
28
|
-
return body.size;
|
|
29
|
-
}
|
|
30
|
-
if (body instanceof ArrayBuffer) {
|
|
31
|
-
return body.byteLength;
|
|
32
|
-
}
|
|
33
|
-
// Currently unhandled types: ArrayBufferView, ReadableStream
|
|
34
|
-
}
|
|
35
|
-
catch (_a) {
|
|
36
|
-
// just return undefined
|
|
37
|
-
}
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
function _encode(input) {
|
|
41
|
-
if (RN_GLOBAL_OBJ.TextEncoder) {
|
|
42
|
-
return new RN_GLOBAL_OBJ.TextEncoder().encode(input);
|
|
43
|
-
}
|
|
44
|
-
return utf8ToBytes(input);
|
|
45
|
-
}
|
|
46
|
-
function _serializeFormData(formData) {
|
|
47
|
-
// This is a bit simplified, but gives us a decent estimate
|
|
48
|
-
// This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'
|
|
49
|
-
// @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584
|
|
50
|
-
return new URLSearchParams(formData).toString();
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=networkUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,2DAA2D;AAC3D,MAAM,UAAU,wBAAwB,CAAC,MAAiC;IACxE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAID,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,SAAS,CAAC;KAClB;IAED,IAAI;QACF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;SAC7B;QAED,IAAI,IAAI,YAAY,eAAe,EAAE;YACnC,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;SACxC;QAED,IAAI,IAAI,YAAY,QAAQ,EAAE;YAC5B,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;SACpC;QAED,IAAI,IAAI,YAAY,IAAI,EAAE;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC;SAClB;QAED,IAAI,IAAI,YAAY,WAAW,EAAE;YAC/B,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;QAED,6DAA6D;KAC9D;IAAC,WAAM;QACN,wBAAwB;KACzB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,aAAa,CAAC,WAAW,EAAE;QAC7B,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAkB;IAC5C,2DAA2D;IAC3D,iFAAiF;IACjF,2LAA2L;IAC3L,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { utf8ToBytes } from '../vendor';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return _encode(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return _encode(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return _encode(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _encode(input: string): number[] | Uint8Array {\n if (RN_GLOBAL_OBJ.TextEncoder) {\n return new RN_GLOBAL_OBJ.TextEncoder().encode(input);\n }\n return utf8ToBytes(input);\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Breadcrumb, BreadcrumbHint } from '@sentry/types';
|
|
2
|
-
/**
|
|
3
|
-
* Enrich an XHR breadcrumb with additional data for Mobile Replay network tab.
|
|
4
|
-
*/
|
|
5
|
-
export declare function enrichXhrBreadcrumbsForMobileReplay(breadcrumb: Breadcrumb, hint: BreadcrumbHint | undefined): void;
|
|
6
|
-
//# sourceMappingURL=xhrUtils.d.ts.map
|