@evolu/common 8.0.0-next.4 → 8.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 (237) hide show
  1. package/dist/src/Array.d.ts +279 -173
  2. package/dist/src/Array.d.ts.map +1 -1
  3. package/dist/src/Array.js +105 -101
  4. package/dist/src/Assert.d.ts +44 -44
  5. package/dist/src/Assert.d.ts.map +1 -1
  6. package/dist/src/Assert.js +44 -32
  7. package/dist/src/BigInt.d.ts +6 -3
  8. package/dist/src/BigInt.d.ts.map +1 -1
  9. package/dist/src/BigInt.js +5 -2
  10. package/dist/src/Brand.d.ts +27 -40
  11. package/dist/src/Brand.d.ts.map +1 -1
  12. package/dist/src/Buffer.d.ts +27 -11
  13. package/dist/src/Buffer.d.ts.map +1 -1
  14. package/dist/src/Cache.d.ts +9 -4
  15. package/dist/src/Cache.d.ts.map +1 -1
  16. package/dist/src/Cache.js +8 -3
  17. package/dist/src/Callbacks.d.ts +30 -19
  18. package/dist/src/Callbacks.d.ts.map +1 -1
  19. package/dist/src/Console.d.ts +145 -66
  20. package/dist/src/Console.d.ts.map +1 -1
  21. package/dist/src/Console.js +91 -43
  22. package/dist/src/Crypto.d.ts +85 -42
  23. package/dist/src/Crypto.d.ts.map +1 -1
  24. package/dist/src/Crypto.js +44 -20
  25. package/dist/src/Eq.d.ts +87 -21
  26. package/dist/src/Eq.d.ts.map +1 -1
  27. package/dist/src/Eq.js +67 -19
  28. package/dist/src/Error.d.ts +5 -3
  29. package/dist/src/Error.d.ts.map +1 -1
  30. package/dist/src/Error.js +16 -0
  31. package/dist/src/Function.d.ts +119 -58
  32. package/dist/src/Function.d.ts.map +1 -1
  33. package/dist/src/Function.js +86 -43
  34. package/dist/src/Http.d.ts +394 -0
  35. package/dist/src/Http.d.ts.map +1 -0
  36. package/dist/src/Http.js +102 -0
  37. package/dist/src/Identicon.d.ts +16 -7
  38. package/dist/src/Identicon.d.ts.map +1 -1
  39. package/dist/src/Identicon.js +14 -5
  40. package/dist/src/LeakDetector.d.ts +88 -0
  41. package/dist/src/LeakDetector.d.ts.map +1 -0
  42. package/dist/src/LeakDetector.js +86 -0
  43. package/dist/src/LockManager.d.ts +18 -9
  44. package/dist/src/LockManager.d.ts.map +1 -1
  45. package/dist/src/LockManager.js +7 -8
  46. package/dist/src/Lookup.d.ts +43 -13
  47. package/dist/src/Lookup.d.ts.map +1 -1
  48. package/dist/src/Lookup.js +28 -8
  49. package/dist/src/Microtask.d.ts +1 -1
  50. package/dist/src/Microtask.d.ts.map +1 -1
  51. package/dist/src/Microtask.js +3 -7
  52. package/dist/src/Number.d.ts +49 -13
  53. package/dist/src/Number.d.ts.map +1 -1
  54. package/dist/src/Number.js +34 -5
  55. package/dist/src/Object.d.ts +160 -40
  56. package/dist/src/Object.d.ts.map +1 -1
  57. package/dist/src/Object.js +92 -46
  58. package/dist/src/Option.d.ts +10 -7
  59. package/dist/src/Option.d.ts.map +1 -1
  60. package/dist/src/Option.js +9 -6
  61. package/dist/src/Order.d.ts +21 -21
  62. package/dist/src/Order.d.ts.map +1 -1
  63. package/dist/src/Order.js +18 -21
  64. package/dist/src/Platform.d.ts +31 -0
  65. package/dist/src/Platform.d.ts.map +1 -1
  66. package/dist/src/Platform.js +98 -0
  67. package/dist/src/Random.d.ts +32 -17
  68. package/dist/src/Random.d.ts.map +1 -1
  69. package/dist/src/Random.js +12 -8
  70. package/dist/src/Redacted.d.ts +43 -29
  71. package/dist/src/Redacted.d.ts.map +1 -1
  72. package/dist/src/Redacted.js +14 -3
  73. package/dist/src/Ref.d.ts +11 -3
  74. package/dist/src/Ref.d.ts.map +1 -1
  75. package/dist/src/Ref.js +2 -2
  76. package/dist/src/RefCount.d.ts +2 -6
  77. package/dist/src/RefCount.d.ts.map +1 -1
  78. package/dist/src/RefCount.js +33 -90
  79. package/dist/src/Relation.d.ts +70 -5
  80. package/dist/src/Relation.d.ts.map +1 -1
  81. package/dist/src/Relation.js +77 -2
  82. package/dist/src/Resource.d.ts +590 -155
  83. package/dist/src/Resource.d.ts.map +1 -1
  84. package/dist/src/Resource.js +592 -343
  85. package/dist/src/Result.d.ts +838 -191
  86. package/dist/src/Result.d.ts.map +1 -1
  87. package/dist/src/Result.js +163 -102
  88. package/dist/src/Schedule.d.ts +684 -231
  89. package/dist/src/Schedule.d.ts.map +1 -1
  90. package/dist/src/Schedule.js +766 -295
  91. package/dist/src/Set.d.ts +89 -40
  92. package/dist/src/Set.d.ts.map +1 -1
  93. package/dist/src/Set.js +50 -29
  94. package/dist/src/Sqlite.d.ts +29 -72
  95. package/dist/src/Sqlite.d.ts.map +1 -1
  96. package/dist/src/Sqlite.js +41 -46
  97. package/dist/src/StackTrace.d.ts +40 -0
  98. package/dist/src/StackTrace.d.ts.map +1 -0
  99. package/dist/src/StackTrace.js +140 -0
  100. package/dist/src/Store.d.ts +5 -4
  101. package/dist/src/Store.d.ts.map +1 -1
  102. package/dist/src/Store.js +5 -4
  103. package/dist/src/String.d.ts +7 -1
  104. package/dist/src/String.d.ts.map +1 -1
  105. package/dist/src/String.js +20 -7
  106. package/dist/src/Task.d.ts +3572 -1770
  107. package/dist/src/Task.d.ts.map +1 -1
  108. package/dist/src/Task.js +1879 -1274
  109. package/dist/src/Test.d.ts +17 -125
  110. package/dist/src/Test.d.ts.map +1 -1
  111. package/dist/src/Test.js +17 -68
  112. package/dist/src/Time.d.ts +108 -49
  113. package/dist/src/Time.d.ts.map +1 -1
  114. package/dist/src/Time.js +172 -73
  115. package/dist/src/Type.d.ts +3542 -1926
  116. package/dist/src/Type.d.ts.map +1 -1
  117. package/dist/src/Type.js +3070 -1784
  118. package/dist/src/Types.d.ts +200 -108
  119. package/dist/src/Types.d.ts.map +1 -1
  120. package/dist/src/Types.js +39 -8
  121. package/dist/src/WebSocket.d.ts +48 -23
  122. package/dist/src/WebSocket.d.ts.map +1 -1
  123. package/dist/src/WebSocket.js +15 -6
  124. package/dist/src/Worker.d.ts +94 -36
  125. package/dist/src/Worker.d.ts.map +1 -1
  126. package/dist/src/Worker.js +58 -24
  127. package/dist/src/index.d.ts +55 -52
  128. package/dist/src/index.d.ts.map +1 -1
  129. package/dist/src/index.js +3 -1
  130. package/dist/src/intl/cs.d.ts +94 -0
  131. package/dist/src/intl/cs.d.ts.map +1 -0
  132. package/dist/src/intl/cs.js +220 -0
  133. package/dist/src/intl/index.d.ts +7 -0
  134. package/dist/src/intl/index.d.ts.map +1 -0
  135. package/dist/src/intl/index.js +6 -0
  136. package/dist/src/local-first/Db.d.ts +12 -8
  137. package/dist/src/local-first/Db.d.ts.map +1 -1
  138. package/dist/src/local-first/Db.js +109 -132
  139. package/dist/src/local-first/Error.d.ts +4 -4
  140. package/dist/src/local-first/Evolu.d.ts +338 -92
  141. package/dist/src/local-first/Evolu.d.ts.map +1 -1
  142. package/dist/src/local-first/Evolu.js +47 -55
  143. package/dist/src/local-first/LocalAuth.d.ts +4 -4
  144. package/dist/src/local-first/LocalAuth.d.ts.map +1 -1
  145. package/dist/src/local-first/Owner.d.ts +61 -24
  146. package/dist/src/local-first/Owner.d.ts.map +1 -1
  147. package/dist/src/local-first/Owner.js +45 -8
  148. package/dist/src/local-first/Protocol.d.ts +44 -31
  149. package/dist/src/local-first/Protocol.d.ts.map +1 -1
  150. package/dist/src/local-first/Protocol.js +36 -13
  151. package/dist/src/local-first/Query.d.ts +147 -62
  152. package/dist/src/local-first/Query.d.ts.map +1 -1
  153. package/dist/src/local-first/Query.js +112 -58
  154. package/dist/src/local-first/Relay.d.ts +44 -14
  155. package/dist/src/local-first/Relay.d.ts.map +1 -1
  156. package/dist/src/local-first/Schema.d.ts +92 -41
  157. package/dist/src/local-first/Schema.d.ts.map +1 -1
  158. package/dist/src/local-first/Schema.js +25 -8
  159. package/dist/src/local-first/Shared.d.ts +23 -21
  160. package/dist/src/local-first/Shared.d.ts.map +1 -1
  161. package/dist/src/local-first/Shared.js +100 -57
  162. package/dist/src/local-first/Storage.d.ts +53 -32
  163. package/dist/src/local-first/Storage.d.ts.map +1 -1
  164. package/dist/src/local-first/Storage.js +194 -234
  165. package/dist/src/local-first/Timestamp.d.ts +21 -21
  166. package/dist/src/local-first/Timestamp.d.ts.map +1 -1
  167. package/dist/src/local-first/Timestamp.js +2 -2
  168. package/dist/src/local-first/index.d.ts +11 -11
  169. package/package.json +14 -13
  170. package/src/Array.ts +306 -205
  171. package/src/Assert.ts +54 -69
  172. package/src/BigInt.ts +6 -3
  173. package/src/Brand.ts +27 -40
  174. package/src/Buffer.ts +28 -12
  175. package/src/Cache.ts +9 -4
  176. package/src/Callbacks.ts +30 -19
  177. package/src/Console.ts +156 -84
  178. package/src/Crypto.ts +83 -41
  179. package/src/Eq.ts +95 -22
  180. package/src/Error.ts +8 -4
  181. package/src/Function.ts +167 -59
  182. package/src/Http.ts +549 -0
  183. package/src/Identicon.ts +16 -7
  184. package/src/LeakDetector.ts +182 -0
  185. package/src/LockManager.ts +43 -39
  186. package/src/Lookup.ts +62 -28
  187. package/src/Microtask.ts +19 -23
  188. package/src/Number.ts +64 -12
  189. package/src/Object.ts +173 -49
  190. package/src/Option.ts +10 -7
  191. package/src/Order.ts +23 -21
  192. package/src/Platform.ts +136 -0
  193. package/src/Polyfills.ts +6 -12
  194. package/src/Random.ts +32 -19
  195. package/src/Redacted.ts +44 -30
  196. package/src/Ref.ts +14 -6
  197. package/src/RefCount.ts +38 -80
  198. package/src/Relation.ts +202 -10
  199. package/src/Resource.ts +1199 -591
  200. package/src/Result.ts +930 -271
  201. package/src/Schedule.ts +859 -343
  202. package/src/Set.ts +89 -40
  203. package/src/Sqlite.ts +144 -138
  204. package/src/StackTrace.ts +230 -0
  205. package/src/Store.ts +8 -7
  206. package/src/String.ts +22 -5
  207. package/src/Task.ts +5101 -2832
  208. package/src/Test.ts +20 -168
  209. package/src/Time.ts +293 -90
  210. package/src/Type.ts +10034 -4117
  211. package/src/Types.ts +227 -110
  212. package/src/WebSocket.ts +64 -36
  213. package/src/Worker.ts +180 -72
  214. package/src/index.ts +55 -52
  215. package/src/intl/cs.ts +388 -0
  216. package/src/intl/index.ts +7 -0
  217. package/src/local-first/Db.ts +152 -179
  218. package/src/local-first/Error.ts +4 -4
  219. package/src/local-first/Evolu.ts +495 -250
  220. package/src/local-first/LocalAuth.ts +6 -12
  221. package/src/local-first/Owner.ts +58 -21
  222. package/src/local-first/Protocol.ts +49 -31
  223. package/src/local-first/Query.ts +146 -61
  224. package/src/local-first/Relay.ts +51 -21
  225. package/src/local-first/Schema.ts +109 -51
  226. package/src/local-first/Shared.ts +266 -226
  227. package/src/local-first/Storage.ts +266 -264
  228. package/src/local-first/Timestamp.ts +25 -18
  229. package/src/local-first/index.ts +11 -11
  230. package/dist/src/Skiplist.d.ts +0 -28
  231. package/dist/src/Skiplist.d.ts.map +0 -1
  232. package/dist/src/Skiplist.js +0 -64
  233. package/dist/src/Tracer.d.ts +0 -48
  234. package/dist/src/Tracer.d.ts.map +0 -1
  235. package/dist/src/Tracer.js +0 -6
  236. package/src/Skiplist.ts +0 -108
  237. package/src/Tracer.ts +0 -54
@@ -3,21 +3,20 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { type NonEmptyReadonlyArray } from "../Array.js";
7
- import type { ConsoleDep } from "../Console.js";
8
- import { type LockManagerDep } from "../LockManager.js";
9
- import type { FlushSyncDep, ReloadAppDep } from "../Platform.js";
10
- import type { Listener, ReadonlyStore, Unsubscribe } from "../Store.js";
11
- import { type Task } from "../Task.js";
12
- import type { TypeError } from "../Type.js";
13
- import { Name } from "../Type.js";
14
- import type { CreateBroadcastChannelDep, CreateMessageChannelDep } from "../Worker.js";
15
- import type { CreateDbWorkerDep } from "./Db.js";
16
- import type { EvoluError } from "./Error.js";
17
- import type { AppOwner, Owner, OwnerTransport, ReadonlyOwner } from "./Owner.js";
18
- import type { Queries, QueriesToQueryRowsPromises, Query, QueryRows, Row } from "./Query.js";
19
- import type { EvoluSchema, IndexesConfig, Mutation, ValidateSchema } from "./Schema.js";
20
- import type { SharedWorkerDep } from "./Shared.js";
6
+ import { type NonEmptyReadonlyArray } from "../Array.ts";
7
+ import type { ConsoleDep } from "../Console.ts";
8
+ import { type LockManagerDep } from "../LockManager.ts";
9
+ import type { FlushSyncDep, ReloadAppDep } from "../Platform.ts";
10
+ import type { Listener, ReadonlyStore, Unsubscribe } from "../Store.ts";
11
+ import type { Task } from "../Task.ts";
12
+ import { Name, type TypeError, UrlSafeString } from "../Type.ts";
13
+ import type { CreateBroadcastChannelDep, CreateMessageChannelDep } from "../Worker.ts";
14
+ import type { CreateDbWorkerDep } from "./Db.ts";
15
+ import type { EvoluError } from "./Error.ts";
16
+ import type { AppOwner, Owner, OwnerTransport, ReadonlyOwner } from "./Owner.ts";
17
+ import type { Queries, QueriesToQueryRowsPromises, Query, QueryRows, Row } from "./Query.ts";
18
+ import type { EvoluSchema, IndexesConfig, Mutation, ValidateSchema } from "./Schema.ts";
19
+ import type { SharedWorkerDep } from "./Shared.ts";
21
20
  export interface EvoluConfig {
22
21
  /**
23
22
  * The app name. Evolu is multitenant - it can run multiple instances
@@ -33,27 +32,30 @@ export interface EvoluConfig {
33
32
  * ### Example
34
33
  *
35
34
  * ```ts
36
- * // appName: AppName.orThrow("MyApp")
35
+ * import { AppName } from "@evolu/common";
36
+ *
37
+ * const appName = AppName.orThrow("MyApp");
38
+ * expect(appName).toBe("MyApp");
37
39
  * ```
38
40
  */
39
41
  readonly appName: AppName;
40
42
  /**
41
43
  * {@link AppOwner} used to create this {@link Evolu} instance.
42
44
  *
43
- * Exposed as {@link Evolu.appOwner}. If `appOwner` is not passed, Evolu
44
- * creates one.
45
+ * Exposed as {@link Evolu.appOwner}. Create an AppOwner before the first run,
46
+ * or restore one from secure storage before creating Evolu.
45
47
  *
46
48
  * AppOwner controls access to the encrypted local SQLite database. If its
47
49
  * secret material (Owner secret / Mnemonic) is not stored safely, data
48
50
  * written by that instance is permanently inaccessible.
49
51
  *
50
- * Best onboarding UX is accountless first use: let users try a ready-to-use
51
- * app, then prompt backup of `evolu.appOwner`.
52
+ * Best onboarding UX is accountless first use: create an AppOwner, let users
53
+ * try a ready-to-use app, then prompt backup of `evolu.appOwner`.
52
54
  *
53
55
  * Recommended usage:
54
56
  *
55
- * - Omit `appOwner` for first run, then persist `evolu.appOwner` after user
56
- * activity and guide the user to back it up.
57
+ * - Create and persist an `appOwner` for first run, then guide the user to back
58
+ * it up after user activity.
57
59
  * - Pass `appOwner` restored from secure storage (for example, Expo
58
60
  * SecureStore, WebAuthn-backed storage, or app-managed account recovery
59
61
  * flow).
@@ -89,33 +91,51 @@ export interface EvoluConfig {
89
91
  *
90
92
  * The default value is:
91
93
  *
92
- * `{ type: "WebSocket", url: "wss://free.evoluhq.com" }`.
94
+ * `[{ type: "WebSocket", url: "wss://free.evoluhq.com" }]`.
93
95
  *
94
96
  * ### Example
95
97
  *
96
98
  * ```ts
97
- * // Single WebSocket relay
98
- * transports: [{ type: "WebSocket", url: "wss://relay1.example.com" }];
99
+ * import {
100
+ * createAppOwner,
101
+ * createOwnerWebSocketTransport,
102
+ * createOwnerSecret,
103
+ * createRandomBytes,
104
+ * type OwnerTransport,
105
+ * } from "@evolu/common";
106
+ *
107
+ * // Create once, persist the mnemonic securely, and restore it on later runs.
108
+ * const appOwner = createAppOwner(
109
+ * createOwnerSecret({ randomBytes: createRandomBytes() }),
110
+ * );
111
+ *
112
+ * // Use one relay.
113
+ * const singleRelay = [
114
+ * { type: "WebSocket", url: "wss://relay1.example.com" },
115
+ * ] satisfies ReadonlyArray<OwnerTransport>;
99
116
  *
100
- * // Multiple WebSocket relays for redundancy
101
- * transports: [
117
+ * // Use independent relays for redundancy.
118
+ * const redundantRelays = [
102
119
  * { type: "WebSocket", url: "wss://relay1.example.com" },
103
120
  * { type: "WebSocket", url: "wss://relay2.example.com" },
104
- * { type: "WebSocket", url: "wss://relay3.example.com" },
105
- * ];
121
+ * ] satisfies ReadonlyArray<OwnerTransport>;
106
122
  *
107
- * // Local-only instance (no sync) - useful for device settings or when relay
108
- * // URL will be provided later (e.g., after authentication), allowing users
109
- * // to work offline before the app connects
110
- * transports: [];
123
+ * // Start local-only before authentication. After authentication, pass an
124
+ * // owner-scoped transport to evolu.useOwner.
125
+ * const localOnlyBeforeAuthentication =
126
+ * [] satisfies ReadonlyArray<OwnerTransport>;
111
127
  *
112
- * // Using createOwnerWebSocketTransport helper for relay authentication
113
- * transports: [
128
+ * // Include the OwnerId when the relay authenticates owners.
129
+ * const authenticatedRelay = [
114
130
  * createOwnerWebSocketTransport({
115
- * url: "ws://localhost:4000",
116
- * ownerId,
131
+ * url: "wss://relay.example.com",
132
+ * ownerId: appOwner.id,
117
133
  * }),
118
134
  * ];
135
+ *
136
+ * expect(authenticatedRelay[0]?.url).toBe(
137
+ * `wss://relay.example.com?ownerId=${appOwner.id}`,
138
+ * );
119
139
  * ```
120
140
  */
121
141
  readonly transports?: ReadonlyArray<OwnerTransport>;
@@ -140,7 +160,28 @@ export interface EvoluConfig {
140
160
  * ### Example
141
161
  *
142
162
  * ```ts
143
- * const evolu = createEvolu(evoluReactDeps)(Schema, {
163
+ * import {
164
+ * AppName,
165
+ * createAppOwner,
166
+ * createEvolu,
167
+ * createOwnerSecret,
168
+ * createRandomBytes,
169
+ * id,
170
+ * } from "@evolu/common";
171
+ *
172
+ * const Schema = {
173
+ * todo: { id: id("Todo") },
174
+ * todoCategory: { id: id("TodoCategory") },
175
+ * };
176
+ * // Create once, persist the mnemonic securely, and restore it on later runs.
177
+ * const appOwner = createAppOwner(
178
+ * createOwnerSecret({ randomBytes: createRandomBytes() }),
179
+ * );
180
+ *
181
+ * const createTodoEvolu = createEvolu(Schema, {
182
+ * appName: AppName.orThrow("IndexedTodos"),
183
+ * appOwner,
184
+ * transports: [],
144
185
  * indexes: (create) => [
145
186
  * create("todoCreatedAt").on("todo").column("createdAt"),
146
187
  * create("todoCategoryCreatedAt")
@@ -148,6 +189,8 @@ export interface EvoluConfig {
148
189
  * .column("createdAt"),
149
190
  * ],
150
191
  * });
192
+ *
193
+ * expect(createTodoEvolu).toBeTypeOf("function");
151
194
  * ```
152
195
  */
153
196
  readonly indexes?: IndexesConfig;
@@ -176,11 +219,12 @@ export interface EvoluConfig {
176
219
  * Uses the same safe alphabet as {@link UrlSafeString} (letters, digits, `-`,
177
220
  * `_`) and must be between 1 and 41 characters.
178
221
  */
179
- export declare const AppName: import("../Type.js").BrandType<import("../Type.js").BrandType<import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "UrlSafeString", import("../Type.js").RegexError<"UrlSafeString">, import("../Type.js").StringError>, "AppName", AppNameError, import("../Type.js").StringError | import("../Type.js").RegexError<"UrlSafeString">>;
180
- export type AppName = typeof AppName.Type;
222
+ export declare const AppName: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"String", string, string, import("../Type.ts").TypeOfError<"String">, null, import("../Type.ts").TypeOfError<"String">, never, string, true>, "UrlSafeString", import("../Type.ts").RegexError<"UrlSafeString">>, "AppName", AppNameError>;
223
+ export type AppName = typeof AppName.Output;
181
224
  export interface AppNameError extends TypeError<"AppName"> {
225
+ readonly value: UrlSafeString;
182
226
  }
183
- export declare const testAppName: string & import("../Brand.js").Brand<"UrlSafeString"> & import("../Brand.js").Brand<"AppName">;
227
+ export declare const testAppName: string & import("../Brand.ts").Brand<"UrlSafeString"> & import("../Brand.ts").Brand<"AppName">;
184
228
  /**
185
229
  * Local-first SQL database with typed queries, mutations, and sync.
186
230
  *
@@ -202,19 +246,45 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
202
246
  * every row has a globally unique, conflict-free identifier without
203
247
  * coordination.
204
248
  *
249
+ * Pass `onComplete` when follow-up work must wait until the mutation and its
250
+ * query patches have been applied.
251
+ *
205
252
  * ### Example
206
253
  *
207
254
  * ```ts
208
- * const { id } = evolu.insert("todo", {
209
- * title: NonEmptyString100.orThrow("Learn Evolu"),
210
- * });
211
- *
212
- * // With onComplete callback
213
- * evolu.insert(
214
- * "todo",
215
- * { title: NonEmptyString100.orThrow("Another todo") },
216
- * { onComplete: () => console.log("Insert completed") },
217
- * );
255
+ * import {
256
+ * id,
257
+ * NonEmptyTrimmedString100,
258
+ * type Evolu,
259
+ * } from "@evolu/common";
260
+ *
261
+ * const TodoId = id("Todo");
262
+ * type TodoId = typeof TodoId.Output;
263
+ * const Schema = {
264
+ * todo: { id: TodoId, title: NonEmptyTrimmedString100 },
265
+ * };
266
+ *
267
+ * const insertTodo = (evolu: Evolu<typeof Schema>) =>
268
+ * evolu.insert("todo", {
269
+ * title: NonEmptyTrimmedString100.orThrow("Learn Evolu"),
270
+ * }).id;
271
+ *
272
+ * const insertTodoAndNotify = (
273
+ * evolu: Evolu<typeof Schema>,
274
+ * onComplete: () => void,
275
+ * ) =>
276
+ * evolu.insert(
277
+ * "todo",
278
+ * { title: NonEmptyTrimmedString100.orThrow("Another todo") },
279
+ * { onComplete },
280
+ * ).id;
281
+ *
282
+ * expectTypeOf<
283
+ * [
284
+ * ReturnType<typeof insertTodo>,
285
+ * ReturnType<typeof insertTodoAndNotify>,
286
+ * ]
287
+ * >().toEqualTypeOf<[TodoId, TodoId]>();
218
288
  * ```
219
289
  *
220
290
  * @see {@link Mutation}
@@ -228,13 +298,31 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
228
298
  * ### Example
229
299
  *
230
300
  * ```ts
231
- * const { id } = evolu.update("todo", {
232
- * id: todoId,
233
- * title: NonEmptyString100.orThrow("Updated title"),
234
- * });
235
- *
236
- * // Soft delete
237
- * evolu.update("todo", { id: todoId, isDeleted: sqliteTrue });
301
+ * import {
302
+ * id,
303
+ * NonEmptyTrimmedString100,
304
+ * sqliteTrue,
305
+ * type Evolu,
306
+ * } from "@evolu/common";
307
+ *
308
+ * const TodoId = id("Todo");
309
+ * type TodoId = typeof TodoId.Output;
310
+ * const Schema = {
311
+ * todo: { id: TodoId, title: NonEmptyTrimmedString100 },
312
+ * };
313
+ *
314
+ * const renameTodo = (evolu: Evolu<typeof Schema>, todoId: TodoId) =>
315
+ * evolu.update("todo", {
316
+ * id: todoId,
317
+ * title: NonEmptyTrimmedString100.orThrow("Updated title"),
318
+ * }).id;
319
+ *
320
+ * const softDeleteTodo = (evolu: Evolu<typeof Schema>, todoId: TodoId) =>
321
+ * evolu.update("todo", { id: todoId, isDeleted: sqliteTrue }).id;
322
+ *
323
+ * expectTypeOf<
324
+ * [ReturnType<typeof renameTodo>, ReturnType<typeof softDeleteTodo>]
325
+ * >().toEqualTypeOf<[TodoId, TodoId]>();
238
326
  * ```
239
327
  *
240
328
  * @see {@link Mutation}
@@ -255,11 +343,26 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
255
343
  * ### Example
256
344
  *
257
345
  * ```ts
258
- * const stableId = createIdFromString("my-todo-1");
259
- * const { id } = evolu.upsert("todo", {
260
- * id: stableId,
261
- * title: NonEmptyString100.orThrow("Learn Evolu"),
262
- * });
346
+ * import {
347
+ * createIdFromString,
348
+ * id,
349
+ * NonEmptyTrimmedString100,
350
+ * type Evolu,
351
+ * } from "@evolu/common";
352
+ *
353
+ * const TodoId = id("Todo");
354
+ * type TodoId = typeof TodoId.Output;
355
+ * const Schema = {
356
+ * todo: { id: TodoId, title: NonEmptyTrimmedString100 },
357
+ * };
358
+ * const stableId = TodoId.orThrow(createIdFromString("my-todo-1"));
359
+ * const upsertTodo = (evolu: Evolu<typeof Schema>) =>
360
+ * evolu.upsert("todo", {
361
+ * id: stableId,
362
+ * title: NonEmptyTrimmedString100.orThrow("Learn Evolu"),
363
+ * }).id;
364
+ *
365
+ * expectTypeOf(upsertTodo).returns.toEqualTypeOf<TodoId>();
263
366
  * ```
264
367
  *
265
368
  * @see {@link Mutation}
@@ -283,25 +386,74 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
283
386
  * ### Example
284
387
  *
285
388
  * ```ts
389
+ * import {
390
+ * createQueryBuilder,
391
+ * id,
392
+ * NonEmptyTrimmedString100,
393
+ * type Evolu,
394
+ * type QueryRows,
395
+ * } from "@evolu/common";
396
+ *
397
+ * const Schema = {
398
+ * todo: { id: id("Todo"), title: NonEmptyTrimmedString100 },
399
+ * };
286
400
  * const createQuery = createQueryBuilder(Schema);
287
401
  * const allTodos = createQuery((db) =>
288
402
  * db.selectFrom("todo").selectAll(),
289
403
  * );
290
- * evolu.loadQuery(allTodos).then((rows) => {
291
- * console.log(rows);
292
- * });
404
+ * const loadTodos = async (evolu: Evolu<typeof Schema>) => {
405
+ * const rows = await evolu.loadQuery(allTodos);
406
+ * return rows;
407
+ * };
408
+ *
409
+ * expectTypeOf(loadTodos).returns.toEqualTypeOf<
410
+ * Promise<QueryRows<typeof allTodos.Row>>
411
+ * >();
293
412
  * ```
294
413
  */
295
414
  readonly loadQuery: <R extends Row>(query: Query<S, R>) => Promise<QueryRows<R>>;
296
415
  /**
297
- * Load an array of {@link Query} queries and return an array of
416
+ * Load an array of {@link Query} values and return an array of
298
417
  * {@link QueryRows} promises. It's like `queries.map(loadQuery)` but with
299
418
  * proper types for returned promises.
300
419
  *
301
420
  * ### Example
302
421
  *
303
422
  * ```ts
304
- * evolu.loadQueries([allTodos, todoById(1)]);
423
+ * import {
424
+ * createIdFromString,
425
+ * createQueryBuilder,
426
+ * id,
427
+ * NonEmptyTrimmedString100,
428
+ * type Evolu,
429
+ * type QueryRows,
430
+ * } from "@evolu/common";
431
+ *
432
+ * const TodoId = id("Todo");
433
+ * type TodoId = typeof TodoId.Output;
434
+ * const Schema = {
435
+ * todo: { id: TodoId, title: NonEmptyTrimmedString100 },
436
+ * };
437
+ * const createQuery = createQueryBuilder(Schema);
438
+ * const allTodos = createQuery((db) =>
439
+ * db.selectFrom("todo").select(["id", "title"]),
440
+ * );
441
+ * const todoById = (todoId: TodoId) =>
442
+ * createQuery((db) =>
443
+ * db.selectFrom("todo").select("title").where("id", "=", todoId),
444
+ * );
445
+ * const firstTodo = todoById(
446
+ * TodoId.orThrow(createIdFromString("first-todo")),
447
+ * );
448
+ * const loadTodoQueries = (evolu: Evolu<typeof Schema>) =>
449
+ * evolu.loadQueries([allTodos, firstTodo]);
450
+ *
451
+ * expectTypeOf(loadTodoQueries).returns.toEqualTypeOf<
452
+ * [
453
+ * Promise<QueryRows<typeof allTodos.Row>>,
454
+ * Promise<QueryRows<typeof firstTodo.Row>>,
455
+ * ]
456
+ * >();
305
457
  * ```
306
458
  */
307
459
  readonly loadQueries: <Q extends Queries<S>>(queries: [...Q]) => [...QueriesToQueryRowsPromises<Q>];
@@ -311,9 +463,31 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
311
463
  * ### Example
312
464
  *
313
465
  * ```ts
314
- * const unsubscribe = evolu.subscribeQuery(allTodos)(() => {
315
- * const rows = evolu.getQueryRows(allTodos);
316
- * });
466
+ * import {
467
+ * createQueryBuilder,
468
+ * id,
469
+ * NonEmptyTrimmedString100,
470
+ * type Evolu,
471
+ * type QueryRows,
472
+ * type Unsubscribe,
473
+ * } from "@evolu/common";
474
+ *
475
+ * const Schema = {
476
+ * todo: { id: id("Todo"), title: NonEmptyTrimmedString100 },
477
+ * };
478
+ * const createQuery = createQueryBuilder(Schema);
479
+ * const allTodos = createQuery((db) =>
480
+ * db.selectFrom("todo").select("title"),
481
+ * );
482
+ * const subscribeToTodos = (
483
+ * evolu: Evolu<typeof Schema>,
484
+ * onRows: (rows: QueryRows<typeof allTodos.Row>) => void,
485
+ * ) =>
486
+ * evolu.subscribeQuery(allTodos)(() => {
487
+ * onRows(evolu.getQueryRows(allTodos));
488
+ * });
489
+ *
490
+ * expectTypeOf(subscribeToTodos).returns.toEqualTypeOf<Unsubscribe>();
317
491
  * ```
318
492
  */
319
493
  readonly subscribeQuery: (query: Query<S>) => (listener: Listener) => Unsubscribe;
@@ -323,9 +497,27 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
323
497
  * ### Example
324
498
  *
325
499
  * ```ts
326
- * const unsubscribe = evolu.subscribeQuery(allTodos)(() => {
327
- * const rows = evolu.getQueryRows(allTodos);
328
- * });
500
+ * import {
501
+ * createQueryBuilder,
502
+ * id,
503
+ * NonEmptyTrimmedString100,
504
+ * type Evolu,
505
+ * type QueryRows,
506
+ * } from "@evolu/common";
507
+ *
508
+ * const Schema = {
509
+ * todo: { id: id("Todo"), title: NonEmptyTrimmedString100 },
510
+ * };
511
+ * const createQuery = createQueryBuilder(Schema);
512
+ * const allTodos = createQuery((db) =>
513
+ * db.selectFrom("todo").select("title"),
514
+ * );
515
+ * const getTodos = (evolu: Evolu<typeof Schema>) =>
516
+ * evolu.getQueryRows(allTodos);
517
+ *
518
+ * expectTypeOf(getTodos).returns.toEqualTypeOf<
519
+ * QueryRows<typeof allTodos.Row>
520
+ * >();
329
521
  * ```
330
522
  */
331
523
  readonly getQueryRows: <R extends Row>(query: Query<S, R>) => QueryRows<R>;
@@ -353,6 +545,8 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
353
545
  *
354
546
  * All instances identified by {@link Evolu.name} will be self-disposed. Use
355
547
  * {@link EvoluConfig.onDatabaseDeleted} to update app UI when that happens.
548
+ *
549
+ * Currently not implemented.
356
550
  */
357
551
  readonly deleteDatabase: () => void;
358
552
  /**
@@ -363,6 +557,8 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
363
557
  *
364
558
  * It also stops using that owner across all tabs and instances. Use
365
559
  * {@link EvoluConfig.onOwnerDeleted} to update app UI when that happens.
560
+ *
561
+ * Currently not implemented.
366
562
  */
367
563
  readonly deleteOwner: (owner: Owner) => void;
368
564
  /**
@@ -381,20 +577,51 @@ export interface Evolu<S extends EvoluSchema = EvoluSchema> extends AsyncDisposa
381
577
  * ### Example
382
578
  *
383
579
  * ```ts
384
- * // Use an Owner (starts syncing).
385
- * const unuseOwner = evolu.useOwner(shardOwner, [
386
- * createOwnerWebSocketTransport({
387
- * url: "ws://localhost:4000",
388
- * ownerId: shardOwner.id,
389
- * }),
390
- * ]);
391
- *
392
- * // Later, stop using the Owner.
393
- * unuseOwner();
394
- *
395
- * // Bulk operations.
396
- * const unuseOwners = owners.map(evolu.useOwner);
397
- * // Later: for (const unuse of unuseOwners) unuse();
580
+ * import {
581
+ * createAppOwner,
582
+ * createOwnerWebSocketTransport,
583
+ * createOwnerSecret,
584
+ * createRandomBytes,
585
+ * deriveShardOwner,
586
+ * type Evolu,
587
+ * type ReadonlyOwner,
588
+ * type UnuseOwner,
589
+ * } from "@evolu/common";
590
+ *
591
+ * // Create once, persist the mnemonic securely, and restore it on later runs.
592
+ * const appOwner = createAppOwner(
593
+ * createOwnerSecret({ randomBytes: createRandomBytes() }),
594
+ * );
595
+ * const shardOwner = deriveShardOwner(appOwner, ["todos", 1]);
596
+ * const shardTransport = createOwnerWebSocketTransport({
597
+ * url: "wss://relay.example.com",
598
+ * ownerId: shardOwner.id,
599
+ * });
600
+ * const useShardOwner = (evolu: Evolu): UnuseOwner =>
601
+ * evolu.useOwner(shardOwner, [shardTransport]);
602
+ *
603
+ * const useOwners = (
604
+ * evolu: Evolu,
605
+ * owners: ReadonlyArray<ReadonlyOwner>,
606
+ * ): UnuseOwner => {
607
+ * const unuseOwners = owners.map((owner) =>
608
+ * evolu.useOwner(owner, [
609
+ * createOwnerWebSocketTransport({
610
+ * url: "wss://relay.example.com",
611
+ * ownerId: owner.id,
612
+ * }),
613
+ * ]),
614
+ * );
615
+ * return () => {
616
+ * for (const unuse of unuseOwners) unuse();
617
+ * };
618
+ * };
619
+ *
620
+ * // Call each returned UnuseOwner once to stop syncing.
621
+ * expect(shardTransport).toEqual({
622
+ * type: "WebSocket",
623
+ * url: `wss://relay.example.com?ownerId=${shardOwner.id}`,
624
+ * });
398
625
  * ```
399
626
  */
400
627
  readonly useOwner: (owner: ReadonlyOwner | Owner, transports?: NonEmptyReadonlyArray<OwnerTransport>) => UnuseOwner;
@@ -406,18 +633,28 @@ export interface EvoluErrorDep {
406
633
  * {@link ReadonlyStore} of {@link EvoluError} shared by all {@link Evolu}
407
634
  * instances created from the same {@link createEvoluDeps} result.
408
635
  *
409
- * Subscribe once to show user-facing messages across all instances. Logging
410
- * is handled by platform {@link createRun} global error handlers.
636
+ * Subscribe once to show user-facing error messages across all instances.
411
637
  *
412
638
  * ### Example
413
639
  *
414
640
  * ```ts
641
+ * import { createStore, Millis, type EvoluError } from "@evolu/common";
642
+ * import type { EvoluErrorDep } from "@evolu/common/local-first";
643
+ *
644
+ * // Stand-in for run.deps.evoluError from createEvoluDeps.
645
+ * using evoluError = createStore<EvoluError | null>(null);
646
+ * const deps = { evoluError } satisfies EvoluErrorDep;
647
+ * let displayedMessage = "";
648
+ * const showMessage = (message: string) => {
649
+ * displayedMessage = message;
650
+ * };
651
+ *
415
652
  * deps.evoluError.subscribe(() => {
416
653
  * const error = deps.evoluError.get();
417
654
  * if (!error) return;
418
655
  *
419
656
  * switch (error.type) {
420
- * case "InvalidComputerClock":
657
+ * case "TimestampDriftError":
421
658
  * // Show guidance specific to the detected error.
422
659
  * showMessage(
423
660
  * "Your system clock appears incorrect. Please fix it.",
@@ -428,6 +665,15 @@ export interface EvoluErrorDep {
428
665
  * showMessage("Something went wrong. Please try again.");
429
666
  * }
430
667
  * });
668
+ *
669
+ * deps.evoluError.set({
670
+ * type: "TimestampDriftError",
671
+ * next: Millis.orThrow(360000),
672
+ * now: Millis.orThrow(0),
673
+ * });
674
+ * expect(displayedMessage).toBe(
675
+ * "Your system clock appears incorrect. Please fix it.",
676
+ * );
431
677
  * ```
432
678
  */
433
679
  readonly evoluError: ReadonlyStore<EvoluError | null>;
@@ -438,7 +684,7 @@ export interface EvoluErrorDep {
438
684
  * Includes platform adapters, the shared {@link EvoluErrorDep.evoluError} store,
439
685
  * and disposal for owned resources.
440
686
  */
441
- export type EvoluDeps = EvoluPlatformDeps & EvoluErrorDep & Disposable;
687
+ export type EvoluDeps = EvoluPlatformDeps & ConsoleDep & EvoluErrorDep & Disposable;
442
688
  /**
443
689
  * Platform-specific dependencies required to create {@link EvoluDeps}.
444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