@bugsee/react-native 7.0.0-beta2 → 7.0.0-beta4
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/README.md +264 -9
- package/android/build.gradle +9 -0
- package/android/consumer-rules.pro +3 -0
- package/android/src/main/java/com/bugsee/reactnative/BreadcrumbFilterBridge.java +224 -20
- package/android/src/main/java/com/bugsee/reactnative/BugseeModule.java +44 -21
- package/android/src/main/java/com/bugsee/reactnative/BugseeOptionEnums.java +15 -0
- package/android/src/main/java/com/bugsee/reactnative/LogFilterBridge.java +119 -5
- package/android/src/main/java/com/bugsee/reactnative/NetworkCaptureProbe.java +107 -0
- package/android/src/main/java/com/bugsee/reactnative/NetworkFilterBridge.java +129 -14
- package/android/src/main/java/com/bugsee/reactnative/ReactNativeWrapperInitProvider.java +48 -0
- package/android/src/main/java/com/bugsee/reactnative/SpanHandles.java +64 -8
- package/android/src/main/java/com/bugsee/reactnative/StartupHold.java +237 -0
- package/ios/BugseeModule.mm +293 -155
- package/ios/Support/Package.resolved +2 -2
- package/ios/Support/Package.swift +1 -1
- package/ios/Support/Sources/BugseeRNSupport/BGSRNBlackout.m +14 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNDeleteCollectedData.m +33 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNFilterArming.m +22 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNFilterDeadline.m +110 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNSpanHandles.m +40 -6
- package/ios/Support/Sources/BugseeRNSupport/BGSRNWrapper.m +1 -1
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNBlackout.h +23 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNCreatedReportOps.h +2 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNDeleteCollectedData.h +29 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNFilterArming.h +26 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNFilterDeadline.h +68 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportHandlerBridge.h +5 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportOps.h +5 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNSpanHandles.h +16 -2
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNWrapperChannelHolder.h +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNBlackoutTests.m +38 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNDeleteCollectedDataTests.m +135 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFakeReport.h +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFilterArmingTests.m +48 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFilterDeadlineTests.m +230 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportHandlerBridgeTests.m +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNSpanHandlesTests.m +86 -6
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperChannelHolderTests.m +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperTests.m +1 -1
- package/native-versions.json +2 -2
- package/package.json +2 -2
- package/plugin/build/dsym-script.d.ts +11 -0
- package/plugin/build/dsym-script.js +26 -3
- package/plugin/build/dsym-script.js.map +1 -1
- package/plugin/build/index.d.ts +27 -0
- package/plugin/build/index.js +33 -21
- package/plugin/build/index.js.map +1 -1
- package/plugin/build/manifest.d.ts +37 -0
- package/plugin/build/manifest.js +67 -1
- package/plugin/build/manifest.js.map +1 -1
- package/plugin/build/native-versions.baked.json +1 -1
- package/scripts/bugsee-xcode.sh +0 -0
- package/scripts/compose-then-inject.js +4 -2
- package/scripts/hermes-sourcemaps.js +40 -3
- package/scripts/hermesc-preserve-js.js +0 -0
- package/scripts/hermesc-preserve-js.sh +0 -0
- package/src/NativeBugsee.ts +39 -22
- package/src/apm/span.ts +42 -7
- package/src/breadcrumbs/filter.ts +104 -13
- package/src/breadcrumbs/types.ts +6 -4
- package/src/breadcrumbs/url-scrub.ts +75 -0
- package/src/exceptions/ErrorBoundary.tsx +4 -1
- package/src/exceptions/RootErrorReporter.tsx +1 -1
- package/src/exceptions/handlers.ts +17 -1
- package/src/exceptions/report.ts +30 -8
- package/src/index.ts +125 -33
- package/src/logs/filter.ts +19 -8
- package/src/network/filter.ts +17 -5
- package/src/options/AndroidLaunchOptions.ts +310 -24
- package/src/options/BugseeLaunchOptions.ts +463 -18
- package/src/options/IOSLaunchOptions.ts +164 -8
- package/src/options/android-options-manifest.json +63 -6
- package/src/options/enums.ts +28 -0
- package/src/options/ios-enums.json +6 -5
- package/src/options/ios-options-manifest.json +594 -0
- package/src/options/keys.ts +19 -1
- package/src/options/noAccessor.ts +16 -0
- package/src/options/option-keys.json +9 -3
- package/src/options/unknownKeys.ts +198 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { keysFor } from './keys';
|
|
2
|
+
|
|
3
|
+
type Platform = 'ios' | 'android';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 6.x option names mapped to their 7.x keys.
|
|
7
|
+
*
|
|
8
|
+
* Neither SDK treats these the same way, and that is the trap: the iOS SDK still
|
|
9
|
+
* maps its own legacy aliases onto the 7.x keys, while the Android SDK silently
|
|
10
|
+
* DROPS any key it does not know. A 6.x name such as `ShakeToReport` therefore
|
|
11
|
+
* works on iOS and does nothing on Android, with no error on either.
|
|
12
|
+
*
|
|
13
|
+
* The list is the iOS SDK's alias table plus the 6.x Android names the wrapper
|
|
14
|
+
* spec records. It only feeds the message: whether a key warns is decided by
|
|
15
|
+
* {@link keysFor}, never by this table.
|
|
16
|
+
*/
|
|
17
|
+
export const LEGACY_OPTION_KEYS: Readonly<Record<string, string>> = {
|
|
18
|
+
MaxRecordingTime: 'com.bugsee.option.config.duration',
|
|
19
|
+
WifiOnlyUpload: 'com.bugsee.option.config.wifi-only-upload',
|
|
20
|
+
NotifyFlushDelay: 'com.bugsee.option.config.notify-flush-delay',
|
|
21
|
+
MaxDataSize: 'com.bugsee.option.config.max-data-size',
|
|
22
|
+
CrashReport: 'com.bugsee.option.detect.crash',
|
|
23
|
+
DetectAppExit: 'com.bugsee.option.detect.exit',
|
|
24
|
+
DetectAppLaunchCrash: 'com.bugsee.option.detect.early-crash',
|
|
25
|
+
HandleAnr: 'com.bugsee.option.detect.hang',
|
|
26
|
+
MonitorNetwork: 'com.bugsee.option.capture.network',
|
|
27
|
+
bodySizeLimit: 'com.bugsee.option.capture.network.body-size-limit',
|
|
28
|
+
MaxNetworkBodySize: 'com.bugsee.option.capture.network.body-size-limit',
|
|
29
|
+
RecordHttpBodyWithoutType: 'com.bugsee.option.capture.network.body-without-type',
|
|
30
|
+
SanitizeNetworkData: 'com.bugsee.option.capture.network.default-sanitizer',
|
|
31
|
+
VideoEnabled: 'com.bugsee.option.capture.video',
|
|
32
|
+
ScreenshotEnabled: 'com.bugsee.option.capture.screenshot',
|
|
33
|
+
VideoScale: 'com.bugsee.option.capture.video.scale',
|
|
34
|
+
VideoQuality: 'com.bugsee.option.capture.video.quality',
|
|
35
|
+
VideoMode: 'com.bugsee.option.capture.video.mode',
|
|
36
|
+
FrameRate: 'com.bugsee.option.capture.video.frame-rate',
|
|
37
|
+
ViewHierarchyEnabled: 'com.bugsee.option.capture.view-hierarchy',
|
|
38
|
+
CaptureLogs: 'com.bugsee.option.capture.logs',
|
|
39
|
+
LogLevel: 'com.bugsee.option.capture.logs.level',
|
|
40
|
+
ShakeToReport: 'com.bugsee.option.reporting.triggers.shake',
|
|
41
|
+
ShakeToTrigger: 'com.bugsee.option.reporting.triggers.shake',
|
|
42
|
+
ScreenshotToReport: 'com.bugsee.option.reporting.triggers.screenshot',
|
|
43
|
+
ScreenshotToTrigger: 'com.bugsee.option.reporting.triggers.screenshot',
|
|
44
|
+
NotificationBarTrigger: 'com.bugsee.option.reporting.triggers.notification-bar',
|
|
45
|
+
BugseeDefaultCrashPriority: 'com.bugsee.option.reporting.defaults.crash-priority',
|
|
46
|
+
BugseeDefaultBugPriority: 'com.bugsee.option.reporting.defaults.bug-priority',
|
|
47
|
+
BugseeDefaultErrorPriority: 'com.bugsee.option.reporting.defaults.error-priority',
|
|
48
|
+
ReportSummaryRequired: 'com.bugsee.option.reporting.ui.summary-required',
|
|
49
|
+
ReportDescriptionRequired: 'com.bugsee.option.reporting.ui.description-required',
|
|
50
|
+
ReportEmailRequired: 'com.bugsee.option.reporting.ui.email-required',
|
|
51
|
+
ReportLabelsEnabled: 'com.bugsee.option.reporting.ui.labels-enabled',
|
|
52
|
+
ReportLabelsRequired: 'com.bugsee.option.reporting.ui.labels-required',
|
|
53
|
+
BugseeReportPrioritySelector: 'com.bugsee.option.reporting.ui.priority-selector-enabled',
|
|
54
|
+
BugseeStyle: 'com.bugsee.option.reporting.ui.style',
|
|
55
|
+
PerformanceMonitoring: 'com.bugsee.option.performance.enabled',
|
|
56
|
+
PerformanceSampleRate: 'com.bugsee.option.performance.sample-rate',
|
|
57
|
+
PerformanceAdaptiveSampling: 'com.bugsee.option.performance.adaptive-sampling',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The 6.x names the iOS SDK itself maps onto 7.x keys (its `legacyKeyAliases`, read from the 7.0.0
|
|
62
|
+
* source). Only these keep working on iOS; every other name in {@link LEGACY_OPTION_KEYS} is ignored
|
|
63
|
+
* there as well. Copied rather than derived because the SDK does not publish it.
|
|
64
|
+
*/
|
|
65
|
+
const IOS_MAPPED_LEGACY_KEYS: ReadonlySet<string> = new Set([
|
|
66
|
+
'MaxRecordingTime', 'WifiOnlyUpload', 'NotifyFlushDelay', 'MaxDataSize',
|
|
67
|
+
'CrashReport', 'DetectAppExit', 'MonitorNetwork', 'bodySizeLimit', 'SanitizeNetworkData',
|
|
68
|
+
'VideoEnabled', 'ScreenshotEnabled', 'VideoScale', 'FrameRate', 'ViewHierarchyEnabled', 'CaptureLogs',
|
|
69
|
+
'ShakeToReport', 'ScreenshotToReport',
|
|
70
|
+
'BugseeDefaultCrashPriority', 'BugseeDefaultBugPriority', 'BugseeDefaultErrorPriority',
|
|
71
|
+
'ReportSummaryRequired', 'ReportDescriptionRequired', 'ReportEmailRequired',
|
|
72
|
+
'ReportLabelsEnabled', 'ReportLabelsRequired', 'BugseeReportPrioritySelector', 'BugseeStyle',
|
|
73
|
+
'PerformanceMonitoring', 'PerformanceSampleRate', 'PerformanceAdaptiveSampling',
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
/** Edit distance, capped: a distance past `limit` is as good as any other. */
|
|
77
|
+
function distance(a: string, b: string, limit: number): number {
|
|
78
|
+
if (Math.abs(a.length - b.length) > limit) {
|
|
79
|
+
return limit + 1;
|
|
80
|
+
}
|
|
81
|
+
let previous = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
82
|
+
for (let i = 1; i <= a.length; i++) {
|
|
83
|
+
const row = [i];
|
|
84
|
+
for (let j = 1; j <= b.length; j++) {
|
|
85
|
+
row[j] = Math.min(
|
|
86
|
+
(previous[j] as number) + 1,
|
|
87
|
+
(row[j - 1] as number) + 1,
|
|
88
|
+
(previous[j - 1] as number) + (a[i - 1] === b[j - 1] ? 0 : 1),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
previous = row;
|
|
92
|
+
}
|
|
93
|
+
return previous[b.length] as number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function closestKey(platform: Platform, key: string): string | undefined {
|
|
97
|
+
let best: string | undefined;
|
|
98
|
+
let bestDistance = 4;
|
|
99
|
+
for (const known of keysFor(platform)) {
|
|
100
|
+
const d = distance(key, known, 3);
|
|
101
|
+
if (d < bestDistance) {
|
|
102
|
+
best = known;
|
|
103
|
+
bestDistance = d;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return best;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The keys of `options` that `platform`'s SDK does not know. */
|
|
110
|
+
export function unknownOptionKeys(
|
|
111
|
+
platform: Platform,
|
|
112
|
+
options: Readonly<Record<string, unknown>>,
|
|
113
|
+
): string[] {
|
|
114
|
+
const known = keysFor(platform);
|
|
115
|
+
return Object.keys(options).filter((key) => !known.has(key));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* What happens to a 6.x name on this platform, and what to use instead. The advice depends on the
|
|
120
|
+
* platform twice over: the iOS SDK maps only some of these names, and the 7.x key a name points at may
|
|
121
|
+
* exist on the other platform only (`NotificationBarTrigger` is Android's, `BugseeStyle` is iOS's).
|
|
122
|
+
*/
|
|
123
|
+
function describeLegacyKey(platform: Platform, key: string, replacement: string): string {
|
|
124
|
+
const sdk = platform === 'ios' ? 'iOS' : 'Android';
|
|
125
|
+
const usable = keysFor(platform).has(replacement);
|
|
126
|
+
if (!usable) {
|
|
127
|
+
return (
|
|
128
|
+
`[Bugsee] "${key}" is a 6.x option name, and the ${sdk} SDK has no equivalent 7.x option ` +
|
|
129
|
+
`("${replacement}" is ${platform === 'ios' ? 'Android' : 'iOS'}-only), so it has no effect.`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const effect =
|
|
133
|
+
platform === 'android'
|
|
134
|
+
? 'The Android SDK ignores it, so the setting has NO effect there'
|
|
135
|
+
: IOS_MAPPED_LEGACY_KEYS.has(key)
|
|
136
|
+
? 'The iOS SDK still maps it, but the Android SDK ignores it'
|
|
137
|
+
: 'Neither SDK maps it, so the setting has NO effect';
|
|
138
|
+
return `[Bugsee] "${key}" is a 6.x option name. ${effect}. Use "${replacement}" (or its accessor on the launch options object).`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** One sentence naming the key, what the SDK does with it, and what to use. */
|
|
142
|
+
export function describeUnknownKey(platform: Platform, key: string): string {
|
|
143
|
+
const sdk = platform === 'ios' ? 'iOS' : 'Android';
|
|
144
|
+
// Own keys only: a plain-object lookup also resolves `constructor`, `toString` and the rest of
|
|
145
|
+
// Object.prototype, which would turn those unknown keys into a nonsense "6.x name" message.
|
|
146
|
+
const legacy = Object.prototype.hasOwnProperty.call(LEGACY_OPTION_KEYS, key)
|
|
147
|
+
? LEGACY_OPTION_KEYS[key]
|
|
148
|
+
: undefined;
|
|
149
|
+
if (legacy !== undefined) {
|
|
150
|
+
return describeLegacyKey(platform, key, legacy);
|
|
151
|
+
}
|
|
152
|
+
const suggestion = closestKey(platform, key);
|
|
153
|
+
const hint = suggestion === undefined ? '' : ` Did you mean "${suggestion}"?`;
|
|
154
|
+
return (
|
|
155
|
+
`[Bugsee] "${key}" is not a launch option the ${sdk} SDK knows, so the SDK ignores it.` +
|
|
156
|
+
hint
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const warned = new Set<string>();
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The warning's only sink. Audited by name in `scripts/raw-messages.ts`: its
|
|
164
|
+
* message comes from {@link describeUnknownKey}, which sees the option KEY and
|
|
165
|
+
* the wrapper's own key tables and is never handed a value.
|
|
166
|
+
*/
|
|
167
|
+
function emitUnknownOptionWarning(message: string): void {
|
|
168
|
+
console.warn(message);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Warns once per key for every option `platform`'s SDK would silently drop.
|
|
173
|
+
*
|
|
174
|
+
* Both SDKs accept an unknown key without complaint, and the customer who sets
|
|
175
|
+
* one is left believing the setting is applied -- the case that prompted this
|
|
176
|
+
* was shake-to-report staying on. The launch itself proceeds unchanged: a key
|
|
177
|
+
* this build does not know may belong to a newer SDK than the one the wrapper
|
|
178
|
+
* was checked against, and refusing it would make `setCustomOption` useless.
|
|
179
|
+
*/
|
|
180
|
+
export function warnUnknownOptions(
|
|
181
|
+
platform: Platform,
|
|
182
|
+
options: Readonly<Record<string, unknown>>,
|
|
183
|
+
warn: (message: string) => void = emitUnknownOptionWarning,
|
|
184
|
+
): void {
|
|
185
|
+
for (const key of unknownOptionKeys(platform, options)) {
|
|
186
|
+
const id = `${platform}:${key}`;
|
|
187
|
+
if (warned.has(id)) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
warned.add(id);
|
|
191
|
+
warn(describeUnknownKey(platform, key));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Forgets what was warned about. For tests. */
|
|
196
|
+
export function resetUnknownOptionWarnings(): void {
|
|
197
|
+
warned.clear();
|
|
198
|
+
}
|