@evolu/react-native 10.1.0 → 10.1.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.
@@ -0,0 +1,7 @@
1
+ import { EvoluFactory, SqliteFactory, SyncFactory } from "@evolu/common";
2
+ import * as Layer from "effect/Layer";
3
+ export declare const NanoIdGeneratorLive: Layer.Layer<import("@evolu/common").NanoIdGenerator, never, never>;
4
+ export declare const SyncFactoryLive: Layer.Layer<SyncFactory, never, never>;
5
+ export declare const SqliteFactoryLive: Layer.Layer<SqliteFactory, never, never>;
6
+ export declare const EvoluFactoryReactNative: Layer.Layer<EvoluFactory, never, never>;
7
+ //# sourceMappingURL=dbFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dbFactory.d.ts","sourceRoot":"","sources":["../src/dbFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGZ,aAAa,EACb,WAAW,EAKZ,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAOtC,eAAO,MAAM,mBAAmB,oEAG/B,CAAC;AAEF,eAAO,MAAM,eAAe,wCAE1B,CAAC;AAEH,eAAO,MAAM,iBAAiB,0CAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB,yCAsBnC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { DbFactory, EvoluFactory, SecretBox, Sqlite, SqliteFactory, SyncFactory, Time, createDb, createNanoIdGeneratorLive, createSync, } from "@evolu/common";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ // @ts-expect-error https://github.com/ai/nanoid/issues/468
5
+ import { customAlphabet, nanoid } from "nanoid/index.browser.js";
6
+ import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
7
+ import { SqliteLive } from "./SqliteLive.js";
8
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
9
+ export const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
10
+ export const SyncFactoryLive = Layer.succeed(SyncFactory, {
11
+ createSync: Effect.provide(createSync, SecretBox.Live),
12
+ });
13
+ export const SqliteFactoryLive = Layer.succeed(SqliteFactory, {
14
+ createSqlite: Sqlite.pipe(Effect.provide(SqliteLive)),
15
+ });
16
+ export const EvoluFactoryReactNative = Layer.provide(EvoluFactory.Common, Layer.mergeAll(Layer.succeed(DbFactory, {
17
+ createDb: createDb.pipe(Effect.provide(Layer.mergeAll(SqliteFactory.Common.pipe(Layer.provide(SqliteFactoryLive), Layer.provide(NanoIdGeneratorLive)), NanoIdGeneratorLive, Time.Live, SyncFactoryLive, SyncLockLive))),
18
+ }), NanoIdGeneratorLive, AppStateLive));
@@ -1,7 +1,5 @@
1
- import { EvoluFactory } from "@evolu/common";
2
- import * as Layer from "effect/Layer";
1
+ export * from "@evolu/common-react";
3
2
  export * from "@evolu/common/public";
4
- export declare const EvoluFactoryReactNative: Layer.Layer<EvoluFactory, never, never>;
5
3
  export declare const
6
4
  /**
7
5
  * Create Evolu from the database schema.
@@ -33,5 +31,4 @@ export declare const
33
31
  * const evolu = E.createEvolu(Database);
34
32
  */
35
33
  createEvolu: <T extends import("@evolu/common").EvoluSchema, I>(schema: import("@effect/schema/Schema").Schema<T, I, never>, config?: Partial<import("@evolu/common").EvoluConfig<T>> | undefined) => import("@evolu/common").Evolu<T>;
36
- export * from "@evolu/common-react";
37
- //# sourceMappingURL=index.d.ts.map
34
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAQrC,eAAO;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,WAAW,2NACiE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { EvoluFactory } from "@evolu/common";
2
+ export * from "@evolu/common-react";
3
+ export * from "@evolu/common/public";
4
+ import * as Effect from "effect/Effect";
5
+ import { EvoluFactoryReactNative } from "./dbFactory.js";
6
+ // JSDoc doesn't support destructured parameters, so we must copy-paste
7
+ // createEvolu docs from `evolu-common/src/Evolu.ts`.
8
+ // https://github.com/microsoft/TypeScript/issues/11859
9
+ export const {
10
+ /**
11
+ * Create Evolu from the database schema.
12
+ *
13
+ * Tables with a name prefixed with `_` are local-only, which means they are
14
+ * never synced. It's useful for device-specific or temporal data.
15
+ *
16
+ * @example
17
+ * import * as S from "@effect/schema/Schema";
18
+ * import * as E from "@evolu/react-native";
19
+ *
20
+ * const TodoId = E.id("Todo");
21
+ * type TodoId = typeof TodoId.Type;
22
+ *
23
+ * const TodoTable = E.table({
24
+ * id: TodoId,
25
+ * title: E.NonEmptyString1000,
26
+ * });
27
+ * type TodoTable = typeof TodoTable.Type;
28
+ *
29
+ * const Database = E.database({
30
+ * todo: TodoTable,
31
+ *
32
+ * // Prefix `_` makes the table local-only (it will not sync)
33
+ * _todo: TodoTable,
34
+ * });
35
+ * type Database = typeof Database.Type;
36
+ *
37
+ * const evolu = E.createEvolu(Database);
38
+ */
39
+ createEvolu, } = EvoluFactory.pipe(Effect.provide(EvoluFactoryReactNative), Effect.runSync);
@@ -0,0 +1,2 @@
1
+ export * from "@evolu/react";
2
+ //# sourceMappingURL=index.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "@evolu/react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/react-native",
3
- "version": "10.1.0",
3
+ "version": "10.1.1",
4
4
  "description": "Evolu for React Native",
5
5
  "keywords": [
6
6
  "evolu",
@@ -15,15 +15,10 @@
15
15
  },
16
16
  "homepage": "https://evolu.dev",
17
17
  "type": "module",
18
- "types": "./dist/index.d.ts",
18
+ "types": "./dist/index.native.d.ts",
19
19
  "exports": {
20
- ".": {
21
- "types": "./dist/index.d.ts",
22
- "import": "./dist/index.js"
23
- }
24
- },
25
- "react-native": {
26
- "./index.js": "./dist/index.js"
20
+ "react-native": "./dist/index.native.js",
21
+ "default": "./dist/index.web.js"
27
22
  },
28
23
  "files": [
29
24
  "dist/**",
@@ -40,9 +35,10 @@
40
35
  "react-native": "^0.74.1",
41
36
  "typescript": "^5.4.5",
42
37
  "vitest": "^1.6.0",
43
- "@evolu/common": "5.2.0",
38
+ "@evolu/common": "5.2.2",
44
39
  "@evolu/common-react": "8.0.5",
45
40
  "@evolu/tsconfig": "0.0.2",
41
+ "@evolu/react": "8.1.0",
46
42
  "eslint-config-evolu": "1.0.0"
47
43
  },
48
44
  "peerDependencies": {
@@ -0,0 +1,57 @@
1
+ import {
2
+ DbFactory,
3
+ EvoluFactory,
4
+ SecretBox,
5
+ Sqlite,
6
+ SqliteFactory,
7
+ SyncFactory,
8
+ Time,
9
+ createDb,
10
+ createNanoIdGeneratorLive,
11
+ createSync,
12
+ } from "@evolu/common";
13
+
14
+ import * as Effect from "effect/Effect";
15
+ import * as Layer from "effect/Layer";
16
+ // @ts-expect-error https://github.com/ai/nanoid/issues/468
17
+ import { customAlphabet, nanoid } from "nanoid/index.browser.js";
18
+ import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
19
+ import { SqliteLive } from "./SqliteLive.js";
20
+
21
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
22
+ export const NanoIdGeneratorLive = createNanoIdGeneratorLive(
23
+ customAlphabet,
24
+ nanoid,
25
+ );
26
+
27
+ export const SyncFactoryLive = Layer.succeed(SyncFactory, {
28
+ createSync: Effect.provide(createSync, SecretBox.Live),
29
+ });
30
+
31
+ export const SqliteFactoryLive = Layer.succeed(SqliteFactory, {
32
+ createSqlite: Sqlite.pipe(Effect.provide(SqliteLive)),
33
+ });
34
+
35
+ export const EvoluFactoryReactNative = Layer.provide(
36
+ EvoluFactory.Common,
37
+ Layer.mergeAll(
38
+ Layer.succeed(DbFactory, {
39
+ createDb: createDb.pipe(
40
+ Effect.provide(
41
+ Layer.mergeAll(
42
+ SqliteFactory.Common.pipe(
43
+ Layer.provide(SqliteFactoryLive),
44
+ Layer.provide(NanoIdGeneratorLive),
45
+ ),
46
+ NanoIdGeneratorLive,
47
+ Time.Live,
48
+ SyncFactoryLive,
49
+ SyncLockLive,
50
+ ),
51
+ ),
52
+ ),
53
+ }),
54
+ NanoIdGeneratorLive,
55
+ AppStateLive,
56
+ ),
57
+ );
@@ -0,0 +1,43 @@
1
+ import { EvoluFactory } from "@evolu/common";
2
+
3
+ export * from "@evolu/common-react";
4
+ export * from "@evolu/common/public";
5
+
6
+ import * as Effect from "effect/Effect";
7
+ import { EvoluFactoryReactNative } from "./dbFactory.js";
8
+
9
+ // JSDoc doesn't support destructured parameters, so we must copy-paste
10
+ // createEvolu docs from `evolu-common/src/Evolu.ts`.
11
+ // https://github.com/microsoft/TypeScript/issues/11859
12
+ export const {
13
+ /**
14
+ * Create Evolu from the database schema.
15
+ *
16
+ * Tables with a name prefixed with `_` are local-only, which means they are
17
+ * never synced. It's useful for device-specific or temporal data.
18
+ *
19
+ * @example
20
+ * import * as S from "@effect/schema/Schema";
21
+ * import * as E from "@evolu/react-native";
22
+ *
23
+ * const TodoId = E.id("Todo");
24
+ * type TodoId = typeof TodoId.Type;
25
+ *
26
+ * const TodoTable = E.table({
27
+ * id: TodoId,
28
+ * title: E.NonEmptyString1000,
29
+ * });
30
+ * type TodoTable = typeof TodoTable.Type;
31
+ *
32
+ * const Database = E.database({
33
+ * todo: TodoTable,
34
+ *
35
+ * // Prefix `_` makes the table local-only (it will not sync)
36
+ * _todo: TodoTable,
37
+ * });
38
+ * type Database = typeof Database.Type;
39
+ *
40
+ * const evolu = E.createEvolu(Database);
41
+ */
42
+ createEvolu,
43
+ } = EvoluFactory.pipe(Effect.provide(EvoluFactoryReactNative), Effect.runSync);
@@ -0,0 +1 @@
1
+ export * from "@evolu/react";
@@ -1 +0,0 @@
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 DELETED
@@ -1,54 +0,0 @@
1
- import { DbFactory, EvoluFactory, SecretBox, Sqlite, SqliteFactory, SyncFactory, Time, createDb, createNanoIdGeneratorLive, createSync, } from "@evolu/common";
2
- import * as Effect from "effect/Effect";
3
- import * as Layer from "effect/Layer";
4
- // @ts-expect-error https://github.com/ai/nanoid/issues/468
5
- import { customAlphabet, nanoid } from "nanoid/index.browser.js";
6
- import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
7
- import { SqliteLive } from "./SqliteLive.js";
8
- export * from "@evolu/common/public";
9
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
10
- const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
11
- const SyncFactoryLive = Layer.succeed(SyncFactory, {
12
- createSync: Effect.provide(createSync, SecretBox.Live),
13
- });
14
- const SqliteFactoryLive = Layer.succeed(SqliteFactory, {
15
- createSqlite: Sqlite.pipe(Effect.provide(SqliteLive)),
16
- });
17
- export const EvoluFactoryReactNative = Layer.provide(EvoluFactory.Common, Layer.mergeAll(Layer.succeed(DbFactory, {
18
- createDb: createDb.pipe(Effect.provide(Layer.mergeAll(SqliteFactory.Common.pipe(Layer.provide(SqliteFactoryLive), Layer.provide(NanoIdGeneratorLive)), NanoIdGeneratorLive, Time.Live, SyncFactoryLive, SyncLockLive))),
19
- }), NanoIdGeneratorLive, AppStateLive));
20
- // JSDoc doesn't support destructured parameters, so we must copy-paste
21
- // createEvolu docs from `evolu-common/src/Evolu.ts`.
22
- // https://github.com/microsoft/TypeScript/issues/11859
23
- export const {
24
- /**
25
- * Create Evolu from the database schema.
26
- *
27
- * Tables with a name prefixed with `_` are local-only, which means they are
28
- * never synced. It's useful for device-specific or temporal data.
29
- *
30
- * @example
31
- * import * as S from "@effect/schema/Schema";
32
- * import * as E from "@evolu/react-native";
33
- *
34
- * const TodoId = E.id("Todo");
35
- * type TodoId = typeof TodoId.Type;
36
- *
37
- * const TodoTable = E.table({
38
- * id: TodoId,
39
- * title: E.NonEmptyString1000,
40
- * });
41
- * type TodoTable = typeof TodoTable.Type;
42
- *
43
- * const Database = E.database({
44
- * todo: TodoTable,
45
- *
46
- * // Prefix `_` makes the table local-only (it will not sync)
47
- * _todo: TodoTable,
48
- * });
49
- * type Database = typeof Database.Type;
50
- *
51
- * const evolu = E.createEvolu(Database);
52
- */
53
- createEvolu, } = EvoluFactory.pipe(Effect.provide(EvoluFactoryReactNative), Effect.runSync);
54
- export * from "@evolu/common-react";
package/src/index.ts DELETED
@@ -1,93 +0,0 @@
1
- import {
2
- DbFactory,
3
- EvoluFactory,
4
- SecretBox,
5
- Sqlite,
6
- SqliteFactory,
7
- SyncFactory,
8
- Time,
9
- createDb,
10
- createNanoIdGeneratorLive,
11
- createSync,
12
- } from "@evolu/common";
13
- import * as Effect from "effect/Effect";
14
- import * as Layer from "effect/Layer";
15
- // @ts-expect-error https://github.com/ai/nanoid/issues/468
16
- import { customAlphabet, nanoid } from "nanoid/index.browser.js";
17
- import { AppStateLive, SyncLockLive } from "./PlatformLive.js";
18
- import { SqliteLive } from "./SqliteLive.js";
19
-
20
- export * from "@evolu/common/public";
21
-
22
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
23
- const NanoIdGeneratorLive = createNanoIdGeneratorLive(customAlphabet, nanoid);
24
-
25
- const SyncFactoryLive = Layer.succeed(SyncFactory, {
26
- createSync: Effect.provide(createSync, SecretBox.Live),
27
- });
28
-
29
- const SqliteFactoryLive = Layer.succeed(SqliteFactory, {
30
- createSqlite: Sqlite.pipe(Effect.provide(SqliteLive)),
31
- });
32
-
33
- export const EvoluFactoryReactNative = Layer.provide(
34
- EvoluFactory.Common,
35
- Layer.mergeAll(
36
- Layer.succeed(DbFactory, {
37
- createDb: createDb.pipe(
38
- Effect.provide(
39
- Layer.mergeAll(
40
- SqliteFactory.Common.pipe(
41
- Layer.provide(SqliteFactoryLive),
42
- Layer.provide(NanoIdGeneratorLive),
43
- ),
44
- NanoIdGeneratorLive,
45
- Time.Live,
46
- SyncFactoryLive,
47
- SyncLockLive,
48
- ),
49
- ),
50
- ),
51
- }),
52
- NanoIdGeneratorLive,
53
- AppStateLive,
54
- ),
55
- );
56
-
57
- // JSDoc doesn't support destructured parameters, so we must copy-paste
58
- // createEvolu docs from `evolu-common/src/Evolu.ts`.
59
- // https://github.com/microsoft/TypeScript/issues/11859
60
- export const {
61
- /**
62
- * Create Evolu from the database schema.
63
- *
64
- * Tables with a name prefixed with `_` are local-only, which means they are
65
- * never synced. It's useful for device-specific or temporal data.
66
- *
67
- * @example
68
- * import * as S from "@effect/schema/Schema";
69
- * import * as E from "@evolu/react-native";
70
- *
71
- * const TodoId = E.id("Todo");
72
- * type TodoId = typeof TodoId.Type;
73
- *
74
- * const TodoTable = E.table({
75
- * id: TodoId,
76
- * title: E.NonEmptyString1000,
77
- * });
78
- * type TodoTable = typeof TodoTable.Type;
79
- *
80
- * const Database = E.database({
81
- * todo: TodoTable,
82
- *
83
- * // Prefix `_` makes the table local-only (it will not sync)
84
- * _todo: TodoTable,
85
- * });
86
- * type Database = typeof Database.Type;
87
- *
88
- * const evolu = E.createEvolu(Database);
89
- */
90
- createEvolu,
91
- } = EvoluFactory.pipe(Effect.provide(EvoluFactoryReactNative), Effect.runSync);
92
-
93
- export * from "@evolu/common-react";