@logbrew/react-native 0.1.19 → 0.1.21
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 +24 -1
- package/apple-native-diagnostics.d.ts +20 -0
- package/apple-native-diagnostics.js +111 -1
- package/index.cjs +1 -1
- package/index.js +36 -1207
- package/index.native.d.ts +1 -0
- package/index.native.js +62 -6
- package/instrumentation.js +3 -632
- package/ios/AppleDiagnostics/LBRNAppleDiagnosticsModule.mm +10 -0
- package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +48 -1
- package/ios/GeneratedAppleDiagnostics/LogBrew/IssueDiagnostics.swift +3 -2
- package/ios/GeneratedAppleDiagnostics/LogBrew/TelemetryContextValidation.swift +16 -0
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/CrashEngine.swift +5 -0
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/CrashReportSanitizer.swift +26 -10
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/NativeCrashCapture.swift +35 -0
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/NativeCrashCorrelation.swift +174 -0
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/NativeCrashPublic.swift +30 -1
- package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +7 -6
- package/metadata.js +10 -181
- package/package.json +2 -2
- package/src/NativeLogBrewAppleDiagnostics.ts +6 -0
package/index.native.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ declare const defaultExport: Omit<
|
|
|
46
46
|
installLogBrewAppleNativeDiagnostics: typeof import("./apple-native-diagnostics.js").installLogBrewAppleNativeDiagnostics;
|
|
47
47
|
purgeLogBrewReactNativePersistentQueue: typeof purgeLogBrewReactNativePersistentQueue;
|
|
48
48
|
replayLogBrewAppleNativeDiagnostics: typeof import("./apple-native-diagnostics.js").replayLogBrewAppleNativeDiagnostics;
|
|
49
|
+
setLogBrewAppleNativeCrashContext: typeof import("./apple-native-diagnostics.js").setLogBrewAppleNativeCrashContext;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export default defaultExport;
|
package/index.native.js
CHANGED
|
@@ -13,7 +13,9 @@ import baseDefault from "./index.js";
|
|
|
13
13
|
import {
|
|
14
14
|
getLogBrewAppleNativeDiagnosticsStatus,
|
|
15
15
|
installLogBrewAppleNativeDiagnostics,
|
|
16
|
-
replayLogBrewAppleNativeDiagnostics
|
|
16
|
+
replayLogBrewAppleNativeDiagnostics,
|
|
17
|
+
setLogBrewAppleNativeCrashContext,
|
|
18
|
+
syncLogBrewAppleNativeCrashBreadcrumbs
|
|
17
19
|
} from "./apple-native-diagnostics.js";
|
|
18
20
|
import {
|
|
19
21
|
purgeReactNativePersistentQueue,
|
|
@@ -26,7 +28,8 @@ export {
|
|
|
26
28
|
export {
|
|
27
29
|
getLogBrewAppleNativeDiagnosticsStatus,
|
|
28
30
|
installLogBrewAppleNativeDiagnostics,
|
|
29
|
-
replayLogBrewAppleNativeDiagnostics
|
|
31
|
+
replayLogBrewAppleNativeDiagnostics,
|
|
32
|
+
setLogBrewAppleNativeCrashContext
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
export * from "./index.js";
|
|
@@ -48,7 +51,7 @@ export function createLogBrewReactNativeClient(config = {}) {
|
|
|
48
51
|
) && input.persistentQueue !== undefined;
|
|
49
52
|
const authKey = clientKey ?? apiKey;
|
|
50
53
|
if (typeof authKey !== "string" || authKey.trim() === "") {
|
|
51
|
-
return createPlatformNeutralClient(input);
|
|
54
|
+
return bindAppleNativeCrashBreadcrumbs(createPlatformNeutralClient(input));
|
|
52
55
|
}
|
|
53
56
|
const resolved = resolveReactNativePersistentEventStore({
|
|
54
57
|
authKey,
|
|
@@ -59,20 +62,72 @@ export function createLogBrewReactNativeClient(config = {}) {
|
|
|
59
62
|
hasExplicitPersistentQueue
|
|
60
63
|
});
|
|
61
64
|
try {
|
|
62
|
-
return createPlatformNeutralClient({
|
|
65
|
+
return bindAppleNativeCrashBreadcrumbs(createPlatformNeutralClient({
|
|
63
66
|
...forwarded,
|
|
64
67
|
apiKey,
|
|
65
68
|
clientKey,
|
|
66
69
|
eventStore: resolved.eventStore,
|
|
67
70
|
maxQueueBytes,
|
|
68
71
|
maxQueueSize
|
|
69
|
-
});
|
|
72
|
+
}));
|
|
70
73
|
} catch (error) {
|
|
71
74
|
resolved.abort();
|
|
72
75
|
throw error;
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
|
|
79
|
+
function bindAppleNativeCrashBreadcrumbs(client) {
|
|
80
|
+
if (Platform?.OS !== "ios") {
|
|
81
|
+
return client;
|
|
82
|
+
}
|
|
83
|
+
const addBreadcrumb = client.addBreadcrumb.bind(client);
|
|
84
|
+
const clearBreadcrumbs = client.clearBreadcrumbs.bind(client);
|
|
85
|
+
client.addBreadcrumb = (...args) => updateAppleNativeBreadcrumbs(
|
|
86
|
+
client, () => addBreadcrumb(...args)
|
|
87
|
+
);
|
|
88
|
+
client.clearBreadcrumbs = () => updateAppleNativeBreadcrumbs(client, clearBreadcrumbs);
|
|
89
|
+
syncAppleNativeCrashBreadcrumbs(client);
|
|
90
|
+
return client;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function updateAppleNativeBreadcrumbs(client, update) {
|
|
94
|
+
const previous = [client.issueBreadcrumbs.slice(), client.issueBreadcrumbsTruncated];
|
|
95
|
+
const result = update();
|
|
96
|
+
try {
|
|
97
|
+
syncAppleNativeCrashBreadcrumbs(client);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
restoreBreadcrumbs(client, previous);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function restoreBreadcrumbs(client, [breadcrumbs, truncated]) {
|
|
106
|
+
client.issueBreadcrumbs.splice(0, client.issueBreadcrumbs.length, ...breadcrumbs);
|
|
107
|
+
client.issueBreadcrumbsTruncated = truncated;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function syncAppleNativeCrashBreadcrumbs(client) {
|
|
111
|
+
const snapshot = client.issueBreadcrumbs.length === 0
|
|
112
|
+
? null
|
|
113
|
+
: {
|
|
114
|
+
breadcrumbs: client.issueBreadcrumbs.map(({ data, ...breadcrumb }) => ({
|
|
115
|
+
...breadcrumb,
|
|
116
|
+
...(data === undefined ? {} : { data: { ...data } })
|
|
117
|
+
})),
|
|
118
|
+
schemaVersion: 1,
|
|
119
|
+
truncated: client.issueBreadcrumbsTruncated
|
|
120
|
+
};
|
|
121
|
+
try {
|
|
122
|
+
syncLogBrewAppleNativeCrashBreadcrumbs(snapshot);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (error?.code !== "native_diagnostics_unavailable"
|
|
125
|
+
&& error?.code !== "native_diagnostics_not_installed") {
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
76
131
|
export function purgeLogBrewReactNativePersistentQueue(config = {}) {
|
|
77
132
|
purgeReactNativePersistentQueue(config);
|
|
78
133
|
}
|
|
@@ -146,7 +201,8 @@ const defaultExport = {
|
|
|
146
201
|
getLogBrewAppleNativeDiagnosticsStatus,
|
|
147
202
|
installLogBrewAppleNativeDiagnostics,
|
|
148
203
|
purgeLogBrewReactNativePersistentQueue,
|
|
149
|
-
replayLogBrewAppleNativeDiagnostics
|
|
204
|
+
replayLogBrewAppleNativeDiagnostics,
|
|
205
|
+
setLogBrewAppleNativeCrashContext
|
|
150
206
|
};
|
|
151
207
|
|
|
152
208
|
export default defaultExport;
|