@evolu/react-native 2.0.1 → 3.0.1
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/index.d.ts +25 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -22
- package/package.json +5 -5
- package/src/index.ts +29 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
import { Config, InvalidMnemonicError, Mnemonic, Schema } from "@evolu/common";
|
|
1
|
+
import { Config, Evolu, InvalidMnemonicError, Mnemonic, Schema } from "@evolu/common";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
export { Id, NonEmptyString1000, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, id, } from "@evolu/common";
|
|
4
4
|
export type { EvoluError, InvalidMnemonicError, Mnemonic, Owner, OwnerId, SyncState, Timestamp, TimestampError, UnexpectedError, } from "@evolu/common";
|
|
5
5
|
export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
|
|
6
|
+
export * from "@evolu/common-react";
|
|
6
7
|
/**
|
|
7
8
|
* Create Evolu for React Native.
|
|
8
9
|
*
|
|
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.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* @example
|
|
14
|
+
* import * as S from "@effect/schema/Schema";
|
|
15
|
+
* import {
|
|
16
|
+
* NonEmptyString1000,
|
|
17
|
+
* createEvolu,
|
|
18
|
+
* id,
|
|
19
|
+
* } from "@evolu/react-native";
|
|
14
20
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
21
|
+
* const TodoId = id("Todo");
|
|
22
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
17
23
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
24
|
+
* const TodoTable = S.struct({
|
|
25
|
+
* id: TodoId,
|
|
26
|
+
* title: NonEmptyString1000,
|
|
27
|
+
* });
|
|
28
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
23
29
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* const Database = S.struct({
|
|
31
|
+
* // _todo is local-only table
|
|
32
|
+
* todo: TodoTable,
|
|
33
|
+
* });
|
|
34
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
27
35
|
*
|
|
28
|
-
*
|
|
29
|
-
* Evolu.create(Database);
|
|
30
|
-
* ```
|
|
36
|
+
* const evolu = createEvolu(Database);
|
|
31
37
|
*/
|
|
32
|
-
export declare const
|
|
38
|
+
export declare const createEvolu: <From, To extends Schema>(schema: import("@effect/schema/Schema").Schema<From, To>, config?: Partial<Config> | undefined) => Evolu<To>;
|
|
33
39
|
/** Parse a string to {@link Mnemonic}. */
|
|
34
40
|
export declare const parseMnemonic: (mnemonic: string) => Effect.Effect<never, InvalidMnemonicError, Mnemonic>;
|
|
35
41
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import { Bip39, DbWorkerLive, EvoluCommonLive, FetchLive, NanoIdLive, SecretBoxLive, SyncWorkerLive, } from "@evolu/common";
|
|
2
|
-
import { EvoluReactLive, makeCreateEvoluReact } from "@evolu/common-react";
|
|
1
|
+
import { Bip39, DbWorkerLive, EvoluCommonLive, FetchLive, NanoIdLive, SecretBoxLive, SyncWorkerLive, makeCreateEvolu, } from "@evolu/common";
|
|
3
2
|
import { Effect, Layer } from "effect";
|
|
4
3
|
import { AppStateLive, Bip39Live, FlushSyncLive, SyncLockLive, } from "./PlatformLive.js";
|
|
5
4
|
import { SqliteLive } from "./SqliteLive.js";
|
|
6
|
-
// export * from "@evolu/common/public"
|
|
7
|
-
//
|
|
5
|
+
// export * from "@evolu/common/public"
|
|
6
|
+
// https://github.com/facebook/metro/issues/1128
|
|
7
|
+
// So we have to export manually.
|
|
8
8
|
// TODO: Recheck after RN 0.73 release.
|
|
9
9
|
export { Id, NonEmptyString1000, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, id, } from "@evolu/common";
|
|
10
10
|
export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
|
|
11
|
+
export * from "@evolu/common-react";
|
|
11
12
|
/** Evolu for native platform. */
|
|
12
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)));
|
|
13
14
|
/**
|
|
14
15
|
* Create Evolu for React Native.
|
|
15
16
|
*
|
|
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.
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* @example
|
|
21
|
+
* import * as S from "@effect/schema/Schema";
|
|
22
|
+
* import {
|
|
23
|
+
* NonEmptyString1000,
|
|
24
|
+
* createEvolu,
|
|
25
|
+
* id,
|
|
26
|
+
* } from "@evolu/react-native";
|
|
21
27
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
28
|
+
* const TodoId = id("Todo");
|
|
29
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
24
30
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
31
|
+
* const TodoTable = S.struct({
|
|
32
|
+
* id: TodoId,
|
|
33
|
+
* title: NonEmptyString1000,
|
|
34
|
+
* });
|
|
35
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
30
36
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
37
|
+
* const Database = S.struct({
|
|
38
|
+
* // _todo is local-only table
|
|
39
|
+
* todo: TodoTable,
|
|
40
|
+
* });
|
|
41
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
34
42
|
*
|
|
35
|
-
*
|
|
36
|
-
* Evolu.create(Database);
|
|
37
|
-
* ```
|
|
43
|
+
* const evolu = createEvolu(Database);
|
|
38
44
|
*/
|
|
39
|
-
export const
|
|
45
|
+
export const createEvolu = makeCreateEvolu(EvoluNativeLive);
|
|
40
46
|
/** Parse a string to {@link Mnemonic}. */
|
|
41
47
|
export const parseMnemonic = Bip39.pipe(Effect.provide(Bip39Live), Effect.runSync).parse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evolu/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Evolu for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"evolu",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"expo-sqlite": "~11.3.3",
|
|
40
40
|
"react-native": "^0.72.6",
|
|
41
41
|
"typescript": "^5.3.2",
|
|
42
|
-
"vitest": "^0.
|
|
43
|
-
"@evolu/common": "2.0
|
|
44
|
-
"@evolu/common-react": "2.0.2",
|
|
42
|
+
"vitest": "^1.0.1",
|
|
43
|
+
"@evolu/common": "2.1.0",
|
|
45
44
|
"@evolu/tsconfig": "0.0.2",
|
|
45
|
+
"@evolu/common-react": "3.0.0",
|
|
46
46
|
"eslint-config-evolu": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@evolu/common-react": "^
|
|
49
|
+
"@evolu/common-react": "^3.0.0",
|
|
50
50
|
"expo": "^49.0.20",
|
|
51
51
|
"expo-sqlite": "~11.3.3",
|
|
52
52
|
"react-native": "^0.72.4"
|
package/src/index.ts
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
Schema,
|
|
12
12
|
SecretBoxLive,
|
|
13
13
|
SyncWorkerLive,
|
|
14
|
+
makeCreateEvolu,
|
|
14
15
|
} from "@evolu/common";
|
|
15
|
-
import { EvoluReactLive, makeCreateEvoluReact } from "@evolu/common-react";
|
|
16
16
|
import { Effect, Layer } from "effect";
|
|
17
17
|
import {
|
|
18
18
|
AppStateLive,
|
|
@@ -22,8 +22,9 @@ import {
|
|
|
22
22
|
} from "./PlatformLive.js";
|
|
23
23
|
import { SqliteLive } from "./SqliteLive.js";
|
|
24
24
|
|
|
25
|
-
// export * from "@evolu/common/public"
|
|
26
|
-
//
|
|
25
|
+
// export * from "@evolu/common/public"
|
|
26
|
+
// https://github.com/facebook/metro/issues/1128
|
|
27
|
+
// So we have to export manually.
|
|
27
28
|
// TODO: Recheck after RN 0.73 release.
|
|
28
29
|
export {
|
|
29
30
|
Id,
|
|
@@ -50,6 +51,8 @@ export type {
|
|
|
50
51
|
} from "@evolu/common";
|
|
51
52
|
export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
|
|
52
53
|
|
|
54
|
+
export * from "@evolu/common-react";
|
|
55
|
+
|
|
53
56
|
/** Evolu for native platform. */
|
|
54
57
|
const EvoluNativeLive: Layer.Layer<
|
|
55
58
|
Config,
|
|
@@ -66,33 +69,35 @@ const EvoluNativeLive: Layer.Layer<
|
|
|
66
69
|
/**
|
|
67
70
|
* Create Evolu for React Native.
|
|
68
71
|
*
|
|
69
|
-
*
|
|
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.
|
|
70
74
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
75
|
+
* @example
|
|
76
|
+
* import * as S from "@effect/schema/Schema";
|
|
77
|
+
* import {
|
|
78
|
+
* NonEmptyString1000,
|
|
79
|
+
* createEvolu,
|
|
80
|
+
* id,
|
|
81
|
+
* } from "@evolu/react-native";
|
|
74
82
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
83
|
+
* const TodoId = id("Todo");
|
|
84
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
77
85
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
86
|
+
* const TodoTable = S.struct({
|
|
87
|
+
* id: TodoId,
|
|
88
|
+
* title: NonEmptyString1000,
|
|
89
|
+
* });
|
|
90
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
83
91
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
92
|
+
* const Database = S.struct({
|
|
93
|
+
* // _todo is local-only table
|
|
94
|
+
* todo: TodoTable,
|
|
95
|
+
* });
|
|
96
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
87
97
|
*
|
|
88
|
-
*
|
|
89
|
-
* Evolu.create(Database);
|
|
90
|
-
* ```
|
|
98
|
+
* const evolu = createEvolu(Database);
|
|
91
99
|
*/
|
|
92
|
-
export const
|
|
93
|
-
Layer.provide(EvoluNativeLive),
|
|
94
|
-
makeCreateEvoluReact,
|
|
95
|
-
);
|
|
100
|
+
export const createEvolu = makeCreateEvolu(EvoluNativeLive);
|
|
96
101
|
|
|
97
102
|
/** Parse a string to {@link Mnemonic}. */
|
|
98
103
|
export const parseMnemonic: (
|