@evolu/react-native 5.0.4 → 5.0.5

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.
@@ -1,7 +1,6 @@
1
- import { AppState, Bip39, FlushSync, PlatformName, SyncLock } from "@evolu/common";
1
+ import { AppState, Bip39, PlatformName, SyncLock } from "@evolu/common";
2
2
  import * as Layer from "effect/Layer";
3
3
  export declare const PlatformNameLive: Layer.Layer<PlatformName, never, never>;
4
- export declare const FlushSyncLive: Layer.Layer<FlushSync, never, never>;
5
4
  export declare const SyncLockLive: Layer.Layer<SyncLock, never, never>;
6
5
  export declare const AppStateLive: Layer.Layer<AppState, never, never>;
7
6
  export declare const Bip39Live: Layer.Layer<Bip39, never, never>;
@@ -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;AAUvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,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"}
1
+ {"version":3,"file":"PlatformLive.d.ts","sourceRoot":"","sources":["../src/PlatformLive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EAGL,YAAY,EACZ,QAAQ,EACT,MAAM,eAAe,CAAC;AASvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,eAAO,MAAM,gBAAgB,yCAA8C,CAAC;AAE5E,eAAO,MAAM,YAAY,qCAexB,CAAC;AAEF,eAAO,MAAM,YAAY,qCA4BxB,CAAC;AAEF,eAAO,MAAM,SAAS,kCAYrB,CAAC"}
@@ -1,14 +1,12 @@
1
- import { AppState, Bip39, FlushSync, PlatformName, SyncLock, } from "@evolu/common";
1
+ import { AppState, Bip39, PlatformName, SyncLock, } from "@evolu/common";
2
2
  import NetInfo from "@react-native-community/netinfo";
3
3
  import { generateMnemonic, mnemonicToSeed, validateMnemonic, } from "@scure/bip39";
4
4
  import { wordlist } from "@scure/bip39/wordlists/english";
5
5
  import * as Effect from "effect/Effect";
6
- import * as Function from "effect/Function";
7
6
  import * as Layer from "effect/Layer";
8
7
  import { reloadAsync } from "expo-updates";
9
8
  import { DevSettings, AppState as ReactNativeAppState } from "react-native";
10
9
  export const PlatformNameLive = Layer.succeed(PlatformName, "react-native");
11
- export const FlushSyncLive = Layer.succeed(FlushSync, Function.constVoid);
12
10
  export const SyncLockLive = Layer.effect(SyncLock, Effect.sync(() => {
13
11
  let hasSyncLock = false;
14
12
  return SyncLock.of({
package/dist/index.d.ts CHANGED
@@ -3,7 +3,8 @@ import * as Effect from "effect/Effect";
3
3
  export { Id, NonEmptyString1000, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, database, id, table, } from "@evolu/common";
4
4
  export type { EvoluError, ExtractRow, InvalidMnemonicError, Mnemonic, NotNull, Owner, OwnerId, QueryResult, SyncState, Timestamp, TimestampError, UnexpectedError, } from "@evolu/common";
5
5
  export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
6
- export * from "@evolu/common-react";
6
+ /** Parse a string to {@link Mnemonic}. */
7
+ export declare const parseMnemonic: (mnemonic: string) => Effect.Effect<Mnemonic, InvalidMnemonicError>;
7
8
  /**
8
9
  * Create Evolu for React Native.
9
10
  *
@@ -21,13 +22,13 @@ export * from "@evolu/common-react";
21
22
  * const TodoId = id("Todo");
22
23
  * type TodoId = S.Schema.To<typeof TodoId>;
23
24
  *
24
- * const TodoTable = S.struct({
25
+ * const TodoTable = table({
25
26
  * id: TodoId,
26
27
  * title: NonEmptyString1000,
27
28
  * });
28
29
  * type TodoTable = S.Schema.To<typeof TodoTable>;
29
30
  *
30
- * const Database = S.struct({
31
+ * const Database = database({
31
32
  * // _todo is local-only table
32
33
  * todo: TodoTable,
33
34
  * });
@@ -36,6 +37,5 @@ export * from "@evolu/common-react";
36
37
  * const evolu = createEvolu(Database);
37
38
  */
38
39
  export declare const createEvolu: <From, To extends import("@evolu/common").DatabaseSchema>(schema: import("@effect/schema/Schema").Schema<To, From, never>, config?: Partial<import("@evolu/common").Config> | undefined) => import("@evolu/common").Evolu<To>;
39
- /** Parse a string to {@link Mnemonic}. */
40
- export declare const parseMnemonic: (mnemonic: string) => Effect.Effect<Mnemonic, InvalidMnemonicError>;
40
+ export * from "@evolu/common-react";
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,EACpB,QAAQ,EAKT,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAcxC,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,WAAW,EACX,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;AAWpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,+NAAmC,CAAC;AAE5D,0CAA0C;AAC1C,eAAO,MAAM,aAAa,EAAE,CAC1B,QAAQ,EAAE,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAG1C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,oBAAoB,EACpB,QAAQ,EAKT,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,0CAA0C;AAC1C,eAAO,MAAM,aAAa,EAAE,CAC1B,QAAQ,EAAE,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAG1C,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,+NAUvB,CAAC;AAEF,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Bip39, DbWorkerLive, EvoluCommonLive, FetchLive, NanoIdLive, SecretBoxLive, SyncWorkerLive, makeCreateEvolu, } from "@evolu/common";
1
+ import { Bip39, DbWorkerLive, EvoluCommonLive, FetchLive, FlushSyncDefaultLive, NanoIdLive, SecretBoxLive, SyncWorkerLive, makeCreateEvolu, } from "@evolu/common";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Layer from "effect/Layer";
4
- import { AppStateLive, Bip39Live, FlushSyncLive, SyncLockLive, } from "./PlatformLive.js";
4
+ import { AppStateLive, Bip39Live, SyncLockLive } from "./PlatformLive.js";
5
5
  import { SqliteLive } from "./SqliteLive.js";
6
6
  // export * from "@evolu/common/public"
7
7
  // https://github.com/facebook/metro/issues/1128
@@ -9,9 +9,8 @@ import { SqliteLive } from "./SqliteLive.js";
9
9
  // TODO: Recheck after RN 0.73 release.
10
10
  export { Id, NonEmptyString1000, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, database, id, table, } from "@evolu/common";
11
11
  export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
12
- export * from "@evolu/common-react";
13
- /** Evolu for native platform. */
14
- 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)));
12
+ /** Parse a string to {@link Mnemonic}. */
13
+ export const parseMnemonic = Bip39.pipe(Effect.provide(Bip39Live), Effect.runSync).parse;
15
14
  /**
16
15
  * Create Evolu for React Native.
17
16
  *
@@ -29,13 +28,13 @@ const EvoluNativeLive = EvoluCommonLive.pipe(Layer.provide(Layer.mergeAll(FlushS
29
28
  * const TodoId = id("Todo");
30
29
  * type TodoId = S.Schema.To<typeof TodoId>;
31
30
  *
32
- * const TodoTable = S.struct({
31
+ * const TodoTable = table({
33
32
  * id: TodoId,
34
33
  * title: NonEmptyString1000,
35
34
  * });
36
35
  * type TodoTable = S.Schema.To<typeof TodoTable>;
37
36
  *
38
- * const Database = S.struct({
37
+ * const Database = database({
39
38
  * // _todo is local-only table
40
39
  * todo: TodoTable,
41
40
  * });
@@ -43,6 +42,5 @@ const EvoluNativeLive = EvoluCommonLive.pipe(Layer.provide(Layer.mergeAll(FlushS
43
42
  *
44
43
  * const evolu = createEvolu(Database);
45
44
  */
46
- export const createEvolu = makeCreateEvolu(EvoluNativeLive);
47
- /** Parse a string to {@link Mnemonic}. */
48
- export const parseMnemonic = Bip39.pipe(Effect.provide(Bip39Live), Effect.runSync).parse;
45
+ export const createEvolu = makeCreateEvolu(EvoluCommonLive.pipe(Layer.provide(Layer.mergeAll(FlushSyncDefaultLive, AppStateLive, DbWorkerLive)), Layer.provide(Layer.mergeAll(Bip39Live, NanoIdLive, SqliteLive, SyncWorkerLive)), Layer.provide(Layer.mergeAll(SecretBoxLive, SyncLockLive, FetchLive))));
46
+ export * from "@evolu/common-react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/react-native",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "Evolu for React Native",
5
5
  "keywords": [
6
6
  "evolu",
@@ -34,13 +34,13 @@
34
34
  "expo-updates": "^0.18.17"
35
35
  },
36
36
  "devDependencies": {
37
- "eslint": "^8.56.0",
37
+ "eslint": "^8.57.0",
38
38
  "expo": "^49.0.21",
39
39
  "expo-sqlite": "~11.3.3",
40
40
  "react-native": "0.72.6",
41
41
  "typescript": "^5.3.3",
42
42
  "vitest": "^1.3.1",
43
- "@evolu/common": "3.1.5",
43
+ "@evolu/common": "3.1.6",
44
44
  "@evolu/common-react": "5.0.4",
45
45
  "@evolu/tsconfig": "0.0.2",
46
46
  "eslint-config-evolu": "1.0.0"
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  AppState,
3
3
  Bip39,
4
- FlushSync,
5
4
  InvalidMnemonicError,
6
5
  Mnemonic,
7
6
  PlatformName,
@@ -15,15 +14,12 @@ import {
15
14
  } from "@scure/bip39";
16
15
  import { wordlist } from "@scure/bip39/wordlists/english";
17
16
  import * as Effect from "effect/Effect";
18
- import * as Function from "effect/Function";
19
17
  import * as Layer from "effect/Layer";
20
18
  import { reloadAsync } from "expo-updates";
21
19
  import { DevSettings, AppState as ReactNativeAppState } from "react-native";
22
20
 
23
21
  export const PlatformNameLive = Layer.succeed(PlatformName, "react-native");
24
22
 
25
- export const FlushSyncLive = Layer.succeed(FlushSync, Function.constVoid);
26
-
27
23
  export const SyncLockLive = Layer.effect(
28
24
  SyncLock,
29
25
  Effect.sync(() => {
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  DbWorkerLive,
4
4
  EvoluCommonLive,
5
5
  FetchLive,
6
+ FlushSyncDefaultLive,
6
7
  InvalidMnemonicError,
7
8
  Mnemonic,
8
9
  NanoIdLive,
@@ -12,12 +13,7 @@ import {
12
13
  } from "@evolu/common";
13
14
  import * as Effect from "effect/Effect";
14
15
  import * as Layer from "effect/Layer";
15
- import {
16
- AppStateLive,
17
- Bip39Live,
18
- FlushSyncLive,
19
- SyncLockLive,
20
- } from "./PlatformLive.js";
16
+ import { AppStateLive, Bip39Live, SyncLockLive } from "./PlatformLive.js";
21
17
  import { SqliteLive } from "./SqliteLive.js";
22
18
 
23
19
  // export * from "@evolu/common/public"
@@ -54,16 +50,13 @@ export type {
54
50
  } from "@evolu/common";
55
51
  export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/sqlite";
56
52
 
57
- export * from "@evolu/common-react";
58
-
59
- /** Evolu for native platform. */
60
- const EvoluNativeLive = EvoluCommonLive.pipe(
61
- Layer.provide(Layer.mergeAll(FlushSyncLive, AppStateLive, DbWorkerLive)),
62
- Layer.provide(
63
- Layer.mergeAll(Bip39Live, NanoIdLive, SqliteLive, SyncWorkerLive),
64
- ),
65
- Layer.provide(Layer.mergeAll(SecretBoxLive, SyncLockLive, FetchLive)),
66
- );
53
+ /** Parse a string to {@link Mnemonic}. */
54
+ export const parseMnemonic: (
55
+ mnemonic: string,
56
+ ) => Effect.Effect<Mnemonic, InvalidMnemonicError> = Bip39.pipe(
57
+ Effect.provide(Bip39Live),
58
+ Effect.runSync,
59
+ ).parse;
67
60
 
68
61
  /**
69
62
  * Create Evolu for React Native.
@@ -82,13 +75,13 @@ const EvoluNativeLive = EvoluCommonLive.pipe(
82
75
  * const TodoId = id("Todo");
83
76
  * type TodoId = S.Schema.To<typeof TodoId>;
84
77
  *
85
- * const TodoTable = S.struct({
78
+ * const TodoTable = table({
86
79
  * id: TodoId,
87
80
  * title: NonEmptyString1000,
88
81
  * });
89
82
  * type TodoTable = S.Schema.To<typeof TodoTable>;
90
83
  *
91
- * const Database = S.struct({
84
+ * const Database = database({
92
85
  * // _todo is local-only table
93
86
  * todo: TodoTable,
94
87
  * });
@@ -96,12 +89,16 @@ const EvoluNativeLive = EvoluCommonLive.pipe(
96
89
  *
97
90
  * const evolu = createEvolu(Database);
98
91
  */
99
- export const createEvolu = makeCreateEvolu(EvoluNativeLive);
92
+ export const createEvolu = makeCreateEvolu(
93
+ EvoluCommonLive.pipe(
94
+ Layer.provide(
95
+ Layer.mergeAll(FlushSyncDefaultLive, AppStateLive, DbWorkerLive),
96
+ ),
97
+ Layer.provide(
98
+ Layer.mergeAll(Bip39Live, NanoIdLive, SqliteLive, SyncWorkerLive),
99
+ ),
100
+ Layer.provide(Layer.mergeAll(SecretBoxLive, SyncLockLive, FetchLive)),
101
+ ),
102
+ );
100
103
 
101
- /** Parse a string to {@link Mnemonic}. */
102
- export const parseMnemonic: (
103
- mnemonic: string,
104
- ) => Effect.Effect<Mnemonic, InvalidMnemonicError> = Bip39.pipe(
105
- Effect.provide(Bip39Live),
106
- Effect.runSync,
107
- ).parse;
104
+ export * from "@evolu/common-react";