@voltro/react-native 0.84.0 → 0.86.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/CHANGELOG.md +1215 -0
- package/THIRD-PARTY-NOTICES.md +5 -89
- package/dist/backgroundSync.js +47 -0
- package/dist/backgroundSyncTask.js +31 -0
- package/dist/connection.js +51 -0
- package/dist/deepLink.js +1 -0
- package/dist/{devices-BjXAU-8I.js → devices.js} +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +11 -419
- package/dist/mobileRuntime.js +57 -0
- package/dist/persistence.js +63 -0
- package/dist/platform.js +79 -0
- package/dist/schema.js +1 -1
- package/dist/sqlite.js +60 -0
- package/dist/useBackgroundSync.js +65 -0
- package/package.json +4 -4
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -1,70 +1,14 @@
|
|
|
1
1
|
# Third-Party Notices — @voltro/react-native
|
|
2
2
|
|
|
3
|
-
This package
|
|
3
|
+
This package uses the open-source software listed below. Each is the
|
|
4
4
|
property of its respective copyright holders and is used under the terms of
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/react-native itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (14 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## @effect/experimental@0.61.1
|
|
13
|
-
|
|
14
|
-
License: MIT
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
MIT License
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2023-present The Contributors
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
-
in the Software without restriction, including without limitation the rights
|
|
24
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
-
furnished to do so, subject to the following conditions:
|
|
27
|
-
|
|
28
|
-
The above copyright notice and this permission notice shall be included in all
|
|
29
|
-
copies or substantial portions of the Software.
|
|
30
|
-
|
|
31
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
-
SOFTWARE.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## @effect/sql@0.52.1
|
|
41
|
-
|
|
42
|
-
License: MIT
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
MIT License
|
|
46
|
-
|
|
47
|
-
Copyright (c) 2023-present The Contributors
|
|
48
|
-
|
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
-
in the Software without restriction, including without limitation the rights
|
|
52
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
-
furnished to do so, subject to the following conditions:
|
|
55
|
-
|
|
56
|
-
The above copyright notice and this permission notice shall be included in all
|
|
57
|
-
copies or substantial portions of the Software.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
-
SOFTWARE.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
12
|
## @tanstack/devtools-event-client@0.4.4
|
|
69
13
|
|
|
70
14
|
License: MIT
|
|
@@ -261,34 +205,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
261
205
|
SOFTWARE.
|
|
262
206
|
```
|
|
263
207
|
|
|
264
|
-
## layerr@3.0.0
|
|
265
|
-
|
|
266
|
-
License: MIT
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
MIT License
|
|
270
|
-
|
|
271
|
-
Copyright (c) 2020 Perry Mitchell
|
|
272
|
-
|
|
273
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
274
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
275
|
-
in the Software without restriction, including without limitation the rights
|
|
276
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
277
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
278
|
-
furnished to do so, subject to the following conditions:
|
|
279
|
-
|
|
280
|
-
The above copyright notice and this permission notice shall be included in all
|
|
281
|
-
copies or substantial portions of the Software.
|
|
282
|
-
|
|
283
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
284
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
285
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
286
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
287
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
288
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
289
|
-
SOFTWARE.
|
|
290
|
-
```
|
|
291
|
-
|
|
292
208
|
## lib0@0.2.117
|
|
293
209
|
|
|
294
210
|
License: MIT
|
|
@@ -525,14 +441,14 @@ Apache License
|
|
|
525
441
|
limitations under the License.
|
|
526
442
|
```
|
|
527
443
|
|
|
528
|
-
##
|
|
444
|
+
## ulid@3.0.2
|
|
529
445
|
|
|
530
446
|
License: MIT
|
|
531
447
|
|
|
532
448
|
```
|
|
533
|
-
MIT License
|
|
449
|
+
The MIT License (MIT)
|
|
534
450
|
|
|
535
|
-
Copyright (c)
|
|
451
|
+
Copyright (c) 2017 Alizain Feerasta
|
|
536
452
|
|
|
537
453
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
538
454
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/backgroundSync.ts
|
|
2
|
+
var e = {
|
|
3
|
+
status: "idle",
|
|
4
|
+
isForeground: !0,
|
|
5
|
+
lastSyncAt: void 0,
|
|
6
|
+
lastAttemptAt: void 0,
|
|
7
|
+
lastError: void 0,
|
|
8
|
+
successCount: 0,
|
|
9
|
+
failureCount: 0
|
|
10
|
+
}, t = (t, n) => {
|
|
11
|
+
switch (n.type) {
|
|
12
|
+
case "foreground": return t.isForeground ? t : {
|
|
13
|
+
...t,
|
|
14
|
+
isForeground: !0
|
|
15
|
+
};
|
|
16
|
+
case "background": return t.isForeground ? {
|
|
17
|
+
...t,
|
|
18
|
+
isForeground: !1
|
|
19
|
+
} : t;
|
|
20
|
+
case "syncStarted": return t.status === "syncing" ? t : {
|
|
21
|
+
...t,
|
|
22
|
+
status: "syncing",
|
|
23
|
+
lastAttemptAt: n.at,
|
|
24
|
+
lastError: void 0
|
|
25
|
+
};
|
|
26
|
+
case "syncSucceeded": return {
|
|
27
|
+
...t,
|
|
28
|
+
status: "success",
|
|
29
|
+
lastSyncAt: n.at,
|
|
30
|
+
lastError: void 0,
|
|
31
|
+
successCount: t.successCount + 1,
|
|
32
|
+
failureCount: 0
|
|
33
|
+
};
|
|
34
|
+
case "syncFailed": return {
|
|
35
|
+
...t,
|
|
36
|
+
status: "error",
|
|
37
|
+
lastError: n.error,
|
|
38
|
+
failureCount: t.failureCount + 1
|
|
39
|
+
};
|
|
40
|
+
case "reset": return {
|
|
41
|
+
...e,
|
|
42
|
+
isForeground: t.isForeground
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, n = (e, t, n, r = !1) => !(!n.enabled || e.status === "syncing" || !r && !e.isForeground || !r && n.intervalMs > 0 && e.lastAttemptAt !== void 0 && t - e.lastAttemptAt < n.intervalMs);
|
|
46
|
+
//#endregion
|
|
47
|
+
export { t as backgroundSyncReducer, e as initialBackgroundSyncState, n as shouldSync };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/backgroundSyncTask.ts
|
|
2
|
+
var e = "voltro-background-sync", t = (e) => {
|
|
3
|
+
let t = e.name ?? "voltro-background-sync", n = e.backgroundFetch.BackgroundFetchResult, r = async () => {
|
|
4
|
+
try {
|
|
5
|
+
let t = await e.run() ?? "no-data";
|
|
6
|
+
return e.onOutcome?.(t), t;
|
|
7
|
+
} catch (t) {
|
|
8
|
+
return e.onOutcome?.("failed", t), "failed";
|
|
9
|
+
}
|
|
10
|
+
}, i = (e) => e === "new-data" ? n.NewData : e === "no-data" ? n.NoData : n.Failed;
|
|
11
|
+
return e.taskManager.defineTask(t, async ({ error: t }) => t ? (e.onOutcome?.("failed", t), n.Failed) : i(await r())), {
|
|
12
|
+
name: t,
|
|
13
|
+
register: async () => {
|
|
14
|
+
e.taskManager.isTaskRegisteredAsync && await e.taskManager.isTaskRegisteredAsync(t) || await e.backgroundFetch.registerTaskAsync(t, {
|
|
15
|
+
minimumInterval: e.minimumIntervalSeconds ?? 900,
|
|
16
|
+
stopOnTerminate: !(e.survivesTermination ?? !0),
|
|
17
|
+
startOnBoot: e.startOnBoot ?? !0
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
unregister: () => e.backgroundFetch.unregisterTaskAsync(t),
|
|
21
|
+
availability: async () => {
|
|
22
|
+
let t = e.backgroundFetch;
|
|
23
|
+
if (!t.getStatusAsync || !t.BackgroundFetchStatus) return "unknown";
|
|
24
|
+
let n = await t.getStatusAsync();
|
|
25
|
+
return n === t.BackgroundFetchStatus.Available ? "available" : n === t.BackgroundFetchStatus.Denied ? "denied" : n === t.BackgroundFetchStatus.Restricted ? "restricted" : "unknown";
|
|
26
|
+
},
|
|
27
|
+
runNow: r
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { e as DEFAULT_BACKGROUND_SYNC_TASK, t as defineBackgroundSyncTask };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { browserOnlineSource as e, browserOnlineSource as t } from "@voltro/client";
|
|
2
|
+
import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
|
|
3
|
+
//#region src/connection.tsx
|
|
4
|
+
var o = {
|
|
5
|
+
localFirst: !0,
|
|
6
|
+
optimistic: !0,
|
|
7
|
+
syncOnForeground: !0,
|
|
8
|
+
syncIntervalMs: 3e5,
|
|
9
|
+
showSyncStatus: !0,
|
|
10
|
+
retryBackoffMs: [
|
|
11
|
+
1e3,
|
|
12
|
+
5e3,
|
|
13
|
+
15e3,
|
|
14
|
+
6e4
|
|
15
|
+
]
|
|
16
|
+
}, s = (e, t) => e ? t > 0 ? "degraded" : "connected" : "offline", c = (e) => {
|
|
17
|
+
let t = (e) => typeof e.isInternetReachable == "boolean" ? e.isInternetReachable : e.isConnected === !0, n = !0;
|
|
18
|
+
return {
|
|
19
|
+
read: () => n,
|
|
20
|
+
subscribe: (r) => {
|
|
21
|
+
let i = e.addEventListener((e) => {
|
|
22
|
+
n = t(e), r(n);
|
|
23
|
+
});
|
|
24
|
+
return e.fetch?.().then((e) => {
|
|
25
|
+
n = t(e), r(n);
|
|
26
|
+
}).catch(() => {}), i;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}, l = (t) => {
|
|
30
|
+
let o = t?.onlineSource ?? e, [c, l] = a(() => o.read()), [u, d] = a(0), [f, p] = a(void 0), m = i(!0);
|
|
31
|
+
r(() => (m.current = !0, () => {
|
|
32
|
+
m.current = !1;
|
|
33
|
+
}), []), r(() => o.subscribe((e) => {
|
|
34
|
+
l(e), e && d(0);
|
|
35
|
+
}), [o]);
|
|
36
|
+
let h = n(() => {
|
|
37
|
+
m.current && (d((e) => e + 1), p(Date.now()));
|
|
38
|
+
}, []), g = n(() => {
|
|
39
|
+
m.current && d(0);
|
|
40
|
+
}, []);
|
|
41
|
+
return {
|
|
42
|
+
status: s(c, u),
|
|
43
|
+
online: c,
|
|
44
|
+
failureCount: u,
|
|
45
|
+
lastFailureAt: f,
|
|
46
|
+
reportFailure: h,
|
|
47
|
+
reportSuccess: g
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { t as browserOnlineSource, s as deriveConnectionStatus, c as netInfoOnlineSource, o as offlineFirstDefaults, l as useMobileConnectionStatus };
|
package/dist/deepLink.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { deepLinkHref, defineDeepLink, dispatchDeepLink, matchDeepLink, matchFirstDeepLink, runDeepLink } from "@voltro/client";
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { StoreStorageProvider } from '@voltro/client';
|
|
|
27
27
|
import { SupervisorHandle } from '@voltro/client';
|
|
28
28
|
import { TokenStore } from '@voltro/client';
|
|
29
29
|
import { UpdateChannel } from '@voltro/client';
|
|
30
|
+
import { WebSocketConstructorOptions } from '@voltro/client';
|
|
30
31
|
|
|
31
32
|
export declare const appStateLifecycle: (appState: AppStateLike) => LifecycleSource;
|
|
32
33
|
|
|
@@ -227,7 +228,7 @@ export declare const DEFAULT_BACKGROUND_SYNC_TASK = "voltro-background-sync";
|
|
|
227
228
|
/** The default constructor: React Native's global `WebSocket`. Exported so the
|
|
228
229
|
* refusal below is testable — an untestable error message is one nobody has
|
|
229
230
|
* ever read. */
|
|
230
|
-
export declare const defaultWebSocketConstructor: (url: string,
|
|
231
|
+
export declare const defaultWebSocketConstructor: (url: string, options?: WebSocketConstructorOptions) => WebSocket;
|
|
231
232
|
|
|
232
233
|
/** `expo-task-manager` requires `defineTask` at module scope, once; this
|
|
233
234
|
* keeps the task body reachable from there while `register` stays lazy. */
|
|
@@ -631,7 +632,7 @@ export declare interface StartMobileApisOptions {
|
|
|
631
632
|
* provides. Injected so this module can be tested without a socket — and so
|
|
632
633
|
* an app on a runtime with a different WebSocket can say so.
|
|
633
634
|
*/
|
|
634
|
-
readonly webSocketConstructor?: (url: string,
|
|
635
|
+
readonly webSocketConstructor?: (url: string, options?: WebSocketConstructorOptions) => WebSocket;
|
|
635
636
|
/** Override the retry schedule (default: 500ms doubling, capped at 5s). */
|
|
636
637
|
readonly retryDelayMs?: (attempt: number) => number;
|
|
637
638
|
}
|
|
@@ -733,6 +734,6 @@ export declare interface UseMobileConnectionStatusOptions {
|
|
|
733
734
|
* RN needs no connect-timeout shim (web has one): a failed connect on a device
|
|
734
735
|
* fires `error` and then `close`.
|
|
735
736
|
*/
|
|
736
|
-
export declare const wireSocket: (construct: (url: string,
|
|
737
|
+
export declare const wireSocket: (construct: (url: string, options?: WebSocketConstructorOptions) => WebSocket, onOpen: () => void, onIssue: (kind: "close" | "error" | "connect-timeout") => void) => (url: string, options?: WebSocketConstructorOptions) => WebSocket;
|
|
737
738
|
|
|
738
739
|
export { }
|