@orkestrel/database 0.0.11 → 0.0.13

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.
@@ -23,7 +23,7 @@ import { TableSchema } from '@orkestrel/database';
23
23
  import { TableSchema as TableSchema_2 } from '@orkestrel/database';
24
24
 
25
25
  /**
26
- * Compile an {@link AggregateOperation} over a {@link FieldPath}.
26
+ * Compiles an {@link AggregateOperation} over a {@link FieldPath}.
27
27
  *
28
28
  * @param operation - The aggregate to compute
29
29
  * @param column - The column or nested path to aggregate
@@ -32,7 +32,7 @@ import { TableSchema as TableSchema_2 } from '@orkestrel/database';
32
32
  export declare function compileAggregateSQL(operation: AggregateOperation, column: FieldPath): string;
33
33
 
34
34
  /**
35
- * Map a portable {@link ColumnStorage} to its SQLite column type.
35
+ * Maps a portable {@link ColumnStorage} to its SQLite column type.
36
36
  *
37
37
  * @param storage - The portable column type
38
38
  * @returns The SQLite column type keyword
@@ -40,7 +40,7 @@ export declare function compileAggregateSQL(operation: AggregateOperation, colum
40
40
  export declare function compileColumnSQL(storage: ColumnStorage): string;
41
41
 
42
42
  /**
43
- * Compile one condition to its `<column> <operator>` SQL fragment and the parameters
43
+ * Compiles one condition to its `<column> <operator>` SQL fragment and the parameters
44
44
  * it binds — engine-exact under SQL's three-valued NULL logic.
45
45
  *
46
46
  * @remarks
@@ -111,7 +111,7 @@ export declare function compileColumnSQL(storage: ColumnStorage): string;
111
111
  export declare function compileConditionSQL(condition: Condition, schema: TableSchema): CompiledSQL;
112
112
 
113
113
  /**
114
- * A parameterized SQL fragment or statement plus its bind values.
114
+ * Represents a parameterized SQL fragment or statement plus its bind values.
115
115
  *
116
116
  * @remarks
117
117
  * Produced by the pure SQL compilers (`compilers.ts`) that turn a core
@@ -126,7 +126,7 @@ export declare interface CompiledSQL {
126
126
  }
127
127
 
128
128
  /**
129
- * Compile a {@link FieldPath} to the SQL expression that reads it.
129
+ * Compiles a {@link FieldPath} to the SQL expression that reads it.
130
130
  *
131
131
  * @param path - The field path
132
132
  * @returns The SQL expression selecting the value
@@ -134,7 +134,7 @@ export declare interface CompiledSQL {
134
134
  export declare function compileFieldSQL(path: FieldPath): string;
135
135
 
136
136
  /**
137
- * Compile a NESTED {@link FieldPath} to the `json_type(<col>, <path>)` SQL
137
+ * Compiles a NESTED {@link FieldPath} to the `json_type(<col>, <path>)` SQL
138
138
  * expression — the {@link compileFieldSQL} `json_extract` sibling used to tell a
139
139
  * PRESENT JSON `null` apart from an ABSENT path (both read back as SQL `NULL`
140
140
  * through `json_extract`, but `json_type` reports `'null'` for the former and
@@ -151,14 +151,14 @@ export declare function compileFieldSQL(path: FieldPath): string;
151
151
  export declare function compileJSONTypeSQL(path: readonly string[]): string;
152
152
 
153
153
  /**
154
- * Compile the ORDER BY clause from the order terms, always ending with the
154
+ * Compiles the ORDER BY clause from the order terms, always ending with the
155
155
  * primary key as the final determinant.
156
156
  *
157
157
  * @remarks
158
158
  * The native `records` read then resolves ties in key order, matching a
159
159
  * primary-key-ordered `scan` and the core engine's stable `sortRows` over a
160
160
  * key-ordered scan (and IndexedDB's key-ordered reads), so a native read equals
161
- * the scan path (AGENTS §21 / §22 native ↔ engine parity). SQLite without an
161
+ * the scan path native ↔ engine parity. SQLite without an
162
162
  * `ORDER BY` returns rowid (insertion) order, and an explicit order alone breaks
163
163
  * ties by rowid too — both diverge from every key-ordered backend. The
164
164
  * tie-breaker is ASCENDING regardless of the explicit directions: the engine's
@@ -172,14 +172,14 @@ export declare function compileJSONTypeSQL(path: readonly string[]): string;
172
172
  *
173
173
  * @example
174
174
  * ```ts
175
- * compileOrder([{ column: 'age', direction: 'descending' }], schema)
175
+ * compileOrderSQL([{ column: 'age', direction: 'descending' }], schema)
176
176
  * // 'ORDER BY "age" DESC, "id"'
177
177
  * ```
178
178
  */
179
- export declare function compileOrder(order: readonly Order[] | undefined, schema: TableSchema): string;
179
+ export declare function compileOrderSQL(order: readonly Order[] | undefined, schema: TableSchema): string;
180
180
 
181
181
  /**
182
- * Compile the LIMIT / OFFSET clause.
182
+ * Compiles the LIMIT / OFFSET clause.
183
183
  *
184
184
  * @remarks
185
185
  * An offset without a limit uses `LIMIT -1` (SQLite's "no limit") so OFFSET is
@@ -191,13 +191,13 @@ export declare function compileOrder(order: readonly Order[] | undefined, schema
191
191
  *
192
192
  * @example
193
193
  * ```ts
194
- * compilePage(undefined, 5) // { sql: 'LIMIT -1 OFFSET ?', parameters: [5] }
194
+ * compilePageSQL(undefined, 5) // { sql: 'LIMIT -1 OFFSET ?', parameters: [5] }
195
195
  * ```
196
196
  */
197
- export declare function compilePage(limit: number | undefined, offset: number | undefined): CompiledSQL;
197
+ export declare function compilePageSQL(limit: number | undefined, offset: number | undefined): CompiledSQL;
198
198
 
199
199
  /**
200
- * Compile a {@link QueryInput} into the SQL clause that follows a table name, with
200
+ * Compiles a {@link QueryInput} into the SQL clause that follows a table name, with
201
201
  * its bound parameters in clause order.
202
202
  *
203
203
  * @remarks
@@ -207,11 +207,13 @@ export declare function compilePage(limit: number | undefined, offset: number |
207
207
  * over a JS `scan`. The WHERE fold is parenthesized **left-to-right** to mirror
208
208
  * the core engine's `matchesQuery` (not SQL's native AND-over-OR precedence),
209
209
  * so a native and an engine read return identical rows. Each operand is encoded
210
- * via `encodeValue`: a flat column uses its declared schema type, while a nested
210
+ * through `encodeValue`: a flat column uses its declared schema type, while a nested
211
211
  * `FieldPath` (a `json_extract` read) encodes each operand as the native scalar
212
212
  * the extract returns — derived from the operand's runtime type — so it compares.
213
- * The 15 operators map per the databases guide's operator table, with
214
- * `starts` / `ends` using `LIKE ESCAPE '\'` and an empty `any` / `none` list
213
+ * Every operator maps per the databases guide's operator table, with
214
+ * `starts` / `ends` compiling to a CODE-POINT `substr` slice guarded by
215
+ * `typeof(<column>) = 'text'` (case-sensitive, matching the engine's
216
+ * `String.prototype.startsWith` / `endsWith`) and an empty `any` / `none` list
215
217
  * collapsing to a constant. An `undefined` input (or one with no parts)
216
218
  * compiles to an empty clause.
217
219
  *
@@ -228,7 +230,7 @@ export declare function compilePage(limit: number | undefined, offset: number |
228
230
  export declare function compileQuerySQL(input: QueryInput | undefined, schema: TableSchema): CompiledSQL;
229
231
 
230
232
  /**
231
- * Fold the conditions into one WHERE clause, parenthesizing progressively
233
+ * Folds the conditions into one WHERE clause, parenthesizing progressively
232
234
  * left-to-right so the grouping matches the engine's `matchesQuery` fold.
233
235
  *
234
236
  * @remarks
@@ -244,14 +246,14 @@ export declare function compileQuerySQL(input: QueryInput | undefined, schema: T
244
246
  *
245
247
  * @example
246
248
  * ```ts
247
- * compileWhere([{ column: 'age', operator: 'from', values: [18], connector: 'and' }], schema)
249
+ * compileWhereSQL([{ column: 'age', operator: 'from', values: [18], connector: 'and' }], schema)
248
250
  * // { sql: 'WHERE "age" >= ?', parameters: [18] }
249
251
  * ```
250
252
  */
251
- export declare function compileWhere(conditions: readonly Condition[], schema: TableSchema): CompiledSQL;
253
+ export declare function compileWhereSQL(conditions: readonly Condition[], schema: TableSchema): CompiledSQL;
252
254
 
253
255
  /**
254
- * Create a persistent JSON-file {@link DriverInterface} for the core database layer.
256
+ * Creates a persistent JSON-file {@link DriverInterface} for the core database layer.
255
257
  *
256
258
  * @remarks
257
259
  * Pass it to `createDatabase` from `@orkestrel/database` to run the typed
@@ -259,9 +261,10 @@ export declare function compileWhere(conditions: readonly Condition[], schema: T
259
261
  * `Table` / `Query` API is unchanged; only where the bytes live changes.
260
262
  * The driver is the reference `MemoryDriver` plus JSON-file persistence: `open` loads
261
263
  * the file, every mutation flushes the whole store back, and querying runs through
262
- * the core engine over `scan` (it is scan-only no native `records` / `count` /
263
- * `aggregate`). A missing, corrupt, or wrong-shaped file starts empty rather than
264
- * throwing.
264
+ * the core engine's `matchesQuery`. The driver implements the native `stream`
265
+ * hook and neither `records` nor `aggregate`, so the engine answers every query
266
+ * on either path. A missing, corrupt, or wrong-shaped file starts empty rather
267
+ * than throwing.
265
268
  *
266
269
  * @param path - The JSON file path data is loaded from and flushed to
267
270
  * @returns A {@link DriverInterface} backed by a JSON file
@@ -282,7 +285,7 @@ export declare function compileWhere(conditions: readonly Condition[], schema: T
282
285
  export declare function createJSONDriver(path: string): DriverInterface;
283
286
 
284
287
  /**
285
- * Create a trusted-mode SQLite {@link DriverInterface} for the core database layer.
288
+ * Creates a trusted-mode SQLite {@link DriverInterface} for the core database layer.
286
289
  *
287
290
  * @remarks
288
291
  * Pass it to `createDatabase` from `@orkestrel/database` to run the typed
@@ -320,7 +323,7 @@ export declare function createJSONDriver(path: string): DriverInterface;
320
323
  export declare function createSQLiteDriver(options?: SQLiteDriverOptions): DriverInterface;
321
324
 
322
325
  /**
323
- * Decode a stored {@link SQLiteRow} back to a {@link Row} by its table's schema.
326
+ * Decodes a stored {@link SQLiteRow} back to a {@link Row} by its table's schema.
324
327
  *
325
328
  * @remarks
326
329
  * Decodes each declared column with {@link decodeValue} and **omits** any column
@@ -341,7 +344,7 @@ export declare function createSQLiteDriver(options?: SQLiteDriverOptions): Drive
341
344
  export declare function decodeRow(row: SQLiteRow, schema: TableSchema): Row;
342
345
 
343
346
  /**
344
- * Decode a stored {@link SQLiteValue} back to its JS value for a declared column —
347
+ * Decodes a stored {@link SQLiteValue} back to its JS value for a declared column —
345
348
  * the exact inverse of {@link encodeValue}.
346
349
  *
347
350
  * @remarks
@@ -363,7 +366,7 @@ export declare function decodeRow(row: SQLiteRow, schema: TableSchema): Row;
363
366
  export declare function decodeValue(value: SQLiteValue, column: ColumnSchema): unknown;
364
367
 
365
368
  /**
366
- * Build a collision-free SQL index name for a table + column-group index —
369
+ * Builds a collision-free SQL index name for a table + column-group index —
367
370
  * shared by the compiler module's `schemaToIndexes` and `stepToSQL`,
368
371
  * so a plan-built index name always matches one `open` would have created.
369
372
  *
@@ -388,7 +391,7 @@ export declare function decodeValue(value: SQLiteValue, column: ColumnSchema): u
388
391
  export declare function deriveSQLiteIndexName(table: string, columns: readonly string[]): string;
389
392
 
390
393
  /**
391
- * Encode a whole {@link Row} to a {@link SQLiteRow} by its table's schema.
394
+ * Encodes a whole {@link Row} to a {@link SQLiteRow} by its table's schema.
392
395
  *
393
396
  * @remarks
394
397
  * Encodes each declared column's value with {@link encodeValue}; columns the row
@@ -407,7 +410,7 @@ export declare function deriveSQLiteIndexName(table: string, columns: readonly s
407
410
  export declare function encodeRow(row: Row, schema: TableSchema): SQLiteRow;
408
411
 
409
412
  /**
410
- * Encode a JS value to its stored {@link SQLiteValue} for a declared column.
413
+ * Encodes a JS value to its stored {@link SQLiteValue} for a declared column.
411
414
  *
412
415
  * @remarks
413
416
  * The codec is total: a malformed value encodes to SQL `NULL`. Absence always
@@ -428,21 +431,7 @@ export declare function encodeRow(row: Row, schema: TableSchema): SQLiteRow;
428
431
  export declare function encodeValue(value: unknown, column: ColumnSchema): SQLiteValue;
429
432
 
430
433
  /**
431
- * Escape `\`, `%`, and `_` (each with a leading `\`) so a `starts` / `ends`
432
- * operand is matched literally under the `LIKE … ESCAPE '\'` clause.
433
- *
434
- * @param text - The raw operand text
435
- * @returns The text with LIKE metacharacters escaped
436
- *
437
- * @example
438
- * ```ts
439
- * escapeLike('50%_off') // '50\\%\\_off'
440
- * ```
441
- */
442
- export declare function escapeLike(text: string): string;
443
-
444
- /**
445
- * The declared {@link ColumnStorage}s whose SQL EQUALITY comparisons (`equals` /
434
+ * Lists the declared {@link ColumnStorage}s whose SQL EQUALITY comparisons (`equals` /
446
435
  * `not` / `any` / `none`) and `starts` / `ends` compiles are provably
447
436
  * engine-exact under declared-type trust — `text` / `integer` / `real` /
448
437
  * `boolean`; a `json` or `blob` column always refines instead.
@@ -455,7 +444,7 @@ export declare function escapeLike(text: string): string;
455
444
  * TEXT byte-for-byte as UTF-8 — equivalent to Unicode CODE-POINT order —
456
445
  * while the core engine's `compareValues` orders JS strings with `<`, which
457
446
  * compares UTF-16 CODE-UNIT order. The two orders diverge for supplementary-
458
- * plane characters (code points ≥ U+10000, e.g. many emoji): a lead surrogate
447
+ * plane characters (code points ≥ U+10000, for example many emoji): a lead surrogate
459
448
  * (`\uD800`–`\uDBFF`) sorts BELOW ``–`￿` in code-unit order, while
460
449
  * its code point sorts ABOVE them. So `matchesConditionExactly`'s range family and
461
450
  * `matchesOrderExactly` exclude `text`, refining through the core engine instead.
@@ -463,7 +452,7 @@ export declare function escapeLike(text: string): string;
463
452
  export declare const EXACT_COLUMN_STORAGE: readonly ColumnStorage[];
464
453
 
465
454
  /**
466
- * The declared {@link ColumnStorage}s whose SQL RANGE comparisons
455
+ * Lists the declared {@link ColumnStorage}s whose SQL RANGE comparisons
467
456
  * (`above` / `below` / `from` / `to` / `between`) and `ORDER BY` compiles are
468
457
  * provably engine-exact — `integer` / `real` / `boolean` only. `text` is
469
458
  * excluded: see {@link EXACT_COLUMN_STORAGE}'s remarks for the BINARY-collation
@@ -473,7 +462,7 @@ export declare const EXACT_COLUMN_STORAGE: readonly ColumnStorage[];
473
462
  export declare const EXACT_RANGE_COLUMN_STORAGE: readonly ColumnStorage[];
474
463
 
475
464
  /**
476
- * Extract a stored row's values in a declared positional order.
465
+ * Extracts a stored row's values in a declared positional order.
477
466
  *
478
467
  * @remarks
479
468
  * SQLite statements bind arrays positionally. Every requested column must be
@@ -494,21 +483,7 @@ export declare const EXACT_RANGE_COLUMN_STORAGE: readonly ColumnStorage[];
494
483
  export declare function extractValues(row: SQLiteRow, names: readonly string[], table: string): readonly SQLiteValue[];
495
484
 
496
485
  /**
497
- * The declared storage type of a flat (string) column, read from the schema.
498
- *
499
- * @param column - The column name
500
- * @param schema - The table's schema
501
- * @returns The column's {@link ColumnStorage}, or `undefined` if the schema does not carry it
502
- *
503
- * @example
504
- * ```ts
505
- * findColumnStorage('age', schema) // 'integer'
506
- * ```
507
- */
508
- export declare function findColumnStorage(column: string, schema: TableSchema): ColumnStorage | undefined;
509
-
510
- /**
511
- * The storage type a nested (`json_extract`) operand encodes as, derived from its
486
+ * Reads the storage type a nested (`json_extract`) operand encodes as from its
512
487
  * RUNTIME value — NOT `json`.
513
488
  *
514
489
  * @remarks
@@ -531,7 +506,7 @@ export declare function findColumnStorage(column: string, schema: TableSchema):
531
506
  export declare function inferValueStorage(value: unknown): ColumnStorage;
532
507
 
533
508
  /**
534
- * A persistent {@link DriverInterface} backed by a single JSON file — the
509
+ * Implements a persistent {@link DriverInterface} backed by a single JSON file — the
535
510
  * reference {@link MemoryDriver} plus file load / flush.
536
511
  *
537
512
  * @remarks
@@ -545,15 +520,15 @@ export declare function inferValueStorage(value: unknown): ColumnStorage;
545
520
  * primary (the table contract), so the key is recovered on load with
546
521
  * {@link extractKey} and the file need not store it. The parsed JSON crosses the
547
522
  * boundary as `unknown` and is narrowed with {@link isRecord} / {@link extractKey},
548
- * never asserted (AGENTS §14). A read that reports no document there starts empty —
523
+ * never asserted. A read that reports no document there starts empty —
549
524
  * `ENOENT` for a plain absence, and `ENOTDIR` for a path whose parent is not a
550
525
  * directory, which no later write could find either; every other read failure or
551
526
  * invalid existing document fails closed without publication, mutation, or
552
- * automatic repair. It is scan-only it implements none of
553
- * the optional native `records` / `aggregate` hooks, so the core engine
554
- * over `scan` answers every query. For development, small datasets, and portable /
555
- * inspectable data; for large or concurrent workloads reach for a SQLite-backed
556
- * driver.
527
+ * automatic repair. It implements the optional native `stream` hook that
528
+ * `TableInterface.scan` prefers over `scan`, and neither `records` nor
529
+ * `aggregate`, so the core engine's `matchesQuery` answers every query on
530
+ * either path. For development, small datasets, and portable / inspectable
531
+ * data; for large or concurrent workloads reach for a SQLite-backed driver.
557
532
  *
558
533
  * Metadata crosses {@link cloneDriverMetadata} at parsed-file ingress, public and
559
534
  * scoped write ingress, candidate/root publication, serialization, and copy-out.
@@ -578,7 +553,7 @@ export declare class JSONDriver implements DriverInterface_2 {
578
553
  keys(table: string): Promise<readonly Key[]>;
579
554
  scan(table: string): AsyncIterable<Row_2>;
580
555
  /**
581
- * Natively filtered lazy iteration — delegates to the inner {@link MemoryDriver}.
556
+ * Iterates rows lazily with native filtering — delegates to the inner {@link MemoryDriver}.
582
557
  *
583
558
  * @remarks
584
559
  * Semantics are the memory driver's own: `input.conditions` filters, `offset`
@@ -591,7 +566,7 @@ export declare class JSONDriver implements DriverInterface_2 {
591
566
  stream(table: string, input: QueryInput_2): AsyncIterable<Row_2>;
592
567
  clear(table: string): Promise<void>;
593
568
  /**
594
- * Run an isolated native transaction callback over a candidate memory store.
569
+ * Runs an isolated native transaction callback over a candidate memory store.
595
570
  *
596
571
  * @remarks
597
572
  * Single-writer: nesting and root operations while active throw `CONFLICT`.
@@ -605,7 +580,7 @@ export declare class JSONDriver implements DriverInterface_2 {
605
580
  */
606
581
  transaction<R>(scope: (storage: StorageInterface) => Promise<R>): Promise<R>;
607
582
  /**
608
- * Capture an owned row snapshot at an exact writer-queue position.
583
+ * Captures an owned row snapshot at an exact writer-queue position.
609
584
  *
610
585
  * @remarks
611
586
  * Capture owns table names, schemas, rows, and one session-local identity per
@@ -621,7 +596,7 @@ export declare class JSONDriver implements DriverInterface_2 {
621
596
  snapshot(tables?: readonly string[]): Promise<() => Promise<void>>;
622
597
  metadata(): Promise<DriverMetadata | undefined>;
623
598
  /**
624
- * Persist an owned metadata snapshot for a later `metadata()` to copy out.
599
+ * Persists an owned metadata snapshot for a later `metadata()` to copy out.
625
600
  *
626
601
  * @remarks
627
602
  * Root stamping conflicts while a transaction is active. The scoped
@@ -632,7 +607,7 @@ export declare class JSONDriver implements DriverInterface_2 {
632
607
  */
633
608
  stamp(metadata: DriverMetadata): Promise<void>;
634
609
  /**
635
- * Apply one atomic {@link MigrationInput} through an isolated candidate.
610
+ * Applies one atomic {@link MigrationInput} through an isolated candidate.
636
611
  *
637
612
  * @remarks
638
613
  * The candidate receives every plan step plus optional metadata. Its complete
@@ -646,7 +621,7 @@ export declare class JSONDriver implements DriverInterface_2 {
646
621
  }
647
622
 
648
623
  /**
649
- * Whether a caught filesystem error reports that nothing is there to read.
624
+ * Reports whether a caught filesystem error says that nothing is there to read.
650
625
  *
651
626
  * @remarks
652
627
  * Two codes carry that meaning: `ENOENT` is a plain absence, and `ENOTDIR` is a
@@ -663,7 +638,7 @@ export declare class JSONDriver implements DriverInterface_2 {
663
638
  * answers `false` rather than being read for a `code` any object could carry.
664
639
  *
665
640
  * @param error - The caught value to classify; any runtime is accepted
666
- * @returns `true` when the error reports that the path holds nothing
641
+ * @returns True if the error reports that the path holds nothing; false otherwise
667
642
  *
668
643
  * @example
669
644
  * ```ts
@@ -675,19 +650,19 @@ export declare class JSONDriver implements DriverInterface_2 {
675
650
  export declare function matchesAbsentPath(error: unknown): boolean;
676
651
 
677
652
  /**
678
- * Determine whether SQLite can execute an aggregate exactly like the core engine.
653
+ * Reports whether SQLite can execute an aggregate exactly like the core engine.
679
654
  *
680
655
  * @param operation - Aggregate operation
681
656
  * @param column - Aggregate field
682
657
  * @param schema - Current table schema
683
- * @returns Whether native aggregation is exact
658
+ * @returns True if native aggregation is exact; false otherwise
684
659
  */
685
660
  export declare function matchesAggregateExactly(operation: AggregateOperation, column: FieldPath, schema: TableSchema): boolean;
686
661
 
687
662
  /**
688
- * Whether one {@link Condition} compiles to SQL that is PROVABLY identical to
689
- * the core engine's `matchesCondition` for every value its column's declared
690
- * type can store.
663
+ * Reports whether one {@link Condition} compiles to SQL that is PROVABLY
664
+ * identical to the core engine's `matchesCondition` for every value its
665
+ * column's declared type can store.
691
666
  *
692
667
  * @remarks
693
668
  * `false` for a nested `FieldPath` (an array) or a column absent from `schema`.
@@ -716,33 +691,33 @@ export declare function matchesAggregateExactly(operation: AggregateOperation, c
716
691
  *
717
692
  * @param condition - The condition to test
718
693
  * @param schema - The table's schema
719
- * @returns Whether `condition` is exact
694
+ * @returns True if `condition` is exact; false otherwise
720
695
  */
721
696
  export declare function matchesConditionExactly(condition: Condition, schema: TableSchema): boolean;
722
697
 
723
698
  /**
724
- * Whether a value's runtime type matches a column's declared exact type
725
- * the operand side of the declared-type-trust proof.
699
+ * Reports whether a value's runtime type matches a column's declared exact type
700
+ * the operand side of the declared-type-trust proof.
726
701
  *
727
702
  * @remarks
728
703
  * `text` ↔ string, `integer` / `real` ↔ FINITE number (`NaN` / `±Infinity`
729
704
  * fail), `boolean` ↔ boolean. Backs {@link matchesConditionExactly}'s operand checks.
730
705
  *
731
706
  * @param value - The condition operand to test
732
- * @param type - The column's declared portable type
733
- * @returns `true` when the operand's runtime type matches the declared type
707
+ * @param storage - The column's declared portable storage type
708
+ * @returns True if the operand's runtime type matches the declared type; false otherwise
734
709
  *
735
710
  * @example
736
711
  * ```ts
737
- * matchesDeclaredType('Ada', 'text') // true
738
- * matchesDeclaredType(Number.NaN, 'integer') // false — only finite numbers
712
+ * matchesDeclaredStorage('Ada', 'text') // true
713
+ * matchesDeclaredStorage(Number.NaN, 'integer') // false — only finite numbers
739
714
  * ```
740
715
  */
741
716
  export declare function matchesDeclaredStorage(value: unknown, storage: ColumnStorage): boolean;
742
717
 
743
718
  /**
744
- * Whether one {@link Order} term's column compiles to an `ORDER BY` that
745
- * matches the engine's {@link import('@src/core').sortRows} exactly.
719
+ * Reports whether one {@link Order} term's column compiles to an `ORDER BY`
720
+ * that matches the engine's {@link import('@src/core').sortRows} exactly.
746
721
  *
747
722
  * @remarks
748
723
  * `false` for a nested `FieldPath`, a column absent from `schema`, or a
@@ -755,32 +730,32 @@ export declare function matchesDeclaredStorage(value: unknown, storage: ColumnSt
755
730
  *
756
731
  * @param order - The order term to test
757
732
  * @param schema - The table's schema
758
- * @returns Whether `order` is exact
733
+ * @returns True if `order` is exact; false otherwise
759
734
  */
760
735
  export declare function matchesOrderExactly(order: Order, schema: TableSchema): boolean;
761
736
 
762
737
  /**
763
- * Whether a whole {@link QueryInput} is exact — every condition and every order
764
- * term is exact. `limit` / `offset` never affect exactness (SQL `LIMIT` /
765
- * `OFFSET` are always engine-identical).
738
+ * Reports whether a whole {@link QueryInput} is exact — every condition and
739
+ * every order term is exact. `limit` / `offset` never affect exactness (SQL
740
+ * `LIMIT` / `OFFSET` are always engine-identical).
766
741
  *
767
742
  * @param input - The query input to test
768
743
  * @param schema - The table's schema
769
- * @returns Whether every part of `input` is exact
744
+ * @returns True if every part of `input` is exact; false otherwise
770
745
  */
771
746
  export declare function matchesQueryExactly(input: QueryInput, schema: TableSchema): boolean;
772
747
 
773
748
  /**
774
- * Test a declared SQLite type against a portable storage affinity.
749
+ * Checks a declared SQLite type against a portable storage affinity.
775
750
  *
776
751
  * @param declared - Native declared type
777
752
  * @param storage - Portable column storage
778
- * @returns Whether SQLite's official affinity rules yield the expected affinity
753
+ * @returns True if SQLite's official affinity rules yield the expected affinity; false otherwise
779
754
  */
780
755
  export declare function matchesSQLiteAffinity(declared: unknown, storage: ColumnStorage): boolean;
781
756
 
782
757
  /**
783
- * The reserved metadata table the {@link SQLiteDriver} creates on `open` to
758
+ * Names the reserved metadata table the {@link SQLiteDriver} creates on `open` to
784
759
  * persist its stamped `DriverMetadata` (`version` + declared schema JSON) — the
785
760
  * SQLite realization of the `metadata` / `stamp` driver hooks.
786
761
  *
@@ -791,7 +766,7 @@ export declare function matchesSQLiteAffinity(declared: unknown, storage: Column
791
766
  export declare const METADATA_TABLE = "_metadata";
792
767
 
793
768
  /**
794
- * Quote a SQL identifier (a table or column name) so any characters are literal.
769
+ * Quotes a SQL identifier (a table or column name) so any characters are literal.
795
770
  *
796
771
  * @remarks
797
772
  * Wraps the name in double quotes and doubles any embedded quote — the standard
@@ -809,7 +784,7 @@ export declare const METADATA_TABLE = "_metadata";
809
784
  export declare function quoteIdentifier(identifier: string): string;
810
785
 
811
786
  /**
812
- * Project a {@link TableSchema} to its declared SQLite indexes.
787
+ * Projects a {@link TableSchema} to its declared SQLite indexes.
813
788
  *
814
789
  * @param schema - The table schema
815
790
  * @returns One statement per declared index
@@ -817,7 +792,7 @@ export declare function quoteIdentifier(identifier: string): string;
817
792
  export declare function schemaToIndexes(schema: TableSchema): readonly string[];
818
793
 
819
794
  /**
820
- * Project a {@link TableSchema} to its `CREATE TABLE IF NOT EXISTS` statement.
795
+ * Projects a {@link TableSchema} to its `CREATE TABLE IF NOT EXISTS` statement.
821
796
  *
822
797
  * @param schema - The table schema
823
798
  * @returns The complete table declaration
@@ -825,8 +800,8 @@ export declare function schemaToIndexes(schema: TableSchema): readonly string[];
825
800
  export declare function schemaToTable(schema: TableSchema): string;
826
801
 
827
802
  /**
828
- * The SQLite {@link DriverInterface} — the server-native, trusted-mode backend
829
- * built on the published `@orkestrel/sqlite` synchronous wrapper.
803
+ * Implements the {@link DriverInterface} over SQLite — the server-native, trusted-mode
804
+ * backend built on the published `@orkestrel/sqlite` synchronous wrapper.
830
805
  *
831
806
  * @remarks
832
807
  * A thin adapter: it implements the storage primitives the core database layer
@@ -837,41 +812,40 @@ export declare function schemaToTable(schema: TableSchema): string;
837
812
  * reopen-safe), and readies a reserved `_metadata` single-row table `metadata()` /
838
813
  * `stamp()` read and write — **a user table named `_metadata` collides with it**;
839
814
  * avoid the name. Rows cross the boundary through the codecs in `helpers.ts`
840
- * (`json` columns store / parse JSON text, a `boolean` stores `1` / `0`), so the
841
- * typed layer above imposes the exact shape (AGENTS §14). `write` is an
815
+ * (`json` columns store / parse JSON text, a `boolean` stores `1` / `0`), so
816
+ * the typed layer above imposes the exact shape. `write` is an
842
817
  * `INSERT OR REPLACE` upsert, while `insert` uses a plain `INSERT` and maps its
843
818
  * atomic primary-key constraint failure to `CONFLICT`; every other backend
844
819
  * `SQLiteError` is contained by the same `DatabaseError` boundary described
845
- * below. Querying, ordering, paging, and
846
- * aggregation is native: `records` / `stream` compile a `QueryInput`
847
- * to SQL with `compileQuerySQL`, and `aggregate` runs a SQL
848
- * `COUNT`/`SUM`/`AVG`/`MIN`/`MAX` (via `compileAggregateSQL`) over the same compiled
849
- * WHERE. `transaction` runs a callback inside native `BEGIN` / `COMMIT` /
850
- * `ROLLBACK`, passing a scoped storage capability that becomes invalid after
851
- * settlement. `migrate` runs the plan's projected DDL
852
- * ({@link import('../compilers.js').stepToSQL}) inside whichever native
853
- * transaction is active: joined into the active transaction callback
854
- * when one exists (the core's versioned reconcile path wraps migrate + stamp
855
- * in one native `BEGIN`, and node:sqlite rejects a nested `BEGIN`), or inside
856
- * its own `database.transaction` otherwise a mid-plan failure rolls back
857
- * atomically either way, an improvement over the non-atomic `MemoryDriver` /
858
- * `JSONDriver` migrate; a step referencing an undeclared table throws
820
+ * below. Querying, ordering, paging, and aggregation is native: `records` /
821
+ * `stream` compile a `QueryInput` to SQL with `compileQuerySQL`, and
822
+ * `aggregate` runs a SQL `COUNT`/`SUM`/`AVG`/`MIN`/`MAX` (through
823
+ * `compileAggregateSQL`) over the same compiled WHERE. `transaction` runs a
824
+ * callback inside native `BEGIN` / `COMMIT` / `ROLLBACK`, passing a scoped
825
+ * storage capability that becomes invalid after settlement. `migrate` runs the
826
+ * plan's projected DDL ({@link import('../compilers.js').stepToSQL}) inside
827
+ * whichever native transaction is active: joined into the active transaction
828
+ * callback when one exists (the core's versioned reconcile path wraps migrate +
829
+ * stamp in one native `BEGIN`, and node:sqlite rejects a nested `BEGIN`), or
830
+ * inside its own `database.transact` otherwise a mid-plan failure rolls
831
+ * back atomically either way, an improvement over the non-atomic `MemoryDriver`
832
+ * / `JSONDriver` migrate; a step referencing an undeclared table throws
859
833
  * `DatabaseError` `MIGRATION` before any DDL for that step runs. `snapshot` is
860
- * capture-replay (SELECT the
861
- * named tables' rows, replay via DELETE + INSERT OR REPLACE inside a native
862
- * transaction on rollback) rather than a SQL `SAVEPOINT`, since the core
863
- * `transaction` calls the rollback thunk only on failure with no commit-on-
864
- * success signal a long-lived `SAVEPOINT` would leave the connection
865
- * uncommitted (lost on close). Every backend interaction runs through `#guard`,
866
- * which maps a thrown backend `SQLiteError` (or any unexpected non-`SQLiteError`
867
- * throw) to a typed {@link DatabaseError} never a raw backend error escapes
868
- * `DriverInterface`: `CONSTRAINT` → `CONFLICT`, the wrapper's own `CLOSED`
869
- * `CLOSED`, `BUSY` (a locked database that outlasted the configured `timeout`)
870
- * → a retryable `DRIVER` (`context.retryable` is `true`), and `UNKNOWN` / any
871
- * other throw `DRIVER`. The original error is preserved as `context.cause`.
872
- * A `DatabaseError` this driver throws directly (`CLOSED` from the `#require`
873
- * gate, `NOT_FOUND` from `#table`, `MIGRATION` from a migration-plan fault)
874
- * passes through `#guard` unchanged, never re-wrapped.
834
+ * capture-replay (SELECT the named tables' rows, replay through DELETE + INSERT OR
835
+ * REPLACE inside a native transaction on rollback) rather than a SQL
836
+ * `SAVEPOINT`, since the core `transaction` calls the rollback thunk only on
837
+ * failure with no commit-on-success signal — a long-lived `SAVEPOINT` would
838
+ * leave the connection uncommitted (lost on close). Every backend interaction
839
+ * runs through `#guard`, which maps a thrown backend `SQLiteError` (or any
840
+ * unexpected non-`SQLiteError` throw) to a typed {@link DatabaseError} never
841
+ * a raw backend error escapes `DriverInterface`: `CONSTRAINT` `CONFLICT`, the
842
+ * wrapper's own `CLOSED` → `CLOSED`, `BUSY` (a locked database that outlasted
843
+ * the configured `timeout`) a retryable `DRIVER` (`context.retryable` is
844
+ * `true`), and `UNKNOWN` / any other throw → `DRIVER`. The original error is
845
+ * preserved as `context.cause`. A `DatabaseError` this driver throws directly
846
+ * (`CLOSED` from the `#require` gate, `NOT_FOUND` from `#table`, `MIGRATION`
847
+ * from a migration-plan fault) passes through `#guard` unchanged, never
848
+ * re-wrapped.
875
849
  */
876
850
  export declare class SQLiteDriver implements DriverInterface_2 {
877
851
  #private;
@@ -889,7 +863,7 @@ export declare class SQLiteDriver implements DriverInterface_2 {
889
863
  aggregate(table: string, operation: AggregateOperation_2, column: FieldPath, input: QueryInput_2): Promise<number | undefined>;
890
864
  stream(table: string, input: QueryInput_2): AsyncIterable<Row_2>;
891
865
  /**
892
- * Begin a native transaction — real `BEGIN`, `COMMIT`, `ROLLBACK`.
866
+ * Begins a native transaction — real `BEGIN`, `COMMIT`, `ROLLBACK`.
893
867
  *
894
868
  * @remarks
895
869
  * The callback receives a scoped {@link StorageInterface}. Fulfillment
@@ -901,23 +875,22 @@ export declare class SQLiteDriver implements DriverInterface_2 {
901
875
  */
902
876
  transaction<R>(scope: (storage: StorageInterface) => Promise<R>): Promise<R>;
903
877
  /**
904
- * Apply a {@link Migration} plan by executing each step's projected DDL
878
+ * Applies a {@link Migration} plan by executing each step's projected DDL
905
879
  * ({@link import('../compilers.js').stepToSQL}).
906
880
  *
907
881
  * @remarks
908
- * Atomicity is provided by whichever native transaction is active: when
909
- * this driver's own `transaction()` callback is active (the
910
- * core's versioned reconcile / migrate path joins migrate + stamp under
911
- * one native `BEGIN`), the plan's DDL runs directly inside that enclosing
912
- * transaction — a mid-plan failure rejects the callback and the driver
913
- * rolls it back. node:sqlite (and SQLite
914
- * generally) rejects a nested `BEGIN`, so this driver must never open a
882
+ * Atomicity is provided by whichever native transaction is active: when this
883
+ * driver's own `transaction()` callback is active (the core's versioned
884
+ * reconcile / migrate path joins migrate + stamp under one native `BEGIN`),
885
+ * the plan's DDL runs directly inside that enclosing transaction — a mid-plan
886
+ * failure rejects the callback and the driver rolls it back. node:sqlite (and
887
+ * SQLite generally) rejects a nested `BEGIN`, so this driver must never open a
915
888
  * second native transaction while one is already open. Otherwise (no
916
889
  * enclosing transaction), `migrate` wraps the plan in its own native
917
890
  * `database.transaction` — atomic on its own: a mid-plan failure rolls
918
891
  * back every DDL statement already applied by the plan. A scoped migration
919
892
  * uses one fixed internal savepoint literal because the published SQLite
920
- * wrapper intentionally exposes raw `exec` but no savepoint manager. That
893
+ * wrapper intentionally exposes raw `execute` but no savepoint manager. That
921
894
  * savepoint contains a caught inner migration so the outer callback
922
895
  * transaction remains active and may continue safely. A step referencing a
923
896
  * table not in this driver's declared schema (and that is not itself a
@@ -928,14 +901,14 @@ export declare class SQLiteDriver implements DriverInterface_2 {
928
901
  */
929
902
  migrate(input: MigrationInput): Promise<void>;
930
903
  /**
931
- * Read the persisted {@link DriverMetadata} from the reserved `_metadata` table.
904
+ * Reads the persisted {@link DriverMetadata} from the reserved `_metadata` table.
932
905
  *
933
906
  * @returns The last-stamped `DriverMetadata`, or `undefined` when never stamped
934
907
  * (or the stored row is malformed)
935
908
  */
936
909
  metadata(): Promise<DriverMetadata | undefined>;
937
910
  /**
938
- * Persist an owned metadata snapshot into the reserved `_metadata` table's
911
+ * Persists an owned metadata snapshot into the reserved `_metadata` table's
939
912
  * single row.
940
913
  *
941
914
  * @param metadata - The {@link DriverMetadata} to persist
@@ -954,11 +927,11 @@ export declare class SQLiteDriver implements DriverInterface_2 {
954
927
  * {@link DatabaseError}); `timeout` is the busy-timeout in milliseconds before
955
928
  * a locked database fails `BUSY`; `references` enables or disables foreign-key
956
929
  * constraint enforcement, while omission retains the upstream default.
957
- * `pragmas` is an ordered record of PRAGMA name to
958
- * value, applied via the wrapper's `pragma()` right after `connect()`, in
959
- * insertion order (e.g. `{ journal_mode: 'WAL' }`). Core rows are
960
- * number-typed — this driver never surfaces a `bigint`, so a stored integer
961
- * beyond `Number.MAX_SAFE_INTEGER` reads back imprecisely (the wrapper's own
930
+ * `pragmas` is an ordered record of PRAGMA name to value, applied through the
931
+ * wrapper's `pragma()` right after `connect()`, in insertion order (for
932
+ * example `{ journal_mode: 'WAL' }`). Core rows are number-typed — this driver
933
+ * never surfaces a `bigint`, so a stored integer beyond
934
+ * `Number.MAX_SAFE_INTEGER` reads back imprecisely (the wrapper's own
962
935
  * `bigints` option is not exposed here).
963
936
  */
964
937
  export declare interface SQLiteDriverOptions {
@@ -970,7 +943,7 @@ export declare interface SQLiteDriverOptions {
970
943
  }
971
944
 
972
945
  /**
973
- * Project one {@link MigrationStep} to SQLite DDL.
946
+ * Projects one {@link MigrationStep} to SQLite DDL.
974
947
  *
975
948
  * @param step - The migration step
976
949
  * @returns The statements that apply the step