@libo11y/react-native 0.4.0 → 0.6.0
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 +5 -8
- package/dist/env.d.ts +5 -0
- package/dist/env.js +3 -3
- package/dist/expo.d.ts +1 -1
- package/dist/internal.d.ts +4 -3
- package/dist/internal.js +3 -3
- package/dist/platform.d.ts +2 -1
- package/dist/platform.js +3 -2
- package/dist/resource.d.ts +2 -2
- package/dist/resource.js +9 -0
- package/dist/setup.d.ts +8 -6
- package/dist/setup.js +23 -17
- package/dist/storage/queue.js +21 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -56,14 +56,11 @@ imports none of them. Tested on Expo SDK 58 only.
|
|
|
56
56
|
|
|
57
57
|
## Status
|
|
58
58
|
|
|
59
|
-
A preview. The package first ships in `ts/v0.4.0`,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
[`ts/v0.4.0` GitHub Release](https://github.com/jamesainslie/libo11y/releases/tag/ts/v0.4.0),
|
|
64
|
-
whose notes list the exact URL:
|
|
59
|
+
A preview. The package first ships in `ts/v0.4.0`, is published on npm at
|
|
60
|
+
`0.6.0` (and attached as a tarball to the
|
|
61
|
+
[`ts/v0.6.0` GitHub Release](https://github.com/libo11y/libo11y/releases/tag/ts/v0.6.0)),
|
|
62
|
+
and its API can change in a minor release:
|
|
65
63
|
|
|
66
64
|
```sh
|
|
67
|
-
npm install
|
|
68
|
-
https://github.com/jamesainslie/libo11y/releases/download/ts/v0.4.0/libo11y-react-native-0.4.0.tgz
|
|
65
|
+
npm install @libo11y/react-native
|
|
69
66
|
```
|
package/dist/env.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ReactNativeEnv } from "./contracts/env.ts";
|
|
2
2
|
import type { ReactNativeDeps } from "./setup.ts";
|
|
3
|
+
export type { AppLifecycle, AppStateLike, ReactNativeEnv } from "./contracts/env.ts";
|
|
4
|
+
export type { KeyValueStorage } from "./contracts/storage.ts";
|
|
5
|
+
export type { NetworkInstrumentation, NetworkInstrumentationOptions } from "./instrumentation/network.ts";
|
|
6
|
+
export type { ReactNativeDeps } from "./setup.ts";
|
|
7
|
+
export type { StorageQueueOptions } from "./storage/queue.ts";
|
|
3
8
|
/** React Native's AppState, Platform and Dimensions, read when called. */
|
|
4
9
|
export declare function defaultReactNativeEnv(): ReactNativeEnv;
|
|
5
10
|
/** The real dependencies of setupReactNativeWith over env. */
|
package/dist/env.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @libo11y/react-native/env: the real React Native dependencies, for @libo11y/rum-react-native's
|
|
3
|
-
* binding, which wraps them. For libo11y packages only: it follows the package version
|
|
4
|
-
* compatibility promise
|
|
5
|
-
*
|
|
3
|
+
* binding, which wraps them. For libo11y packages only: it follows the package version and carries
|
|
4
|
+
* no compatibility promise. The only module of this package that imports a value from react-native,
|
|
5
|
+
* so node tests never load it (boundary.test.ts enforces that).
|
|
6
6
|
*/
|
|
7
7
|
import { createConsentController, createDelivery, createExporterSet, createHttpTransport, } from "@libo11y/web/portable";
|
|
8
8
|
import { AppState, Dimensions, Platform } from "react-native";
|
package/dist/expo.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type ExpoAppInfo } from "./expo/app-info.ts";
|
|
|
10
10
|
import { type ExpoOptions } from "./expo/options.ts";
|
|
11
11
|
import type { ReactNativeSetupOptions, ReactNativeTelemetry } from "./options.ts";
|
|
12
12
|
export type { KeyValueStorage } from "./contracts/storage.ts";
|
|
13
|
-
export type { ReactNativeSetupOptions, ReactNativeTelemetry } from "./options.ts";
|
|
13
|
+
export type { ReactNativeConsentOptions, ReactNativeInstrumentationOptions, ReactNativeSetupOptions, ReactNativeTelemetry, ReactNativeTransportOptions, } from "./options.ts";
|
|
14
14
|
export type { ExpoAppInfo, ExpoOptions };
|
|
15
15
|
/**
|
|
16
16
|
* A KeyValueStorage with one file per key in the libo11y directory of the app's documents
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @libo11y/react-native/internal: the platform's building blocks, for @libo11y/rum-react-native.
|
|
3
|
-
* For libo11y packages only: it follows the package version
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* For libo11y packages only: it follows the package version and carries no compatibility promise.
|
|
4
|
+
* Nothing reachable from here imports react-native or Expo (boundary.test.ts enforces that), so
|
|
5
|
+
* node tests can load it; the binding takes the real env from ./env.
|
|
6
6
|
*/
|
|
7
7
|
export type { AppLifecycle, AppStateLike, ReactNativeEnv } from "./contracts/env.ts";
|
|
8
8
|
export type { KeyValueStorage } from "./contracts/storage.ts";
|
|
@@ -12,6 +12,7 @@ export { expoFileStorageWith, type FileLike, type FileSystemLike } from "./expo/
|
|
|
12
12
|
export { type ExpoOptions, expoOptionsFrom, withExpoOptions } from "./expo/options.ts";
|
|
13
13
|
export { installNetworkInstrumentation, type NetworkInstrumentation, type NetworkInstrumentationOptions, RN_SCOPE, } from "./instrumentation/network.ts";
|
|
14
14
|
export { appStateLifecycle } from "./lifecycle.ts";
|
|
15
|
+
export type { ReactNativeConsentOptions, ReactNativeInstrumentationOptions, ReactNativeSetupOptions, ReactNativeTelemetry, ReactNativeTransportOptions, } from "./options.ts";
|
|
15
16
|
export { MOBILE_ENV_DEFAULTS, type ReactNativePlatformOptions, reactNativePlatform } from "./platform.ts";
|
|
16
17
|
export { uuidCrypto } from "./random.ts";
|
|
17
18
|
export { detectReactNativeResource, type ReactNativeResourceOptions } from "./resource.ts";
|
package/dist/internal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @libo11y/react-native/internal: the platform's building blocks, for @libo11y/rum-react-native.
|
|
3
|
-
* For libo11y packages only: it follows the package version
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* For libo11y packages only: it follows the package version and carries no compatibility promise.
|
|
4
|
+
* Nothing reachable from here imports react-native or Expo (boundary.test.ts enforces that), so
|
|
5
|
+
* node tests can load it; the binding takes the real env from ./env.
|
|
6
6
|
*/
|
|
7
7
|
export { deviceClassOf } from "./device-class.js";
|
|
8
8
|
export { expoAppInfoFrom } from "./expo/app-info.js";
|
package/dist/platform.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export interface ReactNativePlatformOptions {
|
|
|
24
24
|
/**
|
|
25
25
|
* A React Native Platform, named "react-native": env from browserEnv over MOBILE_ENV_DEFAULTS,
|
|
26
26
|
* detectReactNativeResource, the options' context manager (default upstream's
|
|
27
|
-
* StackContextManager), the exporter set over the delivery
|
|
27
|
+
* StackContextManager), the exporter set over the delivery with the gate as its metric consent
|
|
28
|
+
* boundary, console lines through the console
|
|
28
29
|
* methods captured when the platform is built (so captureConsole cannot recurse), core's own SHA-1
|
|
29
30
|
* (Hermes has no Web Crypto), UUIDs from uuidCrypto, the global console for captureConsole, and
|
|
30
31
|
* the gate. No runtime metrics.
|
package/dist/platform.js
CHANGED
|
@@ -20,7 +20,8 @@ export const MOBILE_ENV_DEFAULTS = {
|
|
|
20
20
|
/**
|
|
21
21
|
* A React Native Platform, named "react-native": env from browserEnv over MOBILE_ENV_DEFAULTS,
|
|
22
22
|
* detectReactNativeResource, the options' context manager (default upstream's
|
|
23
|
-
* StackContextManager), the exporter set over the delivery
|
|
23
|
+
* StackContextManager), the exporter set over the delivery with the gate as its metric consent
|
|
24
|
+
* boundary, console lines through the console
|
|
24
25
|
* methods captured when the platform is built (so captureConsole cannot recurse), core's own SHA-1
|
|
25
26
|
* (Hermes has no Web Crypto), UUIDs from uuidCrypto, the global console for captureConsole, and
|
|
26
27
|
* the gate. No runtime metrics.
|
|
@@ -36,7 +37,7 @@ export function reactNativePlatform(o) {
|
|
|
36
37
|
env: () => vars,
|
|
37
38
|
detectResource: (hermetic) => detectReactNativeResource({ env: o.env, hermetic, vars }),
|
|
38
39
|
contextManager: o.exportOptions.contextManager ?? createContextManager,
|
|
39
|
-
buildExporters: (req) => o.createExporterSet(req, o.delivery, o.endpoints),
|
|
40
|
+
buildExporters: (req) => o.createExporterSet(req, o.delivery, o.endpoints, { gate: o.gate }),
|
|
40
41
|
writeConsoleLine: (line) => log(line),
|
|
41
42
|
writeDiagnosticLine: (line) => warn(line),
|
|
42
43
|
sha1: async (data) => sha1(data),
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The React Native resource, in the two layers core merges. Detected: upstream's telemetry.sdk
|
|
3
|
-
* o11y.rum.platform react_native, os.name (ios or android, the bounded set the gateway keeps for
|
|
2
|
+
* The React Native resource, in the two layers core merges. Detected: upstream's telemetry.sdk.*
|
|
3
|
+
* with telemetry.sdk.language javascript, o11y.rum.platform react_native, os.name (ios or android, the bounded set the gateway keeps for
|
|
4
4
|
* native apps) and o11y.rum.device.class. fromEnv: OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME
|
|
5
5
|
* from the options' env, parsed as the web platform parses them, and empty when hermetic. Nothing
|
|
6
6
|
* else, so the gateway drops and refuses nothing.
|
package/dist/resource.js
CHANGED
|
@@ -3,11 +3,20 @@ import { parseResourceAttributes } from "@libo11y/web/portable";
|
|
|
3
3
|
import { SDK_INFO } from "@opentelemetry/core";
|
|
4
4
|
import { deviceClassOf } from "./device-class.js";
|
|
5
5
|
const OS_NAMES = new Set(["ios", "android"]);
|
|
6
|
+
/**
|
|
7
|
+
* telemetry.sdk.language on React Native. Upstream's SDK_INFO depends on the bundler's conditions:
|
|
8
|
+
* Metro resolves OpenTelemetry's browser build (webjs), jest and Node its node build (nodejs), and
|
|
9
|
+
* neither names Hermes. Semantic conventions have no well-known value for React Native and allow
|
|
10
|
+
* another value when none applies, so this names the language. The gateway keeps it as a public
|
|
11
|
+
* resource attribute and classifies nothing by it.
|
|
12
|
+
*/
|
|
13
|
+
const SDK_LANGUAGE = "javascript";
|
|
6
14
|
/** The detected and environment layers of the React Native resource. */
|
|
7
15
|
export function detectReactNativeResource(o) {
|
|
8
16
|
const sdk = Object.fromEntries(Object.entries(SDK_INFO).filter(([k]) => k.startsWith("telemetry.sdk.")));
|
|
9
17
|
const detected = {
|
|
10
18
|
...sdk,
|
|
19
|
+
"telemetry.sdk.language": SDK_LANGUAGE,
|
|
11
20
|
[ATTR_RUM_PLATFORM]: RUM_PLATFORM_VALUE_REACT_NATIVE,
|
|
12
21
|
...(OS_NAMES.has(o.env.os) ? { "os.name": o.env.os } : {}),
|
|
13
22
|
[ATTR_RUM_DEVICE_CLASS]: deviceClassOf(o.env),
|
package/dist/setup.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { ReactNativeSetupOptions, ReactNativeTelemetry } from "./options.ts
|
|
|
10
10
|
import type { StorageQueueOptions } from "./storage/queue.ts";
|
|
11
11
|
/**
|
|
12
12
|
* What setupReactNativeWith builds on. Internal: the default is the real modules and React
|
|
13
|
-
* Native's AppState and Platform (env.ts); tests and
|
|
13
|
+
* Native's AppState and Platform (env.ts); tests and `@libo11y/rum-react-native`'s binding replace
|
|
14
14
|
* or wrap any of them.
|
|
15
15
|
*/
|
|
16
16
|
export interface ReactNativeDeps {
|
|
@@ -43,10 +43,12 @@ export interface ReactNativeDeps {
|
|
|
43
43
|
* always online), reactNativePlatform, then core with console defaulting to false. The handle is
|
|
44
44
|
* core's Telemetry extended in place with consent and traceFetch.
|
|
45
45
|
*
|
|
46
|
-
* Going to the background flushes every provider; coming back drains the queue.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
46
|
+
* Going to the background flushes every provider; coming back drains the queue. Starting denied
|
|
47
|
+
* empties the queue before the delivery is built. Revoking consent starts emptying the queue, then
|
|
48
|
+
* flushes into the closed gate, also when consent was never granted, which deletes what an earlier
|
|
49
|
+
* launch left. Shutdown shuts core down and then the delivery under the one timeoutMillis deadline,
|
|
50
|
+
* aborting a send still in flight at it and reporting that signal's deadline as missed, then removes
|
|
51
|
+
* the patches and the lifecycle subscription and closes the queue. After setup the queue is drained
|
|
52
|
+
* once, so batches an earlier launch left go out once consent allows.
|
|
51
53
|
*/
|
|
52
54
|
export declare function setupReactNativeWith(options: ReactNativeSetupOptions, deps: ReactNativeDeps, install: boolean): Promise<ReactNativeTelemetry>;
|
package/dist/setup.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* index.ts, passes the real ones from env.ts, the only module that loads react-native.
|
|
4
4
|
*/
|
|
5
5
|
import { createTelemetryWith, O11yError, setupWith, } from "@libo11y/core";
|
|
6
|
-
import { flushInBackground, OTLP_SIGNALS, pristineFetch, resolveEndpoints, } from "@libo11y/web/portable";
|
|
6
|
+
import { flushInBackground, OTLP_SIGNALS, pristineFetch, resolveEndpoints, shutdownWithin, } from "@libo11y/web/portable";
|
|
7
7
|
import { diag } from "@opentelemetry/api";
|
|
8
8
|
import { reactNativePlatform } from "./platform.js";
|
|
9
9
|
import { memoryStorage } from "./storage/memory.js";
|
|
@@ -62,14 +62,17 @@ async function cleanup(steps) {
|
|
|
62
62
|
* always online), reactNativePlatform, then core with console defaulting to false. The handle is
|
|
63
63
|
* core's Telemetry extended in place with consent and traceFetch.
|
|
64
64
|
*
|
|
65
|
-
* Going to the background flushes every provider; coming back drains the queue.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
65
|
+
* Going to the background flushes every provider; coming back drains the queue. Starting denied
|
|
66
|
+
* empties the queue before the delivery is built. Revoking consent starts emptying the queue, then
|
|
67
|
+
* flushes into the closed gate, also when consent was never granted, which deletes what an earlier
|
|
68
|
+
* launch left. Shutdown shuts core down and then the delivery under the one timeoutMillis deadline,
|
|
69
|
+
* aborting a send still in flight at it and reporting that signal's deadline as missed, then removes
|
|
70
|
+
* the patches and the lifecycle subscription and closes the queue. After setup the queue is drained
|
|
71
|
+
* once, so batches an earlier launch left go out once consent allows.
|
|
70
72
|
*/
|
|
71
73
|
export async function setupReactNativeWith(options, deps, install) {
|
|
72
74
|
const hermetic = options.hermetic === true;
|
|
75
|
+
const sdkDisabled = !hermetic && (options.env?.OTEL_SDK_DISABLED ?? "").trim().toLowerCase() === "true";
|
|
73
76
|
requireAbsoluteEndpoints(options, hermetic);
|
|
74
77
|
const t = options.transport ?? {};
|
|
75
78
|
// Only the initial state: respectDoNotTrack and respectGlobalPrivacyControl stay off, because a
|
|
@@ -88,6 +91,10 @@ export async function setupReactNativeWith(options, deps, install) {
|
|
|
88
91
|
let telemetry;
|
|
89
92
|
let built;
|
|
90
93
|
try {
|
|
94
|
+
// A denied start deletes what an earlier launch left before a delivery exists to send it, so a
|
|
95
|
+
// grant later in this launch cannot send batches recorded before the denial. Pending keeps them.
|
|
96
|
+
if (controller.consent.state() === "denied")
|
|
97
|
+
await queue.clear();
|
|
91
98
|
endpoints = resolveEndpoints(options, hermetic);
|
|
92
99
|
const transport = deps.createHttpTransport({
|
|
93
100
|
endpoints,
|
|
@@ -101,6 +108,7 @@ export async function setupReactNativeWith(options, deps, install) {
|
|
|
101
108
|
transport,
|
|
102
109
|
queue,
|
|
103
110
|
gate: controller,
|
|
111
|
+
disabled: sdkDisabled,
|
|
104
112
|
persistFirst: true,
|
|
105
113
|
mode: () => "normal",
|
|
106
114
|
isOnline: () => true,
|
|
@@ -143,15 +151,18 @@ export async function setupReactNativeWith(options, deps, install) {
|
|
|
143
151
|
throw err;
|
|
144
152
|
}
|
|
145
153
|
const activeDelivery = delivery;
|
|
146
|
-
// Revocation: the gate is already closed
|
|
147
|
-
//
|
|
154
|
+
// Revocation: the gate is already closed. The persistent queue is emptied first, whatever the
|
|
155
|
+
// flush does: a flush waits for exports in flight, up to its deadline, and an app killed in that
|
|
156
|
+
// time would otherwise keep the queue for a later grant to send. The flush then drains the SDK
|
|
157
|
+
// buffers into the closed gate, which drops them.
|
|
148
158
|
// Revoking while still pending clears too: it deletes only what an earlier launch left.
|
|
149
159
|
const unregisterRevoke = controller.onRevoke(async () => {
|
|
160
|
+
const cleared = activeDelivery.clear();
|
|
150
161
|
try {
|
|
151
162
|
await telemetry.forceFlush();
|
|
152
163
|
}
|
|
153
164
|
finally {
|
|
154
|
-
await
|
|
165
|
+
await cleared;
|
|
155
166
|
}
|
|
156
167
|
});
|
|
157
168
|
const uninstalls = [];
|
|
@@ -163,14 +174,9 @@ export async function setupReactNativeWith(options, deps, install) {
|
|
|
163
174
|
let shutdownPromise;
|
|
164
175
|
handle.shutdown = (opts) => {
|
|
165
176
|
shutdownPromise ??= (async () => {
|
|
166
|
-
|
|
167
|
-
await
|
|
168
|
-
|
|
169
|
-
...listeners,
|
|
170
|
-
unregisterRevoke,
|
|
171
|
-
() => activeDelivery.shutdown(),
|
|
172
|
-
() => queue.close(),
|
|
173
|
-
]);
|
|
177
|
+
// One deadline: core's providers, then the delivery's drain in what is left of it.
|
|
178
|
+
const report = await shutdownWithin(coreShutdown, activeDelivery, opts);
|
|
179
|
+
await cleanup([...uninstalls, ...listeners, unregisterRevoke, () => queue.close()]);
|
|
174
180
|
return report;
|
|
175
181
|
})();
|
|
176
182
|
return shutdownPromise;
|
package/dist/storage/queue.js
CHANGED
|
@@ -65,7 +65,7 @@ export async function openStorageQueue(opts) {
|
|
|
65
65
|
// say) is dropped after MAX_READ_FAILURES, so it cannot hold the queue up for its whole age.
|
|
66
66
|
const readFailures = new Map();
|
|
67
67
|
let chain = Promise.resolve();
|
|
68
|
-
const serial = (fallback, fn) => {
|
|
68
|
+
const serial = (fallback, fn, requireSuccess) => {
|
|
69
69
|
const run = async () => {
|
|
70
70
|
if (closed)
|
|
71
71
|
return fallback;
|
|
@@ -74,6 +74,8 @@ export async function openStorageQueue(opts) {
|
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
76
|
diag.warn("libo11y: react-native: a retry queue operation failed", err);
|
|
77
|
+
if (requireSuccess)
|
|
78
|
+
throw err;
|
|
77
79
|
return fallback;
|
|
78
80
|
}
|
|
79
81
|
};
|
|
@@ -99,10 +101,9 @@ export async function openStorageQueue(opts) {
|
|
|
99
101
|
})),
|
|
100
102
|
}));
|
|
101
103
|
};
|
|
102
|
-
// Removes
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
const cleanup = async () => {
|
|
104
|
+
// Removes bodies no entry owns, once per queue and again after clear. Only a strict clear fails
|
|
105
|
+
// when storage cannot list or remove them.
|
|
106
|
+
const cleanup = async (requireSuccess) => {
|
|
106
107
|
if (cleaned || closed)
|
|
107
108
|
return;
|
|
108
109
|
cleaned = true;
|
|
@@ -111,12 +112,20 @@ export async function openStorageQueue(opts) {
|
|
|
111
112
|
keys = await storage.getAllKeys();
|
|
112
113
|
}
|
|
113
114
|
catch (err) {
|
|
115
|
+
if (requireSuccess) {
|
|
116
|
+
cleaned = false;
|
|
117
|
+
throw err;
|
|
118
|
+
}
|
|
114
119
|
diag.warn("libo11y: react-native: listing the retry queue's orphans failed", err);
|
|
115
120
|
return;
|
|
116
121
|
}
|
|
117
122
|
for (const key of keys) {
|
|
118
123
|
if (key.startsWith(bodyPrefix) && !entries.has(key.slice(bodyPrefix.length))) {
|
|
119
124
|
await storage.removeItem(key).catch((err) => {
|
|
125
|
+
if (requireSuccess) {
|
|
126
|
+
cleaned = false;
|
|
127
|
+
throw err;
|
|
128
|
+
}
|
|
120
129
|
diag.warn("libo11y: react-native: removing an orphan of the retry queue failed", err);
|
|
121
130
|
});
|
|
122
131
|
}
|
|
@@ -155,7 +164,7 @@ export async function openStorageQueue(opts) {
|
|
|
155
164
|
}
|
|
156
165
|
return entry;
|
|
157
166
|
}),
|
|
158
|
-
claim: (now, limit, leaseMillis) => serial([], async () => {
|
|
167
|
+
claim: (now, limit, leaseMillis, match) => serial([], async () => {
|
|
159
168
|
await cleanup();
|
|
160
169
|
const out = [];
|
|
161
170
|
const gone = [];
|
|
@@ -185,6 +194,9 @@ export async function openStorageQueue(opts) {
|
|
|
185
194
|
gone.push(e.id);
|
|
186
195
|
continue;
|
|
187
196
|
}
|
|
197
|
+
// Checked with the body read and before the lease, so a refused entry stays claimable.
|
|
198
|
+
if (match !== undefined && !match({ ...e, body }))
|
|
199
|
+
continue;
|
|
188
200
|
const leased = { ...e, leaseUntil: now + leaseMillis };
|
|
189
201
|
entries.set(e.id, leased);
|
|
190
202
|
out.push({ ...leased, body });
|
|
@@ -209,13 +221,13 @@ export async function openStorageQueue(opts) {
|
|
|
209
221
|
await drop(known);
|
|
210
222
|
await writeIndex();
|
|
211
223
|
}),
|
|
212
|
-
clear: () => serial(undefined, async () => {
|
|
224
|
+
clear: (requireSuccess) => serial(undefined, async () => {
|
|
213
225
|
entries.clear();
|
|
214
226
|
readFailures.clear();
|
|
215
227
|
cleaned = false;
|
|
216
228
|
await storage.removeItem(indexKey);
|
|
217
|
-
await cleanup();
|
|
218
|
-
}),
|
|
229
|
+
await cleanup(requireSuccess);
|
|
230
|
+
}, requireSuccess),
|
|
219
231
|
releaseLeases: () => serial(undefined, async () => {
|
|
220
232
|
for (const [id, e] of entries)
|
|
221
233
|
if (e.leaseUntil !== 0)
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The `@libo11y/react-native` package version. scripts/release.ts keeps it equal to package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.6.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The `@libo11y/react-native` package version. scripts/release.ts keeps it equal to package.json. */
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.6.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libo11y/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The libo11y React Native platform for TypeScript: setup over the OpenTelemetry JS 3.x providers on Hermes, the mobile resource, an OTLP/HTTP transport with a persistent retry queue on device storage, AppState flushing, the consent gate, and fetch and XHR spans.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/
|
|
28
|
+
"url": "git+https://github.com/libo11y/libo11y.git",
|
|
29
29
|
"directory": "ts/packages/react-native"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@libo11y/core": "0.
|
|
33
|
-
"@libo11y/spec": "0.
|
|
34
|
-
"@libo11y/web": "0.
|
|
35
|
-
"@opentelemetry/api": "1.10.0",
|
|
32
|
+
"@libo11y/core": "0.6.0",
|
|
33
|
+
"@libo11y/spec": "0.6.0",
|
|
34
|
+
"@libo11y/web": "0.6.0",
|
|
36
35
|
"@opentelemetry/core": "3.1.1"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
38
|
+
"@opentelemetry/api": ">=1.10.0 <1.11.0",
|
|
39
39
|
"expo-application": ">=58.0.0",
|
|
40
40
|
"expo-device": ">=58.0.0",
|
|
41
41
|
"expo-file-system": ">=58.0.0",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@libo11y/test": "0.
|
|
60
|
+
"@libo11y/test": "0.6.0",
|
|
61
|
+
"@opentelemetry/api": "1.10.0",
|
|
61
62
|
"@opentelemetry/sdk-trace": "3.1.1",
|
|
62
63
|
"@types/react": "19.3.0",
|
|
63
64
|
"react": "19.3.1",
|