@delali/sirannon-db 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/backup-scheduler/index.d.ts +15 -1
  2. package/dist/backup-scheduler/index.mjs +2 -2
  3. package/dist/baseline-D93hcIEE.d.ts +17 -0
  4. package/dist/{change-tracker-DKRVUC3l.d.ts → change-tracker-DDmXB754.d.ts} +56 -8
  5. package/dist/{chunk-5NOIGN5Y.mjs → chunk-2QLXDHAP.mjs} +1 -1
  6. package/dist/{chunk-LNY2VVHE.mjs → chunk-7C36BCSN.mjs} +1 -1
  7. package/dist/{chunk-NVQS53NT.mjs → chunk-7FQRQH5Z.mjs} +53 -64
  8. package/dist/{chunk-D7LAYTKN.mjs → chunk-7R4ER4FB.mjs} +1 -1
  9. package/dist/{chunk-FHWTZFI4.mjs → chunk-BQFQ65OL.mjs} +1 -1
  10. package/dist/{chunk-O7SLN3GI.mjs → chunk-BTTFW4Z4.mjs} +1 -1
  11. package/dist/{chunk-H6PIVVDN.mjs → chunk-CCZK6LCB.mjs} +38 -25
  12. package/dist/{chunk-JZGINXTN.mjs → chunk-HCCGEIZ2.mjs} +2 -2
  13. package/dist/{chunk-67M7KAH6.mjs → chunk-IWGIYDMZ.mjs} +1 -1
  14. package/dist/{chunk-LFZ37BSX.mjs → chunk-OUSWVNWT.mjs} +1 -1
  15. package/dist/{chunk-HR5CWTLC.mjs → chunk-P2VJYRVY.mjs} +60 -7
  16. package/dist/{chunk-UC3SCMIN.mjs → chunk-PBRXXISQ.mjs} +3 -0
  17. package/dist/{chunk-JU64Y7HM.mjs → chunk-SBL6GN43.mjs} +1 -1
  18. package/dist/{chunk-EBJXPQQO.mjs → chunk-UPKKSUPA.mjs} +2 -2
  19. package/dist/{chunk-TJF5GZSV.mjs → chunk-VOSJBZ6Q.mjs} +1 -1
  20. package/dist/{chunk-PIKHN33N.mjs → chunk-VOYGMAU7.mjs} +9 -1
  21. package/dist/{chunk-H237TXZW.mjs → chunk-WJ67DTD6.mjs} +48 -6
  22. package/dist/{chunk-OQVZBEBY.mjs → chunk-XF2HH5E6.mjs} +4 -61
  23. package/dist/client/index.d.ts +211 -12
  24. package/dist/client/index.mjs +155 -67
  25. package/dist/client/topology.d.ts +55 -7
  26. package/dist/client/topology.mjs +20 -1
  27. package/dist/{client-base-CLWmH5Ln.d.ts → client-base-CmZO0v3m.d.ts} +133 -24
  28. package/dist/codegen/cli.mjs +3 -3
  29. package/dist/codegen/index.d.ts +92 -2
  30. package/dist/codegen/index.mjs +3 -3
  31. package/dist/core/index.d.ts +177 -15
  32. package/dist/core/index.mjs +2481 -2226
  33. package/dist/core/writer-worker.mjs +3 -3
  34. package/dist/database-B5Qv1-cU.d.ts +380 -0
  35. package/dist/driver/better-sqlite3.d.ts +18 -1
  36. package/dist/driver/better-sqlite3.mjs +5 -5
  37. package/dist/driver/bun.d.ts +28 -0
  38. package/dist/driver/expo.d.ts +17 -0
  39. package/dist/driver/node.d.ts +18 -1
  40. package/dist/driver/node.mjs +5 -5
  41. package/dist/driver/wa-sqlite.d.ts +18 -1
  42. package/dist/{errors-Bw5MdNCu.d.ts → errors-Dei4GdBb.d.ts} +80 -7
  43. package/dist/file-migrations/index.d.ts +54 -2
  44. package/dist/file-migrations/index.mjs +3 -3
  45. package/dist/{operation-registry-9DcvxcE5.d.ts → operation-registry-hlbhqu7q.d.ts} +50 -1
  46. package/dist/{primary-wins-DPAm2AKG.d.ts → primary-wins-B0np8JS3.d.ts} +25 -1
  47. package/dist/protocol-rqANt-9Q.d.ts +152 -0
  48. package/dist/query-types-DL3LtPvY.d.ts +95 -0
  49. package/dist/react/index.d.ts +58 -3
  50. package/dist/replication/coordinator/etcd.d.ts +63 -3
  51. package/dist/replication/coordinator/etcd.mjs +82 -46
  52. package/dist/replication/index.d.ts +329 -95
  53. package/dist/replication/index.mjs +256 -141
  54. package/dist/server/index.d.ts +230 -12
  55. package/dist/server/index.mjs +63 -50
  56. package/dist/{server-options-1JHu8pid.d.ts → server-options-Dab_Jvd_.d.ts} +96 -12
  57. package/dist/sirannon-CMhiJa5Y.d.ts +111 -0
  58. package/dist/transport/grpc.d.ts +93 -9
  59. package/dist/transport/grpc.mjs +63 -20
  60. package/dist/transport/memory.d.ts +50 -20
  61. package/dist/transport/memory.mjs +25 -0
  62. package/dist/{types-CL6piSnD.d.ts → types-BCejqzNA.d.ts} +20 -0
  63. package/dist/types-CMBcFPhb.d.ts +336 -0
  64. package/dist/types-CjhxcjhA.d.ts +123 -0
  65. package/dist/types-DyrCiWuc.d.ts +499 -0
  66. package/dist/types-rVZKnKN-.d.ts +591 -0
  67. package/package.json +7 -1
  68. package/dist/baseline-Br77Fnhb.d.ts +0 -6
  69. package/dist/database-BY0L5Q2n.d.ts +0 -172
  70. package/dist/protocol-6KrSq2Hy.d.ts +0 -66
  71. package/dist/sirannon-DaQSyhbJ.d.ts +0 -36
  72. package/dist/types-B7gmEsZW.d.ts +0 -221
  73. package/dist/types-BsVabqSI.d.ts +0 -139
  74. package/dist/types-C_D8IhpO.d.ts +0 -60
  75. package/dist/types-zhnRXrsb.d.ts +0 -384
@@ -1,7 +1,7 @@
1
- import { executeGroup } from '../chunk-JZGINXTN.mjs';
2
- import '../chunk-D7LAYTKN.mjs';
1
+ import { executeGroup } from '../chunk-HCCGEIZ2.mjs';
2
+ import '../chunk-7R4ER4FB.mjs';
3
3
  import { WORKER_CANCELLED_CODE, serializeError } from '../chunk-4ISB7XMA.mjs';
4
- import { SirannonError } from '../chunk-UC3SCMIN.mjs';
4
+ import { SirannonError } from '../chunk-PBRXXISQ.mjs';
5
5
  import { parentPort } from 'worker_threads';
6
6
 
7
7
  var STATEMENT_CACHE_CAPACITY = 128;
@@ -0,0 +1,380 @@
1
+ import { Q as QueryHookContext, g as ConnectionHookContext, h as BeforeSubscribeHook, H as HookConfig, i as MetricsConfig, j as QueryMetrics, k as ConnectionMetrics, l as CDCMetrics, a as SQLiteDriver, D as DatabaseOptions, T as Transaction, e as SQLiteConnection, M as Migration, m as MigrationResult, R as RollbackResult, f as BackupScheduleOptions, B as BeforeQueryHook, A as AfterQueryHook } from './types-rVZKnKN-.js';
2
+ import { c as ReplicationChange, C as ConflictResolver, A as ApplyResult, R as ReplicationBatch } from './types-CjhxcjhA.js';
3
+ import { C as ChangeEvent, P as Params, Q as QueryOptions, E as ExecuteResult, S as SubscriptionBuilder } from './query-types-DL3LtPvY.js';
4
+ import { A as AppliedMigrationRow, b as BulkLoadOptions, a as BulkLoadResult } from './server-options-Dab_Jvd_.js';
5
+ import { L as LiveQueryOptions, a as LiveQuery } from './types-BCejqzNA.js';
6
+
7
+ /**
8
+ * Names of the lifecycle points a hook can attach to.
9
+ *
10
+ * @internal
11
+ */
12
+ type HookEvent = 'beforeQuery' | 'afterQuery' | 'beforeConnect' | 'databaseOpen' | 'databaseClose' | 'beforeSubscribe';
13
+ /**
14
+ * Context a subscribe hook receives.
15
+ *
16
+ * @internal
17
+ */
18
+ type SubscribeHookContext = Parameters<BeforeSubscribeHook>[0];
19
+ /**
20
+ * Maps each lifecycle point to the context its hooks receive.
21
+ *
22
+ * @internal
23
+ */
24
+ interface HookEventContextMap {
25
+ beforeQuery: QueryHookContext;
26
+ afterQuery: QueryHookContext & {
27
+ durationMs: number;
28
+ };
29
+ beforeConnect: ConnectionHookContext;
30
+ databaseOpen: ConnectionHookContext;
31
+ databaseClose: ConnectionHookContext;
32
+ beforeSubscribe: SubscribeHookContext;
33
+ }
34
+ /**
35
+ * Function a hook registration stores for one lifecycle point.
36
+ *
37
+ * @internal
38
+ */
39
+ type HookHandler<E extends HookEvent> = (ctx: HookEventContextMap[E]) => void | Promise<void>;
40
+ /**
41
+ * Removes a registered hook when called.
42
+ *
43
+ * @internal
44
+ */
45
+ type HookDispose = () => void;
46
+
47
+ /**
48
+ * Holds the lifecycle hooks a database or registry has registered and invokes them in order.
49
+ *
50
+ * @internal
51
+ */
52
+ declare class HookRegistry {
53
+ private hooks;
54
+ constructor(config?: HookConfig);
55
+ register<E extends HookEvent>(event: E, hook: HookHandler<E>): HookDispose;
56
+ invoke<E extends HookEvent>(event: E, ctx: HookEventContextMap[E]): Promise<void>;
57
+ invokeSync<E extends HookEvent>(event: E, ctx: HookEventContextMap[E]): void;
58
+ has(event: HookEvent): boolean;
59
+ count(event: HookEvent): number;
60
+ clear(event?: HookEvent): void;
61
+ private addHook;
62
+ private loadConfig;
63
+ }
64
+
65
+ /**
66
+ * Times queries and reports connection and change-capture activity to the configured metrics callbacks.
67
+ *
68
+ * @internal
69
+ */
70
+ declare class MetricsCollector {
71
+ private config;
72
+ constructor(config?: MetricsConfig);
73
+ trackQuery<T>(fn: () => Promise<T>, context: Omit<QueryMetrics, 'durationMs' | 'error'>): Promise<T>;
74
+ trackConnection(metrics: ConnectionMetrics): void;
75
+ trackCDCEvent(metrics: CDCMetrics): void;
76
+ get active(): boolean;
77
+ }
78
+
79
+ interface StagedRecovery {
80
+ resumeSeq: bigint | null;
81
+ appliedSeq: bigint | null;
82
+ /**
83
+ * The failure that stopped the recovery apply, or null. The staged rows
84
+ * are untouched by the failure and the resume watermark still covers
85
+ * them, so the caller opens the subscription anyway: a schema-gate refusal
86
+ * there is what tells a device it must migrate before this apply can
87
+ * succeed. The caller must then retry the recovery, because the resume
88
+ * watermark is past the transaction this apply left unapplied, so the
89
+ * server sends nothing that would prompt another try.
90
+ */
91
+ applyError: unknown | null;
92
+ }
93
+
94
+ /**
95
+ * How far a device has pulled from its server, and which sequence space that
96
+ * position belongs to.
97
+ *
98
+ * @public
99
+ */
100
+ interface DeviceSyncPullState {
101
+ /** Highest server change-log position this device has applied. */
102
+ seq: bigint;
103
+ /** Sequence space that position came from. */
104
+ epoch: string | undefined;
105
+ }
106
+ /**
107
+ * What a device's local database offers the sync loop: it stages and applies
108
+ * what the server sends, reads what the device still owes the server, and
109
+ * keeps both cursors. Take one from {@link Database.deviceSync}.
110
+ *
111
+ * @public
112
+ */
113
+ interface DeviceSyncPort {
114
+ /** Returns the identifier this device stamps its own changes with. */
115
+ identity(): Promise<{
116
+ nodeId: string;
117
+ }>;
118
+ /** Applies one pulled transaction and advances the pull cursor in the same write. */
119
+ applyPulledTransaction(changes: readonly ReplicationChange[], pullSeq: bigint, resolver?: ConflictResolver | ((table: string) => ConflictResolver)): Promise<ApplyResult>;
120
+ /** Stores pulled changes durably without applying them, so an interrupted device resumes from disk. */
121
+ stagePulledChanges(events: readonly ChangeEvent[]): Promise<bigint | null>;
122
+ /** Applies whatever is staged and returns the position reached. */
123
+ applyStagedPull(resolver?: ConflictResolver | ((table: string) => ConflictResolver), onChange?: (event: ChangeEvent) => void): Promise<bigint | null>;
124
+ /** Applies what a previous run left staged, and reports the failure that stopped it. */
125
+ recoverStagedPull(resolver?: ConflictResolver | ((table: string) => ConflictResolver), onChange?: (event: ChangeEvent) => void): Promise<StagedRecovery>;
126
+ /** Reads the next run of local changes the device still owes the server. */
127
+ readOutboxBatch(afterSeq: bigint, limit: number): Promise<ReplicationBatch | null>;
128
+ /** Counts the local changes the device still owes the server. */
129
+ countOutboxPending(afterSeq: bigint): Promise<number>;
130
+ /** Reads how far the device has pushed. */
131
+ getPushCursor(): Promise<bigint>;
132
+ /** Records how far the device has pushed. */
133
+ setPushCursor(seq: bigint): Promise<void>;
134
+ /** Reads how far the device has pulled, or null before it has pulled anything. */
135
+ getPullState(): Promise<DeviceSyncPullState | null>;
136
+ /** Reports whether the server has told this device to download a fresh snapshot. */
137
+ getResyncRequired(): Promise<boolean>;
138
+ /** Records whether the device must download a fresh snapshot. */
139
+ setResyncRequired(required: boolean): Promise<void>;
140
+ /** Records how far the device has pulled, and the sequence space it came from. */
141
+ setPullState(seq: bigint, epoch?: string): Promise<void>;
142
+ /** Keeps changes above a position out of pruning until the server has accepted them. */
143
+ protectUnpushedChanges(pushedSeq: bigint): void;
144
+ /** Reports whether a snapshot download was interrupted and still has to finish. */
145
+ snapshotLoadPending(): Promise<boolean>;
146
+ /** Clears the named tables and opens the database for a snapshot download. */
147
+ beginSnapshotLoad(tables: readonly string[]): Promise<void>;
148
+ /** Applies the schema statements a snapshot carries. */
149
+ applySnapshotSchema(schema: readonly string[]): Promise<void>;
150
+ /** Writes one page of snapshot rows into a table. */
151
+ loadSnapshotPage(table: string, rows: readonly Record<string, unknown>[]): Promise<void>;
152
+ /** Replaces the local migration history with the server's. */
153
+ replaceMigrationHistory(rows: readonly AppliedMigrationRow[]): Promise<void>;
154
+ /** Closes a completed snapshot download and reopens the database for normal use. */
155
+ endSnapshotLoad(tables: readonly string[]): Promise<void>;
156
+ /** Abandons a snapshot download, leaving the database marked as needing another. */
157
+ abortSnapshotLoad(): Promise<void>;
158
+ }
159
+
160
+ interface DatabaseInternals {
161
+ parentHooks?: HookRegistry;
162
+ metrics?: MetricsCollector;
163
+ }
164
+
165
+ /**
166
+ * One open SQLite database, with its reads, writes, transactions, migrations, change subscriptions, and live queries.
167
+ *
168
+ * Open one through {@link Sirannon.open} rather than constructing it.
169
+ *
170
+ * @public
171
+ */
172
+ declare class Database {
173
+ /** Identifier this database was opened under. */
174
+ readonly id: string;
175
+ /** File path of the SQLite database. */
176
+ readonly path: string;
177
+ /** Whether this database refuses writes. */
178
+ readonly readOnly: boolean;
179
+ private readonly runtime;
180
+ private readonly closeListeners;
181
+ private _closed;
182
+ private constructor();
183
+ /** @internal */
184
+ static create(id: string, path: string, driver: SQLiteDriver, options?: DatabaseOptions, internals?: DatabaseInternals): Promise<Database>;
185
+ /** @internal */
186
+ applyChanges(batch: ReplicationBatch, resolver?: ConflictResolver | ((table: string) => ConflictResolver)): Promise<ApplyResult>;
187
+ /**
188
+ * Returns the device-sync port for this database, which reads and advances
189
+ * the cursors a `SyncController` keeps against a server.
190
+ *
191
+ * @returns The port, which `downloadDatabaseSnapshot` also accepts.
192
+ */
193
+ deviceSync(): DeviceSyncPort;
194
+ /**
195
+ * Runs a read and returns every row.
196
+ *
197
+ * @param sql - The statement to run.
198
+ * @param params - Values bound to the statement, named or positional.
199
+ * @param options - Read concern for this statement.
200
+ * @returns The rows the statement produced.
201
+ */
202
+ query<T = Record<string, unknown>>(sql: string, params?: Params, options?: QueryOptions): Promise<T[]>;
203
+ /** @internal */
204
+ queryForWire(sql: string, params?: Params, options?: QueryOptions): Promise<unknown[]>;
205
+ /**
206
+ * Runs a read and returns its first row.
207
+ *
208
+ * @param sql - The statement to run.
209
+ * @param params - Values bound to the statement, named or positional.
210
+ * @param options - Read concern for this statement.
211
+ * @returns The first row, or undefined when the statement produced none.
212
+ */
213
+ queryOne<T = Record<string, unknown>>(sql: string, params?: Params, options?: QueryOptions): Promise<T | undefined>;
214
+ /**
215
+ * Runs one write.
216
+ *
217
+ * @param sql - The statement to run.
218
+ * @param params - Values bound to the statement, named or positional.
219
+ * @param options - Write concern for this statement.
220
+ * @returns How many rows changed, and the last inserted row id.
221
+ */
222
+ execute(sql: string, params?: Params, options?: QueryOptions): Promise<ExecuteResult>;
223
+ /**
224
+ * Runs one statement over many parameter sets inside a single transaction.
225
+ *
226
+ * @param sql - The statement to run for each parameter set.
227
+ * @param paramsBatch - One parameter set per run.
228
+ * @param options - Write concern for the transaction.
229
+ * @returns One result per parameter set, in order.
230
+ */
231
+ executeBatch(sql: string, paramsBatch: Params[], options?: QueryOptions): Promise<ExecuteResult[]>;
232
+ /**
233
+ * Imports many rows with relaxed writer durability, then restores the configured level.
234
+ *
235
+ * Use this for a load you can re-run from scratch, because
236
+ * {@link Database.executeBatch} keeps full durability. The load holds the
237
+ * writer lock throughout and restores the configured level before this
238
+ * resolves, whether it succeeds or fails. One transaction covers the whole
239
+ * batch, and the rows are summed rather than returned one by one to bound
240
+ * memory on a large load. Like {@link Database.execute}, this writes only to
241
+ * the local database; under replication the server routes loads through the
242
+ * engine instead.
243
+ *
244
+ * @param sql - The statement to run for each parameter set.
245
+ * @param paramsBatch - One parameter set per row.
246
+ * @param options - Durability during the load, and whether it ends with a checkpoint.
247
+ * @returns How many rows the load applied and how many rows changed.
248
+ */
249
+ bulkLoad(sql: string, paramsBatch: Params[], options?: BulkLoadOptions): Promise<BulkLoadResult>;
250
+ /**
251
+ * Runs a fixed list of statements in one transaction so that several callers can share one commit.
252
+ *
253
+ * This takes the statements up front rather than a callback, because a group
254
+ * cannot wait on an arbitrary caller-supplied callback without delaying every
255
+ * transaction beside it.
256
+ *
257
+ * @param statements - The statements to run, in order, each with its own parameters.
258
+ * @returns One result per statement, in order.
259
+ */
260
+ executeTransaction(statements: readonly {
261
+ sql: string;
262
+ params?: Params;
263
+ }[]): Promise<ExecuteResult[]>;
264
+ /**
265
+ * Runs a function inside one transaction, committing when it returns and rolling back when it throws.
266
+ *
267
+ * @param fn - Receives the transaction and runs statements on it.
268
+ * @returns Whatever the function returned.
269
+ */
270
+ transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
271
+ /**
272
+ * Starts recording changes to a table so that subscribers and replication see them.
273
+ *
274
+ * @param table - Name of the table to watch.
275
+ */
276
+ watch(table: string): Promise<void>;
277
+ /**
278
+ * Stops recording changes to a table.
279
+ *
280
+ * @param table - Name of the table to stop watching.
281
+ */
282
+ unwatch(table: string): Promise<void>;
283
+ /**
284
+ * Runs a CDC maintenance write (change-log pruning) on the shared writer
285
+ * under the writer lock. Serialising it with application writes keeps it
286
+ * from becoming a second writer that contends for SQLite's single write
287
+ * lock and stalls the event loop on `busy_timeout`.
288
+ *
289
+ * @internal
290
+ */
291
+ runCdcMaintenance(op: (writer: SQLiteConnection) => Promise<unknown>): Promise<void>;
292
+ /** @internal */
293
+ ensureChangeStamping(): Promise<void>;
294
+ /**
295
+ * Begins a change subscription on a watched table.
296
+ *
297
+ * @param table - Name of the watched table.
298
+ * @returns A builder you narrow with a filter and then subscribe to.
299
+ */
300
+ on(table: string): SubscriptionBuilder;
301
+ /**
302
+ * Opens a live query that keeps a registered read's rows current as the tables behind it change.
303
+ *
304
+ * @param operation - Name of the registered read, or a reference built by {@link operationRef}.
305
+ * @param args - Arguments the operation takes.
306
+ * @param options - Re-read jitter and the transaction size above which the query re-reads.
307
+ * @returns The live query, already subscribed.
308
+ */
309
+ live<T = Record<string, unknown>>(sql: string, params?: Params, options?: LiveQueryOptions): Promise<LiveQuery<T>>;
310
+ /**
311
+ * Applies every migration this database has not yet applied, in ascending version order.
312
+ *
313
+ * @param migrations - The full set of migrations for this database.
314
+ * @returns Which migrations this call applied, and how many it skipped.
315
+ */
316
+ migrate(migrations: Migration[]): Promise<MigrationResult>;
317
+ /**
318
+ * Lists the migrations this database has applied.
319
+ *
320
+ * @returns One entry per applied migration, with its version, name, and checksum.
321
+ */
322
+ appliedMigrations(): Promise<AppliedMigrationRow[]>;
323
+ /**
324
+ * Undoes applied migrations, newest first.
325
+ *
326
+ * @param migrations - The full set of migrations so that the runner finds each down statement.
327
+ * @param version - Lowest version to keep. Without it, only the newest migration is undone.
328
+ * @returns Which migrations this call undid.
329
+ */
330
+ rollback(migrations: Migration[], version?: number): Promise<RollbackResult>;
331
+ /**
332
+ * Copies this database to a file while it stays open for reads and writes.
333
+ *
334
+ * @param destPath - Path the copy is written to.
335
+ */
336
+ backup(destPath: string): Promise<void>;
337
+ /**
338
+ * Starts repeating backups on a cron schedule, keeping a bounded number of files.
339
+ *
340
+ * @param options - Cron expression, destination directory, retention, time zone, and failure callback.
341
+ */
342
+ scheduleBackup(options: BackupScheduleOptions): void;
343
+ /**
344
+ * Loads a SQLite extension into this database.
345
+ *
346
+ * @param extensionPath - Path to the extension, which the driver resolves to an absolute path.
347
+ */
348
+ loadExtension(extensionPath: string): Promise<void>;
349
+ /**
350
+ * Registers a hook that runs before each statement on this database. Throw from it to refuse the statement.
351
+ *
352
+ * @param hook - Receives the statement, its parameters, and the concerns it carries.
353
+ */
354
+ onBeforeQuery(hook: BeforeQueryHook): void;
355
+ /**
356
+ * Registers a hook that runs after each statement on this database.
357
+ *
358
+ * @param hook - Receives the statement and how long it took.
359
+ */
360
+ onAfterQuery(hook: AfterQueryHook): void;
361
+ /** @internal */
362
+ addCloseListener(fn: () => void | Promise<void>): void;
363
+ /**
364
+ * Closes every connection this database holds and ends its subscriptions.
365
+ */
366
+ close(): Promise<void>;
367
+ /**
368
+ * Whether this database has been closed.
369
+ */
370
+ get closed(): boolean;
371
+ /**
372
+ * Number of read connections the pool holds.
373
+ */
374
+ get readerCount(): number;
375
+ private ensureWritable;
376
+ private ensureOpen;
377
+ private ensureNotClosed;
378
+ }
379
+
380
+ export { Database as D, type HookDispose as H, MetricsCollector as M, type SubscribeHookContext as S, type HookEvent as a, type HookEventContextMap as b, type HookHandler as c, HookRegistry as d, type DeviceSyncPort as e };
@@ -1,8 +1,25 @@
1
- import { a as SQLiteDriver } from '../types-zhnRXrsb.js';
1
+ import { a as SQLiteDriver } from '../types-rVZKnKN-.js';
2
+ import '../query-types-DL3LtPvY.js';
2
3
 
4
+ /**
5
+ * @public
6
+ *
7
+ * Settings for the better-sqlite3 driver.
8
+ */
3
9
  interface BetterSqlite3Options {
10
+ /**
11
+ * Milliseconds a statement waits for the write lock before it fails.
12
+ */
4
13
  busyTimeout?: number;
5
14
  }
15
+ /**
16
+ * @public
17
+ *
18
+ * Builds a driver on better-sqlite3, which is the fastest option on Node.
19
+ *
20
+ * @param driverOptions - How long a statement waits for the write lock.
21
+ * @returns The driver, ready to pass to a `Sirannon` registry.
22
+ */
6
23
  declare function betterSqlite3(driverOptions?: BetterSqlite3Options): SQLiteDriver;
7
24
 
8
25
  export { type BetterSqlite3Options, betterSqlite3 };
@@ -1,9 +1,9 @@
1
- import { nodeResolveExtensionPath, nodeBackupEngine, nodeWriterContext, WriterWorker, createStatementCache, narrowSafeBigInt, narrowRowIntegers, narrowRowsIntegers } from '../chunk-EBJXPQQO.mjs';
2
- import '../chunk-PIKHN33N.mjs';
3
- import { defineDriver } from '../chunk-FHWTZFI4.mjs';
1
+ import { nodeResolveExtensionPath, nodeBackupEngine, nodeWriterContext, WriterWorker, createStatementCache, narrowSafeBigInt, narrowRowIntegers, narrowRowsIntegers } from '../chunk-UPKKSUPA.mjs';
2
+ import '../chunk-VOYGMAU7.mjs';
3
+ import { defineDriver } from '../chunk-BQFQ65OL.mjs';
4
4
  import '../chunk-4ISB7XMA.mjs';
5
- import { synchronousPragmaValue } from '../chunk-LFZ37BSX.mjs';
6
- import '../chunk-UC3SCMIN.mjs';
5
+ import { synchronousPragmaValue } from '../chunk-OUSWVNWT.mjs';
6
+ import '../chunk-PBRXXISQ.mjs';
7
7
 
8
8
  // src/drivers/better-sqlite3/index.ts
9
9
  function createConnection(db) {
@@ -0,0 +1,28 @@
1
+ import { a as SQLiteDriver } from '../types-rVZKnKN-.js';
2
+ import '../query-types-DL3LtPvY.js';
3
+
4
+ /**
5
+ * @public
6
+ *
7
+ * Settings for the driver built on Bun's built-in SQLite.
8
+ */
9
+ interface BunSqliteOptions {
10
+ /**
11
+ * Milliseconds a statement waits for the write lock before it fails as busy. Default: 5000.
12
+ */
13
+ busyTimeout?: number;
14
+ }
15
+ /**
16
+ * @public
17
+ *
18
+ * Builds a driver that runs SQLite through `bun:sqlite`, which is built into the Bun runtime.
19
+ *
20
+ * It reads every integer as a BigInt and narrows the safe ones back, so a
21
+ * value beyond `Number.MAX_SAFE_INTEGER` survives the round trip.
22
+ *
23
+ * @param driverOptions - How long a statement waits for the write lock.
24
+ * @returns The driver, ready to pass to a `Sirannon` registry running under Bun.
25
+ */
26
+ declare function bunSqlite(driverOptions?: BunSqliteOptions): SQLiteDriver;
27
+
28
+ export { type BunSqliteOptions, bunSqlite };
@@ -0,0 +1,17 @@
1
+ import { a as SQLiteDriver } from '../types-rVZKnKN-.js';
2
+ import '../query-types-DL3LtPvY.js';
3
+
4
+ /**
5
+ * @public
6
+ *
7
+ * Builds a driver that runs SQLite on a device through `expo-sqlite`.
8
+ *
9
+ * Expo opens one connection per database, so this driver reports no support
10
+ * for multiple connections and Sirannon serves every read and write over that
11
+ * single connection.
12
+ *
13
+ * @returns The driver, ready to pass to a `Sirannon` registry in a React Native app.
14
+ */
15
+ declare function expoSqlite(): SQLiteDriver;
16
+
17
+ export { expoSqlite };
@@ -1,8 +1,25 @@
1
- import { a as SQLiteDriver } from '../types-zhnRXrsb.js';
1
+ import { a as SQLiteDriver } from '../types-rVZKnKN-.js';
2
+ import '../query-types-DL3LtPvY.js';
2
3
 
4
+ /**
5
+ * @public
6
+ *
7
+ * Settings for the driver built on Node's own SQLite module.
8
+ */
3
9
  interface NodeSqliteOptions {
10
+ /**
11
+ * Milliseconds a statement waits for the write lock before it fails.
12
+ */
4
13
  busyTimeout?: number;
5
14
  }
15
+ /**
16
+ * @public
17
+ *
18
+ * Builds a driver on Node's own SQLite module, which needs no native dependency.
19
+ *
20
+ * @param driverOptions - How long a statement waits for the write lock.
21
+ * @returns The driver, ready to pass to a `Sirannon` registry.
22
+ */
6
23
  declare function nodeSqlite(driverOptions?: NodeSqliteOptions): SQLiteDriver;
7
24
 
8
25
  export { type NodeSqliteOptions, nodeSqlite };
@@ -1,9 +1,9 @@
1
- import { nodeResolveExtensionPath, nodeBackupEngine, nodeWriterContext, createStatementCache, WriterWorker, narrowSafeBigInt, narrowRowIntegers, narrowRowsIntegers } from '../chunk-EBJXPQQO.mjs';
2
- import '../chunk-PIKHN33N.mjs';
3
- import { defineDriver } from '../chunk-FHWTZFI4.mjs';
1
+ import { nodeResolveExtensionPath, nodeBackupEngine, nodeWriterContext, createStatementCache, WriterWorker, narrowSafeBigInt, narrowRowIntegers, narrowRowsIntegers } from '../chunk-UPKKSUPA.mjs';
2
+ import '../chunk-VOYGMAU7.mjs';
3
+ import { defineDriver } from '../chunk-BQFQ65OL.mjs';
4
4
  import '../chunk-4ISB7XMA.mjs';
5
- import { synchronousPragmaValue } from '../chunk-LFZ37BSX.mjs';
6
- import '../chunk-UC3SCMIN.mjs';
5
+ import { synchronousPragmaValue } from '../chunk-OUSWVNWT.mjs';
6
+ import '../chunk-PBRXXISQ.mjs';
7
7
 
8
8
  // src/drivers/node/index.ts
9
9
  function nodeSqlite(driverOptions) {
@@ -1,8 +1,25 @@
1
- import { a as SQLiteDriver } from '../types-zhnRXrsb.js';
1
+ import { a as SQLiteDriver } from '../types-rVZKnKN-.js';
2
+ import '../query-types-DL3LtPvY.js';
2
3
 
4
+ /**
5
+ * @public
6
+ *
7
+ * Settings for the browser driver built on wa-sqlite.
8
+ */
3
9
  interface WaSqliteOptions {
10
+ /**
11
+ * Where the browser stores the database. Default: 'IDBBatchAtomicVFS'.
12
+ */
4
13
  vfs?: 'IDBBatchAtomicVFS' | 'AccessHandlePoolVFS';
5
14
  }
15
+ /**
16
+ * @public
17
+ *
18
+ * Builds a driver that runs SQLite in the browser through WebAssembly.
19
+ *
20
+ * @param driverOptions - Where the browser stores the database.
21
+ * @returns The driver, ready to pass to a `Sirannon` registry.
22
+ */
6
23
  declare function waSqlite(driverOptions?: WaSqliteOptions): SQLiteDriver;
7
24
 
8
25
  export { type WaSqliteOptions, waSqlite };