@logbrew/react-native 0.1.39 → 0.1.41

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 (99) hide show
  1. package/README.md +3 -3
  2. package/android-native-diagnostics.d.ts +15 -5
  3. package/android-native-diagnostics.js +170 -94
  4. package/apollo.cjs +435 -226
  5. package/apollo.d.cts +2 -70
  6. package/apollo.d.ts +24 -12
  7. package/apollo.js +438 -221
  8. package/apple-native-diagnostics-config.js +176 -0
  9. package/apple-native-diagnostics-context.js +232 -0
  10. package/apple-native-diagnostics-module.js +229 -0
  11. package/apple-native-diagnostics.d.ts +42 -11
  12. package/apple-native-diagnostics.js +60 -389
  13. package/expo.cjs +29 -16
  14. package/expo.d.ts +10 -9
  15. package/expo.js +4 -3
  16. package/fatal-admission.cjs +113 -0
  17. package/fatal-record.cjs +317 -0
  18. package/fatal-replay.cjs +297 -508
  19. package/global-errors-capture.cjs +369 -0
  20. package/global-errors-event.cjs +174 -0
  21. package/global-errors-support.cjs +128 -0
  22. package/global-errors.cjs +75 -351
  23. package/global-errors.d.cts +29 -278
  24. package/global-errors.d.ts +57 -27
  25. package/global-errors.js +7 -2
  26. package/global-errors.native.js +83 -48
  27. package/index-breadcrumbs.cjs +139 -0
  28. package/index-errors.cjs +167 -0
  29. package/index-events.cjs +365 -0
  30. package/index-navigation.cjs +327 -0
  31. package/index-random.cjs +120 -0
  32. package/index-react.cjs +189 -0
  33. package/index-spans.cjs +190 -0
  34. package/index-trace-fetch.cjs +322 -0
  35. package/index-trace.cjs +335 -0
  36. package/index-transport.cjs +201 -0
  37. package/index-values.cjs +232 -0
  38. package/index.cjs +97 -1245
  39. package/index.d.cts +2 -505
  40. package/index.d.ts +130 -469
  41. package/index.native.d.ts +146 -22
  42. package/index.native.js +184 -159
  43. package/instrumentation-fetch.cjs +113 -0
  44. package/instrumentation-install.cjs +241 -0
  45. package/instrumentation-runtime.cjs +65 -0
  46. package/instrumentation-teardown.cjs +93 -0
  47. package/instrumentation-values.cjs +282 -0
  48. package/instrumentation-xhr-request.cjs +298 -0
  49. package/instrumentation-xhr.cjs +233 -0
  50. package/instrumentation.cjs +110 -599
  51. package/instrumentation.d.cts +2 -84
  52. package/instrumentation.d.ts +22 -8
  53. package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +1 -1
  54. package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryLifecycle.swift +1 -1
  55. package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +1 -1
  56. package/lifecycle.cjs +181 -78
  57. package/lifecycle.d.cts +1 -50
  58. package/lifecycle.d.ts +17 -6
  59. package/metadata.cjs +279 -114
  60. package/metro-debug-id.cjs +296 -0
  61. package/metro-serializer.cjs +219 -0
  62. package/metro.cjs +153 -297
  63. package/metro.d.cts +2 -57
  64. package/metro.d.ts +27 -13
  65. package/metro.js +2 -3
  66. package/native-bridge-async.cjs +165 -0
  67. package/native-bridge-scope.cjs +148 -0
  68. package/native-bridge.cjs +83 -186
  69. package/native-bridge.d.cts +2 -94
  70. package/native-bridge.d.ts +28 -15
  71. package/native-client-bindings.js +230 -0
  72. package/native-diagnostics-values.js +120 -0
  73. package/native-module-lookup.js +31 -0
  74. package/native-null.js +3 -0
  75. package/null-value.cjs +4 -0
  76. package/package.json +43 -1
  77. package/persistent-delivery-store.js +247 -0
  78. package/persistent-delivery.native.js +183 -261
  79. package/promise-rejection-handlers.cjs +368 -0
  80. package/promise-rejections.cjs +169 -361
  81. package/react-native.config.js +3 -1
  82. package/release-artifacts-files.cjs +94 -0
  83. package/release-artifacts-options.cjs +182 -0
  84. package/release-artifacts.cjs +278 -207
  85. package/release-artifacts.d.cts +2 -55
  86. package/release-artifacts.d.ts +18 -7
  87. package/release-artifacts.js +2 -4
  88. package/resource-fetch-graphql.cjs +265 -0
  89. package/resource-fetch-size.cjs +156 -0
  90. package/resource-fetch.cjs +227 -428
  91. package/resource-fetch.d.cts +1 -60
  92. package/resource-fetch.d.ts +17 -6
  93. package/scripts/sync-apple-native-sources.mjs +101 -53
  94. package/types/capture.d.ts +95 -0
  95. package/types/config.d.ts +85 -0
  96. package/types/defaults.d.ts +55 -0
  97. package/types/events.d.ts +203 -0
  98. package/types/provider.d.ts +81 -0
  99. package/types/trace.d.ts +104 -0
@@ -0,0 +1,203 @@
1
+ import type { ActionAttributes, IssueAttributes, Metadata, SpanAttributes } from "@logbrew/sdk";
2
+ import type { ReactNativeAppStateLike, ReactNativePlatformLike } from "./config.js";
3
+ import type { ReactNativeTraceInput } from "./trace.js";
4
+
5
+ type ReactNavigationRouteLike = {
6
+ key?: string | number | null;
7
+ name?: string | null;
8
+ path?: string | null;
9
+ };
10
+
11
+ type ReactNavigationContainerLike = {
12
+ current?: ReactNavigationContainerLike | null;
13
+ addListener(
14
+ eventName: string,
15
+ listener: (event?: unknown) => void
16
+ ): { remove(): void } | (() => void) | void;
17
+ getCurrentRoute(): ReactNavigationRouteLike | undefined | null;
18
+ };
19
+
20
+ type ReactNativeContextOptions = {
21
+ platform?: ReactNativePlatformLike;
22
+ appState?: ReactNativeAppStateLike;
23
+ metadata?: Metadata;
24
+ trace?: ReactNativeTraceInput;
25
+ };
26
+
27
+ type CaptureScreenViewOptions = ReactNativeContextOptions & {
28
+ id?: string;
29
+ timestamp?: string;
30
+ status?: ActionAttributes["status"];
31
+ };
32
+
33
+ type CaptureAppStateChangeOptions = ReactNativeContextOptions & {
34
+ id?: string;
35
+ timestamp?: string;
36
+ };
37
+
38
+ type CreateAppStateListenerOptions = CaptureAppStateChangeOptions & {
39
+ /** Flush the configured client transport when AppState becomes inactive or background. */
40
+ flushOnBackground?: boolean;
41
+ /** Observe a background flush failure without throwing from the AppState callback. */
42
+ onFlushError?: (error: unknown) => void;
43
+ };
44
+
45
+ type ReactNativeActionEvent = {
46
+ id: string;
47
+ timestamp: string;
48
+ attributes: ActionAttributes;
49
+ };
50
+
51
+ type ReactNativeActionInput = ReactNativeContextOptions & {
52
+ id?: string;
53
+ idFactory?: (context: ReactNativeActionIdFactoryContext) => string;
54
+ name?: string;
55
+ now?: () => string;
56
+ screen?: string;
57
+ sessionId?: string;
58
+ status?: ActionAttributes["status"];
59
+ timestamp?: string;
60
+ traceId?: string;
61
+ };
62
+
63
+ type ReactNativeActionIdFactoryContext = {
64
+ name?: string;
65
+ screen?: string;
66
+ };
67
+
68
+ type ReactNativeNetworkInput = ReactNativeContextOptions & {
69
+ durationMs?: number;
70
+ id?: string;
71
+ idFactory?: (context: ReactNativeNetworkIdFactoryContext) => string;
72
+ method?: string;
73
+ name?: string;
74
+ now?: () => string;
75
+ routeTemplate?: string;
76
+ screen?: string;
77
+ sessionId?: string;
78
+ status?: ActionAttributes["status"];
79
+ statusCode?: number;
80
+ timestamp?: string;
81
+ traceId?: string;
82
+ };
83
+
84
+ type ReactNativeNetworkIdFactoryContext = {
85
+ method?: string;
86
+ routeTemplate?: string;
87
+ screen?: string;
88
+ };
89
+
90
+ type ReactNativeSpanEvent = {
91
+ id: string;
92
+ timestamp: string;
93
+ attributes: SpanAttributes;
94
+ };
95
+
96
+ type ReactNativeNavigationSpanInput = ReactNativeContextOptions & {
97
+ actionType?: string;
98
+ durationMs?: number;
99
+ id?: string;
100
+ idFactory?: (context: ReactNativeNavigationSpanIdFactoryContext) => string;
101
+ includeRouteKey?: boolean;
102
+ name?: string;
103
+ now?: () => string;
104
+ previousRouteKey?: string | number | null;
105
+ previousRouteName?: string;
106
+ routeKey?: string | number | null;
107
+ routeName?: string;
108
+ routePath?: string;
109
+ screen?: string;
110
+ status?: SpanAttributes["status"];
111
+ timestamp?: string;
112
+ };
113
+
114
+ type ReactNativeNavigationSpanIdFactoryContext = {
115
+ routeName?: string;
116
+ routePath?: string;
117
+ screen?: string;
118
+ };
119
+
120
+ type ReactNativeResourceSpanInput = ReactNativeContextOptions & {
121
+ durationMs?: number;
122
+ id?: string;
123
+ idFactory?: (context: ReactNativeResourceSpanIdFactoryContext) => string;
124
+ kind?: string;
125
+ method?: string;
126
+ name?: string;
127
+ now?: () => string;
128
+ responseSizeBytes?: number;
129
+ routeTemplate?: string;
130
+ screen?: string;
131
+ sessionId?: string;
132
+ status?: SpanAttributes["status"];
133
+ statusCode?: number;
134
+ timestamp?: string;
135
+ };
136
+
137
+ type ReactNativeResourceSpanIdFactoryContext = {
138
+ method?: string;
139
+ routeTemplate?: string;
140
+ screen?: string;
141
+ };
142
+
143
+ type ReactNavigationSpanListenerOptions = ReactNativeContextOptions & {
144
+ captureInitialRoute?: boolean;
145
+ includeRouteKey?: boolean;
146
+ now?: () => string;
147
+ nowMs?: () => number;
148
+ onError?: (error: unknown) => void;
149
+ };
150
+
151
+ type ReactNativeErrorEvent = {
152
+ id: string;
153
+ timestamp: string;
154
+ attributes: IssueAttributes;
155
+ };
156
+
157
+ type ReactNativeErrorIdFactoryContext = {
158
+ error: unknown;
159
+ message: string;
160
+ screen?: string;
161
+ };
162
+
163
+ type CaptureReactNativeErrorOptions = ReactNativeContextOptions & {
164
+ debugIdMap?: Record<string, string>;
165
+ evidence?: IssueAttributes["evidence"];
166
+ environment?: string;
167
+ fingerprint?: string;
168
+ handled?: boolean;
169
+ id?: string;
170
+ idFactory?: (context: ReactNativeErrorIdFactoryContext) => string;
171
+ includeStack?: boolean;
172
+ level?: IssueAttributes["level"];
173
+ mechanism?: string;
174
+ now?: () => string;
175
+ release?: string;
176
+ runtime?: string;
177
+ screen?: string;
178
+ service?: string;
179
+ timestamp?: string;
180
+ };
181
+
182
+ export type {
183
+ CaptureAppStateChangeOptions,
184
+ CaptureReactNativeErrorOptions,
185
+ CaptureScreenViewOptions,
186
+ CreateAppStateListenerOptions,
187
+ ReactNativeActionEvent,
188
+ ReactNativeActionIdFactoryContext,
189
+ ReactNativeActionInput,
190
+ ReactNativeContextOptions,
191
+ ReactNativeErrorEvent,
192
+ ReactNativeErrorIdFactoryContext,
193
+ ReactNativeNavigationSpanIdFactoryContext,
194
+ ReactNativeNavigationSpanInput,
195
+ ReactNativeNetworkIdFactoryContext,
196
+ ReactNativeNetworkInput,
197
+ ReactNativeResourceSpanIdFactoryContext,
198
+ ReactNativeResourceSpanInput,
199
+ ReactNativeSpanEvent,
200
+ ReactNavigationContainerLike,
201
+ ReactNavigationRouteLike,
202
+ ReactNavigationSpanListenerOptions
203
+ };
@@ -0,0 +1,81 @@
1
+ import type {
2
+ ActionAttributes,
3
+ DeliveryHealthSnapshot,
4
+ EnvironmentAttributes,
5
+ IssueAttributes,
6
+ LogAttributes,
7
+ LogBrewClient,
8
+ ReleaseAttributes,
9
+ SpanAttributes,
10
+ Transport,
11
+ TransportResponse
12
+ } from "@logbrew/sdk";
13
+ import type {
14
+ CaptureAppStateChangeOptions,
15
+ CaptureReactNativeErrorOptions,
16
+ CaptureScreenViewOptions,
17
+ ReactNativeActionEvent,
18
+ ReactNativeActionInput,
19
+ ReactNativeErrorEvent,
20
+ ReactNativeNavigationSpanInput,
21
+ ReactNativeNetworkInput,
22
+ ReactNativeResourceSpanInput,
23
+ ReactNativeSpanEvent
24
+ } from "./events.js";
25
+ import type { ReactElement, ReactNode } from "react";
26
+ import type { ReactNativeAppStateLike, ReactNativePlatformLike } from "./config.js";
27
+ import type { ReactNativeTraceContext, ReactNativeTraceInput } from "./trace.js";
28
+
29
+ type LogBrewNativeProviderProps = {
30
+ client: LogBrewClient;
31
+ platform?: ReactNativePlatformLike;
32
+ appState?: ReactNativeAppStateLike;
33
+ trace?: ReactNativeTraceInput;
34
+ children?: ReactNode;
35
+ };
36
+
37
+ type LogBrewNativeContextValue = {
38
+ client: LogBrewClient;
39
+ platform?: ReactNativePlatformLike;
40
+ appState?: ReactNativeAppStateLike;
41
+ trace?: ReactNativeTraceContext;
42
+ };
43
+
44
+ type LogBrewNativeActions = {
45
+ release(id: string, timestamp: string, attributes: ReleaseAttributes): void;
46
+ environment(id: string, timestamp: string, attributes: EnvironmentAttributes): void;
47
+ issue(id: string, timestamp: string, attributes: IssueAttributes): void;
48
+ log(id: string, timestamp: string, attributes: LogAttributes): void;
49
+ span(id: string, timestamp: string, attributes: SpanAttributes): void;
50
+ action(id: string, timestamp: string, attributes: ActionAttributes): void;
51
+ flush(transport?: Transport): Promise<TransportResponse>;
52
+ shutdown(transport?: Transport): Promise<TransportResponse>;
53
+ deliveryHealth(): DeliveryHealthSnapshot;
54
+ droppedEvents(): number;
55
+ pendingBytes(): number;
56
+ previewJson(): string;
57
+ pendingEvents(): number;
58
+ trace?: ReactNativeTraceContext;
59
+ captureScreenView(screenName: string, options?: CaptureScreenViewOptions): void;
60
+ captureAppStateChange(state: string, options?: CaptureAppStateChangeOptions): void;
61
+ captureReactNativeAction(input?: ReactNativeActionInput): ReactNativeActionEvent;
62
+ captureReactNativeNetwork(input?: ReactNativeNetworkInput): ReactNativeActionEvent;
63
+ captureReactNativeNavigationSpan(input?: ReactNativeNavigationSpanInput): ReactNativeSpanEvent;
64
+ captureReactNativeResourceSpan(input?: ReactNativeResourceSpanInput): ReactNativeSpanEvent;
65
+ captureReactNativeError(error: unknown, options?: CaptureReactNativeErrorOptions): ReactNativeErrorEvent;
66
+ };
67
+
68
+ declare function LogBrewNativeProvider(props: LogBrewNativeProviderProps): ReactElement;
69
+ declare function useLogBrewNative(): LogBrewNativeContextValue;
70
+ declare function useLogBrewNativeActions(): LogBrewNativeActions;
71
+
72
+ export type {
73
+ LogBrewNativeActions,
74
+ LogBrewNativeContextValue,
75
+ LogBrewNativeProviderProps
76
+ };
77
+ export {
78
+ LogBrewNativeProvider,
79
+ useLogBrewNative,
80
+ useLogBrewNativeActions
81
+ };
@@ -0,0 +1,104 @@
1
+ import type { Metadata, SpanAttributes } from "@logbrew/sdk";
2
+
3
+ type TracePropagationTarget = string | RegExp | ((url: string) => boolean);
4
+
5
+ type ReactNativeTraceparentConfig = {
6
+ traceId?: string;
7
+ spanId?: string;
8
+ traceFlags?: string;
9
+ randomValues?: (length: number) => ArrayLike<number>;
10
+ };
11
+
12
+ type ReactNativeTraceContext = {
13
+ traceId: string;
14
+ spanId: string;
15
+ parentSpanId?: string;
16
+ traceFlags: string;
17
+ sampled: boolean;
18
+ };
19
+
20
+ type ReactNativeTraceInput = ReactNativeTraceContext | string;
21
+
22
+ type ReactNativeTraceContextConfig = ReactNativeTraceparentConfig & {
23
+ parentSpanId?: string;
24
+ traceparent?: string;
25
+ };
26
+
27
+ type ReactNativeSpanAttributesInput = {
28
+ durationMs?: number;
29
+ metadata?: Metadata;
30
+ name?: string;
31
+ spanId?: string;
32
+ status?: SpanAttributes["status"];
33
+ trace?: ReactNativeTraceInput;
34
+ };
35
+
36
+ type TraceparentFetchLike<TResponse = unknown> = (
37
+ input: any,
38
+ init?: any
39
+ ) => Promise<TResponse> | TResponse;
40
+
41
+ type TraceparentFetchConfig<TResponse = unknown> = {
42
+ fetchImpl?: TraceparentFetchLike<TResponse>;
43
+ randomValues?: (length: number) => ArrayLike<number>;
44
+ trace?: ReactNativeTraceInput;
45
+ traceFlags?: string;
46
+ traceparent?: string;
47
+ traceparentFactory?: (context: {
48
+ input: any;
49
+ init?: any;
50
+ url: string;
51
+ }) => string | undefined;
52
+ tracePropagationTargets?: TracePropagationTarget[];
53
+ };
54
+
55
+ declare function createReactNativeTraceparent(config?: ReactNativeTraceparentConfig): string;
56
+ declare function createReactNativeTraceContext(
57
+ config?: ReactNativeTraceContextConfig
58
+ ): ReactNativeTraceContext;
59
+ declare function getActiveLogBrewTrace(): ReactNativeTraceContext | undefined;
60
+ declare function withLogBrewTrace<TResult>(
61
+ trace: ReactNativeTraceInput | undefined,
62
+ operation: (trace: ReactNativeTraceContext) => TResult
63
+ ): TResult;
64
+ declare function bindLogBrewTrace<TArgs extends unknown[], TResult>(
65
+ trace: ReactNativeTraceInput | undefined,
66
+ operation: (...args: TArgs) => TResult
67
+ ): (...args: TArgs) => TResult;
68
+ declare function getReactNativeTraceMetadata(trace?: ReactNativeTraceInput): Metadata;
69
+ declare function createReactNativeSpanAttributes(
70
+ input?: ReactNativeSpanAttributesInput
71
+ ): SpanAttributes;
72
+ declare function createReactNativeTraceHeaders(
73
+ trace?: ReactNativeTraceInput
74
+ ): { traceparent: string };
75
+ declare function createTraceparentFetch<TResponse = unknown>(
76
+ config?: TraceparentFetchConfig<TResponse>
77
+ ): TraceparentFetchLike<TResponse>;
78
+ declare function shouldPropagateTraceparent(
79
+ url: string,
80
+ tracePropagationTargets?: TracePropagationTarget[]
81
+ ): boolean;
82
+
83
+ export type {
84
+ ReactNativeSpanAttributesInput,
85
+ ReactNativeTraceContext,
86
+ ReactNativeTraceContextConfig,
87
+ ReactNativeTraceInput,
88
+ ReactNativeTraceparentConfig,
89
+ TracePropagationTarget,
90
+ TraceparentFetchConfig,
91
+ TraceparentFetchLike
92
+ };
93
+ export {
94
+ bindLogBrewTrace,
95
+ createReactNativeSpanAttributes,
96
+ createReactNativeTraceContext,
97
+ createReactNativeTraceHeaders,
98
+ createReactNativeTraceparent,
99
+ createTraceparentFetch,
100
+ getActiveLogBrewTrace,
101
+ getReactNativeTraceMetadata,
102
+ shouldPropagateTraceparent,
103
+ withLogBrewTrace
104
+ };