@evolu/react-native 3.0.0 → 3.0.2
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/dist/PlatformLive.d.ts.map +1 -1
- package/dist/PlatformLive.js +3 -4
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/package.json +6 -6
- package/src/PlatformLive.ts +3 -5
- package/src/index.ts +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformLive.d.ts","sourceRoot":"","sources":["../src/PlatformLive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,YAAY,EACZ,QAAQ,EACT,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAoB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIjD,eAAO,MAAM,gBAAgB,yCAA8C,CAAC;AAE5E,eAAO,MAAM,aAAa,sCAA+C,CAAC;AAE1E,eAAO,MAAM,YAAY,qCAexB,CAAC;AAEF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"PlatformLive.d.ts","sourceRoot":"","sources":["../src/PlatformLive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,YAAY,EACZ,QAAQ,EACT,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAoB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIjD,eAAO,MAAM,gBAAgB,yCAA8C,CAAC;AAE5E,eAAO,MAAM,aAAa,sCAA+C,CAAC;AAE1E,eAAO,MAAM,YAAY,qCAexB,CAAC;AAEF,eAAO,MAAM,YAAY,qCA4BxB,CAAC;AAEF,eAAO,MAAM,SAAS,kCAYrB,CAAC"}
|
package/dist/PlatformLive.js
CHANGED
|
@@ -22,11 +22,11 @@ export const SyncLockLive = Layer.effect(SyncLock, Effect.sync(() => {
|
|
|
22
22
|
});
|
|
23
23
|
}));
|
|
24
24
|
export const AppStateLive = Layer.succeed(AppState, AppState.of({
|
|
25
|
-
init: ({
|
|
25
|
+
init: ({ onRequestSync }) => {
|
|
26
26
|
let appStateStatus = ReactNativeAppState.currentState;
|
|
27
27
|
ReactNativeAppState.addEventListener("change", (current) => {
|
|
28
28
|
if (appStateStatus.match(/inactive|background/) && current === "active")
|
|
29
|
-
|
|
29
|
+
onRequestSync();
|
|
30
30
|
appStateStatus = current;
|
|
31
31
|
});
|
|
32
32
|
let netInfoState = null;
|
|
@@ -34,10 +34,9 @@ export const AppStateLive = Layer.succeed(AppState, AppState.of({
|
|
|
34
34
|
if (netInfoState?.isInternetReachable === false &&
|
|
35
35
|
current.isConnected &&
|
|
36
36
|
current.isInternetReachable)
|
|
37
|
-
|
|
37
|
+
onRequestSync();
|
|
38
38
|
netInfoState = current;
|
|
39
39
|
});
|
|
40
|
-
onReconnect();
|
|
41
40
|
},
|
|
42
41
|
reset: Effect.sync(() => {
|
|
43
42
|
if (process.env.NODE_ENV === "development")
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,18 @@ export type { EvoluError, InvalidMnemonicError, Mnemonic, Owner, OwnerId, SyncSt
|
|
|
5
5
|
export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
|
|
6
6
|
export * from "@evolu/common-react";
|
|
7
7
|
/**
|
|
8
|
-
* Create Evolu for
|
|
8
|
+
* Create Evolu for React Native.
|
|
9
|
+
*
|
|
10
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
11
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
9
12
|
*
|
|
10
13
|
* @example
|
|
11
14
|
* import * as S from "@effect/schema/Schema";
|
|
12
|
-
* import {
|
|
15
|
+
* import {
|
|
16
|
+
* NonEmptyString1000,
|
|
17
|
+
* createEvolu,
|
|
18
|
+
* id,
|
|
19
|
+
* } from "@evolu/react-native";
|
|
13
20
|
*
|
|
14
21
|
* const TodoId = id("Todo");
|
|
15
22
|
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
@@ -21,6 +28,7 @@ export * from "@evolu/common-react";
|
|
|
21
28
|
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
22
29
|
*
|
|
23
30
|
* const Database = S.struct({
|
|
31
|
+
* // _todo is local-only table
|
|
24
32
|
* todo: TodoTable,
|
|
25
33
|
* });
|
|
26
34
|
* type Database = S.Schema.To<typeof Database>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,KAAK,EAGL,oBAAoB,EACpB,QAAQ,EAER,MAAM,EAIP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAavC,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,EAAE,GACH,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,cAAc,qBAAqB,CAAC;AAepC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,KAAK,EAGL,oBAAoB,EACpB,QAAQ,EAER,MAAM,EAIP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAavC,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,EAAE,GACH,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,cAAc,qBAAqB,CAAC;AAepC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,wIAAmC,CAAC;AAE5D,0CAA0C;AAC1C,eAAO,MAAM,aAAa,EAAE,CAC1B,QAAQ,EAAE,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,oBAAoB,EAAE,QAAQ,CAGjD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,11 +12,18 @@ export * from "@evolu/common-react";
|
|
|
12
12
|
/** Evolu for native platform. */
|
|
13
13
|
const EvoluNativeLive = EvoluCommonLive.pipe(Layer.provide(Layer.mergeAll(FlushSyncLive, AppStateLive, DbWorkerLive)), Layer.provide(Layer.mergeAll(Bip39Live, NanoIdLive, SqliteLive, SyncWorkerLive)), Layer.provide(Layer.mergeAll(SecretBoxLive, SyncLockLive, FetchLive)));
|
|
14
14
|
/**
|
|
15
|
-
* Create Evolu for
|
|
15
|
+
* Create Evolu for React Native.
|
|
16
|
+
*
|
|
17
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
18
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
16
19
|
*
|
|
17
20
|
* @example
|
|
18
21
|
* import * as S from "@effect/schema/Schema";
|
|
19
|
-
* import {
|
|
22
|
+
* import {
|
|
23
|
+
* NonEmptyString1000,
|
|
24
|
+
* createEvolu,
|
|
25
|
+
* id,
|
|
26
|
+
* } from "@evolu/react-native";
|
|
20
27
|
*
|
|
21
28
|
* const TodoId = id("Todo");
|
|
22
29
|
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
@@ -28,6 +35,7 @@ const EvoluNativeLive = EvoluCommonLive.pipe(Layer.provide(Layer.mergeAll(FlushS
|
|
|
28
35
|
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
29
36
|
*
|
|
30
37
|
* const Database = S.struct({
|
|
38
|
+
* // _todo is local-only table
|
|
31
39
|
* todo: TodoTable,
|
|
32
40
|
* });
|
|
33
41
|
* type Database = S.Schema.To<typeof Database>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evolu/react-native",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Evolu for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"evolu",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"expo": "^49.0.21",
|
|
39
39
|
"expo-sqlite": "~11.3.3",
|
|
40
40
|
"react-native": "^0.72.6",
|
|
41
|
-
"typescript": "^5.3.
|
|
42
|
-
"vitest": "^0.
|
|
43
|
-
"@evolu/common": "2.
|
|
44
|
-
"@evolu/common-react": "3.0.
|
|
41
|
+
"typescript": "^5.3.3",
|
|
42
|
+
"vitest": "^1.0.1",
|
|
43
|
+
"@evolu/common": "2.2.0",
|
|
44
|
+
"@evolu/common-react": "3.0.1",
|
|
45
45
|
"@evolu/tsconfig": "0.0.2",
|
|
46
46
|
"eslint-config-evolu": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@evolu/common-react": "^3.0.
|
|
49
|
+
"@evolu/common-react": "^3.0.1",
|
|
50
50
|
"expo": "^49.0.20",
|
|
51
51
|
"expo-sqlite": "~11.3.3",
|
|
52
52
|
"react-native": "^0.72.4"
|
package/src/PlatformLive.ts
CHANGED
|
@@ -42,11 +42,11 @@ export const SyncLockLive = Layer.effect(
|
|
|
42
42
|
export const AppStateLive = Layer.succeed(
|
|
43
43
|
AppState,
|
|
44
44
|
AppState.of({
|
|
45
|
-
init: ({
|
|
45
|
+
init: ({ onRequestSync }) => {
|
|
46
46
|
let appStateStatus = ReactNativeAppState.currentState;
|
|
47
47
|
ReactNativeAppState.addEventListener("change", (current): void => {
|
|
48
48
|
if (appStateStatus.match(/inactive|background/) && current === "active")
|
|
49
|
-
|
|
49
|
+
onRequestSync();
|
|
50
50
|
appStateStatus = current;
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -57,11 +57,9 @@ export const AppStateLive = Layer.succeed(
|
|
|
57
57
|
current.isConnected &&
|
|
58
58
|
current.isInternetReachable
|
|
59
59
|
)
|
|
60
|
-
|
|
60
|
+
onRequestSync();
|
|
61
61
|
netInfoState = current;
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
onReconnect();
|
|
65
63
|
},
|
|
66
64
|
|
|
67
65
|
reset: Effect.sync(() => {
|
package/src/index.ts
CHANGED
|
@@ -67,11 +67,18 @@ const EvoluNativeLive: Layer.Layer<
|
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* Create Evolu for
|
|
70
|
+
* Create Evolu for React Native.
|
|
71
|
+
*
|
|
72
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
73
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
71
74
|
*
|
|
72
75
|
* @example
|
|
73
76
|
* import * as S from "@effect/schema/Schema";
|
|
74
|
-
* import {
|
|
77
|
+
* import {
|
|
78
|
+
* NonEmptyString1000,
|
|
79
|
+
* createEvolu,
|
|
80
|
+
* id,
|
|
81
|
+
* } from "@evolu/react-native";
|
|
75
82
|
*
|
|
76
83
|
* const TodoId = id("Todo");
|
|
77
84
|
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
@@ -83,6 +90,7 @@ const EvoluNativeLive: Layer.Layer<
|
|
|
83
90
|
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
84
91
|
*
|
|
85
92
|
* const Database = S.struct({
|
|
93
|
+
* // _todo is local-only table
|
|
86
94
|
* todo: TodoTable,
|
|
87
95
|
* });
|
|
88
96
|
* type Database = S.Schema.To<typeof Database>;
|