@logbrew/react-native 0.1.38 → 0.1.40
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 -1
- package/README.md +17 -15
- package/android-native-diagnostics.d.ts +15 -5
- package/android-native-diagnostics.js +170 -94
- package/apollo.cjs +435 -226
- package/apollo.d.cts +2 -70
- package/apollo.d.ts +24 -12
- package/apollo.js +438 -221
- package/apple-native-diagnostics-config.js +176 -0
- package/apple-native-diagnostics-context.js +232 -0
- package/apple-native-diagnostics-module.js +229 -0
- package/apple-native-diagnostics.d.ts +42 -11
- package/apple-native-diagnostics.js +60 -389
- package/expo.cjs +29 -16
- package/expo.d.ts +10 -9
- package/expo.js +4 -3
- package/fatal-admission.cjs +113 -0
- package/fatal-record.cjs +317 -0
- package/fatal-replay.cjs +297 -508
- package/global-errors-capture.cjs +369 -0
- package/global-errors-event.cjs +174 -0
- package/global-errors-support.cjs +128 -0
- package/global-errors.cjs +75 -351
- package/global-errors.d.cts +29 -278
- package/global-errors.d.ts +57 -27
- package/global-errors.js +7 -2
- package/global-errors.native.js +83 -48
- package/index-breadcrumbs.cjs +139 -0
- package/index-errors.cjs +167 -0
- package/index-events.cjs +365 -0
- package/index-navigation.cjs +327 -0
- package/index-random.cjs +120 -0
- package/index-react.cjs +189 -0
- package/index-spans.cjs +190 -0
- package/index-trace-fetch.cjs +322 -0
- package/index-trace.cjs +335 -0
- package/index-transport.cjs +201 -0
- package/index-values.cjs +232 -0
- package/index.cjs +95 -1220
- package/index.d.cts +2 -505
- package/index.d.ts +130 -469
- package/index.native.d.ts +146 -22
- package/index.native.js +184 -159
- package/instrumentation-fetch.cjs +113 -0
- package/instrumentation-install.cjs +241 -0
- package/instrumentation-runtime.cjs +65 -0
- package/instrumentation-teardown.cjs +93 -0
- package/instrumentation-values.cjs +282 -0
- package/instrumentation-xhr-request.cjs +298 -0
- package/instrumentation-xhr.cjs +233 -0
- package/instrumentation.cjs +110 -599
- package/instrumentation.d.cts +2 -84
- package/instrumentation.d.ts +22 -8
- package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +1 -1
- package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryEngine.swift +7 -1
- package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryEngineAutomatic.swift +36 -4
- package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryEngineQueue.swift +17 -0
- package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryLifecycle.swift +2 -0
- package/ios/GeneratedAppleDiagnostics/LogBrew/Transport.swift +41 -6
- package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +5 -5
- package/lifecycle.cjs +181 -78
- package/lifecycle.d.cts +1 -50
- package/lifecycle.d.ts +17 -6
- package/metadata.cjs +279 -114
- package/metro-debug-id.cjs +296 -0
- package/metro-serializer.cjs +219 -0
- package/metro.cjs +153 -297
- package/metro.d.cts +2 -57
- package/metro.d.ts +27 -13
- package/metro.js +2 -3
- package/native-bridge-async.cjs +165 -0
- package/native-bridge-scope.cjs +148 -0
- package/native-bridge.cjs +83 -186
- package/native-bridge.d.cts +2 -94
- package/native-bridge.d.ts +28 -15
- package/native-client-bindings.js +230 -0
- package/native-diagnostics-values.js +120 -0
- package/native-module-lookup.js +31 -0
- package/native-null.js +3 -0
- package/null-value.cjs +4 -0
- package/package.json +44 -2
- package/persistent-delivery-store.js +247 -0
- package/persistent-delivery.native.js +183 -261
- package/promise-rejection-handlers.cjs +368 -0
- package/promise-rejections.cjs +169 -361
- package/react-native.config.js +3 -1
- package/release-artifacts-files.cjs +94 -0
- package/release-artifacts-options.cjs +182 -0
- package/release-artifacts.cjs +278 -207
- package/release-artifacts.d.cts +2 -55
- package/release-artifacts.d.ts +18 -7
- package/release-artifacts.js +2 -4
- package/resource-fetch-graphql.cjs +265 -0
- package/resource-fetch-size.cjs +156 -0
- package/resource-fetch.cjs +227 -428
- package/resource-fetch.d.cts +1 -60
- package/resource-fetch.d.ts +17 -6
- package/scripts/sync-apple-native-sources.mjs +101 -53
- package/types/capture.d.ts +95 -0
- package/types/config.d.ts +85 -0
- package/types/defaults.d.ts +55 -0
- package/types/events.d.ts +203 -0
- package/types/provider.d.ts +81 -0
- package/types/trace.d.ts +104 -0
package/resource-fetch.d.cts
CHANGED
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
ReactNativeAppStateLike,
|
|
4
|
-
ReactNativePlatformLike,
|
|
5
|
-
ReactNativeTraceInput,
|
|
6
|
-
TracePropagationTarget
|
|
7
|
-
} from "./index.cjs";
|
|
8
|
-
|
|
9
|
-
export type ReactNativeResourceFetchOptions<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
10
|
-
appState?: ReactNativeAppStateLike;
|
|
11
|
-
fetchImpl?: (input: TInput, init?: TInit) => Promise<TResponse> | TResponse;
|
|
12
|
-
measureResponseBodySize?: boolean;
|
|
13
|
-
metadata?: Metadata;
|
|
14
|
-
metadataFactory?: (context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => Metadata | undefined;
|
|
15
|
-
now?: () => string;
|
|
16
|
-
nowMs?: () => number;
|
|
17
|
-
platform?: ReactNativePlatformLike;
|
|
18
|
-
randomValues?: (length: number) => ArrayLike<number>;
|
|
19
|
-
routeTemplate?: string;
|
|
20
|
-
routeTemplateFactory?: (context: { input: TInput; init?: TInit; url: string }) => string | undefined;
|
|
21
|
-
screen?: string;
|
|
22
|
-
sessionId?: string;
|
|
23
|
-
trace?: ReactNativeTraceInput;
|
|
24
|
-
traceFlags?: string;
|
|
25
|
-
tracePropagationTargets?: TracePropagationTarget[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type ReactNativeResourceFetchMetadataContext<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
29
|
-
readonly durationMs?: number;
|
|
30
|
-
readonly error?: unknown;
|
|
31
|
-
readonly init?: TInit;
|
|
32
|
-
readonly input: TInput;
|
|
33
|
-
readonly method: string;
|
|
34
|
-
readonly response?: TResponse;
|
|
35
|
-
readonly responseSizeBytes?: number;
|
|
36
|
-
readonly responseStartDurationMs?: number;
|
|
37
|
-
readonly routeTemplate?: string;
|
|
38
|
-
readonly status?: string;
|
|
39
|
-
readonly statusCode?: number;
|
|
40
|
-
readonly url: string;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type ReactNativeGraphQLMetadataFactoryOptions<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
44
|
-
endpoint?: ReactNativeGraphQLEndpointMatcher<TInput, TInit, TResponse> | ReactNativeGraphQLEndpointMatcher<TInput, TInit, TResponse>[];
|
|
45
|
-
metadataFactory?: (context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => Metadata | undefined;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type ReactNativeGraphQLEndpointMatcher<TInput = unknown, TInit = unknown, TResponse = unknown> =
|
|
49
|
-
| string
|
|
50
|
-
| RegExp
|
|
51
|
-
| ((context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => boolean);
|
|
52
|
-
|
|
53
|
-
export declare function createReactNativeGraphQLMetadataFactory<TInput = unknown, TInit = unknown, TResponse = unknown>(
|
|
54
|
-
options?: ReactNativeGraphQLMetadataFactoryOptions<TInput, TInit, TResponse>
|
|
55
|
-
): (context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => Metadata;
|
|
56
|
-
|
|
57
|
-
export declare function createReactNativeResourceFetch<TInput = unknown, TInit = unknown, TResponse = unknown>(
|
|
58
|
-
client: LogBrewClient,
|
|
59
|
-
options?: ReactNativeResourceFetchOptions<TInput, TInit, TResponse>
|
|
60
|
-
): (input: TInput, init?: TInit) => Promise<TResponse>;
|
|
1
|
+
export * from "./resource-fetch.js";
|
package/resource-fetch.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
TracePropagationTarget
|
|
7
7
|
} from "./index.js";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type ReactNativeResourceFetchOptions<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
10
10
|
appState?: ReactNativeAppStateLike;
|
|
11
11
|
fetchImpl?: (input: TInput, init?: TInit) => Promise<TResponse> | TResponse;
|
|
12
12
|
measureResponseBodySize?: boolean;
|
|
@@ -25,7 +25,7 @@ export type ReactNativeResourceFetchOptions<TInput = unknown, TInit = unknown, T
|
|
|
25
25
|
tracePropagationTargets?: TracePropagationTarget[];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
type ReactNativeResourceFetchMetadataContext<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
29
29
|
readonly durationMs?: number;
|
|
30
30
|
readonly error?: unknown;
|
|
31
31
|
readonly init?: TInit;
|
|
@@ -40,21 +40,32 @@ export type ReactNativeResourceFetchMetadataContext<TInput = unknown, TInit = un
|
|
|
40
40
|
readonly url: string;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
type ReactNativeGraphQLMetadataFactoryOptions<TInput = unknown, TInit = unknown, TResponse = unknown> = {
|
|
44
44
|
endpoint?: ReactNativeGraphQLEndpointMatcher<TInput, TInit, TResponse> | ReactNativeGraphQLEndpointMatcher<TInput, TInit, TResponse>[];
|
|
45
45
|
metadataFactory?: (context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => Metadata | undefined;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
type ReactNativeGraphQLEndpointMatcher<TInput = unknown, TInit = unknown, TResponse = unknown> =
|
|
49
49
|
| string
|
|
50
50
|
| RegExp
|
|
51
51
|
| ((context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => boolean);
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
declare function createReactNativeGraphQLMetadataFactory<TInput = unknown, TInit = unknown, TResponse = unknown>(
|
|
54
54
|
options?: ReactNativeGraphQLMetadataFactoryOptions<TInput, TInit, TResponse>
|
|
55
55
|
): (context: ReactNativeResourceFetchMetadataContext<TInput, TInit, TResponse>) => Metadata;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
declare function createReactNativeResourceFetch<TInput = unknown, TInit = unknown, TResponse = unknown>(
|
|
58
58
|
client: LogBrewClient,
|
|
59
59
|
options?: ReactNativeResourceFetchOptions<TInput, TInit, TResponse>
|
|
60
60
|
): (input: TInput, init?: TInit) => Promise<TResponse>;
|
|
61
|
+
|
|
62
|
+
export type {
|
|
63
|
+
ReactNativeGraphQLEndpointMatcher,
|
|
64
|
+
ReactNativeGraphQLMetadataFactoryOptions,
|
|
65
|
+
ReactNativeResourceFetchMetadataContext,
|
|
66
|
+
ReactNativeResourceFetchOptions
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
createReactNativeGraphQLMetadataFactory,
|
|
70
|
+
createReactNativeResourceFetch
|
|
71
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
3
4
|
import fs from "node:fs";
|
|
4
5
|
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
const scriptDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
const packageRoot = path.resolve(scriptDirectory, "..");
|
|
@@ -15,16 +15,89 @@ const generatedHeader = [
|
|
|
15
15
|
"// Edit the canonical Swift source, then regenerate this package boundary.",
|
|
16
16
|
""
|
|
17
17
|
].join("\n");
|
|
18
|
-
const
|
|
18
|
+
const MODE_ARGUMENT = 2;
|
|
19
|
+
const JSON_INDENT = 2;
|
|
20
|
+
const mode = process.argv[MODE_ARGUMENT] ?? "--check";
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} root
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
26
|
+
function listFiles(root) {
|
|
27
|
+
if (!fs.existsSync(root)) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
/** @type {string[]} */
|
|
31
|
+
const files = [];
|
|
32
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
33
|
+
const entryPath = path.join(root, entry.name);
|
|
34
|
+
files.push(...(entry.isDirectory() ? listFiles(entryPath) : [entryPath]));
|
|
35
|
+
}
|
|
36
|
+
files.sort();
|
|
37
|
+
return files;
|
|
38
|
+
}
|
|
25
39
|
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} canonical
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
function transformCanonicalSource(canonical) {
|
|
45
|
+
return canonical
|
|
46
|
+
.replaceAll("@_spi(CrashReplay) import LogBrew\n", "")
|
|
47
|
+
.replaceAll("@objc(LBW", "@objc(LBRNApple")
|
|
48
|
+
.replaceAll("@preconcurrency import KSCrashRecording\n", "@preconcurrency import KSCrash\n")
|
|
49
|
+
.replaceAll("@preconcurrency import KSCrashRecordingCore\n", "@preconcurrency import KSCrash\n");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {string} moduleName
|
|
54
|
+
* @returns {Readonly<{ contents: string, digest: string, manifestPath: string, relativePath: string }>[]}
|
|
55
|
+
*/
|
|
56
|
+
function moduleEntries(moduleName) {
|
|
57
|
+
const moduleRoot = path.join(sourceRoot, moduleName);
|
|
58
|
+
return listFiles(moduleRoot).filter(filePath => filePath.endsWith(".swift")).map(sourcePath => {
|
|
59
|
+
const moduleRelativePath = path.relative(moduleRoot, sourcePath);
|
|
60
|
+
const relativePath = path.join(moduleName, moduleRelativePath);
|
|
61
|
+
const canonical = fs.readFileSync(sourcePath, "utf8");
|
|
62
|
+
const transformed = transformCanonicalSource(canonical);
|
|
63
|
+
return {
|
|
64
|
+
contents: `${generatedHeader}${transformed}`,
|
|
65
|
+
digest: crypto.createHash("sha256").update(canonical).digest("hex"),
|
|
66
|
+
manifestPath: path.join("swift", "logbrew-swift", "Sources", relativePath),
|
|
67
|
+
relativePath
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {readonly [string, string]} left
|
|
74
|
+
* @param {readonly [string, string]} right
|
|
75
|
+
* @returns {number}
|
|
76
|
+
*/
|
|
77
|
+
function byPath([leftPath], [rightPath]) {
|
|
78
|
+
return leftPath.localeCompare(rightPath);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @returns {Map<string, string>}
|
|
83
|
+
*/
|
|
84
|
+
function expectedFiles() {
|
|
85
|
+
const entries = sourceModules.flatMap(moduleName => moduleEntries(moduleName));
|
|
86
|
+
const manifest = Object.fromEntries(entries.map(entry => [entry.manifestPath, entry.digest]));
|
|
87
|
+
/** @type {[string, string][]} */
|
|
88
|
+
const files = entries.map(entry => [entry.relativePath, entry.contents]);
|
|
89
|
+
files.push([
|
|
90
|
+
"SOURCE-MANIFEST.json",
|
|
91
|
+
`${JSON.stringify({ schemaVersion: 1, sources: manifest }, undefined, JSON_INDENT)}\n`
|
|
92
|
+
]);
|
|
93
|
+
files.sort(byPath);
|
|
94
|
+
return new Map(files);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param {Readonly<ReadonlyMap<string, string>>} expected
|
|
99
|
+
*/
|
|
100
|
+
function writeExpected(expected) {
|
|
28
101
|
fs.rmSync(generatedRoot, { force: true, recursive: true });
|
|
29
102
|
for (const [relativePath, contents] of expected) {
|
|
30
103
|
const destination = path.join(generatedRoot, relativePath);
|
|
@@ -32,8 +105,13 @@ if (mode === "--write") {
|
|
|
32
105
|
fs.writeFileSync(destination, contents, "utf8");
|
|
33
106
|
}
|
|
34
107
|
process.stdout.write(`generated ${expected.size} Apple diagnostics source files\n`);
|
|
35
|
-
}
|
|
36
|
-
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {Readonly<ReadonlyMap<string, string>>} expected
|
|
112
|
+
*/
|
|
113
|
+
function checkExpected(expected) {
|
|
114
|
+
const actualPaths = listFiles(generatedRoot).map(filePath =>
|
|
37
115
|
path.relative(generatedRoot, filePath)
|
|
38
116
|
);
|
|
39
117
|
assert.deepEqual(actualPaths, [...expected.keys()]);
|
|
@@ -45,49 +123,19 @@ if (mode === "--write") {
|
|
|
45
123
|
);
|
|
46
124
|
}
|
|
47
125
|
process.stdout.write(`verified ${expected.size} Apple diagnostics source files\n`);
|
|
48
|
-
} else {
|
|
49
|
-
throw new Error("usage: sync-apple-native-sources.mjs [--check|--write]");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function expectedFiles() {
|
|
53
|
-
const files = new Map();
|
|
54
|
-
const manifest = {};
|
|
55
|
-
for (const moduleName of sourceModules) {
|
|
56
|
-
const moduleRoot = path.join(sourceRoot, moduleName);
|
|
57
|
-
for (const sourcePath of listFiles(moduleRoot).filter((filePath) => filePath.endsWith(".swift"))) {
|
|
58
|
-
const moduleRelativePath = path.relative(moduleRoot, sourcePath);
|
|
59
|
-
const relativePath = path.join(moduleName, moduleRelativePath);
|
|
60
|
-
const canonical = fs.readFileSync(sourcePath, "utf8");
|
|
61
|
-
const transformed = transformCanonicalSource(canonical);
|
|
62
|
-
const contents = `${generatedHeader}${transformed}`;
|
|
63
|
-
files.set(relativePath, contents);
|
|
64
|
-
manifest[path.join("swift", "logbrew-swift", "Sources", relativePath)] =
|
|
65
|
-
crypto.createHash("sha256").update(canonical).digest("hex");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
files.set(
|
|
69
|
-
"SOURCE-MANIFEST.json",
|
|
70
|
-
`${JSON.stringify({ schemaVersion: 1, sources: manifest }, null, 2)}\n`
|
|
71
|
-
);
|
|
72
|
-
return new Map([...files].sort(([left], [right]) => left.localeCompare(right)));
|
|
73
126
|
}
|
|
74
127
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.replaceAll("@preconcurrency import KSCrashRecordingCore\n", "@preconcurrency import KSCrash\n");
|
|
81
|
-
}
|
|
128
|
+
assert.ok(
|
|
129
|
+
generatedRoot.startsWith(`${packageRoot}${path.sep}`)
|
|
130
|
+
&& path.basename(generatedRoot) === "GeneratedAppleDiagnostics",
|
|
131
|
+
"refusing to operate outside the package-generated source directory"
|
|
132
|
+
);
|
|
82
133
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return entry.isDirectory() ? listFiles(entryPath) : [entryPath];
|
|
91
|
-
})
|
|
92
|
-
.sort();
|
|
134
|
+
const expected = expectedFiles();
|
|
135
|
+
if (mode === "--write") {
|
|
136
|
+
writeExpected(expected);
|
|
137
|
+
} else if (mode === "--check") {
|
|
138
|
+
checkExpected(expected);
|
|
139
|
+
} else {
|
|
140
|
+
throw new Error("usage: sync-apple-native-sources.mjs [--check|--write]");
|
|
93
141
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CaptureAppStateChangeOptions,
|
|
3
|
+
CaptureReactNativeErrorOptions,
|
|
4
|
+
CaptureScreenViewOptions,
|
|
5
|
+
CreateAppStateListenerOptions,
|
|
6
|
+
ReactNativeActionEvent,
|
|
7
|
+
ReactNativeActionInput,
|
|
8
|
+
ReactNativeContextOptions,
|
|
9
|
+
ReactNativeErrorEvent,
|
|
10
|
+
ReactNativeNavigationSpanInput,
|
|
11
|
+
ReactNativeNetworkInput,
|
|
12
|
+
ReactNativeResourceSpanInput,
|
|
13
|
+
ReactNativeSpanEvent,
|
|
14
|
+
ReactNavigationContainerLike,
|
|
15
|
+
ReactNavigationSpanListenerOptions
|
|
16
|
+
} from "./events.js";
|
|
17
|
+
import type { LogBrewClient, Metadata } from "@logbrew/sdk";
|
|
18
|
+
import type { ReactNativeAppStateLike } from "./config.js";
|
|
19
|
+
|
|
20
|
+
declare function getReactNativeContext(options?: ReactNativeContextOptions): Metadata;
|
|
21
|
+
declare function captureScreenView(
|
|
22
|
+
client: LogBrewClient,
|
|
23
|
+
screenName: string,
|
|
24
|
+
options?: CaptureScreenViewOptions
|
|
25
|
+
): void;
|
|
26
|
+
declare function captureAppStateChange(
|
|
27
|
+
client: LogBrewClient,
|
|
28
|
+
state: string,
|
|
29
|
+
options?: CaptureAppStateChangeOptions
|
|
30
|
+
): void;
|
|
31
|
+
declare function createReactNativeActionEvent(
|
|
32
|
+
input?: ReactNativeActionInput
|
|
33
|
+
): ReactNativeActionEvent;
|
|
34
|
+
declare function captureReactNativeAction(
|
|
35
|
+
client: LogBrewClient,
|
|
36
|
+
input?: ReactNativeActionInput
|
|
37
|
+
): ReactNativeActionEvent;
|
|
38
|
+
declare function createReactNativeNetworkEvent(
|
|
39
|
+
input?: ReactNativeNetworkInput
|
|
40
|
+
): ReactNativeActionEvent;
|
|
41
|
+
declare function captureReactNativeNetwork(
|
|
42
|
+
client: LogBrewClient,
|
|
43
|
+
input?: ReactNativeNetworkInput
|
|
44
|
+
): ReactNativeActionEvent;
|
|
45
|
+
declare function createReactNativeNavigationSpanEvent(
|
|
46
|
+
input?: ReactNativeNavigationSpanInput
|
|
47
|
+
): ReactNativeSpanEvent;
|
|
48
|
+
declare function captureReactNativeNavigationSpan(
|
|
49
|
+
client: LogBrewClient,
|
|
50
|
+
input?: ReactNativeNavigationSpanInput
|
|
51
|
+
): ReactNativeSpanEvent;
|
|
52
|
+
declare function createReactNativeResourceSpanEvent(
|
|
53
|
+
input?: ReactNativeResourceSpanInput
|
|
54
|
+
): ReactNativeSpanEvent;
|
|
55
|
+
declare function captureReactNativeResourceSpan(
|
|
56
|
+
client: LogBrewClient,
|
|
57
|
+
input?: ReactNativeResourceSpanInput
|
|
58
|
+
): ReactNativeSpanEvent;
|
|
59
|
+
declare function createReactNavigationSpanListener(
|
|
60
|
+
client: LogBrewClient,
|
|
61
|
+
navigationContainer: ReactNavigationContainerLike,
|
|
62
|
+
options?: ReactNavigationSpanListenerOptions
|
|
63
|
+
): () => void;
|
|
64
|
+
declare function createReactNativeErrorEvent(
|
|
65
|
+
error: unknown,
|
|
66
|
+
options?: CaptureReactNativeErrorOptions
|
|
67
|
+
): ReactNativeErrorEvent;
|
|
68
|
+
declare function captureReactNativeError(
|
|
69
|
+
client: LogBrewClient,
|
|
70
|
+
error: unknown,
|
|
71
|
+
options?: CaptureReactNativeErrorOptions
|
|
72
|
+
): ReactNativeErrorEvent;
|
|
73
|
+
declare function createAppStateListener(
|
|
74
|
+
client: LogBrewClient,
|
|
75
|
+
appState: ReactNativeAppStateLike,
|
|
76
|
+
options?: CreateAppStateListenerOptions
|
|
77
|
+
): () => void;
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
captureAppStateChange,
|
|
81
|
+
captureReactNativeAction,
|
|
82
|
+
captureReactNativeError,
|
|
83
|
+
captureReactNativeNavigationSpan,
|
|
84
|
+
captureReactNativeNetwork,
|
|
85
|
+
captureReactNativeResourceSpan,
|
|
86
|
+
captureScreenView,
|
|
87
|
+
createAppStateListener,
|
|
88
|
+
createReactNativeActionEvent,
|
|
89
|
+
createReactNativeErrorEvent,
|
|
90
|
+
createReactNativeNavigationSpanEvent,
|
|
91
|
+
createReactNativeNetworkEvent,
|
|
92
|
+
createReactNativeResourceSpanEvent,
|
|
93
|
+
createReactNavigationSpanListener,
|
|
94
|
+
getReactNativeContext
|
|
95
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DroppedEvent,
|
|
3
|
+
EventStore,
|
|
4
|
+
LogBrewClient,
|
|
5
|
+
TelemetryContext,
|
|
6
|
+
Transport
|
|
7
|
+
} from "@logbrew/sdk";
|
|
8
|
+
|
|
9
|
+
type ReactNativePlatformLike = {
|
|
10
|
+
OS?: string;
|
|
11
|
+
Version?: string | number;
|
|
12
|
+
isPad?: boolean;
|
|
13
|
+
constants?: { isTesting?: boolean; [key: string]: unknown };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type ReactNativeAppStateLike = {
|
|
17
|
+
currentState?: string | null | undefined;
|
|
18
|
+
addEventListener?: (
|
|
19
|
+
type: "change",
|
|
20
|
+
listener: (state: string) => void
|
|
21
|
+
) => { remove(): void } | (() => void);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type CreateLogBrewReactNativeClientConfig = {
|
|
25
|
+
automaticDelivery?: boolean;
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
clientKey?: string;
|
|
28
|
+
context?: TelemetryContext;
|
|
29
|
+
/** Automatic delivery interval in milliseconds. Defaults to 5000 on mobile to save battery. */
|
|
30
|
+
deliveryIntervalMs?: number;
|
|
31
|
+
deliveryQueueThreshold?: number;
|
|
32
|
+
/** Advanced synchronous persistence seam. React Native apps normally use the native entry's persistentQueue mode. */
|
|
33
|
+
eventStore?: EventStore;
|
|
34
|
+
maxBatchBytes?: number;
|
|
35
|
+
maxBatchEvents?: number;
|
|
36
|
+
maxQueueBytes?: number;
|
|
37
|
+
maxQueueSize?: number;
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
onEventDropped?: (drop: DroppedEvent) => void;
|
|
40
|
+
sdkName?: string;
|
|
41
|
+
sdkVersion?: string;
|
|
42
|
+
transport?: Transport;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type ReactNativeFetchResponseLike = {
|
|
46
|
+
status: number;
|
|
47
|
+
headers?: {
|
|
48
|
+
get(name: string): string | null | undefined;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type ReactNativeFetchLike = (
|
|
53
|
+
endpoint: string,
|
|
54
|
+
init: {
|
|
55
|
+
body: string;
|
|
56
|
+
headers: Record<string, string>;
|
|
57
|
+
method: "POST";
|
|
58
|
+
}
|
|
59
|
+
) => Promise<ReactNativeFetchResponseLike> | ReactNativeFetchResponseLike;
|
|
60
|
+
|
|
61
|
+
type ReactNativeFetchTransportConfig = {
|
|
62
|
+
endpoint?: string;
|
|
63
|
+
fetchImpl?: ReactNativeFetchLike;
|
|
64
|
+
headers?: Record<string, string>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare function createLogBrewReactNativeClient(
|
|
68
|
+
config: CreateLogBrewReactNativeClientConfig
|
|
69
|
+
): LogBrewClient;
|
|
70
|
+
declare function createReactNativeFetchTransport(
|
|
71
|
+
config?: ReactNativeFetchTransportConfig
|
|
72
|
+
): Transport;
|
|
73
|
+
|
|
74
|
+
export type {
|
|
75
|
+
CreateLogBrewReactNativeClientConfig,
|
|
76
|
+
ReactNativeAppStateLike,
|
|
77
|
+
ReactNativeFetchLike,
|
|
78
|
+
ReactNativeFetchResponseLike,
|
|
79
|
+
ReactNativeFetchTransportConfig,
|
|
80
|
+
ReactNativePlatformLike
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
createLogBrewReactNativeClient,
|
|
84
|
+
createReactNativeFetchTransport
|
|
85
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CaptureAppStateChangeOptions,
|
|
3
|
+
CaptureReactNativeErrorOptions,
|
|
4
|
+
CaptureScreenViewOptions,
|
|
5
|
+
CreateAppStateListenerOptions,
|
|
6
|
+
ReactNativeActionEvent,
|
|
7
|
+
ReactNativeActionInput,
|
|
8
|
+
ReactNativeErrorEvent,
|
|
9
|
+
ReactNativeNetworkInput
|
|
10
|
+
} from "./events.js";
|
|
11
|
+
import type { LogBrewClient, Metadata } from "@logbrew/sdk";
|
|
12
|
+
import type { CreateLogBrewReactNativeClientConfig } from "./config.js";
|
|
13
|
+
|
|
14
|
+
declare function createDefaultLogBrewReactNativeClient(
|
|
15
|
+
config: CreateLogBrewReactNativeClientConfig
|
|
16
|
+
): LogBrewClient;
|
|
17
|
+
declare function getDefaultReactNativeContext(options?: { metadata?: Metadata }): Metadata;
|
|
18
|
+
declare function captureDefaultScreenView(
|
|
19
|
+
client: LogBrewClient,
|
|
20
|
+
screenName: string,
|
|
21
|
+
options?: Omit<CaptureScreenViewOptions, "platform" | "appState">
|
|
22
|
+
): void;
|
|
23
|
+
declare function captureDefaultAppStateChange(
|
|
24
|
+
client: LogBrewClient,
|
|
25
|
+
state: string,
|
|
26
|
+
options?: Omit<CaptureAppStateChangeOptions, "platform" | "appState">
|
|
27
|
+
): void;
|
|
28
|
+
declare function captureDefaultReactNativeAction(
|
|
29
|
+
client: LogBrewClient,
|
|
30
|
+
input?: Omit<ReactNativeActionInput, "platform" | "appState">
|
|
31
|
+
): ReactNativeActionEvent;
|
|
32
|
+
declare function captureDefaultReactNativeNetwork(
|
|
33
|
+
client: LogBrewClient,
|
|
34
|
+
input?: Omit<ReactNativeNetworkInput, "platform" | "appState">
|
|
35
|
+
): ReactNativeActionEvent;
|
|
36
|
+
declare function captureDefaultReactNativeError(
|
|
37
|
+
client: LogBrewClient,
|
|
38
|
+
error: unknown,
|
|
39
|
+
options?: Omit<CaptureReactNativeErrorOptions, "platform" | "appState">
|
|
40
|
+
): ReactNativeErrorEvent;
|
|
41
|
+
declare function createDefaultAppStateListener(
|
|
42
|
+
client: LogBrewClient,
|
|
43
|
+
options?: Omit<CreateAppStateListenerOptions, "appState">
|
|
44
|
+
): () => void;
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
captureDefaultAppStateChange,
|
|
48
|
+
captureDefaultReactNativeAction,
|
|
49
|
+
captureDefaultReactNativeError,
|
|
50
|
+
captureDefaultReactNativeNetwork,
|
|
51
|
+
captureDefaultScreenView,
|
|
52
|
+
createDefaultAppStateListener,
|
|
53
|
+
createDefaultLogBrewReactNativeClient,
|
|
54
|
+
getDefaultReactNativeContext
|
|
55
|
+
};
|