@logbrew/react-native 0.1.22 → 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.
- package/LogBrewReactNative.podspec +1 -0
- package/README.md +70 -7
- package/android/CMakeLists.txt +7 -0
- package/android/build.gradle +12 -0
- package/android/src/main/cpp/android_diagnostics.cpp +363 -0
- package/android/src/main/java/co/logbrew/reactnative/AndroidDiagnosticsRuntime.java +214 -0
- package/android/src/main/java/co/logbrew/reactnative/AndroidNativeDiagnostics.java +363 -0
- package/android/src/main/java/co/logbrew/reactnative/AndroidNativeSignalStore.java +233 -0
- package/android/src/main/java/co/logbrew/reactnative/AndroidParentDirectorySync.java +12 -12
- package/android/src/main/java/co/logbrew/reactnative/EventRecordStore.java +15 -5
- package/android/src/main/java/co/logbrew/reactnative/FatalStoreModuleImpl.java +127 -156
- package/android/src/newarch/java/co/logbrew/reactnative/FatalStoreModule.java +17 -17
- package/android/src/oldarch/java/co/logbrew/reactnative/FatalStoreModule.java +17 -17
- package/android-native-diagnostics.d.ts +29 -0
- package/android-native-diagnostics.js +176 -0
- package/fatal-replay.cjs +35 -3
- package/global-errors.d.cts +3 -3
- package/global-errors.d.ts +3 -3
- package/global-errors.native.js +1 -12
- package/index.cjs +27 -5
- package/index.native.d.ts +4 -0
- package/index.native.js +29 -4
- package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +1 -1
- package/ios/GeneratedAppleDiagnostics/LogBrew/LogBrewLogger.swift +2 -10
- package/ios/GeneratedAppleDiagnostics/LogBrew/OperationTrace.swift +56 -0
- package/ios/GeneratedAppleDiagnostics/LogBrew/URLSessionTracer.swift +48 -56
- package/ios/GeneratedAppleDiagnostics/LogBrew/Validation.swift +6 -0
- package/ios/GeneratedAppleDiagnostics/LogBrewCrash/NativeCrashCorrelation.swift +0 -1
- package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +5 -4
- package/ios/LBRNFatalStoreModule.mm +34 -86
- package/package.json +17 -5
- package/persistent-delivery.native.js +4 -3
- package/resource-fetch.js +5 -463
- package/src/NativeLogBrewFatalStore.ts +6 -4
- package/android/src/main/java/co/logbrew/reactnative/FatalRecordStore.java +0 -623
- package/ios/LBRNFatalRecordStore.h +0 -25
- package/ios/LBRNFatalRecordStore.m +0 -542
package/resource-fetch.js
CHANGED
|
@@ -1,464 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
SdkError
|
|
3
|
-
} from "@logbrew/sdk";
|
|
4
|
-
import {
|
|
5
|
-
captureReactNativeResourceSpan,
|
|
6
|
-
createReactNativeTraceContext,
|
|
7
|
-
createTraceparentFetch,
|
|
8
|
-
getActiveLogBrewTrace
|
|
9
|
-
} from "./index.js";
|
|
10
|
-
import {
|
|
11
|
-
createSafeReactNativeMetadata,
|
|
12
|
-
safeReactNativeMetadataFactoryResult
|
|
13
|
-
} from "./metadata.js";
|
|
1
|
+
import implementation from "./resource-fetch.cjs";
|
|
14
2
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export function createReactNativeResourceFetch(client, {
|
|
21
|
-
appState,
|
|
22
|
-
fetchImpl,
|
|
23
|
-
metadata = {},
|
|
24
|
-
metadataFactory,
|
|
25
|
-
measureResponseBodySize = false,
|
|
26
|
-
now = () => new Date().toISOString(),
|
|
27
|
-
nowMs = () => Date.now(),
|
|
28
|
-
platform,
|
|
29
|
-
randomValues,
|
|
30
|
-
routeTemplate,
|
|
31
|
-
routeTemplateFactory = defaultRouteTemplateFactory,
|
|
32
|
-
screen,
|
|
33
|
-
sessionId,
|
|
34
|
-
trace,
|
|
35
|
-
traceFlags = "01",
|
|
36
|
-
tracePropagationTargets = []
|
|
37
|
-
} = {}) {
|
|
38
|
-
if (routeTemplateFactory !== undefined && typeof routeTemplateFactory !== "function") {
|
|
39
|
-
throw new SdkError("configuration_error", "routeTemplateFactory must be a function");
|
|
40
|
-
}
|
|
41
|
-
if (metadataFactory !== undefined && typeof metadataFactory !== "function") {
|
|
42
|
-
throw new SdkError("configuration_error", "metadataFactory must be a function");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return async function logBrewResourceFetch(input, init) {
|
|
46
|
-
const startedAtMs = nowMs();
|
|
47
|
-
const timestamp = now();
|
|
48
|
-
const activeTrace = resourceTraceContext({ randomValues, trace, traceFlags });
|
|
49
|
-
const tracedFetch = createTraceparentFetch({
|
|
50
|
-
fetchImpl,
|
|
51
|
-
trace: activeTrace,
|
|
52
|
-
tracePropagationTargets
|
|
53
|
-
});
|
|
54
|
-
const method = requestMethod(input, init);
|
|
55
|
-
const url = requestUrl(input);
|
|
56
|
-
const safeRouteTemplate = routeTemplate ?? routeTemplateFactory({ input, init, url });
|
|
57
|
-
try {
|
|
58
|
-
const response = await tracedFetch(input, init);
|
|
59
|
-
const responseStartDurationMs = elapsedMs(startedAtMs, nowMs);
|
|
60
|
-
const statusCode = responseStatusCode(response);
|
|
61
|
-
const responseSizeBytes = await responseSizeBytesFromResponse(response, { measureResponseBodySize });
|
|
62
|
-
const durationMs = elapsedMs(startedAtMs, nowMs);
|
|
63
|
-
captureReactNativeResourceSpan(client, {
|
|
64
|
-
appState,
|
|
65
|
-
durationMs,
|
|
66
|
-
metadata: {
|
|
67
|
-
...createSafeReactNativeMetadata(metadata, metadataFactory, {
|
|
68
|
-
durationMs,
|
|
69
|
-
init,
|
|
70
|
-
input,
|
|
71
|
-
method,
|
|
72
|
-
response,
|
|
73
|
-
responseSizeBytes,
|
|
74
|
-
responseStartDurationMs,
|
|
75
|
-
routeTemplate: safeRouteTemplate,
|
|
76
|
-
statusCode,
|
|
77
|
-
url
|
|
78
|
-
}),
|
|
79
|
-
responseStartDurationMs
|
|
80
|
-
},
|
|
81
|
-
method,
|
|
82
|
-
platform,
|
|
83
|
-
routeTemplate: safeRouteTemplate,
|
|
84
|
-
screen,
|
|
85
|
-
sessionId,
|
|
86
|
-
responseSizeBytes,
|
|
87
|
-
statusCode,
|
|
88
|
-
timestamp,
|
|
89
|
-
trace: activeTrace
|
|
90
|
-
});
|
|
91
|
-
return response;
|
|
92
|
-
} catch (error) {
|
|
93
|
-
const durationMs = elapsedMs(startedAtMs, nowMs);
|
|
94
|
-
captureReactNativeResourceSpan(client, {
|
|
95
|
-
appState,
|
|
96
|
-
durationMs,
|
|
97
|
-
metadata: {
|
|
98
|
-
...createSafeReactNativeMetadata(metadata, metadataFactory, {
|
|
99
|
-
durationMs,
|
|
100
|
-
error,
|
|
101
|
-
init,
|
|
102
|
-
input,
|
|
103
|
-
method,
|
|
104
|
-
routeTemplate: safeRouteTemplate,
|
|
105
|
-
status: "error",
|
|
106
|
-
url
|
|
107
|
-
}),
|
|
108
|
-
fetchErrorName: errorName(error),
|
|
109
|
-
fetchErrorValueType: typeof error
|
|
110
|
-
},
|
|
111
|
-
method,
|
|
112
|
-
platform,
|
|
113
|
-
routeTemplate: safeRouteTemplate,
|
|
114
|
-
screen,
|
|
115
|
-
sessionId,
|
|
116
|
-
status: "error",
|
|
117
|
-
timestamp,
|
|
118
|
-
trace: activeTrace
|
|
119
|
-
});
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function createReactNativeGraphQLMetadataFactory({
|
|
126
|
-
endpoint,
|
|
127
|
-
metadataFactory
|
|
128
|
-
} = {}) {
|
|
129
|
-
const endpointMatchers = normalizeGraphQLEndpointMatchers(endpoint);
|
|
130
|
-
if (metadataFactory !== undefined && typeof metadataFactory !== "function") {
|
|
131
|
-
throw new SdkError("configuration_error", "metadataFactory must be a function");
|
|
132
|
-
}
|
|
133
|
-
return function logBrewReactNativeGraphQLMetadata(context) {
|
|
134
|
-
const safeMetadata = safeReactNativeMetadataFactoryResult(typeof metadataFactory === "function" ? metadataFactory(context) : undefined);
|
|
135
|
-
if (endpointMatchers.length > 0 && !matchesGraphQLEndpoint(context, endpointMatchers)) {
|
|
136
|
-
return safeMetadata;
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
...safeMetadata,
|
|
140
|
-
...graphqlMetadataFromContext(context)
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function normalizeGraphQLEndpointMatchers(endpoint) {
|
|
146
|
-
if (endpoint === undefined) {
|
|
147
|
-
return [];
|
|
148
|
-
}
|
|
149
|
-
const endpoints = Array.isArray(endpoint) ? endpoint : [endpoint];
|
|
150
|
-
return endpoints.map((candidate) => {
|
|
151
|
-
if (typeof candidate === "string" || candidate instanceof String) {
|
|
152
|
-
const value = normalizeEndpointString(candidate.toString());
|
|
153
|
-
if (value === "") {
|
|
154
|
-
throw new SdkError("configuration_error", "GraphQL endpoint strings must not be empty");
|
|
155
|
-
}
|
|
156
|
-
return value;
|
|
157
|
-
}
|
|
158
|
-
if (candidate instanceof RegExp || typeof candidate === "function") {
|
|
159
|
-
return candidate;
|
|
160
|
-
}
|
|
161
|
-
throw new SdkError("configuration_error", "GraphQL endpoint must be a string, RegExp, function, or array");
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function matchesGraphQLEndpoint(context, endpointMatchers) {
|
|
166
|
-
const candidates = graphqlEndpointCandidates(context);
|
|
167
|
-
return endpointMatchers.some((matcher) => {
|
|
168
|
-
if (typeof matcher === "string") {
|
|
169
|
-
return candidates.includes(matcher);
|
|
170
|
-
}
|
|
171
|
-
if (matcher instanceof RegExp) {
|
|
172
|
-
return candidates.some((candidate) => endpointRegExpMatches(matcher, candidate));
|
|
173
|
-
}
|
|
174
|
-
return matcher(context) === true;
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function endpointRegExpMatches(matcher, candidate) {
|
|
179
|
-
matcher.lastIndex = 0;
|
|
180
|
-
const matched = matcher.test(candidate);
|
|
181
|
-
matcher.lastIndex = 0;
|
|
182
|
-
return matched;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function graphqlEndpointCandidates(context) {
|
|
186
|
-
const candidates = new Set();
|
|
187
|
-
if (typeof context?.routeTemplate === "string" && context.routeTemplate.trim() !== "") {
|
|
188
|
-
candidates.add(context.routeTemplate);
|
|
189
|
-
}
|
|
190
|
-
for (const candidate of endpointCandidatesFromUrl(context?.url)) {
|
|
191
|
-
candidates.add(candidate);
|
|
192
|
-
}
|
|
193
|
-
return Array.from(candidates);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function normalizeEndpointString(endpoint) {
|
|
197
|
-
const value = endpoint.trim();
|
|
198
|
-
const candidates = endpointCandidatesFromUrl(value);
|
|
199
|
-
return candidates[candidates.length - 1] ?? value.split(/[?#]/u, 1)[0];
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function endpointCandidatesFromUrl(value) {
|
|
203
|
-
if (typeof value !== "string" || value.trim() === "") {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
const URLConstructor = globalThis.URL;
|
|
207
|
-
if (typeof URLConstructor === "function") {
|
|
208
|
-
try {
|
|
209
|
-
const parsedUrl = new URLConstructor(value, "https://logbrew.local");
|
|
210
|
-
const candidates = [parsedUrl.pathname];
|
|
211
|
-
if (/^https?:\/\//iu.test(value)) {
|
|
212
|
-
candidates.push(`${parsedUrl.origin}${parsedUrl.pathname}`);
|
|
213
|
-
}
|
|
214
|
-
return candidates;
|
|
215
|
-
} catch {
|
|
216
|
-
// Fall back to query/hash stripping below for non-standard request keys.
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return [value.split(/[?#]/u, 1)[0]];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function graphqlMetadataFromContext(context) {
|
|
223
|
-
const payload = graphqlPayloadFromBody(requestBody(context));
|
|
224
|
-
if (!payload) {
|
|
225
|
-
return {};
|
|
226
|
-
}
|
|
227
|
-
const operation = graphqlOperationDetails(payload.query);
|
|
228
|
-
const operationName = safeGraphqlOperationName(payload.operationName) ?? operation.operationName;
|
|
229
|
-
const metadata = {};
|
|
230
|
-
if (operationName) {
|
|
231
|
-
metadata.graphqlOperationName = operationName;
|
|
232
|
-
}
|
|
233
|
-
if (operation.operationType) {
|
|
234
|
-
metadata.graphqlOperationType = operation.operationType;
|
|
235
|
-
}
|
|
236
|
-
return metadata;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function requestBody(context) {
|
|
240
|
-
const body = context?.init?.body ?? context?.input?.body;
|
|
241
|
-
if (typeof body === "string") {
|
|
242
|
-
return body;
|
|
243
|
-
}
|
|
244
|
-
if (body instanceof String) {
|
|
245
|
-
return body.toString();
|
|
246
|
-
}
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function graphqlPayloadFromBody(body) {
|
|
251
|
-
if (typeof body !== "string" || body.length > MAX_GRAPHQL_BODY_CHARS) {
|
|
252
|
-
return undefined;
|
|
253
|
-
}
|
|
254
|
-
try {
|
|
255
|
-
const payload = JSON.parse(body);
|
|
256
|
-
return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : undefined;
|
|
257
|
-
} catch {
|
|
258
|
-
return undefined;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function graphqlOperationDetails(query) {
|
|
263
|
-
if (typeof query !== "string" || query.length > MAX_GRAPHQL_BODY_CHARS) {
|
|
264
|
-
return {};
|
|
265
|
-
}
|
|
266
|
-
const source = query.trimStart();
|
|
267
|
-
if (source.startsWith("{")) {
|
|
268
|
-
return { operationType: "query" };
|
|
269
|
-
}
|
|
270
|
-
const match = GRAPHQL_OPERATION_RE.exec(stripLeadingGraphQLComments(source));
|
|
271
|
-
if (!match) {
|
|
272
|
-
return {};
|
|
273
|
-
}
|
|
274
|
-
return {
|
|
275
|
-
operationName: safeGraphqlOperationName(match[2]),
|
|
276
|
-
operationType: match[1]
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function stripLeadingGraphQLComments(source) {
|
|
281
|
-
return source.replace(/^(?:#[^\n\r]*(?:\r?\n|$)\s*)+/u, "").trimStart();
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function safeGraphqlOperationName(value) {
|
|
285
|
-
if (typeof value !== "string") {
|
|
286
|
-
return undefined;
|
|
287
|
-
}
|
|
288
|
-
const name = value.trim();
|
|
289
|
-
if (
|
|
290
|
-
name.length === 0 ||
|
|
291
|
-
name.length > MAX_GRAPHQL_OPERATION_NAME_CHARS ||
|
|
292
|
-
!GRAPHQL_OPERATION_NAME_RE.test(name)
|
|
293
|
-
) {
|
|
294
|
-
return undefined;
|
|
295
|
-
}
|
|
296
|
-
return name;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function requestMethod(input, init) {
|
|
300
|
-
const method = init?.method ?? input?.method ?? "GET";
|
|
301
|
-
return String(method).toUpperCase();
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function resourceTraceContext({ randomValues, trace, traceFlags }) {
|
|
305
|
-
if (typeof trace === "string") {
|
|
306
|
-
return createReactNativeTraceContext({ randomValues, traceFlags, traceparent: trace });
|
|
307
|
-
}
|
|
308
|
-
return trace ?? getActiveLogBrewTrace() ?? createReactNativeTraceContext({ randomValues, traceFlags });
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function requestUrl(input) {
|
|
312
|
-
if (typeof input === "string") {
|
|
313
|
-
return input;
|
|
314
|
-
}
|
|
315
|
-
const URLConstructor = globalThis.URL;
|
|
316
|
-
if (typeof URLConstructor === "function" && input instanceof URLConstructor) {
|
|
317
|
-
return input.toString();
|
|
318
|
-
}
|
|
319
|
-
if (typeof input?.url === "string") {
|
|
320
|
-
return input.url;
|
|
321
|
-
}
|
|
322
|
-
return String(input);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function defaultRouteTemplateFactory({ url }) {
|
|
326
|
-
const URLConstructor = globalThis.URL;
|
|
327
|
-
if (typeof URLConstructor === "function") {
|
|
328
|
-
try {
|
|
329
|
-
const parsedUrl = new URLConstructor(url, "https://logbrew.local");
|
|
330
|
-
return parsedUrl.pathname;
|
|
331
|
-
} catch {
|
|
332
|
-
// Fall back to query/hash stripping below for non-standard request keys.
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return String(url).split(/[?#]/u, 1)[0];
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function elapsedMs(startedAtMs, nowMs) {
|
|
339
|
-
const durationMs = nowMs() - startedAtMs;
|
|
340
|
-
return Number.isFinite(durationMs) ? Math.max(0, durationMs) : undefined;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
function responseStatusCode(response) {
|
|
344
|
-
return typeof response?.status === "number" && Number.isFinite(response.status) ? response.status : undefined;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
async function responseSizeBytesFromResponse(response, { measureResponseBodySize = false } = {}) {
|
|
348
|
-
const contentLength = responseContentLengthBytes(response);
|
|
349
|
-
if (contentLength !== undefined) {
|
|
350
|
-
return contentLength;
|
|
351
|
-
}
|
|
352
|
-
return measureResponseBodySize ? clonedResponseBodySizeBytes(response) : undefined;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function responseContentLengthBytes(response) {
|
|
356
|
-
const header = responseHeader(response, "Content-Length");
|
|
357
|
-
const value = Number.parseInt(String(header ?? ""), 10);
|
|
358
|
-
return Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function responseHeader(response, name) {
|
|
362
|
-
if (typeof response?.headers?.get !== "function") {
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
try {
|
|
366
|
-
return response.headers.get(name) ?? response.headers.get(name.toLowerCase()) ?? undefined;
|
|
367
|
-
} catch {
|
|
368
|
-
return undefined;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
async function clonedResponseBodySizeBytes(response) {
|
|
373
|
-
if (typeof response?.clone !== "function") {
|
|
374
|
-
return undefined;
|
|
375
|
-
}
|
|
376
|
-
let clonedResponse;
|
|
377
|
-
try {
|
|
378
|
-
clonedResponse = response.clone();
|
|
379
|
-
} catch {
|
|
380
|
-
return undefined;
|
|
381
|
-
}
|
|
382
|
-
return responseBodySizeBytes(clonedResponse);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
async function responseBodySizeBytes(response) {
|
|
386
|
-
const arrayBufferSize = await responseArrayBufferSizeBytes(response);
|
|
387
|
-
if (arrayBufferSize !== undefined) {
|
|
388
|
-
return arrayBufferSize;
|
|
389
|
-
}
|
|
390
|
-
const blobSize = await responseBlobSizeBytes(response);
|
|
391
|
-
if (blobSize !== undefined) {
|
|
392
|
-
return blobSize;
|
|
393
|
-
}
|
|
394
|
-
return responseTextSizeBytes(response);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
async function responseArrayBufferSizeBytes(response) {
|
|
398
|
-
if (typeof response?.arrayBuffer !== "function") {
|
|
399
|
-
return undefined;
|
|
400
|
-
}
|
|
401
|
-
try {
|
|
402
|
-
return binaryByteLength(await response.arrayBuffer());
|
|
403
|
-
} catch {
|
|
404
|
-
return undefined;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
async function responseBlobSizeBytes(response) {
|
|
409
|
-
if (typeof response?.blob !== "function") {
|
|
410
|
-
return undefined;
|
|
411
|
-
}
|
|
412
|
-
try {
|
|
413
|
-
const blob = await response.blob();
|
|
414
|
-
return typeof blob?.size === "number" && Number.isFinite(blob.size) && blob.size >= 0 ? blob.size : undefined;
|
|
415
|
-
} catch {
|
|
416
|
-
return undefined;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
async function responseTextSizeBytes(response) {
|
|
421
|
-
if (typeof response?.text !== "function") {
|
|
422
|
-
return undefined;
|
|
423
|
-
}
|
|
424
|
-
try {
|
|
425
|
-
const text = await response.text();
|
|
426
|
-
return typeof text === "string" || text instanceof String ? utf8ByteLength(text.toString()) : undefined;
|
|
427
|
-
} catch {
|
|
428
|
-
return undefined;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function binaryByteLength(value) {
|
|
433
|
-
if (typeof value?.byteLength === "number" && Number.isFinite(value.byteLength) && value.byteLength >= 0) {
|
|
434
|
-
return value.byteLength;
|
|
435
|
-
}
|
|
436
|
-
return undefined;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
function utf8ByteLength(value) {
|
|
440
|
-
let bytes = 0;
|
|
441
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
442
|
-
const code = value.charCodeAt(index);
|
|
443
|
-
if (code <= 0x7f) {
|
|
444
|
-
bytes += 1;
|
|
445
|
-
} else if (code <= 0x7ff) {
|
|
446
|
-
bytes += 2;
|
|
447
|
-
} else if (code >= 0xd800 && code <= 0xdbff && index + 1 < value.length) {
|
|
448
|
-
const next = value.charCodeAt(index + 1);
|
|
449
|
-
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
450
|
-
bytes += 4;
|
|
451
|
-
index += 1;
|
|
452
|
-
} else {
|
|
453
|
-
bytes += 3;
|
|
454
|
-
}
|
|
455
|
-
} else {
|
|
456
|
-
bytes += 3;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return bytes;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
function errorName(error) {
|
|
463
|
-
return typeof error?.name === "string" && error.name.trim() !== "" ? error.name : "Error";
|
|
464
|
-
}
|
|
3
|
+
export const {
|
|
4
|
+
createReactNativeGraphQLMetadataFactory,
|
|
5
|
+
createReactNativeResourceFetch
|
|
6
|
+
} = implementation;
|
|
@@ -2,10 +2,7 @@ import type { CodegenTypes, TurboModule } from "react-native";
|
|
|
2
2
|
import { TurboModuleRegistry } from "react-native";
|
|
3
3
|
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
|
-
|
|
6
|
-
readFatalRecord(): CodegenTypes.UnsafeObject;
|
|
7
|
-
acknowledgeFatalRecord(recordId: string): CodegenTypes.UnsafeObject;
|
|
8
|
-
discardFatalRecord(): CodegenTypes.UnsafeObject;
|
|
5
|
+
secureRandomHex(length: number): string;
|
|
9
6
|
loadEventRecords(queueKey: string): CodegenTypes.UnsafeObject;
|
|
10
7
|
appendEventRecord(
|
|
11
8
|
queueKey: string,
|
|
@@ -15,6 +12,11 @@ export interface Spec extends TurboModule {
|
|
|
15
12
|
acknowledgeEventRecords(queueKey: string, count: number): CodegenTypes.UnsafeObject;
|
|
16
13
|
purgeEventRecords(queueKey: string): CodegenTypes.UnsafeObject;
|
|
17
14
|
closeEventStore(queueKey: string): CodegenTypes.UnsafeObject;
|
|
15
|
+
installAndroidDiagnostics(
|
|
16
|
+
configuration: CodegenTypes.UnsafeObject
|
|
17
|
+
): CodegenTypes.UnsafeObject;
|
|
18
|
+
androidDiagnosticsStatus(): CodegenTypes.UnsafeObject;
|
|
19
|
+
uninstallAndroidDiagnostics(): CodegenTypes.UnsafeObject;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export default TurboModuleRegistry.getEnforcing<Spec>("LogBrewFatalStore");
|