@evolu/common 6.0.1-preview.8 → 7.0.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.
Files changed (184) hide show
  1. package/README.md +2 -2
  2. package/dist/src/Array.d.ts +256 -12
  3. package/dist/src/Array.d.ts.map +1 -1
  4. package/dist/src/Array.js +215 -9
  5. package/dist/src/Assert.d.ts +0 -13
  6. package/dist/src/Assert.d.ts.map +1 -1
  7. package/dist/src/Assert.js +0 -15
  8. package/dist/src/Brand.d.ts +75 -0
  9. package/dist/src/Brand.d.ts.map +1 -0
  10. package/dist/src/Brand.js +1 -0
  11. package/dist/src/Buffer.d.ts +1 -1
  12. package/dist/src/Buffer.d.ts.map +1 -1
  13. package/dist/src/Buffer.js +8 -7
  14. package/dist/src/Cache.d.ts +44 -0
  15. package/dist/src/Cache.d.ts.map +1 -0
  16. package/dist/src/Cache.js +52 -0
  17. package/dist/src/Callbacks.d.ts +45 -12
  18. package/dist/src/Callbacks.d.ts.map +1 -1
  19. package/dist/src/Callbacks.js +14 -7
  20. package/dist/src/Console.d.ts +31 -6
  21. package/dist/src/Console.d.ts.map +1 -1
  22. package/dist/src/Console.js +72 -9
  23. package/dist/src/Crypto.d.ts +56 -42
  24. package/dist/src/Crypto.d.ts.map +1 -1
  25. package/dist/src/Crypto.js +40 -53
  26. package/dist/src/Evolu/Db.d.ts +162 -74
  27. package/dist/src/Evolu/Db.d.ts.map +1 -1
  28. package/dist/src/Evolu/Db.js +284 -702
  29. package/dist/src/Evolu/Diff.d.ts +3 -3
  30. package/dist/src/Evolu/Diff.d.ts.map +1 -1
  31. package/dist/src/Evolu/Diff.js +7 -5
  32. package/dist/src/Evolu/Evolu.d.ts +214 -134
  33. package/dist/src/Evolu/Evolu.d.ts.map +1 -1
  34. package/dist/src/Evolu/Evolu.js +189 -180
  35. package/dist/src/Evolu/Internal.d.ts +0 -2
  36. package/dist/src/Evolu/Internal.d.ts.map +1 -1
  37. package/dist/src/Evolu/Internal.js +0 -2
  38. package/dist/src/Evolu/LocalAuth.d.ts +150 -0
  39. package/dist/src/Evolu/LocalAuth.d.ts.map +1 -0
  40. package/dist/src/Evolu/LocalAuth.js +174 -0
  41. package/dist/src/Evolu/Owner.d.ts +273 -120
  42. package/dist/src/Evolu/Owner.d.ts.map +1 -1
  43. package/dist/src/Evolu/Owner.js +130 -104
  44. package/dist/src/Evolu/Platform.d.ts +9 -7
  45. package/dist/src/Evolu/Platform.d.ts.map +1 -1
  46. package/dist/src/Evolu/Protocol.d.ts +268 -240
  47. package/dist/src/Evolu/Protocol.d.ts.map +1 -1
  48. package/dist/src/Evolu/Protocol.js +600 -454
  49. package/dist/src/Evolu/Public.d.ts +6 -8
  50. package/dist/src/Evolu/Public.d.ts.map +1 -1
  51. package/dist/src/Evolu/Public.js +2 -3
  52. package/dist/src/Evolu/PublicKysely.d.ts.map +1 -1
  53. package/dist/src/Evolu/PublicKysely.js +3 -4
  54. package/dist/src/Evolu/Query.d.ts +2 -1
  55. package/dist/src/Evolu/Query.d.ts.map +1 -1
  56. package/dist/src/Evolu/Query.js +1 -1
  57. package/dist/src/Evolu/Relay.d.ts +91 -8
  58. package/dist/src/Evolu/Relay.d.ts.map +1 -1
  59. package/dist/src/Evolu/Relay.js +214 -88
  60. package/dist/src/Evolu/Schema.d.ts +125 -47
  61. package/dist/src/Evolu/Schema.d.ts.map +1 -1
  62. package/dist/src/Evolu/Schema.js +175 -31
  63. package/dist/src/Evolu/Storage.d.ts +249 -27
  64. package/dist/src/Evolu/Storage.d.ts.map +1 -1
  65. package/dist/src/Evolu/Storage.js +198 -92
  66. package/dist/src/Evolu/Sync.d.ts +68 -13
  67. package/dist/src/Evolu/Sync.d.ts.map +1 -1
  68. package/dist/src/Evolu/Sync.js +469 -20
  69. package/dist/src/Evolu/Timestamp.d.ts +83 -30
  70. package/dist/src/Evolu/Timestamp.d.ts.map +1 -1
  71. package/dist/src/Evolu/Timestamp.js +79 -34
  72. package/dist/src/Identicon.d.ts +35 -0
  73. package/dist/src/Identicon.d.ts.map +1 -0
  74. package/dist/src/Identicon.js +143 -0
  75. package/dist/src/Instances.d.ts +34 -0
  76. package/dist/src/Instances.d.ts.map +1 -0
  77. package/dist/src/Instances.js +44 -0
  78. package/dist/src/Number.d.ts +4 -3
  79. package/dist/src/Number.d.ts.map +1 -1
  80. package/dist/src/Number.js +5 -4
  81. package/dist/src/Object.d.ts +10 -4
  82. package/dist/src/Object.d.ts.map +1 -1
  83. package/dist/src/Object.js +9 -3
  84. package/dist/src/Platform.d.ts +20 -0
  85. package/dist/src/Platform.d.ts.map +1 -0
  86. package/dist/src/Platform.js +22 -0
  87. package/dist/src/Random.d.ts +3 -2
  88. package/dist/src/Random.d.ts.map +1 -1
  89. package/dist/src/Relation.d.ts +79 -0
  90. package/dist/src/Relation.d.ts.map +1 -0
  91. package/dist/src/Relation.js +127 -0
  92. package/dist/src/Resources.d.ts +118 -0
  93. package/dist/src/Resources.d.ts.map +1 -0
  94. package/dist/src/Resources.js +197 -0
  95. package/dist/src/Result.d.ts +184 -52
  96. package/dist/src/Result.d.ts.map +1 -1
  97. package/dist/src/Result.js +30 -241
  98. package/dist/src/Skiplist.js +2 -1
  99. package/dist/src/Sqlite.d.ts +89 -5
  100. package/dist/src/Sqlite.d.ts.map +1 -1
  101. package/dist/src/Sqlite.js +136 -9
  102. package/dist/src/Task.d.ts +586 -0
  103. package/dist/src/Task.d.ts.map +1 -0
  104. package/dist/src/Task.js +469 -0
  105. package/dist/src/Time.d.ts +66 -1
  106. package/dist/src/Time.d.ts.map +1 -1
  107. package/dist/src/Time.js +99 -5
  108. package/dist/src/Type.d.ts +676 -343
  109. package/dist/src/Type.d.ts.map +1 -1
  110. package/dist/src/Type.js +718 -467
  111. package/dist/src/Types.d.ts +1 -75
  112. package/dist/src/Types.d.ts.map +1 -1
  113. package/dist/src/WebSocket.d.ts +5 -2
  114. package/dist/src/WebSocket.d.ts.map +1 -1
  115. package/dist/src/WebSocket.js +12 -18
  116. package/dist/src/Worker.d.ts +39 -11
  117. package/dist/src/Worker.d.ts.map +1 -1
  118. package/dist/src/Worker.js +22 -4
  119. package/dist/src/index.d.ts +8 -3
  120. package/dist/src/index.d.ts.map +1 -1
  121. package/dist/src/index.js +8 -3
  122. package/package.json +15 -14
  123. package/src/Array.ts +301 -19
  124. package/src/Assert.ts +0 -21
  125. package/src/Brand.ts +75 -0
  126. package/src/Buffer.ts +7 -7
  127. package/src/Cache.ts +85 -0
  128. package/src/Callbacks.ts +62 -22
  129. package/src/Console.ts +91 -11
  130. package/src/Crypto.ts +94 -90
  131. package/src/Evolu/Db.ts +519 -1026
  132. package/src/Evolu/Diff.ts +7 -5
  133. package/src/Evolu/Evolu.ts +477 -361
  134. package/src/Evolu/Internal.ts +0 -2
  135. package/src/Evolu/LocalAuth.ts +463 -0
  136. package/src/Evolu/Owner.ts +355 -228
  137. package/src/Evolu/Platform.ts +9 -9
  138. package/src/Evolu/Protocol.ts +842 -742
  139. package/src/Evolu/Public.ts +7 -14
  140. package/src/Evolu/PublicKysely.ts +4 -5
  141. package/src/Evolu/Query.ts +3 -2
  142. package/src/Evolu/Relay.ts +406 -103
  143. package/src/Evolu/Schema.ts +323 -91
  144. package/src/Evolu/Storage.ts +559 -137
  145. package/src/Evolu/Sync.ts +819 -36
  146. package/src/Evolu/Timestamp.ts +90 -58
  147. package/src/Identicon.ts +197 -0
  148. package/src/Instances.ts +90 -0
  149. package/src/Number.ts +6 -10
  150. package/src/Object.ts +13 -5
  151. package/src/Platform.ts +26 -0
  152. package/src/Random.ts +3 -2
  153. package/src/Relation.ts +234 -0
  154. package/src/Resources.ts +367 -0
  155. package/src/Result.ts +191 -54
  156. package/src/Skiplist.ts +1 -1
  157. package/src/Sqlite.ts +152 -17
  158. package/src/Task.ts +901 -0
  159. package/src/Time.ts +180 -5
  160. package/src/Type.ts +1135 -730
  161. package/src/Types.ts +1 -77
  162. package/src/WebSocket.ts +27 -25
  163. package/src/Worker.ts +72 -23
  164. package/src/index.ts +8 -3
  165. package/dist/src/Evolu/Config.d.ts +0 -69
  166. package/dist/src/Evolu/Config.d.ts.map +0 -1
  167. package/dist/src/Evolu/Config.js +0 -9
  168. package/dist/src/Evolu/Kysely.d.ts +0 -6
  169. package/dist/src/Evolu/Kysely.d.ts.map +0 -1
  170. package/dist/src/Evolu/Kysely.js +0 -21
  171. package/dist/src/ManyToManyMap.d.ts +0 -26
  172. package/dist/src/ManyToManyMap.d.ts.map +0 -1
  173. package/dist/src/ManyToManyMap.js +0 -92
  174. package/dist/src/NanoId.d.ts +0 -27
  175. package/dist/src/NanoId.d.ts.map +0 -1
  176. package/dist/src/NanoId.js +0 -6
  177. package/dist/src/Promise.d.ts +0 -180
  178. package/dist/src/Promise.d.ts.map +0 -1
  179. package/dist/src/Promise.js +0 -176
  180. package/src/Evolu/Config.ts +0 -83
  181. package/src/Evolu/Kysely.ts +0 -38
  182. package/src/ManyToManyMap.ts +0 -140
  183. package/src/NanoId.ts +0 -39
  184. package/src/Promise.ts +0 -295
@@ -26,8 +26,8 @@ export declare const makePatches: (previousRows: ReadonlyArray<Row> | undefined,
26
26
  * A unique identifier prepended to JSON-encoded strings. This allows safe
27
27
  * detection and parsing of only those columns that require JSON.parse.
28
28
  *
29
- * The identifier is generated using nanoid to ensure randomness and uniqueness,
30
- * preventing malicious actors from inserting fake data that could be
29
+ * The identifier is a cryptographically random Evolu Id, ensuring uniqueness
30
+ * and preventing malicious actors from inserting fake data that could be
31
31
  * misinterpreted as JSON by the application.
32
32
  *
33
33
  * Note: The same queries created by different browser tabs will have different
@@ -38,6 +38,6 @@ export declare const makePatches: (previousRows: ReadonlyArray<Row> | undefined,
38
38
  *
39
39
  * See: https://github.com/kysely-org/kysely/issues/1372#issuecomment-2702773948
40
40
  */
41
- export declare const kyselyJsonIdentifier: string;
41
+ export declare const kyselyJsonIdentifier: string & import("../Brand.js").Brand<"Id">;
42
42
  export declare const parseSqliteJsonArray: <T>(arr: ReadonlyArray<T>) => ReadonlyArray<T>;
43
43
  //# sourceMappingURL=Diff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Diff.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Diff.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,KAAK,GAAG,eAAe,GAAG,cAAc,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,GACvB,SAAS,aAAa,CAAC,KAAK,CAAC,EAC7B,SAAS,aAAa,CAAC,GAAG,CAAC,KAC1B,aAAa,CAAC,GAAG,CAUP,CAAC;AAEd;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,cAAc,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,EAC5C,UAAU,aAAa,CAAC,GAAG,CAAC,KAC3B,aAAa,CAAC,KAAK,CA6BrB,CAAC;AAUF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,QAAW,CAAC;AAE7C,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,KAAK,aAAa,CAAC,CAAC,CAAC,KACpB,aAAa,CAAC,CAAC,CAMjB,CAAC"}
1
+ {"version":3,"file":"Diff.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Diff.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,KAAK,GAAG,eAAe,GAAG,cAAc,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,GACvB,SAAS,aAAa,CAAC,KAAK,CAAC,EAC7B,SAAS,aAAa,CAAC,GAAG,CAAC,KAC1B,aAAa,CAAC,GAAG,CAUP,CAAC;AAEd;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,cAAc,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,EAC5C,UAAU,aAAa,CAAC,GAAG,CAAC,KAC3B,aAAa,CAAC,KAAK,CA6BrB,CAAC;AAUF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,4CAE/B,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,KAAK,aAAa,CAAC,CAAC,CAAC,KACpB,aAAa,CAAC,CAAC,CAMjB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { nanoid } from "nanoid";
1
+ import { createRandomBytes } from "../Crypto.js";
2
2
  import { isPlainObject } from "../Object.js";
3
3
  import { orderUint8Array } from "../Order.js";
4
- import { String } from "../Type.js";
4
+ import { createId, String } from "../Type.js";
5
5
  export const applyPatches = (patches, current) => patches.reduce((next, patch) => {
6
6
  switch (patch.op) {
7
7
  case "replaceAll":
@@ -54,8 +54,8 @@ const areEqual = (a, b) => {
54
54
  * A unique identifier prepended to JSON-encoded strings. This allows safe
55
55
  * detection and parsing of only those columns that require JSON.parse.
56
56
  *
57
- * The identifier is generated using nanoid to ensure randomness and uniqueness,
58
- * preventing malicious actors from inserting fake data that could be
57
+ * The identifier is a cryptographically random Evolu Id, ensuring uniqueness
58
+ * and preventing malicious actors from inserting fake data that could be
59
59
  * misinterpreted as JSON by the application.
60
60
  *
61
61
  * Note: The same queries created by different browser tabs will have different
@@ -66,7 +66,9 @@ const areEqual = (a, b) => {
66
66
  *
67
67
  * See: https://github.com/kysely-org/kysely/issues/1372#issuecomment-2702773948
68
68
  */
69
- export const kyselyJsonIdentifier = nanoid();
69
+ export const kyselyJsonIdentifier = createId({
70
+ randomBytes: createRandomBytes(),
71
+ });
70
72
  export const parseSqliteJsonArray = (arr) => {
71
73
  const result = new Array(arr.length);
72
74
  for (let i = 0; i < arr.length; ++i) {
@@ -1,21 +1,48 @@
1
1
  import { ConsoleDep } from "../Console.js";
2
- import { SymmetricCryptoDecryptError } from "../Crypto.js";
2
+ import { RandomBytesDep, SymmetricCryptoDecryptError } from "../Crypto.js";
3
3
  import { TransferableError } from "../Error.js";
4
- import { NanoIdLibDep } from "../NanoId.js";
5
4
  import { SqliteError } from "../Sqlite.js";
6
5
  import { StoreSubscribe } from "../Store.js";
7
6
  import { TimeDep } from "../Time.js";
8
7
  import { Mnemonic } from "../Type.js";
9
- import { Config } from "./Config.js";
10
- import { CreateDbWorkerDep } from "./Db.js";
8
+ import { CreateDbWorkerDep, DbConfig } from "./Db.js";
11
9
  import { AppOwner } from "./Owner.js";
12
- import { CreateAppStateDep, FlushSyncDep } from "./Platform.js";
13
- import { ProtocolError, ProtocolUnsupportedVersionError } from "./Protocol.js";
10
+ import { FlushSyncDep, ReloadAppDep } from "./Platform.js";
11
+ import { ProtocolError } from "./Protocol.js";
14
12
  import { Queries, QueriesToQueryRowsPromises, Query, QueryRows, Row } from "./Query.js";
15
- import { CreateQuery, EvoluSchema, Mutation, ValidateSchema } from "./Schema.js";
16
- import { SyncState } from "./Sync.js";
13
+ import { CreateQuery, EvoluSchema, IndexesConfig, Mutation, ValidateSchema } from "./Schema.js";
14
+ import { SyncOwner } from "./Sync.js";
17
15
  import { TimestampError } from "./Timestamp.js";
18
- export interface Evolu<S extends EvoluSchema = EvoluSchema> {
16
+ export interface EvoluConfig extends Partial<DbConfig> {
17
+ /**
18
+ * Use the `indexes` option to define SQLite indexes.
19
+ *
20
+ * Table and column names are not typed because Kysely doesn't support it.
21
+ *
22
+ * https://medium.com/@JasonWyatt/squeezing-performance-from-sqlite-indexes-indexes-c4e175f3c346
23
+ *
24
+ * ### Example
25
+ *
26
+ * ```ts
27
+ * const evolu = createEvolu(evoluReactDeps)(Schema, {
28
+ * indexes: (create) => [
29
+ * create("todoCreatedAt").on("todo").column("createdAt"),
30
+ * create("todoCategoryCreatedAt")
31
+ * .on("todoCategory")
32
+ * .column("createdAt"),
33
+ * ],
34
+ * });
35
+ * ```
36
+ */
37
+ readonly indexes?: IndexesConfig;
38
+ /**
39
+ * URL to reload browser tabs after reset or restore.
40
+ *
41
+ * The default value is `/`.
42
+ */
43
+ readonly reloadUrl?: string;
44
+ }
45
+ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends Disposable {
19
46
  /**
20
47
  * Subscribe to {@link EvoluError} changes.
21
48
  *
@@ -40,7 +67,8 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
40
67
  * All this function does is compile the Kysely query and serialize it into a
41
68
  * unique string. Both operations are fast and cheap.
42
69
  *
43
- * For mutations, use {@link Evolu.insert} and {@link Evolu.update}.
70
+ * For mutations, use {@link Evolu#insert}, {@link Evolu#update}, or
71
+ * {@link Evolu#upsert}.
44
72
  *
45
73
  * ### Example
46
74
  *
@@ -59,43 +87,16 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
59
87
  /**
60
88
  * Load {@link Query} and return a promise with {@link QueryRows}.
61
89
  *
62
- * A returned promise always resolves successfully because there is no reason
63
- * why loading should fail. All data are local, and the query is typed. A
64
- * serious unexpected Evolu error shall be handled with
65
- * {@link Evolu.subscribeError}.
66
- *
67
- * Loading is batched, and returned promises are cached, so there is no need
68
- * for an additional cache. Evolu's internal cache is invalidated on
69
- * mutation.
70
- *
71
- * The returned promise is enriched with special status and value properties
72
- * for the upcoming React `use` Hook, but other UI libraries can also leverage
73
- * them. Speaking of React, there are two essential React Suspense-related
74
- * patterns that every developer should be aware of—passing promises to
75
- * children and caching over mutations.
76
- *
77
- * With promises passed to children, we can load a query as soon as possible,
78
- * but we don't have to use the returned promise immediately. That's useful
79
- * for prefetching, which is generally not necessary for local-first apps but
80
- * can be if a query takes a long time to load.
81
- *
82
- * Caching over mutation is a pattern that every developer should know. As we
83
- * said, Evolu caches promise until a mutation happens. A query loaded after
84
- * that will return a new pending promise. That's okay for general usage but
85
- * not for UI with React Suspense because a mutation would suspend rerendered
86
- * queries on a page, and that's not a good UX.
87
- *
88
- * We call this pattern "caching over mutation" because it has no globally
89
- * accepted name yet. React RFC for React Cache does not exist yet.
90
+ * The returned promise always resolves successfully because there is no
91
+ * reason why loading should fail. All data are local, and the query is typed.
92
+ * Unexpected errors are handled with {@link Evolu#subscribeError}.
90
93
  *
91
- * For better UX, a query must be subscribed for updates. This way, instead of
92
- * Suspense flashes, the user sees new data immediately because Evolu replaces
93
- * cached promises with fresh, already resolved new ones.
94
+ * Loading is batched, and returned promises are cached until resolved to
95
+ * prevent redundant database queries and to support React Suspense (which
96
+ * requires stable promise references while pending).
94
97
  *
95
- * If you are curious why Evolu does not do that for all queries by default,
96
- * the answer is simple: performance. Tracking changes is costly and
97
- * meaningful only for visible (hence subscribed) queries anyway. To subscribe
98
- * to a query, use {@link Evolu.subscribeQuery}.
98
+ * To subscribe a query for automatic updates, use
99
+ * {@link Evolu#subscribeQuery}.
99
100
  *
100
101
  * ### Example
101
102
  *
@@ -103,7 +104,7 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
103
104
  * const allTodos = evolu.createQuery((db) =>
104
105
  * db.selectFrom("todo").selectAll(),
105
106
  * );
106
- * evolu.loadQuery(allTodos).then(({ rows }) => {
107
+ * evolu.loadQuery(allTodos).then((rows) => {
107
108
  * console.log(rows);
108
109
  * });
109
110
  * ```
@@ -146,80 +147,165 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
146
147
  */
147
148
  readonly getQueryRows: <R extends Row>(query: Query<R>) => QueryRows<R>;
148
149
  /**
149
- * Subscribe to {@link AppOwner} changes.
150
+ * Promise that resolves to {@link AppOwner} when available.
151
+ *
152
+ * Note: With web-only deps, this promise will not resolve during SSR because
153
+ * there is no AppOwner on the server.
150
154
  *
151
155
  * ### Example
152
156
  *
153
157
  * ```ts
154
- * const unsubscribe = evolu.subscribeAppOwner(() => {
155
- * const owner = evolu.getAppOwner();
156
- * });
158
+ * const owner = await evolu.appOwner;
157
159
  * ```
158
160
  */
159
- readonly subscribeAppOwner: StoreSubscribe;
161
+ readonly appOwner: Promise<AppOwner>;
160
162
  /**
161
- * Get {@link AppOwner}.
163
+ * Inserts a row into the database and returns a {@link Result} with the new
164
+ * {@link Id}.
162
165
  *
163
- * ### Example
166
+ * The first argument is the table name, and the second is an object
167
+ * containing the row data. An optional third argument provides mutation
168
+ * options including an `onComplete` callback and `onlyValidate` flag.
164
169
  *
165
- * ```ts
166
- * const unsubscribe = evolu.subscribeAppOwner(() => {
167
- * const owner = evolu.getAppOwner();
168
- * });
169
- * ```
170
- */
171
- readonly getAppOwner: () => AppOwner | null;
172
- /**
173
- * Subscribe to {@link SyncState} changes.
170
+ * Returns a Result type - use `.ok` to check if the insertion succeeded, and
171
+ * `.value.id` to access the generated ID on success, or `.error` to handle
172
+ * validation errors.
173
+ *
174
+ * Evolu does not use SQL for mutations to ensure data can be safely and
175
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
176
+ * to automatically update {@link SystemColumns}.
174
177
  *
175
178
  * ### Example
176
179
  *
177
180
  * ```ts
178
- * const unsubscribe = evolu.subscribeSyncState(() => {
179
- * const syncState = evolu.getSyncState();
181
+ * const result = evolu.insert("todo", {
182
+ * title: "Learn Evolu",
183
+ * isCompleted: false,
180
184
  * });
185
+ *
186
+ * if (result.ok) {
187
+ * console.log("Todo created with ID:", result.value.id);
188
+ * } else {
189
+ * console.error("Validation error:", result.error);
190
+ * }
191
+ *
192
+ * // With onComplete callback
193
+ * evolu.insert(
194
+ * "todo",
195
+ * { title: "Another todo" },
196
+ * {
197
+ * onComplete: () => {
198
+ * console.log("Insert completed");
199
+ * },
200
+ * },
201
+ * );
181
202
  * ```
182
203
  */
183
- readonly subscribeSyncState: StoreSubscribe;
204
+ insert: Mutation<S, "insert">;
184
205
  /**
185
- * Get {@link SyncState}.
206
+ * Updates a row in the database and returns a {@link Result} with the existing
207
+ * {@link Id}.
208
+ *
209
+ * The first argument is the table name, and the second is an object
210
+ * containing the row data including the required `id` field. An optional
211
+ * third argument provides mutation options including an `onComplete` callback
212
+ * and `onlyValidate` flag.
213
+ *
214
+ * Returns a Result type - use `.ok` to check if the update succeeded, and
215
+ * `.value.id` to access the ID on success, or `.error` to handle validation
216
+ * errors.
217
+ *
218
+ * Evolu does not use SQL for mutations to ensure data can be safely and
219
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
220
+ * to automatically update {@link SystemColumns}.
186
221
  *
187
222
  * ### Example
188
223
  *
189
224
  * ```ts
190
- * const unsubscribe = evolu.subscribeSyncState(() => {
191
- * const syncState = evolu.getSyncState();
225
+ * const result = evolu.update("todo", {
226
+ * id: todoId,
227
+ * title: "Updated title",
228
+ * isCompleted: true,
192
229
  * });
230
+ *
231
+ * if (result.ok) {
232
+ * console.log("Todo updated with ID:", result.value.id);
233
+ * } else {
234
+ * console.error("Validation error:", result.error);
235
+ * }
236
+ *
237
+ * // To delete a row, set isDeleted to true
238
+ * evolu.update("todo", { id: todoId, isDeleted: true });
239
+ *
240
+ * // With onComplete callback
241
+ * evolu.update(
242
+ * "todo",
243
+ * { id: todoId, title: "New title" },
244
+ * {
245
+ * onComplete: () => {
246
+ * console.log("Update completed");
247
+ * },
248
+ * },
249
+ * );
193
250
  * ```
194
251
  */
195
- readonly getSyncState: () => SyncState;
252
+ update: Mutation<S, "update">;
196
253
  /**
197
- * Inserts a row.
254
+ * Upserts a row in the database and returns a {@link Result} with the existing
255
+ * {@link Id}.
198
256
  *
199
- * ### Example
257
+ * The first argument is the table name, and the second is an object
258
+ * containing the row data including the required `id` field. An optional
259
+ * third argument provides mutation options including an `onComplete` callback
260
+ * and `onlyValidate` flag.
200
261
  *
201
- * ```ts
202
- * // TODO:
203
- * ```
204
- */
205
- insert: Mutation<S, "insert">;
206
- /**
207
- * Updates a row.
262
+ * This function allows you to use custom IDs and optionally set `createdAt`,
263
+ * which is useful for external systems, data migrations, or when the same row
264
+ * may already be created on a different device.
208
265
  *
209
- * ### Example
266
+ * Returns a Result type - use `.ok` to check if the upsert succeeded, and
267
+ * `.value.id` to access the ID on success, or `.error` to handle validation
268
+ * errors.
210
269
  *
211
- * ```ts
212
- * // TODO:
213
- * ```
214
- */
215
- update: Mutation<S, "update">;
216
- /**
217
- * Upserts a row.
270
+ * Evolu does not use SQL for mutations to ensure data can be safely and
271
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
272
+ * to automatically update {@link SystemColumns}.
218
273
  *
219
274
  * ### Example
220
275
  *
221
276
  * ```ts
222
- * // TODO:
277
+ * // Use deterministic ID for stable upserts across devices
278
+ * const stableId = createIdFromString("my-todo-1");
279
+ *
280
+ * const result = evolu.upsert("todo", {
281
+ * id: stableId,
282
+ * title: "Learn Evolu",
283
+ * isCompleted: false,
284
+ * });
285
+ *
286
+ * if (result.ok) {
287
+ * console.log("Todo upserted with ID:", result.value.id);
288
+ * } else {
289
+ * console.error("Validation error:", result.error);
290
+ * }
291
+ *
292
+ * // Data migration with custom createdAt
293
+ * evolu.upsert("todo", {
294
+ * id: externalId,
295
+ * title: "Migrated todo",
296
+ * createdAt: new Date("2023-01-01"), // Preserve original timestamp
297
+ * });
298
+ *
299
+ * // With onComplete callback
300
+ * evolu.upsert(
301
+ * "todo",
302
+ * { id: stableId, title: "Updated title" },
303
+ * {
304
+ * onComplete: () => {
305
+ * console.log("Upsert completed");
306
+ * },
307
+ * },
308
+ * );
223
309
  * ```
224
310
  */
225
311
  upsert: Mutation<S, "upsert">;
@@ -237,7 +323,7 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
237
323
  }) => Promise<void>;
238
324
  /**
239
325
  * Restore {@link AppOwner} with all their synced data. It uses
240
- * {@link Evolu.resetAppOwner}, so be careful.
326
+ * {@link Evolu#resetAppOwner}, so be careful.
241
327
  */
242
328
  readonly restoreAppOwner: (mnemonic: Mnemonic, options?: {
243
329
  readonly reload?: boolean;
@@ -247,59 +333,46 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
247
333
  * all tabs using Evolu. For native apps, it will restart the app.
248
334
  */
249
335
  readonly reloadApp: () => void;
250
- /** Export SQLite database file as Uint8Array. */
251
- readonly exportDatabase: () => Promise<Uint8Array>;
252
- }
253
- /** Represent errors that can occur in Evolu. */
254
- export type EvoluError = TimestampError | ProtocolError | TransferableError | SymmetricCryptoDecryptError | ProtocolUnsupportedVersionError | SqliteError;
255
- export type EvoluDeps = CreateDbWorkerDep & TimeDep & NanoIdLibDep & Partial<FlushSyncDep> & ConsoleDep & CreateAppStateDep;
256
- export interface EvoluConfigWithInitialData<S extends EvoluSchema = EvoluSchema> extends Config {
257
336
  /**
258
- * Use this option to create initial data (fixtures).
337
+ * Export SQLite database file as Uint8Array.
338
+ *
339
+ * In the future, it will be possible to import a database and export/import
340
+ * history for 1:1 migrations across owners.
341
+ */
342
+ readonly exportDatabase: () => Promise<Uint8Array<ArrayBuffer>>;
343
+ /**
344
+ * Use an owner. Using an owner means syncing it and subscribing to
345
+ * broadcasted changes. Returns a function to stop using the owner.
346
+ *
347
+ * Transport connections are automatically deduplicated and reference-counted,
348
+ * so multiple owners using the same transport will share a single
349
+ * connection.
259
350
  *
260
351
  * ### Example
261
352
  *
262
353
  * ```ts
263
- * const evolu = createEvolu(evoluReactWebDeps)(Schema, {
264
- * initialData: (evolu) => {
265
- * const todoCategory = evolu.insert("todoCategory", {
266
- * name: "Not Urgent",
267
- * });
268
- *
269
- * // This is a developer error, which should be fixed immediately.
270
- * assert(todoCategory.ok, "invalid initial data");
271
- *
272
- * evolu.insert("todo", {
273
- * title: "Try React Suspense",
274
- * categoryId: todoCategory.value.id,
275
- * });
276
- * },
277
- * });
354
+ * // Use an owner (starts syncing and subscribing to changes).
355
+ * const unuse = evolu.useOwner(shardOwner);
356
+ *
357
+ * // Later, stop using the owner.
358
+ * unuse();
359
+ *
360
+ * // Bulk operations.
361
+ * const unuses = owners.map((owner) => evolu.useOwner(owner));
362
+ * // Later: unuses.forEach(unuse => unuse());
278
363
  * ```
364
+ *
365
+ * @experimental
279
366
  */
280
- initialData?: (evolu: EvoluForInitialData<S>) => void;
281
- }
282
- export interface EvoluForInitialData<S extends EvoluSchema = EvoluSchema> {
283
- insert: Mutation<S, "insert">;
367
+ readonly useOwner: (owner: SyncOwner) => () => void;
284
368
  }
369
+ /** Represents errors that can occur in Evolu. */
370
+ export type EvoluError = ProtocolError | SqliteError | SymmetricCryptoDecryptError | TimestampError | TransferableError;
371
+ export type EvoluDeps = ConsoleDep & CreateDbWorkerDep & Partial<FlushSyncDep> & RandomBytesDep & ReloadAppDep & TimeDep;
285
372
  /**
286
- * Creates an {@link Evolu} instance configured with the specified
287
- * {@link EvoluSchema} and optional configuration.
288
- *
289
- * This function returns a configured Evolu instance, providing a typed
290
- * interface for querying, mutating, and syncing your application's data. The
291
- * returned instance includes:
292
- *
293
- * - Subscription methods for receiving updates on queries, the owner, errors, and
294
- * sync state.
295
- * - Methods for creating, updating, or deleting rows in a type-safe manner.
296
- * - Methods for querying data using Evolu's typed SQL queries, leveraging Kysely
297
- * under the hood.
298
- * - Built-in support for local-first and offline-first data with automatic sync
299
- * and merging.
300
- * - Automatic schema evolution that updates the underlying database with new
301
- * columns or tables.
302
- * - Managing owner data with resetAppOwner and restoreAppOwner.
373
+ * Creates an {@link Evolu} instance for a platform configured with the specified
374
+ * {@link EvoluSchema} and optional {@link EvoluConfig} providing a typed
375
+ * interface for querying, mutating, and syncing your application's data.
303
376
  *
304
377
  * ### Example
305
378
  *
@@ -328,7 +401,14 @@ export interface EvoluForInitialData<S extends EvoluSchema = EvoluSchema> {
328
401
  *
329
402
  * const evolu = createEvolu(evoluReactDeps)(Schema);
330
403
  * ```
404
+ *
405
+ * ### Instance Caching
406
+ *
407
+ * `createEvolu` caches instances using {@link Instances} by {@link EvoluConfig}
408
+ * name to enable hot reloading and prevent database corruption from multiple
409
+ * connections. For testing, use unique instance names to ensure proper
410
+ * isolation.
331
411
  */
332
- export declare const createEvolu: (deps: EvoluDeps) => <S extends EvoluSchema>(schema: ValidateSchema<S> extends never ? S : ValidateSchema<S>, partialConfig?: Partial<EvoluConfigWithInitialData<S>>) => Evolu<S>;
333
- export declare const createNamespaceName: (config: Config) => (name: string) => string;
412
+ export declare const createEvolu: (deps: EvoluDeps) => <S extends EvoluSchema>(schema: ValidateSchema<S> extends never ? S : ValidateSchema<S>, config?: EvoluConfig) => Evolu<S>;
413
+ export declare const createQuery: <R extends Row>(queryCallback: Parameters<CreateQuery<EvoluSchema>>[0], options?: Parameters<CreateQuery<EvoluSchema>>[1]) => Query<R>;
334
414
  //# sourceMappingURL=Evolu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Evolu.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Evolu.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,YAAY,EAA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