@evolu/common 6.0.1-preview.2 → 6.0.1-preview.21

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 (154) hide show
  1. package/dist/src/Assert.d.ts +6 -3
  2. package/dist/src/Assert.d.ts.map +1 -1
  3. package/dist/src/Assert.js +7 -4
  4. package/dist/src/Brand.d.ts +75 -0
  5. package/dist/src/Brand.d.ts.map +1 -0
  6. package/dist/src/Brand.js +1 -0
  7. package/dist/src/Buffer.d.ts +1 -1
  8. package/dist/src/Buffer.d.ts.map +1 -1
  9. package/dist/src/Buffer.js +1 -1
  10. package/dist/src/CallbackRegistry.d.ts +53 -0
  11. package/dist/src/CallbackRegistry.d.ts.map +1 -0
  12. package/dist/src/CallbackRegistry.js +25 -0
  13. package/dist/src/Console.d.ts +31 -6
  14. package/dist/src/Console.d.ts.map +1 -1
  15. package/dist/src/Console.js +72 -9
  16. package/dist/src/Crypto.d.ts +61 -34
  17. package/dist/src/Crypto.d.ts.map +1 -1
  18. package/dist/src/Crypto.js +29 -42
  19. package/dist/src/Evolu/Db.d.ts +159 -66
  20. package/dist/src/Evolu/Db.d.ts.map +1 -1
  21. package/dist/src/Evolu/Db.js +300 -705
  22. package/dist/src/Evolu/Diff.d.ts +3 -3
  23. package/dist/src/Evolu/Diff.d.ts.map +1 -1
  24. package/dist/src/Evolu/Diff.js +7 -5
  25. package/dist/src/Evolu/Evolu.d.ts +200 -115
  26. package/dist/src/Evolu/Evolu.d.ts.map +1 -1
  27. package/dist/src/Evolu/Evolu.js +287 -157
  28. package/dist/src/Evolu/Internal.d.ts +0 -2
  29. package/dist/src/Evolu/Internal.d.ts.map +1 -1
  30. package/dist/src/Evolu/Internal.js +0 -2
  31. package/dist/src/Evolu/LocalAuth.d.ts +144 -0
  32. package/dist/src/Evolu/LocalAuth.d.ts.map +1 -0
  33. package/dist/src/Evolu/LocalAuth.js +171 -0
  34. package/dist/src/Evolu/Owner.d.ts +209 -124
  35. package/dist/src/Evolu/Owner.d.ts.map +1 -1
  36. package/dist/src/Evolu/Owner.js +118 -104
  37. package/dist/src/Evolu/Platform.d.ts +9 -7
  38. package/dist/src/Evolu/Platform.d.ts.map +1 -1
  39. package/dist/src/Evolu/Protocol.d.ts +256 -211
  40. package/dist/src/Evolu/Protocol.d.ts.map +1 -1
  41. package/dist/src/Evolu/Protocol.js +558 -359
  42. package/dist/src/Evolu/Public.d.ts +6 -8
  43. package/dist/src/Evolu/Public.d.ts.map +1 -1
  44. package/dist/src/Evolu/Public.js +2 -3
  45. package/dist/src/Evolu/PublicKysely.js +3 -3
  46. package/dist/src/Evolu/Query.d.ts +2 -1
  47. package/dist/src/Evolu/Query.d.ts.map +1 -1
  48. package/dist/src/Evolu/Relay.d.ts +72 -4
  49. package/dist/src/Evolu/Relay.d.ts.map +1 -1
  50. package/dist/src/Evolu/Relay.js +124 -13
  51. package/dist/src/Evolu/Schema.d.ts +129 -73
  52. package/dist/src/Evolu/Schema.d.ts.map +1 -1
  53. package/dist/src/Evolu/Schema.js +169 -89
  54. package/dist/src/Evolu/Storage.d.ts +159 -14
  55. package/dist/src/Evolu/Storage.d.ts.map +1 -1
  56. package/dist/src/Evolu/Storage.js +42 -32
  57. package/dist/src/Evolu/Sync.d.ts +68 -13
  58. package/dist/src/Evolu/Sync.d.ts.map +1 -1
  59. package/dist/src/Evolu/Sync.js +414 -20
  60. package/dist/src/Evolu/Timestamp.d.ts +35 -27
  61. package/dist/src/Evolu/Timestamp.d.ts.map +1 -1
  62. package/dist/src/Evolu/Timestamp.js +27 -18
  63. package/dist/src/ManyToManyMap.d.ts +74 -10
  64. package/dist/src/ManyToManyMap.d.ts.map +1 -1
  65. package/dist/src/ManyToManyMap.js +41 -6
  66. package/dist/src/Number.d.ts +2 -1
  67. package/dist/src/Number.d.ts.map +1 -1
  68. package/dist/src/Random.d.ts +3 -2
  69. package/dist/src/Random.d.ts.map +1 -1
  70. package/dist/src/RefCountedResourceManager.d.ts +119 -0
  71. package/dist/src/RefCountedResourceManager.d.ts.map +1 -0
  72. package/dist/src/RefCountedResourceManager.js +197 -0
  73. package/dist/src/Result.d.ts +176 -51
  74. package/dist/src/Result.d.ts.map +1 -1
  75. package/dist/src/Result.js +30 -241
  76. package/dist/src/Sqlite.d.ts +21 -4
  77. package/dist/src/Sqlite.d.ts.map +1 -1
  78. package/dist/src/Sqlite.js +50 -8
  79. package/dist/src/Task.d.ts +511 -0
  80. package/dist/src/Task.d.ts.map +1 -0
  81. package/dist/src/Task.js +410 -0
  82. package/dist/src/Time.d.ts +59 -0
  83. package/dist/src/Time.d.ts.map +1 -1
  84. package/dist/src/Time.js +87 -4
  85. package/dist/src/Type.d.ts +474 -327
  86. package/dist/src/Type.d.ts.map +1 -1
  87. package/dist/src/Type.js +502 -436
  88. package/dist/src/Types.d.ts +0 -74
  89. package/dist/src/Types.d.ts.map +1 -1
  90. package/dist/src/WebSocket.d.ts +5 -2
  91. package/dist/src/WebSocket.d.ts.map +1 -1
  92. package/dist/src/WebSocket.js +12 -13
  93. package/dist/src/Worker.d.ts +39 -11
  94. package/dist/src/Worker.d.ts.map +1 -1
  95. package/dist/src/Worker.js +22 -4
  96. package/dist/src/index.d.ts +3 -3
  97. package/dist/src/index.d.ts.map +1 -1
  98. package/dist/src/index.js +3 -3
  99. package/package.json +14 -13
  100. package/src/Assert.ts +8 -7
  101. package/src/Brand.ts +75 -0
  102. package/src/Buffer.ts +1 -1
  103. package/src/CallbackRegistry.ts +84 -0
  104. package/src/Console.ts +91 -11
  105. package/src/Crypto.ts +94 -79
  106. package/src/Evolu/Db.ts +528 -1027
  107. package/src/Evolu/Diff.ts +7 -5
  108. package/src/Evolu/Evolu.ts +682 -329
  109. package/src/Evolu/Internal.ts +0 -2
  110. package/src/Evolu/LocalAuth.ts +422 -0
  111. package/src/Evolu/Owner.ts +282 -227
  112. package/src/Evolu/Platform.ts +9 -9
  113. package/src/Evolu/Protocol.ts +788 -640
  114. package/src/Evolu/Public.ts +7 -14
  115. package/src/Evolu/PublicKysely.ts +3 -3
  116. package/src/Evolu/Query.ts +2 -1
  117. package/src/Evolu/Relay.ts +238 -18
  118. package/src/Evolu/Schema.ts +391 -191
  119. package/src/Evolu/Storage.ts +275 -55
  120. package/src/Evolu/Sync.ts +708 -37
  121. package/src/Evolu/Timestamp.ts +38 -35
  122. package/src/ManyToManyMap.ts +127 -24
  123. package/src/Number.ts +2 -6
  124. package/src/Random.ts +3 -2
  125. package/src/RefCountedResourceManager.ts +368 -0
  126. package/src/Result.ts +183 -53
  127. package/src/Sqlite.ts +59 -23
  128. package/src/Task.ts +779 -0
  129. package/src/Time.ts +168 -4
  130. package/src/Type.ts +708 -660
  131. package/src/Types.ts +0 -76
  132. package/src/WebSocket.ts +23 -17
  133. package/src/Worker.ts +72 -23
  134. package/src/index.ts +3 -3
  135. package/dist/src/Callbacks.d.ts +0 -20
  136. package/dist/src/Callbacks.d.ts.map +0 -1
  137. package/dist/src/Callbacks.js +0 -18
  138. package/dist/src/Evolu/Config.d.ts +0 -69
  139. package/dist/src/Evolu/Config.d.ts.map +0 -1
  140. package/dist/src/Evolu/Config.js +0 -9
  141. package/dist/src/Evolu/Kysely.d.ts +0 -6
  142. package/dist/src/Evolu/Kysely.d.ts.map +0 -1
  143. package/dist/src/Evolu/Kysely.js +0 -21
  144. package/dist/src/NanoId.d.ts +0 -27
  145. package/dist/src/NanoId.d.ts.map +0 -1
  146. package/dist/src/NanoId.js +0 -6
  147. package/dist/src/Promise.d.ts +0 -180
  148. package/dist/src/Promise.d.ts.map +0 -1
  149. package/dist/src/Promise.js +0 -176
  150. package/src/Callbacks.ts +0 -43
  151. package/src/Evolu/Config.ts +0 -83
  152. package/src/Evolu/Kysely.ts +0 -38
  153. package/src/NanoId.ts +0 -39
  154. 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,SAA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C,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,20 +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";
9
+ import { LocalAuthDep } from "./LocalAuth.js";
11
10
  import { AppOwner } from "./Owner.js";
12
- import { CreateAppStateDep, FlushSyncDep } from "./Platform.js";
11
+ import { FlushSyncDep, ReloadAppDep } from "./Platform.js";
13
12
  import { ProtocolError, ProtocolUnsupportedVersionError } from "./Protocol.js";
14
13
  import { Queries, QueriesToQueryRowsPromises, Query, QueryRows, Row } from "./Query.js";
15
- import { CreateQuery, EvoluSchema, Mutation } from "./Schema.js";
16
- import { SyncState } from "./Sync.js";
14
+ import { CreateQuery, EvoluSchema, IndexesConfig, Mutation, ValidateSchema } from "./Schema.js";
15
+ import { SyncOwner } from "./Sync.js";
17
16
  import { TimestampError } from "./Timestamp.js";
17
+ export interface EvoluConfig extends Partial<DbConfig> {
18
+ /**
19
+ * Use the `indexes` option to define SQLite indexes.
20
+ *
21
+ * Table and column names are not typed because Kysely doesn't support it.
22
+ *
23
+ * https://medium.com/@JasonWyatt/squeezing-performance-from-sqlite-indexes-indexes-c4e175f3c346
24
+ *
25
+ * ### Example
26
+ *
27
+ * ```ts
28
+ * const evolu = createEvolu(evoluReactDeps)(Schema, {
29
+ * indexes: (create) => [
30
+ * create("todoCreatedAt").on("todo").column("createdAt"),
31
+ * create("todoCategoryCreatedAt")
32
+ * .on("todoCategory")
33
+ * .column("createdAt"),
34
+ * ],
35
+ * });
36
+ * ```
37
+ */
38
+ readonly indexes?: IndexesConfig;
39
+ /**
40
+ * URL to reload browser tabs after reset or restore.
41
+ *
42
+ * The default value is `/`.
43
+ */
44
+ readonly reloadUrl?: string;
45
+ }
18
46
  export interface Evolu<S extends EvoluSchema = EvoluSchema> {
19
47
  /**
20
48
  * Subscribe to {@link EvoluError} changes.
@@ -40,7 +68,8 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
40
68
  * All this function does is compile the Kysely query and serialize it into a
41
69
  * unique string. Both operations are fast and cheap.
42
70
  *
43
- * For mutations, use {@link Evolu.insert} and {@link Evolu.update}.
71
+ * For mutations, use {@link Evolu#insert}, {@link Evolu#update}, or
72
+ * {@link Evolu#upsert}.
44
73
  *
45
74
  * ### Example
46
75
  *
@@ -59,43 +88,20 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
59
88
  /**
60
89
  * Load {@link Query} and return a promise with {@link QueryRows}.
61
90
  *
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}.
91
+ * The returned promise always resolves successfully because there is no
92
+ * reason why loading should fail. All data are local, and the query is typed.
93
+ * Unexpected errors are handled with {@link Evolu#subscribeError}.
66
94
  *
67
95
  * 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
- *
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
- *
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}.
96
+ * for an additional cache. Evolu's internal cache is invalidated on mutation.
97
+ * Unsubscribed queries are removed from the cache, so loading them again will
98
+ * return a new pending promise. Subscribed queries remain in the cache to
99
+ * prevent unnecessary Suspense boundaries from activating. Their promises are
100
+ * replaced with `Promise.resolve(rows)`, allowing React to synchronously
101
+ * unwrap the updated data without suspending.
102
+ *
103
+ * To subscribe a query for automatic updates, use
104
+ * {@link Evolu#subscribeQuery}.
99
105
  *
100
106
  * ### Example
101
107
  *
@@ -103,7 +109,7 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
103
109
  * const allTodos = evolu.createQuery((db) =>
104
110
  * db.selectFrom("todo").selectAll(),
105
111
  * );
106
- * evolu.loadQuery(allTodos).then(({ rows }) => {
112
+ * evolu.loadQuery(allTodos).then((rows) => {
107
113
  * console.log(rows);
108
114
  * });
109
115
  * ```
@@ -146,80 +152,162 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
146
152
  */
147
153
  readonly getQueryRows: <R extends Row>(query: Query<R>) => QueryRows<R>;
148
154
  /**
149
- * Subscribe to {@link AppOwner} changes.
155
+ * Promise that resolves to {@link AppOwner} when available.
150
156
  *
151
157
  * ### Example
152
158
  *
153
159
  * ```ts
154
- * const unsubscribe = evolu.subscribeAppOwner(() => {
155
- * const owner = evolu.getAppOwner();
156
- * });
160
+ * const owner = await evolu.appOwner;
157
161
  * ```
158
162
  */
159
- readonly subscribeAppOwner: StoreSubscribe;
163
+ readonly appOwner: Promise<AppOwner>;
160
164
  /**
161
- * Get {@link AppOwner}.
165
+ * Inserts a row into the database and returns a {@link Result} with the new
166
+ * {@link Id}.
162
167
  *
163
- * ### Example
168
+ * The first argument is the table name, and the second is an object
169
+ * containing the row data. An optional third argument provides mutation
170
+ * options including an `onComplete` callback and `onlyValidate` flag.
164
171
  *
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.
172
+ * Returns a Result type - use `.ok` to check if the insertion succeeded, and
173
+ * `.value.id` to access the generated ID on success, or `.error` to handle
174
+ * validation errors.
175
+ *
176
+ * Evolu does not use SQL for mutations to ensure data can be safely and
177
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
178
+ * to automatically add and update {@link DefaultColumns}.
174
179
  *
175
180
  * ### Example
176
181
  *
177
182
  * ```ts
178
- * const unsubscribe = evolu.subscribeSyncState(() => {
179
- * const syncState = evolu.getSyncState();
183
+ * const result = evolu.insert("todo", {
184
+ * title: "Learn Evolu",
185
+ * isCompleted: false,
180
186
  * });
187
+ *
188
+ * if (result.ok) {
189
+ * console.log("Todo created with ID:", result.value.id);
190
+ * } else {
191
+ * console.error("Validation error:", result.error);
192
+ * }
193
+ *
194
+ * // With onComplete callback
195
+ * evolu.insert(
196
+ * "todo",
197
+ * { title: "Another todo" },
198
+ * {
199
+ * onComplete: () => {
200
+ * console.log("Insert completed");
201
+ * },
202
+ * },
203
+ * );
181
204
  * ```
182
205
  */
183
- readonly subscribeSyncState: StoreSubscribe;
206
+ insert: Mutation<S, "insert">;
184
207
  /**
185
- * Get {@link SyncState}.
208
+ * Updates a row in the database and returns a {@link Result} with the existing
209
+ * {@link Id}.
210
+ *
211
+ * The first argument is the table name, and the second is an object
212
+ * containing the row data including the required `id` field. An optional
213
+ * third argument provides mutation options including an `onComplete` callback
214
+ * and `onlyValidate` flag.
215
+ *
216
+ * Returns a Result type - use `.ok` to check if the update succeeded, and
217
+ * `.value.id` to access the ID on success, or `.error` to handle validation
218
+ * errors.
219
+ *
220
+ * Evolu does not use SQL for mutations to ensure data can be safely and
221
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
222
+ * to automatically add and update {@link DefaultColumns}.
186
223
  *
187
224
  * ### Example
188
225
  *
189
226
  * ```ts
190
- * const unsubscribe = evolu.subscribeSyncState(() => {
191
- * const syncState = evolu.getSyncState();
227
+ * const result = evolu.update("todo", {
228
+ * id: todoId,
229
+ * title: "Updated title",
230
+ * isCompleted: true,
192
231
  * });
232
+ *
233
+ * if (result.ok) {
234
+ * console.log("Todo updated with ID:", result.value.id);
235
+ * } else {
236
+ * console.error("Validation error:", result.error);
237
+ * }
238
+ *
239
+ * // To delete a row, set isDeleted to true
240
+ * evolu.update("todo", { id: todoId, isDeleted: true });
241
+ *
242
+ * // With onComplete callback
243
+ * evolu.update(
244
+ * "todo",
245
+ * { id: todoId, title: "New title" },
246
+ * {
247
+ * onComplete: () => {
248
+ * console.log("Update completed");
249
+ * },
250
+ * },
251
+ * );
193
252
  * ```
194
253
  */
195
- readonly getSyncState: () => SyncState;
254
+ update: Mutation<S, "update">;
196
255
  /**
197
- * Inserts a row.
256
+ * Upserts a row in the database and returns a {@link Result} with the existing
257
+ * {@link Id}.
198
258
  *
199
- * ### Example
259
+ * The first argument is the table name, and the second is an object
260
+ * containing the row data including the required `id` field. An optional
261
+ * third argument provides mutation options including an `onComplete` callback
262
+ * and `onlyValidate` flag.
200
263
  *
201
- * ```ts
202
- * // TODO:
203
- * ```
204
- */
205
- insert: Mutation<S, "insert">;
206
- /**
207
- * Updates a row.
264
+ * This function allows you to use custom IDs and optionally set `createdAt`,
265
+ * which is useful for external systems, data migrations, or when the same row
266
+ * may already be created on a different device.
208
267
  *
209
- * ### Example
268
+ * Returns a Result type - use `.ok` to check if the upsert succeeded, and
269
+ * `.value.id` to access the ID on success, or `.error` to handle validation
270
+ * errors.
210
271
  *
211
- * ```ts
212
- * // TODO:
213
- * ```
214
- */
215
- update: Mutation<S, "update">;
216
- /**
217
- * Upserts a row.
272
+ * Evolu does not use SQL for mutations to ensure data can be safely and
273
+ * predictably merged without conflicts. Explicit mutations also allow Evolu
274
+ * to automatically add and update {@link DefaultColumns}.
218
275
  *
219
276
  * ### Example
220
277
  *
221
278
  * ```ts
222
- * // TODO:
279
+ * // Use deterministic ID for stable upserts across devices
280
+ * const stableId = createIdFromString("my-todo-1");
281
+ *
282
+ * const result = evolu.upsert("todo", {
283
+ * id: stableId,
284
+ * title: "Learn Evolu",
285
+ * isCompleted: false,
286
+ * });
287
+ *
288
+ * if (result.ok) {
289
+ * console.log("Todo upserted with ID:", result.value.id);
290
+ * } else {
291
+ * console.error("Validation error:", result.error);
292
+ * }
293
+ *
294
+ * // Data migration with custom createdAt
295
+ * evolu.upsert("todo", {
296
+ * id: externalId,
297
+ * title: "Migrated todo",
298
+ * createdAt: new Date("2023-01-01"), // Preserve original timestamp
299
+ * });
300
+ *
301
+ * // With onComplete callback
302
+ * evolu.upsert(
303
+ * "todo",
304
+ * { id: stableId, title: "Updated title" },
305
+ * {
306
+ * onComplete: () => {
307
+ * console.log("Upsert completed");
308
+ * },
309
+ * },
310
+ * );
223
311
  * ```
224
312
  */
225
313
  upsert: Mutation<S, "upsert">;
@@ -237,7 +325,7 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
237
325
  }) => Promise<void>;
238
326
  /**
239
327
  * Restore {@link AppOwner} with all their synced data. It uses
240
- * {@link Evolu.resetAppOwner}, so be careful.
328
+ * {@link Evolu#resetAppOwner}, so be careful.
241
329
  */
242
330
  readonly restoreAppOwner: (mnemonic: Mnemonic, options?: {
243
331
  readonly reload?: boolean;
@@ -248,40 +336,36 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> {
248
336
  */
249
337
  readonly reloadApp: () => void;
250
338
  /** 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 {
339
+ readonly exportDatabase: () => Promise<Uint8Array<ArrayBuffer>>;
257
340
  /**
258
- * Use this option to create initial data (fixtures).
341
+ * Use an owner. Using an owner means syncing it and subscribing to
342
+ * broadcasted changes. Returns a function to stop using the owner.
343
+ *
344
+ * Transport connections are automatically deduplicated and reference-counted,
345
+ * so multiple owners using the same transport will share a single
346
+ * connection.
259
347
  *
260
348
  * ### Example
261
349
  *
262
350
  * ```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
- * });
351
+ * // Use an owner (starts syncing and subscribing to changes).
352
+ * const unuse = evolu.useOwner(shardOwner);
353
+ *
354
+ * // Later, stop using the owner.
355
+ * unuse();
356
+ *
357
+ * // Bulk operations.
358
+ * const unuses = owners.map((owner) => evolu.useOwner(owner));
359
+ * // Later: unuses.forEach(unuse => unuse());
278
360
  * ```
361
+ *
362
+ * @experimental
279
363
  */
280
- initialData?: (evolu: EvoluForInitialData<S>) => void;
281
- }
282
- export interface EvoluForInitialData<S extends EvoluSchema = EvoluSchema> {
283
- insert: Mutation<S, "insert">;
364
+ readonly useOwner: (owner: SyncOwner) => () => void;
284
365
  }
366
+ /** Represents errors that can occur in Evolu. */
367
+ export type EvoluError = ProtocolError | ProtocolUnsupportedVersionError | SqliteError | SymmetricCryptoDecryptError | TimestampError | TransferableError;
368
+ export type EvoluDeps = ConsoleDep & CreateDbWorkerDep & LocalAuthDep & Partial<FlushSyncDep> & RandomBytesDep & ReloadAppDep & TimeDep;
285
369
  /**
286
370
  * Creates an {@link Evolu} instance configured with the specified
287
371
  * {@link EvoluSchema} and optional configuration.
@@ -299,7 +383,8 @@ export interface EvoluForInitialData<S extends EvoluSchema = EvoluSchema> {
299
383
  * and merging.
300
384
  * - Automatic schema evolution that updates the underlying database with new
301
385
  * columns or tables.
302
- * - Managing owner data with resetAppOwner and restoreAppOwner.
386
+ * - Managing owner data with {@link Evolu#resetAppOwner} and
387
+ * {@link Evolu#restoreAppOwner}.
303
388
  *
304
389
  * ### Example
305
390
  *
@@ -329,6 +414,6 @@ export interface EvoluForInitialData<S extends EvoluSchema = EvoluSchema> {
329
414
  * const evolu = createEvolu(evoluReactDeps)(Schema);
330
415
  * ```
331
416
  */
332
- export declare const createEvolu: (deps: EvoluDeps) => <S extends EvoluSchema>(schema: S, partialConfig?: Partial<EvoluConfigWithInitialData<S>>) => Evolu<S>;
333
- export declare const createNamespaceName: (config: Config) => (name: string) => string;
417
+ export declare const createEvolu: (deps: EvoluDeps) => <S extends EvoluSchema>(schema: ValidateSchema<S> extends never ? S : ValidateSchema<S>, config?: EvoluConfig) => Evolu<S>;
418
+ export declare const createQuery: <R extends Row>(queryCallback: Parameters<CreateQuery<EvoluSchema>>[0], options?: Parameters<CreateQuery<EvoluSchema>>[1]) => Query<R>;
334
419
  //# 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,EAAE,MAAM,cAA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