@logbrew/react-native 0.1.23 → 0.1.24

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.
Files changed (35) hide show
  1. package/README.md +62 -5
  2. package/android/CMakeLists.txt +7 -0
  3. package/android/build.gradle +12 -0
  4. package/android/src/main/cpp/android_diagnostics.cpp +363 -0
  5. package/android/src/main/java/co/logbrew/reactnative/AndroidDiagnosticsRuntime.java +214 -0
  6. package/android/src/main/java/co/logbrew/reactnative/AndroidNativeDiagnostics.java +363 -0
  7. package/android/src/main/java/co/logbrew/reactnative/AndroidNativeSignalStore.java +233 -0
  8. package/android/src/main/java/co/logbrew/reactnative/AndroidParentDirectorySync.java +12 -12
  9. package/android/src/main/java/co/logbrew/reactnative/EventRecordStore.java +15 -5
  10. package/android/src/main/java/co/logbrew/reactnative/FatalStoreModuleImpl.java +111 -156
  11. package/android/src/newarch/java/co/logbrew/reactnative/FatalStoreModule.java +15 -20
  12. package/android/src/oldarch/java/co/logbrew/reactnative/FatalStoreModule.java +15 -20
  13. package/android-native-diagnostics.d.ts +29 -0
  14. package/android-native-diagnostics.js +176 -0
  15. package/fatal-replay.cjs +35 -3
  16. package/global-errors.d.cts +3 -3
  17. package/global-errors.d.ts +3 -3
  18. package/global-errors.native.js +1 -12
  19. package/index.cjs +1 -1
  20. package/index.native.d.ts +4 -0
  21. package/index.native.js +21 -3
  22. package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +1 -1
  23. package/ios/GeneratedAppleDiagnostics/LogBrew/LogBrewLogger.swift +2 -10
  24. package/ios/GeneratedAppleDiagnostics/LogBrew/OperationTrace.swift +56 -0
  25. package/ios/GeneratedAppleDiagnostics/LogBrew/URLSessionTracer.swift +48 -56
  26. package/ios/GeneratedAppleDiagnostics/LogBrew/Validation.swift +6 -0
  27. package/ios/GeneratedAppleDiagnostics/LogBrewCrash/NativeCrashCorrelation.swift +0 -1
  28. package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +5 -4
  29. package/ios/LBRNFatalStoreModule.mm +15 -86
  30. package/package.json +17 -5
  31. package/persistent-delivery.native.js +4 -3
  32. package/src/NativeLogBrewFatalStore.ts +5 -4
  33. package/android/src/main/java/co/logbrew/reactnative/FatalRecordStore.java +0 -623
  34. package/ios/LBRNFatalRecordStore.h +0 -25
  35. package/ios/LBRNFatalRecordStore.m +0 -542
@@ -2,6 +2,12 @@
2
2
  // Edit the canonical Swift source, then regenerate this package boundary.
3
3
  import Foundation
4
4
 
5
+ func currentTelemetryTimestamp() -> String {
6
+ let formatter = ISO8601DateFormatter()
7
+ formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
8
+ return formatter.string(from: Date())
9
+ }
10
+
5
11
  func validateRelease(_ attributes: ReleaseAttributes) throws -> ReleaseAttributes {
6
12
  try requireNonEmpty("release version", attributes.version)
7
13
  if let commit = attributes.commit {
@@ -43,7 +43,6 @@ struct NativeCrashDiagnosticSnapshot: Codable, Equatable {
43
43
  ? nil
44
44
  : TelemetryContext(trace: trace, session: session, subject: subject)
45
45
  }
46
-
47
46
  }
48
47
 
49
48
  enum NativeCrashCorrelation {
@@ -15,10 +15,11 @@
15
15
  "swift/logbrew-swift/Sources/LogBrew/IssueExceptionChain.swift": "10f81cbce95b47da0a44ef9e515b150e60d71dfcc8b04be24b037b1222a373a5",
16
16
  "swift/logbrew-swift/Sources/LogBrew/LifecycleTrace.swift": "738cd3f129fac821a892404d1d42ee92bd806b6583d3dbb5379e88b14ab23c16",
17
17
  "swift/logbrew-swift/Sources/LogBrew/LogBrewClient.swift": "186cdbda3754a811f17b82818ca8e7a1711b3b75123686cd17dc3b7441fa21cb",
18
- "swift/logbrew-swift/Sources/LogBrew/LogBrewLogger.swift": "d3266353a5f5139a2a1ca1a86bacce793518eb1489bf67ed9e3720b57b1c29b2",
18
+ "swift/logbrew-swift/Sources/LogBrew/LogBrewLogger.swift": "96e440f411c6276056e10c5feca82eb24fce9824632c7dbcedfd99b49d8332fc",
19
19
  "swift/logbrew-swift/Sources/LogBrew/LogBrewTrace.swift": "f67edf4ca464e6a6eb1c7a22cd4997928cd27b6c2d07535855a18a053d8de924",
20
20
  "swift/logbrew-swift/Sources/LogBrew/Metadata.swift": "65840ebb3f3b79fbfc1f5faa3026c2583319e89ff26061676dc552c03ee15dbe",
21
21
  "swift/logbrew-swift/Sources/LogBrew/NativeStackFrame.swift": "ecbd418969ec4a31503d9916a8bf27f22e6863356c6fabe457c1e61027a8d805",
22
+ "swift/logbrew-swift/Sources/LogBrew/OperationTrace.swift": "d7383d1926c7276cc97f03537e4587e20e4495f80226b5113e8ef10397f9c702",
22
23
  "swift/logbrew-swift/Sources/LogBrew/ProductTimeline.swift": "209906aa0e8f096a347e35832840522710eadfb530053253cd73c748518e362d",
23
24
  "swift/logbrew-swift/Sources/LogBrew/PublicTypes.swift": "a21aee058f716ec9d41d54ad032b2c7a4d64a4b99d749a9fa2be3fd2df5c6568",
24
25
  "swift/logbrew-swift/Sources/LogBrew/TelemetryContext.swift": "ce3ac93a62a345f8c9a8f4c69ce84efc991bf02a688f49bad5e68edcff2f6e08",
@@ -26,14 +27,14 @@
26
27
  "swift/logbrew-swift/Sources/LogBrew/TraceEvidence.swift": "40aaa42976164c53d9f4d9e9e30d236534238da43bbe90832a673c8809ad54b6",
27
28
  "swift/logbrew-swift/Sources/LogBrew/Transport.swift": "73eec81aaebec4bc922b2a372429c88fcd3e85606a7862cd08e1795eb2a8e6cd",
28
29
  "swift/logbrew-swift/Sources/LogBrew/URLSessionTrace.swift": "d0076c72671716c41bd7498d0509e453b8182c418156e169196fee9f26fc66b1",
29
- "swift/logbrew-swift/Sources/LogBrew/URLSessionTracer.swift": "0cdf08f92d6111c0dc2883b87837b81f69b5c2f9a8e5501780a114c23a741af7",
30
- "swift/logbrew-swift/Sources/LogBrew/Validation.swift": "07ff5c2daeb829b1df4f50edb0b79727f9a81b1c9b5cde5f995f5ad6ce660aa7",
30
+ "swift/logbrew-swift/Sources/LogBrew/URLSessionTracer.swift": "8f45867e5ec48fc7be8f4c7a015e887ed7f49f3a0ffb11bd850e1bb7e937f9a0",
31
+ "swift/logbrew-swift/Sources/LogBrew/Validation.swift": "4ce069077dcca7899b15733e9aee921392da1e2136996ae3d4eb37bd73a5af07",
31
32
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashEngine.swift": "a94dfce653e3e7f381be42b6d2c4540f0be77e83777ecc53e06682cd2e569c5a",
32
33
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashReportSanitizer.swift": "a56a2f6c6c7f1db900804a37df51aebba7b83dce14fa7816de5753c33409e4a5",
33
34
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashStorageDirectory.swift": "7cd566703cbf704dc99155451ee93dcace12c35c805abc09a6dcf23975cf43f9",
34
35
  "swift/logbrew-swift/Sources/LogBrewCrash/NativeArtifactIdentity.swift": "3d785ad717dcf7302451531c18b5e1183983270a6cd78dd543a407e3facc6ae0",
35
36
  "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashCapture.swift": "0b773a63987b6c694b044e56c0f81878f4f5e71eae3fdd126744cba3cf15aac1",
36
- "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashCorrelation.swift": "e5a7c25448c83ca2ae149c650ecfc72c5193741291a6ff9623eabadad8a9c440",
37
+ "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashCorrelation.swift": "001cba0fc6fa0d03ac058170b3e998b7db415a1b1038acaaec481183f26e8f0d",
37
38
  "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashExceptionEvidence.swift": "ce191e46298d91d87b379528d610caa88b924b15a8dd912b4a164b51eb172a7a",
38
39
  "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashPublic.swift": "70aa9700efd26d03b9656f1df96876de0b9eb769c03512ec53f667696773954f",
39
40
  "swift/logbrew-swift/Sources/LogBrewCrash/NativeCrashReplay.swift": "3eb3d93b32cf14de416f56fa30d6d65e6f268b5ec9d1a67081d7525c4efd4f80",
@@ -1,7 +1,6 @@
1
1
  #import "LBRNFatalStoreModule.h"
2
2
 
3
3
  #import "LBRNEventRecordStore.h"
4
- #import "LBRNFatalRecordStore.h"
5
4
  #import "LBRNPrivateStorage.h"
6
5
 
7
6
  #import <CommonCrypto/CommonDigest.h>
@@ -63,39 +62,10 @@ static NSString *LBRNQueueHash(NSString *queueKey)
63
62
  return value;
64
63
  }
65
64
 
66
- static NSDictionary *LBRNNormalizeRecord(NSDictionary *record)
67
- {
68
- if (![record isKindOfClass:[NSDictionary class]]) {
69
- return @{};
70
- }
71
- id framesValue = record[@"stackFrames"];
72
- if (![framesValue isKindOfClass:[NSArray class]]) {
73
- return record;
74
- }
75
- NSMutableArray *frames = [NSMutableArray arrayWithCapacity:[framesValue count]];
76
- for (id value in framesValue) {
77
- if (![value isKindOfClass:[NSDictionary class]]) {
78
- return record;
79
- }
80
- NSMutableDictionary *frame = [value mutableCopy];
81
- NSString *filename = frame[@"filename"];
82
- if ([filename isKindOfClass:[NSString class]]
83
- && [filename hasPrefix:@"/"]
84
- && [[filename substringFromIndex:1] rangeOfString:@"/"].location == NSNotFound) {
85
- frame[@"filename"] = [filename substringFromIndex:1];
86
- }
87
- [frames addObject:frame];
88
- }
89
- NSMutableDictionary *normalized = [record mutableCopy];
90
- normalized[@"stackFrames"] = frames;
91
- return normalized;
92
- }
93
-
94
65
  @interface LBRNFatalStoreModule ()
95
66
  #ifdef RCT_NEW_ARCH_ENABLED
96
67
  <NativeLogBrewFatalStoreSpec>
97
68
  #endif
98
- @property (nonatomic, nullable) LBRNFatalRecordStore *store;
99
69
  @property (nonatomic, nullable) NSURL *eventStoreParentURL;
100
70
  @property (nonatomic) NSMutableDictionary<NSString *, LBRNEventRecordStore *> *eventStores;
101
71
  @end
@@ -119,14 +89,6 @@ RCT_EXPORT_MODULE(LogBrewFatalStore)
119
89
  if (baseURL != nil && LBRNPreparePrivateRootDirectory(baseURL)) {
120
90
  _eventStoreParentURL = baseURL;
121
91
  _eventStores = [NSMutableDictionary dictionary];
122
- NSURL *directoryURL = [baseURL URLByAppendingPathComponent:@"LogBrewFatalJS"
123
- isDirectory:YES];
124
- LBRNFatalDirectoryPreparation directoryPreparation = ^BOOL(NSURL *preparedURL) {
125
- return LBRNPrepareProtectedDirectory(preparedURL);
126
- };
127
- _store = [[LBRNFatalRecordStore alloc]
128
- initWithDirectoryURL:directoryURL
129
- directoryPreparation:directoryPreparation];
130
92
  }
131
93
  }
132
94
  return self;
@@ -173,54 +135,6 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(secureRandomHex:(double)length)
173
135
  }
174
136
  }
175
137
 
176
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(writeFatalRecord:(NSDictionary *)record)
177
- {
178
- if (self.store == nil) {
179
- return LBRNStorageError();
180
- }
181
- @try {
182
- return [self.store writeRecord:LBRNNormalizeRecord(record)];
183
- } @catch (__unused NSException *exception) {
184
- return LBRNStorageError();
185
- }
186
- }
187
-
188
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(readFatalRecord)
189
- {
190
- if (self.store == nil) {
191
- return LBRNStorageError();
192
- }
193
- @try {
194
- return [self.store readRecord];
195
- } @catch (__unused NSException *exception) {
196
- return LBRNStorageError();
197
- }
198
- }
199
-
200
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(acknowledgeFatalRecord:(NSString *)recordId)
201
- {
202
- if (self.store == nil || ![recordId isKindOfClass:[NSString class]]) {
203
- return LBRNStorageError();
204
- }
205
- @try {
206
- return [self.store acknowledgeRecordId:recordId];
207
- } @catch (__unused NSException *exception) {
208
- return LBRNStorageError();
209
- }
210
- }
211
-
212
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(discardFatalRecord)
213
- {
214
- if (self.store == nil) {
215
- return LBRNStorageError();
216
- }
217
- @try {
218
- return [self.store discardRecord];
219
- } @catch (__unused NSException *exception) {
220
- return LBRNStorageError();
221
- }
222
- }
223
-
224
138
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(loadEventRecords:(NSString *)queueKey)
225
139
  {
226
140
  LBRNEventRecordStore *eventStore = [self eventStoreForQueueKey:queueKey];
@@ -300,6 +214,21 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(closeEventStore:(NSString *)queueKey)
300
214
  }
301
215
  }
302
216
 
217
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(installAndroidDiagnostics:(NSDictionary *)configuration)
218
+ {
219
+ return @{ @"status" : @"error", @"code" : @"unsupported_platform" };
220
+ }
221
+
222
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(androidDiagnosticsStatus)
223
+ {
224
+ return @{ @"status" : @"not_installed", @"pending" : @0 };
225
+ }
226
+
227
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(uninstallAndroidDiagnostics)
228
+ {
229
+ return @{ @"status" : @"not_installed", @"pending" : @0 };
230
+ }
231
+
303
232
  #ifdef RCT_NEW_ARCH_ENABLED
304
233
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
305
234
  (const facebook::react::ObjCTurboModule::InitParams &)params
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@logbrew/react-native",
3
- "version": "0.1.23",
4
- "description": "React Native offline delivery, Apple native diagnostics, screen, error, trace, action, and network timeline helpers for LogBrew.",
3
+ "version": "0.1.24",
4
+ "description": "React Native offline delivery, native diagnostics, screen, error, trace, action, and network timeline helpers for LogBrew.",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -126,6 +126,17 @@
126
126
  },
127
127
  "default": "./apple-native-diagnostics.js"
128
128
  },
129
+ "./android-native-diagnostics": {
130
+ "react-native": {
131
+ "types": "./android-native-diagnostics.d.ts",
132
+ "default": "./android-native-diagnostics.js"
133
+ },
134
+ "import": {
135
+ "types": "./android-native-diagnostics.d.ts",
136
+ "default": "./android-native-diagnostics.js"
137
+ },
138
+ "default": "./android-native-diagnostics.js"
139
+ },
129
140
  "./expo": {
130
141
  "import": {
131
142
  "types": "./expo.d.ts",
@@ -185,16 +196,17 @@
185
196
  "metro.d.cts",
186
197
  "apple-native-diagnostics.js",
187
198
  "apple-native-diagnostics.d.ts",
199
+ "android-native-diagnostics.js",
200
+ "android-native-diagnostics.d.ts",
188
201
  "expo.cjs",
189
202
  "expo.js",
190
203
  "expo.d.ts",
191
204
  "LogBrewReactNative.podspec",
192
205
  "android/build.gradle",
206
+ "android/CMakeLists.txt",
193
207
  "android/src/main",
194
208
  "android/src/oldarch",
195
209
  "android/src/newarch",
196
- "ios/LBRNFatalRecordStore.h",
197
- "ios/LBRNFatalRecordStore.m",
198
210
  "ios/LBRNFatalStoreModule.h",
199
211
  "ios/LBRNFatalStoreModule.mm",
200
212
  "ios/LBRNPrivateStorage.h",
@@ -251,6 +263,6 @@
251
263
  }
252
264
  },
253
265
  "scripts": {
254
- "test": "node scripts/sync-apple-native-sources.mjs --check && node --check index.js && node --check index.cjs && node --check index.native.js && node --check apple-native-diagnostics.js && node --check expo.js && node --check expo.cjs && node --check apollo.js && node --check apollo.cjs && node --check instrumentation.js && node --check instrumentation.cjs && node --check lifecycle.js && node --check lifecycle.cjs && node --check global-errors.js && node --check global-errors.native.js && node --check global-errors.cjs && node --check promise-rejections.cjs && node --check fatal-replay.cjs && node --check metadata.js && node --check metadata.cjs && node --check native-bridge.js && node --check native-bridge.cjs && node --check resource-fetch.js && node --check resource-fetch.cjs && node --check release-artifacts.js && node --check release-artifacts.cjs && node --check metro.js && node --check metro.cjs && node --check examples/index.mjs && node --check examples/apollo-link-spans.mjs && node --check examples/instrumentation-kit.mjs && node --check examples/lifecycle-spans.mjs && node --check examples/native-bridge-scope.mjs && node --check examples/navigation-resource-spans.mjs && node --check examples/readme-example.mjs && node --check examples/real-user-smoke.mjs && node --check examples/resource-fetch-spans.mjs && node --check examples/trace-correlation.mjs && node --test"
266
+ "test": "node scripts/sync-apple-native-sources.mjs --check && node --check index.js && node --check index.cjs && node --check index.native.js && node --check apple-native-diagnostics.js && node --check android-native-diagnostics.js && node --check expo.js && node --check expo.cjs && node --check apollo.js && node --check apollo.cjs && node --check instrumentation.js && node --check instrumentation.cjs && node --check lifecycle.js && node --check lifecycle.cjs && node --check global-errors.js && node --check global-errors.native.js && node --check global-errors.cjs && node --check promise-rejections.cjs && node --check fatal-replay.cjs && node --check metadata.js && node --check metadata.cjs && node --check native-bridge.js && node --check native-bridge.cjs && node --check resource-fetch.js && node --check resource-fetch.cjs && node --check release-artifacts.js && node --check release-artifacts.cjs && node --check metro.js && node --check metro.cjs && node --check examples/index.mjs && node --check examples/apollo-link-spans.mjs && node --check examples/instrumentation-kit.mjs && node --check examples/lifecycle-spans.mjs && node --check examples/native-bridge-scope.mjs && node --check examples/navigation-resource-spans.mjs && node --check examples/readme-example.mjs && node --check examples/real-user-smoke.mjs && node --check examples/resource-fetch-spans.mjs && node --check examples/trace-correlation.mjs && node --test"
255
267
  }
256
268
  }
@@ -29,10 +29,10 @@ export function resolveReactNativePersistentEventStore({
29
29
  "eventStore and persistentQueue are mutually exclusive"
30
30
  );
31
31
  }
32
- return { eventStore, abort() {}, release() {} };
32
+ return { eventStore, durable: false, abort() {}, release() {} };
33
33
  }
34
34
  if (persistentQueue === "disabled") {
35
- return { eventStore: undefined, abort() {}, release() {} };
35
+ return { eventStore: undefined, durable: false, abort() {}, release() {} };
36
36
  }
37
37
 
38
38
  const nativeStore = defaultNativeStore();
@@ -43,7 +43,7 @@ export function resolveReactNativePersistentEventStore({
43
43
  "React Native persistent queue requires the linked LogBrew native module"
44
44
  );
45
45
  }
46
- return { eventStore: undefined, abort() {}, release() {} };
46
+ return { eventStore: undefined, durable: false, abort() {}, release() {} };
47
47
  }
48
48
  validateNativeQueueLimits({ maxQueueBytes, maxQueueSize });
49
49
  if (ACTIVE_QUEUE_KEYS.has(authKey)) {
@@ -63,6 +63,7 @@ export function resolveReactNativePersistentEventStore({
63
63
  };
64
64
  const nativeEventStore = createNativeEventStore(nativeStore, authKey, release);
65
65
  return {
66
+ durable: true,
66
67
  eventStore: nativeEventStore,
67
68
  abort() {
68
69
  try {
@@ -3,10 +3,6 @@ import { TurboModuleRegistry } from "react-native";
3
3
 
4
4
  export interface Spec extends TurboModule {
5
5
  secureRandomHex(length: number): string;
6
- writeFatalRecord(record: CodegenTypes.UnsafeObject): CodegenTypes.UnsafeObject;
7
- readFatalRecord(): CodegenTypes.UnsafeObject;
8
- acknowledgeFatalRecord(recordId: string): CodegenTypes.UnsafeObject;
9
- discardFatalRecord(): CodegenTypes.UnsafeObject;
10
6
  loadEventRecords(queueKey: string): CodegenTypes.UnsafeObject;
11
7
  appendEventRecord(
12
8
  queueKey: string,
@@ -16,6 +12,11 @@ export interface Spec extends TurboModule {
16
12
  acknowledgeEventRecords(queueKey: string, count: number): CodegenTypes.UnsafeObject;
17
13
  purgeEventRecords(queueKey: string): CodegenTypes.UnsafeObject;
18
14
  closeEventStore(queueKey: string): CodegenTypes.UnsafeObject;
15
+ installAndroidDiagnostics(
16
+ configuration: CodegenTypes.UnsafeObject
17
+ ): CodegenTypes.UnsafeObject;
18
+ androidDiagnosticsStatus(): CodegenTypes.UnsafeObject;
19
+ uninstallAndroidDiagnostics(): CodegenTypes.UnsafeObject;
19
20
  }
20
21
 
21
22
  export default TurboModuleRegistry.getEnforcing<Spec>("LogBrewFatalStore");