@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/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