@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.
- package/README.md +3 -3
- 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 +97 -1245
- 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/DeliveryLifecycle.swift +1 -1
- package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +1 -1
- 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 +43 -1
- 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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const net = require("node:net");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {"android" | "ios"} ReleaseArtifactPlatform
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const HOSTED_UPLOAD_ENDPOINT = "https://api.logbrew.co/api/release-artifacts";
|
|
10
|
+
/** @type {ReadonlySet<string>} */
|
|
11
|
+
const HTTP_PROTOCOLS = new Set(["http:", "https:"]);
|
|
12
|
+
const NOT_AN_IP = 0;
|
|
13
|
+
const MIN_UPLOAD_SCALAR = 0;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {unknown} value
|
|
17
|
+
* @param {string} key
|
|
18
|
+
* @returns {unknown}
|
|
19
|
+
*/
|
|
20
|
+
function field(value, key) {
|
|
21
|
+
return (typeof value === "object" && value !== null) || typeof value === "function" ? Reflect.get(value, key) : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {unknown} options
|
|
26
|
+
* @param {string} name
|
|
27
|
+
* @returns {string}
|
|
28
|
+
*/
|
|
29
|
+
function requiredString(options, name) {
|
|
30
|
+
const value = field(options, name);
|
|
31
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
32
|
+
throw new Error(`LogBrew React Native release-artifact helper requires ${name}`);
|
|
33
|
+
}
|
|
34
|
+
return value.trim();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {unknown} options
|
|
39
|
+
* @param {string} name
|
|
40
|
+
* @returns {string | undefined}
|
|
41
|
+
*/
|
|
42
|
+
function optionalString(options, name) {
|
|
43
|
+
const value = field(options, name);
|
|
44
|
+
if (value === undefined || value === null) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
48
|
+
throw new Error(`LogBrew React Native release-artifact helper option ${name} must be a non-empty string`);
|
|
49
|
+
}
|
|
50
|
+
return value.trim();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {unknown} options
|
|
55
|
+
* @param {string} name
|
|
56
|
+
* @returns {string | undefined}
|
|
57
|
+
*/
|
|
58
|
+
function optionalUploadScalar(options, name) {
|
|
59
|
+
const value = field(options, name);
|
|
60
|
+
if (value === undefined || value === null) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (typeof value === "number") {
|
|
64
|
+
if (!Number.isFinite(value) || value < MIN_UPLOAD_SCALAR) {
|
|
65
|
+
throw new Error(`LogBrew React Native release-artifact helper option ${name} must be non-negative`);
|
|
66
|
+
}
|
|
67
|
+
return String(value);
|
|
68
|
+
}
|
|
69
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
70
|
+
throw new Error(`LogBrew React Native release-artifact helper option ${name} must be a non-empty string or number`);
|
|
71
|
+
}
|
|
72
|
+
return value.trim();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {unknown} item
|
|
77
|
+
* @returns {item is string}
|
|
78
|
+
*/
|
|
79
|
+
function isNonEmptyString(item) {
|
|
80
|
+
return typeof item === "string" && item.trim() !== "";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {unknown} value
|
|
85
|
+
* @returns {value is readonly string[]}
|
|
86
|
+
*/
|
|
87
|
+
function isNonEmptyStringArray(value) {
|
|
88
|
+
return Array.isArray(value) && value.every((item) => isNonEmptyString(item));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {unknown} value
|
|
93
|
+
* @param {string} name
|
|
94
|
+
* @returns {string[]}
|
|
95
|
+
*/
|
|
96
|
+
function normalizeStringArray(value, name) {
|
|
97
|
+
if (value === undefined || value === null) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
if (!isNonEmptyStringArray(value)) {
|
|
101
|
+
throw new Error(`LogBrew React Native release-artifact helper option ${name} must be an array of non-empty strings`);
|
|
102
|
+
}
|
|
103
|
+
return value.map((item) => item.trim());
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {unknown} options
|
|
108
|
+
* @returns {ReleaseArtifactPlatform}
|
|
109
|
+
*/
|
|
110
|
+
function normalizePlatform(options) {
|
|
111
|
+
const platform = requiredString(options, "platform").toLowerCase();
|
|
112
|
+
if (platform !== "android" && platform !== "ios") {
|
|
113
|
+
throw new Error("LogBrew React Native release-artifact helper option platform must be android or ios");
|
|
114
|
+
}
|
|
115
|
+
return platform;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param {string} endpoint
|
|
120
|
+
* @returns {URL}
|
|
121
|
+
*/
|
|
122
|
+
function parseUploadUrl(endpoint) {
|
|
123
|
+
try {
|
|
124
|
+
return new URL(endpoint);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
throw new Error(`upload endpoint is not a valid URL: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {string} endpoint
|
|
132
|
+
* @returns {URL}
|
|
133
|
+
*/
|
|
134
|
+
function parseUploadEndpoint(endpoint) {
|
|
135
|
+
const parsed = parseUploadUrl(endpoint);
|
|
136
|
+
if (!HTTP_PROTOCOLS.has(parsed.protocol)) {
|
|
137
|
+
throw new Error("release artifact upload proof endpoint must use http or https");
|
|
138
|
+
}
|
|
139
|
+
return parsed;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {URL} parsed
|
|
144
|
+
* @returns {boolean}
|
|
145
|
+
*/
|
|
146
|
+
function isLoopbackUploadEndpoint(parsed) {
|
|
147
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
148
|
+
return (
|
|
149
|
+
hostname === "localhost" ||
|
|
150
|
+
hostname === "[::1]" ||
|
|
151
|
+
hostname === "::1" ||
|
|
152
|
+
(net.isIP(hostname) !== NOT_AN_IP && (hostname.startsWith("127.") || hostname === "::1"))
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @param {string} endpoint
|
|
158
|
+
* @param {boolean} allowHosted
|
|
159
|
+
* @returns {void}
|
|
160
|
+
*/
|
|
161
|
+
function requireUploadEndpoint(endpoint, allowHosted) {
|
|
162
|
+
const parsed = parseUploadEndpoint(endpoint);
|
|
163
|
+
if (isLoopbackUploadEndpoint(parsed)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!allowHosted) {
|
|
167
|
+
throw new Error("release artifact hosted upload requires explicit allowHostedUpload; use loopback endpoints for local proof");
|
|
168
|
+
}
|
|
169
|
+
if (endpoint !== HOSTED_UPLOAD_ENDPOINT) {
|
|
170
|
+
throw new Error(`hosted release artifact uploads must use ${HOSTED_UPLOAD_ENDPOINT}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
module.exports = {
|
|
175
|
+
field,
|
|
176
|
+
normalizePlatform,
|
|
177
|
+
normalizeStringArray,
|
|
178
|
+
optionalString,
|
|
179
|
+
optionalUploadScalar,
|
|
180
|
+
requireUploadEndpoint,
|
|
181
|
+
requiredString
|
|
182
|
+
};
|