@evolu/react-native 10.0.1 → 10.1.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.
@@ -1,6 +1,5 @@
1
- import { AppState, Bip39, SyncLock } from "@evolu/common";
1
+ import { AppState, SyncLock } from "@evolu/common";
2
2
  import * as Layer from "effect/Layer";
3
3
  export declare const AppStateLive: Layer.Layer<AppState, never, never>;
4
4
  export declare const SyncLockLive: Layer.Layer<SyncLock, never, never>;
5
- export declare const Bip39Live: Layer.Layer<Bip39, never, never>;
6
5
  //# sourceMappingURL=PlatformLive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformLive.d.ts","sourceRoot":"","sources":["../src/PlatformLive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EAEL,QAAQ,EAIT,MAAM,eAAe,CAAC;AASvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,eAAO,MAAM,YAAY,qCAmCxB,CAAC;AAEF,eAAO,MAAM,YAAY,qCA2BxB,CAAC;AAEF,eAAO,MAAM,SAAS,kCAUrB,CAAC"}
1
+ {"version":3,"file":"PlatformLive.d.ts","sourceRoot":"","sources":["../src/PlatformLive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EAGT,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,eAAO,MAAM,YAAY,qCAmCxB,CAAC;AAEF,eAAO,MAAM,YAAY,qCA2BxB,CAAC"}
@@ -1,7 +1,5 @@
1
- import { AppState, Bip39, SyncLock, SyncLockAlreadySyncingError, validateMnemonicToEffect, } from "@evolu/common";
1
+ import { AppState, SyncLock, SyncLockAlreadySyncingError, } from "@evolu/common";
2
2
  import NetInfo from "@react-native-community/netinfo";
3
- import { generateMnemonic, mnemonicToSeed, validateMnemonic, } from "@scure/bip39";
4
- import { wordlist } from "@scure/bip39/wordlists/english";
5
3
  import * as Effect from "effect/Effect";
6
4
  import * as Layer from "effect/Layer";
7
5
  import { reloadAsync } from "expo-updates";
@@ -56,8 +54,3 @@ export const SyncLockLive = Layer.effect(SyncLock, Effect.sync(() => {
56
54
  }),
57
55
  });
58
56
  }));
59
- export const Bip39Live = Layer.succeed(Bip39, Bip39.of({
60
- make: Effect.sync(() => generateMnemonic(wordlist, 128)),
61
- toSeed: (mnemonic) => Effect.promise(() => mnemonicToSeed(mnemonic)),
62
- parse: (mnemonic) => validateMnemonicToEffect(validateMnemonic)(mnemonic, wordlist),
63
- }));
package/dist/index.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- import { EvoluFactory, InvalidMnemonicError, Mnemonic } from "@evolu/common";
2
- import * as Effect from "effect/Effect";
1
+ import { EvoluFactory } from "@evolu/common";
3
2
  import * as Layer from "effect/Layer";
4
3
  export * from "@evolu/common/public";
5
- /** Parse a string to {@link Mnemonic}. */
6
- export declare const parseMnemonic: (mnemonic: string) => Effect.Effect<Mnemonic, InvalidMnemonicError>;
7
4
  export declare const EvoluFactoryReactNative: Layer.Layer<EvoluFactory, never, never>;
8
5
  export declare const
9
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EAST,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAStC,cAAc,sBAAsB,CAAC;AAErC,0CAA0C;AAC1C,eAAO,MAAM,aAAa,EAAE,CAC1B,QAAQ,EAAE,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAG1C,CAAC;AAUR,eAAO,MAAM,uBAAuB,yCAuBnC,CAAC;AAKF,eAAO;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,WAAW,2NACiE,CAAC;AAE/E,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EASb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAMtC,cAAc,sBAAsB,CAAC;AAarC,eAAO,MAAM,uBAAuB,yCAsBnC,CAAC;AAKF,eAAO;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,WAAW,2NACiE,CAAC;AAE/E,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,13 @@
1
- import { Bip39, DbFactory, EvoluFactory, SecretBox, Sqlite, SqliteFactory, SyncFactory, Time, createDb, createNanoIdGeneratorLive, createSync, } from "@evolu/common";
1
+ import { DbFactory, EvoluFactory, SecretBox, Sqlite, SqliteFactory, SyncFactory, Time, createDb, createNanoIdGeneratorLive, createSync, } from "@evolu/common";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Layer from "effect/Layer";
4
4
  // @ts-expect-error https://github.com/ai/nanoid/issues/468
5
5
  import { customAlphabet, nanoid } from "nanoid/index.browser.js";
6
- import { AppStateLive, Bip39Live, SyncLockLive } from "./PlatformLive.js";
6
+ import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
7
7
  import { SqliteLive } from "./SqliteLive.js";
8
+ export * from "@evolu/common/public";
8
9
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
9
10
  const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
10
- export * from "@evolu/common/public";
11
- /** Parse a string to {@link Mnemonic}. */
12
- export const parseMnemonic = Bip39.pipe(Effect.provide(Bip39Live), Effect.runSync).parse;
13
11
  const SyncFactoryLive = Layer.succeed(SyncFactory, {
14
12
  createSync: Effect.provide(createSync, SecretBox.Live),
15
13
  });
@@ -17,7 +15,7 @@ const SqliteFactoryLive = Layer.succeed(SqliteFactory, {
17
15
  createSqlite: Sqlite.pipe(Effect.provide(SqliteLive)),
18
16
  });
19
17
  export const EvoluFactoryReactNative = Layer.provide(EvoluFactory.Common, Layer.mergeAll(Layer.succeed(DbFactory, {
20
- createDb: createDb.pipe(Effect.provide(Layer.mergeAll(Bip39Live, SqliteFactory.Common.pipe(Layer.provide(SqliteFactoryLive), Layer.provide(NanoIdGeneratorLive)), NanoIdGeneratorLive, Time.Live, SyncFactoryLive, SyncLockLive))),
18
+ createDb: createDb.pipe(Effect.provide(Layer.mergeAll(SqliteFactory.Common.pipe(Layer.provide(SqliteFactoryLive), Layer.provide(NanoIdGeneratorLive)), NanoIdGeneratorLive, Time.Live, SyncFactoryLive, SyncLockLive))),
21
19
  }), NanoIdGeneratorLive, AppStateLive));
22
20
  // JSDoc doesn't support destructured parameters, so we must copy-paste
23
21
  // createEvolu docs from `evolu-common/src/Evolu.ts`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/react-native",
3
- "version": "10.0.1",
3
+ "version": "10.1.0",
4
4
  "description": "Evolu for React Native",
5
5
  "keywords": [
6
6
  "evolu",
@@ -35,18 +35,18 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "eslint": "^8.57.0",
38
- "expo": "^51.0.2",
38
+ "expo": "^51.0.5",
39
39
  "expo-sqlite": "^14.0.3",
40
40
  "react-native": "^0.74.1",
41
41
  "typescript": "^5.4.5",
42
42
  "vitest": "^1.6.0",
43
- "@evolu/common": "5.1.1",
44
- "@evolu/common-react": "8.0.4",
43
+ "@evolu/common": "5.2.0",
44
+ "@evolu/common-react": "8.0.5",
45
45
  "@evolu/tsconfig": "0.0.2",
46
46
  "eslint-config-evolu": "1.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@evolu/common-react": "^8.0.4",
49
+ "@evolu/common-react": "^8.0.5",
50
50
  "expo": "^51.0.0",
51
51
  "expo-sqlite": "^14.0.3",
52
52
  "react-native": "^0.74.1"
@@ -1,19 +1,10 @@
1
1
  import {
2
2
  AppState,
3
- Bip39,
4
- Mnemonic,
5
3
  SyncLock,
6
4
  SyncLockAlreadySyncingError,
7
5
  SyncLockRelease,
8
- validateMnemonicToEffect,
9
6
  } from "@evolu/common";
10
7
  import NetInfo, { NetInfoState } from "@react-native-community/netinfo";
11
- import {
12
- generateMnemonic,
13
- mnemonicToSeed,
14
- validateMnemonic,
15
- } from "@scure/bip39";
16
- import { wordlist } from "@scure/bip39/wordlists/english";
17
8
  import * as Effect from "effect/Effect";
18
9
  import * as Layer from "effect/Layer";
19
10
  import { reloadAsync } from "expo-updates";
@@ -84,15 +75,3 @@ export const SyncLockLive = Layer.effect(
84
75
  });
85
76
  }),
86
77
  );
87
-
88
- export const Bip39Live = Layer.succeed(
89
- Bip39,
90
- Bip39.of({
91
- make: Effect.sync(() => generateMnemonic(wordlist, 128) as Mnemonic),
92
-
93
- toSeed: (mnemonic) => Effect.promise(() => mnemonicToSeed(mnemonic)),
94
-
95
- parse: (mnemonic) =>
96
- validateMnemonicToEffect(validateMnemonic)(mnemonic, wordlist),
97
- }),
98
- );
package/src/index.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  import {
2
- Bip39,
3
2
  DbFactory,
4
3
  EvoluFactory,
5
- InvalidMnemonicError,
6
- Mnemonic,
7
4
  SecretBox,
8
5
  Sqlite,
9
6
  SqliteFactory,
@@ -17,21 +14,13 @@ import * as Effect from "effect/Effect";
17
14
  import * as Layer from "effect/Layer";
18
15
  // @ts-expect-error https://github.com/ai/nanoid/issues/468
19
16
  import { customAlphabet, nanoid } from "nanoid/index.browser.js";
20
- import { AppStateLive, Bip39Live, SyncLockLive } from "./PlatformLive.js";
17
+ import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
21
18
  import { SqliteLive } from "./SqliteLive.js";
22
19
 
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
24
- const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
25
-
26
20
  export * from "@evolu/common/public";
27
21
 
28
- /** Parse a string to {@link Mnemonic}. */
29
- export const parseMnemonic: (
30
- mnemonic: string,
31
- ) => Effect.Effect<Mnemonic, InvalidMnemonicError> = Bip39.pipe(
32
- Effect.provide(Bip39Live),
33
- Effect.runSync,
34
- ).parse;
22
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
23
+ const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
35
24
 
36
25
  const SyncFactoryLive = Layer.succeed(SyncFactory, {
37
26
  createSync: Effect.provide(createSync, SecretBox.Live),
@@ -48,7 +37,6 @@ export const EvoluFactoryReactNative = Layer.provide(
48
37
  createDb: createDb.pipe(
49
38
  Effect.provide(
50
39
  Layer.mergeAll(
51
- Bip39Live,
52
40
  SqliteFactory.Common.pipe(
53
41
  Layer.provide(SqliteFactoryLive),
54
42
  Layer.provide(NanoIdGeneratorLive),