@logbrew/react-native 0.1.9 → 0.1.11
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 +111 -2
- package/android/src/main/java/co/logbrew/reactnative/EventRecordStore.java +611 -0
- package/android/src/main/java/co/logbrew/reactnative/FatalStoreModuleImpl.java +129 -0
- package/android/src/newarch/java/co/logbrew/reactnative/FatalStoreModule.java +26 -0
- package/android/src/oldarch/java/co/logbrew/reactnative/FatalStoreModule.java +26 -0
- package/global-errors.cjs +4 -2
- package/global-errors.d.cts +63 -0
- package/global-errors.d.ts +63 -0
- package/global-errors.js +2 -1
- package/global-errors.native.js +63 -2
- package/index.cjs +2 -0
- package/index.d.cts +3 -0
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/index.native.d.ts +47 -2
- package/index.native.js +70 -2
- package/ios/LBRNEventRecordStore.h +29 -0
- package/ios/LBRNEventRecordStore.m +746 -0
- package/ios/LBRNFatalStoreModule.mm +159 -14
- package/ios/LBRNPrivateStorage.h +7 -0
- package/ios/LBRNPrivateStorage.m +38 -0
- package/package.json +7 -2
- package/persistent-delivery.native.js +282 -0
- package/promise-rejections.cjs +128 -4
- package/src/NativeLogBrewFatalStore.ts +9 -0
package/index.native.js
CHANGED
|
@@ -6,15 +6,67 @@ import {
|
|
|
6
6
|
captureReactNativeNetwork,
|
|
7
7
|
captureScreenView,
|
|
8
8
|
createAppStateListener,
|
|
9
|
-
createLogBrewReactNativeClient,
|
|
9
|
+
createLogBrewReactNativeClient as createPlatformNeutralClient,
|
|
10
10
|
getReactNativeContext
|
|
11
11
|
} from "./index.js";
|
|
12
|
+
import baseDefault from "./index.js";
|
|
13
|
+
import {
|
|
14
|
+
purgeReactNativePersistentQueue,
|
|
15
|
+
resolveReactNativePersistentEventStore
|
|
16
|
+
} from "./persistent-delivery.native.js";
|
|
12
17
|
export {
|
|
13
|
-
installLogBrewReactNativeGlobalErrorHandler
|
|
18
|
+
installLogBrewReactNativeGlobalErrorHandler,
|
|
19
|
+
installLogBrewReactNativePromiseRejectionTracker
|
|
14
20
|
} from "./global-errors.native.js";
|
|
15
21
|
|
|
16
22
|
export * from "./index.js";
|
|
17
23
|
|
|
24
|
+
export function createLogBrewReactNativeClient(config = {}) {
|
|
25
|
+
const input = config !== null && typeof config === "object" ? config : {};
|
|
26
|
+
const {
|
|
27
|
+
apiKey,
|
|
28
|
+
clientKey,
|
|
29
|
+
eventStore,
|
|
30
|
+
maxQueueBytes,
|
|
31
|
+
maxQueueSize,
|
|
32
|
+
persistentQueue = "auto",
|
|
33
|
+
...forwarded
|
|
34
|
+
} = input;
|
|
35
|
+
const hasExplicitPersistentQueue = Object.prototype.hasOwnProperty.call(
|
|
36
|
+
input,
|
|
37
|
+
"persistentQueue"
|
|
38
|
+
) && input.persistentQueue !== undefined;
|
|
39
|
+
const authKey = clientKey ?? apiKey;
|
|
40
|
+
if (typeof authKey !== "string" || authKey.trim() === "") {
|
|
41
|
+
return createPlatformNeutralClient(input);
|
|
42
|
+
}
|
|
43
|
+
const resolved = resolveReactNativePersistentEventStore({
|
|
44
|
+
authKey,
|
|
45
|
+
eventStore,
|
|
46
|
+
maxQueueBytes,
|
|
47
|
+
maxQueueSize,
|
|
48
|
+
persistentQueue,
|
|
49
|
+
hasExplicitPersistentQueue
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
return createPlatformNeutralClient({
|
|
53
|
+
...forwarded,
|
|
54
|
+
apiKey,
|
|
55
|
+
clientKey,
|
|
56
|
+
eventStore: resolved.eventStore,
|
|
57
|
+
maxQueueBytes,
|
|
58
|
+
maxQueueSize
|
|
59
|
+
});
|
|
60
|
+
} catch (error) {
|
|
61
|
+
resolved.abort();
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function purgeLogBrewReactNativePersistentQueue(config = {}) {
|
|
67
|
+
purgeReactNativePersistentQueue(config);
|
|
68
|
+
}
|
|
69
|
+
|
|
18
70
|
export function createDefaultLogBrewReactNativeClient(config = {}) {
|
|
19
71
|
return createLogBrewReactNativeClient(config);
|
|
20
72
|
}
|
|
@@ -69,3 +121,19 @@ export function createDefaultAppStateListener(client, options = {}) {
|
|
|
69
121
|
...options
|
|
70
122
|
});
|
|
71
123
|
}
|
|
124
|
+
|
|
125
|
+
const defaultExport = {
|
|
126
|
+
...baseDefault,
|
|
127
|
+
captureDefaultAppStateChange,
|
|
128
|
+
captureDefaultReactNativeAction,
|
|
129
|
+
captureDefaultReactNativeError,
|
|
130
|
+
captureDefaultReactNativeNetwork,
|
|
131
|
+
captureDefaultScreenView,
|
|
132
|
+
createDefaultAppStateListener,
|
|
133
|
+
createDefaultLogBrewReactNativeClient,
|
|
134
|
+
createLogBrewReactNativeClient,
|
|
135
|
+
getDefaultReactNativeContext,
|
|
136
|
+
purgeLogBrewReactNativePersistentQueue
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default defaultExport;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
+
|
|
5
|
+
FOUNDATION_EXPORT NSString *const LBRNEventRecordPrefix;
|
|
6
|
+
FOUNDATION_EXPORT NSString *const LBRNEventRecordSuffix;
|
|
7
|
+
FOUNDATION_EXPORT NSString *const LBRNEventMarkerPrefix;
|
|
8
|
+
FOUNDATION_EXPORT NSString *const LBRNEventMarkerSuffix;
|
|
9
|
+
|
|
10
|
+
typedef BOOL (^LBRNEventDirectoryPreparation)(NSURL *directoryURL);
|
|
11
|
+
|
|
12
|
+
@interface LBRNEventRecordStore : NSObject
|
|
13
|
+
|
|
14
|
+
- (instancetype)initWithDirectoryURL:(NSURL *)directoryURL;
|
|
15
|
+
- (instancetype)initWithDirectoryURL:(NSURL *)directoryURL
|
|
16
|
+
directoryPreparation:(LBRNEventDirectoryPreparation)directoryPreparation
|
|
17
|
+
NS_DESIGNATED_INITIALIZER;
|
|
18
|
+
- (instancetype)init NS_UNAVAILABLE;
|
|
19
|
+
|
|
20
|
+
- (NSDictionary *)loadRecords;
|
|
21
|
+
- (NSDictionary *)appendSerializedEvent:(NSString *)serializedEvent
|
|
22
|
+
eventBytes:(NSNumber *)eventBytes;
|
|
23
|
+
- (NSDictionary *)acknowledgeRecordCount:(NSNumber *)count;
|
|
24
|
+
- (NSDictionary *)purgeRecords;
|
|
25
|
+
- (NSDictionary *)closeStore;
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
NS_ASSUME_NONNULL_END
|