@orkestrel/table 0.0.4 → 0.0.6

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.
@@ -1,10 +1,11 @@
1
- import { EmitterErrorHandler } from '@orkestrel/emitter';
2
- import { EmitterHooks } from '@orkestrel/emitter';
3
- import { EmitterInterface } from '@orkestrel/emitter';
4
- import { JSONRecord } from '@orkestrel/contract';
1
+ import type { EmitterErrorHandler } from '@orkestrel/emitter';
2
+ import type { EmitterHooks } from '@orkestrel/emitter';
3
+ import type { EmitterInterface } from '@orkestrel/emitter';
4
+ import type { JSONRecord } from '@orkestrel/contract';
5
5
 
6
6
  /**
7
- * Checks whether one column admits a filter and all its operands.
7
+ * Checks whether one column admits a filter and every operand it carries — the gate `filter.set`
8
+ * and {@link matchesFilter} share.
8
9
  *
9
10
  * @param column - The column that fixes the accepted operators and cell shapes.
10
11
  * @param filter - The filter to inspect.
@@ -13,7 +14,8 @@ import { JSONRecord } from '@orkestrel/contract';
13
14
  export declare function admitsFilter(column: TableColumn, filter: TableFilter): boolean;
14
15
 
15
16
  /**
16
- * Audits a structurally valid schema for domain and budget faults.
17
+ * Audits a structurally valid schema for domain faults and budget breaches, returning human
18
+ * diagnostics.
17
19
  *
18
20
  * @param schema - The table schema to audit.
19
21
  * @returns Frozen human-readable diagnostics, or an empty list when the schema is sound.
@@ -21,11 +23,12 @@ export declare function admitsFilter(column: TableColumn, filter: TableFilter):
21
23
  export declare function auditTable(schema: TableSchema): readonly string[];
22
24
 
23
25
  /**
24
- * Keeps the rows whose cell falls between these bounds, both included.
26
+ * Keeps the rows whose cell falls between `minimum` and `maximum`, both included, compared the
27
+ * way the column compares.
25
28
  *
26
29
  * @remarks
27
- * The bounds compare the way the column compares, so a `text` column holding ISO strings takes a
28
- * pair of ISO strings and reads as a date range.
30
+ * A `text` column holding ISO strings therefore takes a pair of ISO strings and reads as a date
31
+ * range.
29
32
  */
30
33
  export declare interface BetweenFilter {
31
34
  readonly column: string;
@@ -35,13 +38,13 @@ export declare interface BetweenFilter {
35
38
  }
36
39
 
37
40
  /**
38
- * Compares two cells of one column.
41
+ * Compares two cells of one column, replacing what its `cell` fixes. Always describes ascending
42
+ * order; direction is applied afterwards.
39
43
  *
40
44
  * @remarks
41
- * It replaces the comparison the column's {@link ColumnCell} fixes, for that column alone, and it
42
- * receives `undefined` for a row carrying no cell there. Sorting reads the result the way
43
- * `Array.prototype.sort` does and applies {@link TableDirection} afterwards, so a comparator
44
- * always describes ascending order.
45
+ * The replacement covers that column alone, and it receives `undefined` for a row carrying no
46
+ * cell there. Sorting reads the result the way `Array.prototype.sort` does and applies
47
+ * {@link TableDirection} to it.
45
48
  *
46
49
  * @param left - The first row's cell, or `undefined` when it carries none.
47
50
  * @param right - The second row's cell, or `undefined` when it carries none.
@@ -55,11 +58,12 @@ export declare interface BetweenFilter {
55
58
  export declare type CellComparator = (left: TableCell | undefined, right: TableCell | undefined) => number;
56
59
 
57
60
  /**
58
- * Tests one column's cell against a filter.
61
+ * Tests one column's cell against a filter, replacing what its `cell` fixes. Receives every
62
+ * filter the table holds against that column.
59
63
  *
60
64
  * @remarks
61
- * It replaces the test the column's {@link ColumnCell} fixes, for that column alone, and it
62
- * receives every filter the table holds against that column.
65
+ * The replacement covers that column alone, and it receives `undefined` for a row carrying no
66
+ * cell there.
63
67
  *
64
68
  * @param cell - The row's cell, or `undefined` when it carries none.
65
69
  * @param filter - The filter the table is applying.
@@ -72,11 +76,12 @@ export declare type CellComparator = (left: TableCell | undefined, right: TableC
72
76
  */
73
77
  export declare type CellMatcher = (cell: TableCell | undefined, filter: TableFilter) => boolean;
74
78
 
75
- /** Names the maximum number of choices one `choice` column may offer. */
79
+ /** Names the maximum number of choices one `choice` column may offer: 1024. */
76
80
  export declare const CHOICE_LIMIT = 1024;
77
81
 
78
82
  /**
79
- * Represents a column drawn from a declared list, compared by the order that list declares.
83
+ * Represents a column drawn from a declared list, compared by the order that list declares. It
84
+ * requires `choices`.
80
85
  *
81
86
  * @remarks
82
87
  * A cell holding a value the list does not offer is refused at admission.
@@ -95,7 +100,8 @@ export declare interface ChoiceColumn extends ColumnBase {
95
100
  export declare function cloneRow(row: TableRow): TableRow;
96
101
 
97
102
  /**
98
- * Clones a table schema into an owned frozen snapshot.
103
+ * Clones a whole schema into an owned frozen snapshot, freezing every nested column, choice list,
104
+ * choice, and `meta`; raises `SCHEMA` for a `meta` it cannot own.
99
105
  *
100
106
  * @param schema - The schema to own.
101
107
  * @returns A frozen schema with every nested column, choice, list, and metadata record owned.
@@ -105,11 +111,12 @@ export declare function cloneSchema(schema: TableSchema): TableSchema;
105
111
  /** Lists every column cell, in the order declared by the public contract. */
106
112
  export declare const COLUMN_CELLS: readonly ColumnCell[];
107
113
 
108
- /** Names the maximum number of columns one schema may declare. */
114
+ /** Names the maximum number of columns one schema may declare: 256. */
109
115
  export declare const COLUMN_LIMIT = 256;
110
116
 
111
117
  /**
112
- * Describes what every column carries, whatever its cells hold.
118
+ * Describes what every column carries, whatever its cells hold — the name a row's cell uses, the
119
+ * text a reader sees, whether a host draws the column, and the metadata a host attaches to it.
113
120
  *
114
121
  * @remarks
115
122
  * `key` names the column, and it is the name a row uses for that column's cell. `label` is the
@@ -134,11 +141,12 @@ export declare interface ColumnBase {
134
141
  }
135
142
 
136
143
  /**
137
- * Names what a column's cells hold.
144
+ * Names what a column's cells hold — the discriminant that fixes the column's options, its
145
+ * comparison, and the filters that apply to it.
138
146
  *
139
147
  * @remarks
140
- * The cell is the discriminant of every {@link TableColumn} variant, so choosing it fixes what the
141
- * cells hold, how the column compares, and which filter operators apply to it.
148
+ * Every {@link TableColumn} variant is discriminated by it, so narrowing on the member reaches
149
+ * that variant's own options.
142
150
  *
143
151
  * A date, a time, and a timestamp are `text` holding a canonically spelled ISO string. Lexical
144
152
  * order is chronological only when a column uses one offset, one precision, and normalized
@@ -152,10 +160,10 @@ export declare interface ColumnBase {
152
160
  export declare type ColumnCell = 'text' | 'number' | 'flag' | 'choice';
153
161
 
154
162
  /**
155
- * Represents one value a `choice` column offers.
163
+ * Represents one value a `choice` column offers — `value` is stored, `label` is read, and `help`
164
+ * explains.
156
165
  *
157
166
  * @remarks
158
- * `value` is what the cell holds and `label` is what a reader sees. `help` explains the choice.
159
167
  * The order a column declares its choices in is the order that column sorts by, which is what
160
168
  * lets a status column sort draft before live before archived rather than alphabetically.
161
169
  */
@@ -166,7 +174,7 @@ export declare interface ColumnChoice {
166
174
  }
167
175
 
168
176
  /**
169
- * Compares two cells in ascending order according to one column.
177
+ * Compares two of one column's cells the way its `cell` fixes, describing ascending order.
170
178
  *
171
179
  * @param column - The column that fixes the comparison.
172
180
  * @param left - The first cell, or absence.
@@ -176,7 +184,8 @@ export declare interface ColumnChoice {
176
184
  export declare function compareCells(column: TableColumn, left: TableCell | undefined, right: TableCell | undefined): number;
177
185
 
178
186
  /**
179
- * Computes one atomic 0/1/N membership change over known keys.
187
+ * Computes one atomic 0/1/N membership change over the keys a caller may address — the engine
188
+ * selection and expansion share.
180
189
  *
181
190
  * @param known - Every key the caller may change.
182
191
  * @param current - The current key set.
@@ -187,7 +196,7 @@ export declare function compareCells(column: TableColumn, left: TableCell | unde
187
196
  */
188
197
  export declare function computeKeys(known: readonly TableKey[], current: ReadonlySet<TableKey>, input: TableKey | readonly TableKey[] | undefined, include: (included: boolean) => boolean): ReadonlySet<TableKey> | undefined;
189
198
 
190
- /** Keeps the rows whose cell holds this text somewhere inside it. */
199
+ /** Keeps the rows whose cell holds this `text` somewhere inside it. */
191
200
  export declare interface ContainsFilter {
192
201
  readonly column: string;
193
202
  readonly operator: 'contains';
@@ -195,22 +204,48 @@ export declare interface ContainsFilter {
195
204
  }
196
205
 
197
206
  /**
198
- * Opens a table against a schema.
207
+ * Opens a table against a schema. The schema is copied, and the copy is what the table declares.
199
208
  *
200
209
  * @param schema - The table declaration to own.
201
210
  * @param options - Initial rows, lens overrides, pagination, and emitter wiring.
202
211
  * @returns A live table interface.
203
212
  * @throws A {@link TableError} coded `SCHEMA` when the schema is unusable, `KEY` when a seeded
204
213
  * identity is unusable or repeated, and `CELL` when a seeded cell is invalid.
205
- * @example
214
+ * @example Open a table
206
215
  * ```ts
207
- * const table = createTable({ key: 'id', columns: [{ cell: 'text', key: 'id' }] })
208
- * table.rows.add({ id: '1' })
216
+ * import { createTable } from '@orkestrel/table'
217
+ *
218
+ * const table = createTable(
219
+ * {
220
+ * label: 'People',
221
+ * key: 'id',
222
+ * columns: [
223
+ * { cell: 'text', key: 'id', label: 'Reference' },
224
+ * { cell: 'text', key: 'name', label: 'Name' },
225
+ * { cell: 'number', key: 'age', label: 'Age' },
226
+ * ],
227
+ * },
228
+ * {
229
+ * rows: [
230
+ * { id: '1', name: 'Ada', age: 36 },
231
+ * { id: '2', name: 'Grace', age: 45 },
232
+ * { id: '3', name: 'Alan', age: 41 },
233
+ * ],
234
+ * limit: 2,
235
+ * },
236
+ * )
237
+ *
238
+ * table.filter.set({ column: 'name', operator: 'contains', text: 'a' })
239
+ * table.sort.set({ column: 'age', direction: 'descending' })
240
+ *
241
+ * table.count // 3 — every name holds a lowercase 'a'
242
+ * table.pagination.count // 2 — two pages of two
243
+ * table.view.map((row) => row.name) // ['Grace', 'Alan'] — page one, oldest first
209
244
  * ```
210
245
  */
211
246
  export declare function createTable(schema: TableSchema, options?: TableOptions): TableInterface;
212
247
 
213
- /** Keeps the rows whose cell holds exactly this value. */
248
+ /** Keeps the rows whose cell holds exactly this `value`. */
214
249
  export declare interface EqualsFilter {
215
250
  readonly column: string;
216
251
  readonly operator: 'equals';
@@ -233,7 +268,7 @@ export declare interface EqualsFilter {
233
268
  export declare interface ExpansionManagerInterface {
234
269
  /** Holds the keys of the rows opened right now. */
235
270
  readonly keys: ReadonlySet<TableKey>;
236
- /** Opens every row the table holds. */
271
+ /** Opens every row the table holds, one row, or several. */
237
272
  expand(): void;
238
273
  /**
239
274
  * Opens one row.
@@ -250,7 +285,9 @@ export declare interface ExpansionManagerInterface {
250
285
  * checked before any row opens.
251
286
  */
252
287
  expand(keys: readonly TableKey[]): boolean;
253
- /** Closes every row. */
288
+ /**
289
+ * Closes every row, one row, or several. A known key that was not open still answers `true`.
290
+ */
254
291
  clear(): void;
255
292
  /**
256
293
  * Closes one row.
@@ -269,7 +306,8 @@ export declare interface ExpansionManagerInterface {
269
306
  */
270
307
  clear(keys: readonly TableKey[]): boolean;
271
308
  /**
272
- * Opens one row, or closes it when it is already open.
309
+ * Opens one row, or closes it when it is already open; over a list, turns each row around on
310
+ * its own.
273
311
  *
274
312
  * @param key - The row's key.
275
313
  * @returns True if the key named a row the table holds; false otherwise.
@@ -286,7 +324,7 @@ export declare interface ExpansionManagerInterface {
286
324
  }
287
325
 
288
326
  /**
289
- * Finds one column by key.
327
+ * Finds one column by key; `undefined` when the schema declares no such column.
290
328
  *
291
329
  * @param schema - The schema whose columns to search.
292
330
  * @param key - The column key to find.
@@ -295,7 +333,8 @@ export declare interface ExpansionManagerInterface {
295
333
  export declare function extractColumn(schema: TableSchema, key: string): TableColumn | undefined;
296
334
 
297
335
  /**
298
- * Reads one row's declared identity.
336
+ * Reads one row's declared identity; `undefined` when its key cell is missing, empty, or not a
337
+ * string.
299
338
  *
300
339
  * @param schema - The schema that names the identity column.
301
340
  * @param row - The row whose identity to read.
@@ -317,20 +356,22 @@ export declare function extractKey(schema: TableSchema, row: TableRow): TableKey
317
356
  */
318
357
  export declare interface FilterManagerInterface {
319
358
  /**
320
- * Finds one column's filter.
359
+ * Finds one column's filter; `undefined` when nothing filters that column.
321
360
  *
322
361
  * @param column - The column's key.
323
362
  * @returns The filter, or `undefined` when nothing filters that column.
324
363
  */
325
364
  filter(column: string): TableFilter | undefined;
326
365
  /**
327
- * Reads every filter the table keeps rows by.
366
+ * Reads every filter the table keeps rows by, in the order they were set.
328
367
  *
329
- * @returns The filters, in the order they were set.
368
+ * @returns The filters the table keeps rows by.
330
369
  */
331
370
  filters(): readonly TableFilter[];
332
371
  /**
333
- * Filters several columns.
372
+ * Filters one column or several. A filter for a column already filtered replaces it; every
373
+ * other one joins the end. An undeclared column raises `COLUMN`, and a filter the column does
374
+ * not admit raises `CELL`.
334
375
  *
335
376
  * @param filters - The filters to set. A filter for a column already filtered replaces that
336
377
  * column's filter; every other one joins the end of the list.
@@ -347,7 +388,10 @@ export declare interface FilterManagerInterface {
347
388
  * not declare, and `CELL` when an operand is one the column cannot hold.
348
389
  */
349
390
  set(filter: TableFilter): void;
350
- /** Stops filtering by anything. */
391
+ /**
392
+ * Stops filtering everything, one column, or several. An undeclared column returns `false` and
393
+ * stops nothing.
394
+ */
351
395
  remove(): void;
352
396
  /**
353
397
  * Stops filtering one column.
@@ -367,7 +411,7 @@ export declare interface FilterManagerInterface {
367
411
  }
368
412
 
369
413
  /**
370
- * Names how a filter tests a cell.
414
+ * Names how a filter tests a cell — the operator each filter carries.
371
415
  *
372
416
  * @remarks
373
417
  * `contains` looks for text inside a `text` or `choice` cell. `between` accepts a cell inside a
@@ -380,7 +424,8 @@ export declare interface FilterManagerInterface {
380
424
  export declare type FilterOperator = 'contains' | 'between' | 'equals';
381
425
 
382
426
  /**
383
- * Keeps the rows accepted by every filter.
427
+ * Keeps the rows every filter accepts, in the order given; a supplied {@link CellMatcher}
428
+ * replaces the default per column.
384
429
  *
385
430
  * @param schema - The schema that declares the filtered columns.
386
431
  * @param rows - The rows to filter.
@@ -404,7 +449,8 @@ export declare interface FlagColumn extends ColumnBase {
404
449
  export declare function isColumnCell(input: unknown): input is ColumnCell;
405
450
 
406
451
  /**
407
- * Determines whether an unknown value is one exact column choice record.
452
+ * Determines whether an unknown value is one exact {@link ColumnChoice} record; an unknown member
453
+ * refuses it.
408
454
  *
409
455
  * @param input - The value to inspect.
410
456
  * @returns True if the value is a column choice; false otherwise.
@@ -412,7 +458,8 @@ export declare function isColumnCell(input: unknown): input is ColumnCell;
412
458
  export declare function isColumnChoice(input: unknown): input is ColumnChoice;
413
459
 
414
460
  /**
415
- * Determines whether an unknown value has one exact structural table-schema shape.
461
+ * Determines whether an unknown value has the exact shape of a {@link TableSchema} — the shape
462
+ * alone, with no domain check.
416
463
  *
417
464
  * @param input - The value to inspect.
418
465
  * @returns True if the value has the exact structure of a table schema; false otherwise.
@@ -420,7 +467,8 @@ export declare function isColumnChoice(input: unknown): input is ColumnChoice;
420
467
  export declare function isStructuralTableSchema(input: unknown): input is TableSchema;
421
468
 
422
469
  /**
423
- * Determines whether an unknown value has a table cell shape.
470
+ * Determines whether an unknown value has a table cell shape — a string, a finite number, or a
471
+ * boolean.
424
472
  *
425
473
  * @param input - The value to inspect.
426
474
  * @returns True if the value is a string, finite number, or boolean; false otherwise.
@@ -428,7 +476,8 @@ export declare function isStructuralTableSchema(input: unknown): input is TableS
428
476
  export declare function isTableCell(input: unknown): input is TableCell;
429
477
 
430
478
  /**
431
- * Determines whether an unknown value is one exact discriminated table column.
479
+ * Determines whether an unknown value is one exact discriminated {@link TableColumn}, checked
480
+ * against its cell's own options.
432
481
  *
433
482
  * @param input - The value to inspect.
434
483
  * @returns True if the value is a structurally valid table column; false otherwise.
@@ -436,7 +485,8 @@ export declare function isTableCell(input: unknown): input is TableCell;
436
485
  export declare function isTableColumn(input: unknown): input is TableColumn;
437
486
 
438
487
  /**
439
- * Determines whether an unknown value is a table error.
488
+ * Determines whether a caught value is a table error, so a `catch` branches on `code` without an
489
+ * assertion.
440
490
  *
441
491
  * @param input - The value to inspect.
442
492
  * @returns True if the value is a {@link TableError} instance; false otherwise.
@@ -444,7 +494,8 @@ export declare function isTableColumn(input: unknown): input is TableColumn;
444
494
  export declare function isTableError(input: unknown): input is TableError;
445
495
 
446
496
  /**
447
- * Determines whether an unknown value is a record of table cells.
497
+ * Determines whether an unknown value is a record whose every own key is a string and every value
498
+ * a {@link TableCell}.
448
499
  *
449
500
  * @param input - The value to inspect.
450
501
  * @returns True if every own key is a string and every value is a table cell; false otherwise.
@@ -452,7 +503,8 @@ export declare function isTableError(input: unknown): input is TableError;
452
503
  export declare function isTableRow(input: unknown): input is TableRow;
453
504
 
454
505
  /**
455
- * Determines whether an unknown value is one semantically sound table schema.
506
+ * Determines whether an unknown value is a {@link TableSchema} a table can be opened against —
507
+ * the exact shape, and an audit that finds nothing.
456
508
  *
457
509
  * @param input - The value to inspect.
458
510
  * @returns True if the value has valid structure, domain relationships, and
@@ -461,7 +513,8 @@ export declare function isTableRow(input: unknown): input is TableRow;
461
513
  export declare function isTableSchema(input: unknown): input is TableSchema;
462
514
 
463
515
  /**
464
- * Checks whether a value has the shape required by one column cell.
516
+ * Checks whether one column can hold a value the shape gate every write and every seed passes
517
+ * through.
465
518
  *
466
519
  * @param column - The column that owns the cell.
467
520
  * @param value - The unknown value to inspect.
@@ -470,7 +523,7 @@ export declare function isTableSchema(input: unknown): input is TableSchema;
470
523
  export declare function matchesCell(column: TableColumn, value: unknown): value is TableCell;
471
524
 
472
525
  /**
473
- * Tests one cell against a filter according to its column.
526
+ * Tests one of a column's cells against one filter the way its `cell` fixes.
474
527
  *
475
528
  * @param column - The column that fixes the accepted operators.
476
529
  * @param cell - The cell to test, or absence.
@@ -480,7 +533,8 @@ export declare function matchesCell(column: TableColumn, value: unknown): value
480
533
  export declare function matchesFilter(column: TableColumn, cell: TableCell | undefined, filter: TableFilter): boolean;
481
534
 
482
535
  /**
483
- * Checks whether two lens lists hold the same terms in the same order.
536
+ * Checks whether two lens lists hold the same terms in the same order, with the supplied test
537
+ * deciding the operands.
484
538
  *
485
539
  * @param left - The first list.
486
540
  * @param right - The second list.
@@ -491,7 +545,8 @@ export declare function matchesFilter(column: TableColumn, cell: TableCell | und
491
545
  export declare function matchesTerms<Term extends TableTerm>(left: readonly Term[], right: readonly Term[], equal: (left: Term, right: Term) => boolean): boolean;
492
546
 
493
547
  /**
494
- * Merges lens terms into a column-keyed list, replacing the entry that names the same column.
548
+ * Merges lens terms into a column-keyed list, replacing the entry that names the same column
549
+ * the `set` write.
495
550
  *
496
551
  * @param current - The list as it stands.
497
552
  * @param requested - The terms to write, in the order they are written.
@@ -500,10 +555,10 @@ export declare function matchesTerms<Term extends TableTerm>(left: readonly Term
500
555
  */
501
556
  export declare function mergeTerms<Term extends TableTerm>(current: readonly Term[], requested: readonly Term[]): readonly Term[];
502
557
 
503
- /** Names the maximum length, in UTF-16 code units, of a schema name or column key. */
558
+ /** Names the maximum length of a schema name or column key: 128 UTF-16 code units. */
504
559
  export declare const NAME_LIMIT = 128;
505
560
 
506
- /** Names the maximum total number of records, arrays, and leaves one schema retains. */
561
+ /** Names the maximum total number of records, arrays, and leaves one schema retains: 16384. */
507
562
  export declare const NODE_LIMIT = 16384;
508
563
 
509
564
  /** Represents a column of numbers, compared by magnitude. */
@@ -538,18 +593,18 @@ export declare interface PaginationManagerInterface {
538
593
  /** Counts the pages the rows admitted by the filter fill, and `1` when the table is not paged. */
539
594
  readonly count: number;
540
595
  /**
541
- * Shows another page.
596
+ * Shows another page, counted from one and clamped to the pages that exist.
542
597
  *
543
598
  * @param page - The page to show, counted from one and clamped to the pages that exist. `NaN`
544
599
  * shows the first page.
545
600
  */
546
601
  move(page: number): void;
547
602
  /**
548
- * Sets how many rows a page holds.
603
+ * Sets how many rows a page holds, keeping the first row the view was showing. Leave the
604
+ * argument out to stop paging.
549
605
  *
550
606
  * @remarks
551
- * The view keeps showing the first of the rows it was showing, so the page moves to wherever
552
- * that row now falls.
607
+ * The page moves to wherever that first row now falls.
553
608
  *
554
609
  * @param limit - How many rows a page holds. Leave it out to stop paging, and the view shows
555
610
  * every row the filter admits.
@@ -558,7 +613,8 @@ export declare interface PaginationManagerInterface {
558
613
  }
559
614
 
560
615
  /**
561
- * Parses unknown wire rows against one table schema.
616
+ * Parses unknown wire data into owned rows against one table schema, coercing a numeric string
617
+ * and `'true'` / `'false'`.
562
618
  *
563
619
  * @param schema - The schema that declares the accepted keys and cell shapes.
564
620
  * @param input - The unknown row-list value to parse.
@@ -567,7 +623,7 @@ export declare interface PaginationManagerInterface {
567
623
  export declare function parseRows(schema: TableSchema, input: unknown): readonly TableRow[] | undefined;
568
624
 
569
625
  /**
570
- * Parses unknown wire data into an owned, semantically sound table schema.
626
+ * Parses unknown wire data into an owned, structurally valid, semantically sound table schema.
571
627
  *
572
628
  * @param input - The unknown schema value to parse.
573
629
  * @returns An owned table schema, or `undefined` on refusal.
@@ -575,7 +631,8 @@ export declare function parseRows(schema: TableSchema, input: unknown): readonly
575
631
  export declare function parseTable(input: unknown): TableSchema | undefined;
576
632
 
577
633
  /**
578
- * Removes every lens term naming one of the given columns.
634
+ * Removes every lens term naming one of the given columns — the drop `sort.remove` and
635
+ * `filter.remove` share.
579
636
  *
580
637
  * @param current - The list as it stands.
581
638
  * @param columns - The column keys to drop.
@@ -598,20 +655,21 @@ export declare function removeTerms<Term extends TableTerm>(current: readonly Te
598
655
  */
599
656
  export declare interface RowManagerInterface {
600
657
  /**
601
- * Finds one row by key.
658
+ * Finds one row by key; `undefined` when the table holds no such key.
602
659
  *
603
660
  * @param key - The row's key.
604
661
  * @returns The row, or `undefined` when the table holds no such key.
605
662
  */
606
663
  row(key: TableKey): TableRow | undefined;
607
664
  /**
608
- * Reads every row the table holds, in its own order.
665
+ * Reads every row the table holds, in its own order — unfiltered, unsorted, and unpaged.
609
666
  *
610
- * @returns The rows, unfiltered, unsorted, and unpaged.
667
+ * @returns The rows, in the order the table holds them.
611
668
  */
612
669
  rows(): readonly TableRow[];
613
670
  /**
614
- * Takes in several rows, appending them in the order given.
671
+ * Takes in one row or several, appending them in the order given. Every row is checked before
672
+ * any is admitted.
615
673
  *
616
674
  * @param rows - The rows to admit.
617
675
  * @throws A {@link TableError} coded `KEY` when a row's key is missing, unusable, already
@@ -628,7 +686,8 @@ export declare interface RowManagerInterface {
628
686
  */
629
687
  add(row: TableRow): void;
630
688
  /**
631
- * Writes over several rows, each found by the key it carries.
689
+ * Writes over one row or several, each found by the key it carries. The cells given replace;
690
+ * the cells left out stay.
632
691
  *
633
692
  * @param rows - The rows to write, each carrying the key of the row it writes over.
634
693
  * @returns True if every key named a row the table holds; false otherwise.
@@ -649,7 +708,8 @@ export declare interface RowManagerInterface {
649
708
  */
650
709
  update(row: TableRow): boolean;
651
710
  /**
652
- * Moves one row to another place in the table's own order.
711
+ * Moves one row to another place in the table's own order, counted from zero and clamped to the
712
+ * rows that exist.
653
713
  *
654
714
  * @param key - The row's key.
655
715
  * @param index - Where to put it, counted from zero and clamped to the rows that exist. `NaN`
@@ -658,10 +718,8 @@ export declare interface RowManagerInterface {
658
718
  */
659
719
  move(key: TableKey, index: number): boolean;
660
720
  /**
661
- * Takes out every row.
662
- *
663
- * @remarks
664
- * Selection and expansion drop the keys they held, because those rows are gone.
721
+ * Takes out every row, one row, or several. Selection and expansion drop the keys of the rows
722
+ * that went.
665
723
  */
666
724
  remove(): void;
667
725
  /**
@@ -698,11 +756,10 @@ export declare interface SelectionManagerInterface {
698
756
  /** Holds the keys of the rows picked right now. */
699
757
  readonly keys: ReadonlySet<TableKey>;
700
758
  /**
701
- * Picks every row the table holds.
759
+ * Picks every row the table holds, one row, or several. Every row, not every visible one.
702
760
  *
703
761
  * @remarks
704
- * Every row, not every visible one. A host picking one page hands that page's keys over
705
- * instead.
762
+ * A host picking one page hands that page's keys over instead.
706
763
  */
707
764
  select(): void;
708
765
  /**
@@ -720,7 +777,9 @@ export declare interface SelectionManagerInterface {
720
777
  * checked before any row is picked.
721
778
  */
722
779
  select(keys: readonly TableKey[]): boolean;
723
- /** Drops every pick. */
780
+ /**
781
+ * Drops every pick, one pick, or several. A known key that was not picked still answers `true`.
782
+ */
724
783
  clear(): void;
725
784
  /**
726
785
  * Drops one pick.
@@ -739,7 +798,8 @@ export declare interface SelectionManagerInterface {
739
798
  */
740
799
  clear(keys: readonly TableKey[]): boolean;
741
800
  /**
742
- * Picks one row, or drops it when it is already picked.
801
+ * Picks one row, or drops it when it is already picked; over a list, turns each row around on
802
+ * its own.
743
803
  *
744
804
  * @param key - The row's key.
745
805
  * @returns True if the key named a row the table holds; false otherwise.
@@ -756,7 +816,8 @@ export declare interface SelectionManagerInterface {
756
816
  }
757
817
 
758
818
  /**
759
- * Projects rows into schema-column-ordered JSON.
819
+ * Projects rows into JSON with each row's cells in the schema's column order, dropping every
820
+ * absent cell.
760
821
  *
761
822
  * @param schema - The schema that fixes cell order.
762
823
  * @param rows - The rows to project.
@@ -765,7 +826,8 @@ export declare interface SelectionManagerInterface {
765
826
  export declare function serializeRows(schema: TableSchema, rows: readonly TableRow[]): readonly JSONRecord[];
766
827
 
767
828
  /**
768
- * Projects a schema into declaration-ordered JSON.
829
+ * Projects a schema into JSON in declaration order, dropping every absent member; raises `SCHEMA`
830
+ * for a `meta` it cannot own.
769
831
  *
770
832
  * @param schema - The schema to project.
771
833
  * @returns A deeply owned JSON record with absent members omitted.
@@ -789,20 +851,21 @@ export declare function serializeTable(schema: TableSchema): JSONRecord;
789
851
  */
790
852
  export declare interface SortManagerInterface {
791
853
  /**
792
- * Finds one column's term.
854
+ * Finds one column's term; `undefined` when nothing sorts that column.
793
855
  *
794
856
  * @param column - The column's key.
795
857
  * @returns The term, or `undefined` when nothing sorts that column.
796
858
  */
797
859
  order(column: string): TableOrder | undefined;
798
860
  /**
799
- * Reads every term the table sorts by.
861
+ * Reads every term the table sorts by, first to last, in the order they decide.
800
862
  *
801
- * @returns The terms, first to last, in the order they decide.
863
+ * @returns The terms the table sorts by.
802
864
  */
803
865
  orders(): readonly TableOrder[];
804
866
  /**
805
- * Sorts by several columns.
867
+ * Sorts by one column or several. A term for a column already sorted replaces its direction in
868
+ * place; every other term joins the end. An undeclared column raises `COLUMN`.
806
869
  *
807
870
  * @param orders - The terms to set. A term for a column already sorted replaces that column's
808
871
  * direction in place; every other term joins the end of the list.
@@ -818,7 +881,10 @@ export declare interface SortManagerInterface {
818
881
  * declare.
819
882
  */
820
883
  set(order: TableOrder): void;
821
- /** Stops sorting by anything. */
884
+ /**
885
+ * Stops sorting by everything, by one column, or by several. An undeclared column returns
886
+ * `false` and stops nothing.
887
+ */
822
888
  remove(): void;
823
889
  /**
824
890
  * Stops sorting by one column.
@@ -838,7 +904,8 @@ export declare interface SortManagerInterface {
838
904
  }
839
905
 
840
906
  /**
841
- * Orders rows stably by a sequence of terms.
907
+ * Orders rows by the terms given, stably; a supplied {@link CellComparator} replaces the default
908
+ * per column.
842
909
  *
843
910
  * @param schema - The schema that declares the sorted columns.
844
911
  * @param rows - The rows to order.
@@ -848,10 +915,13 @@ export declare interface SortManagerInterface {
848
915
  */
849
916
  export declare function sortRows(schema: TableSchema, rows: readonly TableRow[], orders: readonly TableOrder[], comparators?: Readonly<Record<string, CellComparator>>): readonly TableRow[];
850
917
 
851
- /** Names the maximum length, in UTF-16 code units, of any single retained string. */
918
+ /** Names the maximum length of any single retained string: 65536 UTF-16 code units. */
852
919
  export declare const STRING_LIMIT = 65536;
853
920
 
854
- /** Holds a schema, its rows, and the lens through which they are read. */
921
+ /**
922
+ * Holds a schema, its rows, and the lens through which they are read, implementing
923
+ * {@link TableInterface} exactly.
924
+ */
855
925
  export declare class Table implements TableInterface {
856
926
  #private;
857
927
  /**
@@ -892,7 +962,7 @@ export declare class Table implements TableInterface {
892
962
  }
893
963
 
894
964
  /**
895
- * Represents every value a cell can hold.
965
+ * Represents every value a cell can hold — a `string`, a `number`, or a `boolean`.
896
966
  *
897
967
  * @remarks
898
968
  * The variant follows the column: `text` and `choice` hold a `string`, `number` holds a `number`,
@@ -902,11 +972,10 @@ export declare class Table implements TableInterface {
902
972
  export declare type TableCell = string | number | boolean;
903
973
 
904
974
  /**
905
- * Represents any column a schema can declare.
975
+ * Represents any column a schema can declare — the union discriminated on `cell`.
906
976
  *
907
977
  * @remarks
908
- * The union discriminates on `cell`, so narrowing on that member reaches each variant's own
909
- * members.
978
+ * Narrowing on `cell` reaches each variant's own members.
910
979
  *
911
980
  * @example
912
981
  * ```ts
@@ -918,15 +987,17 @@ export declare type TableCell = string | number | boolean;
918
987
  export declare type TableColumn = TextColumn | NumberColumn | FlagColumn | ChoiceColumn;
919
988
 
920
989
  /**
921
- * Names which way a column sorts.
990
+ * Names which way a column sorts. A column nobody has sorted carries no term at all.
922
991
  *
923
992
  * @remarks
924
- * A column nobody has sorted has no {@link TableOrder} at all, so there is no third member
925
- * standing for unsorted.
993
+ * No member of this union stands for unsorted; that state is the missing {@link TableOrder}.
926
994
  */
927
995
  export declare type TableDirection = 'ascending' | 'descending';
928
996
 
929
- /** Represents an error raised by the table domain. */
997
+ /**
998
+ * Represents an error raised by the table domain — a machine-readable `code` and optional
999
+ * structured `context`.
1000
+ */
930
1001
  export declare class TableError extends Error {
931
1002
  /** Holds the machine-readable reason for this failure. */
932
1003
  readonly code: TableErrorCode;
@@ -943,7 +1014,7 @@ export declare class TableError extends Error {
943
1014
  }
944
1015
 
945
1016
  /**
946
- * Names the machine-readable code a table error carries.
1017
+ * Names the reason a {@link TableError} carries — the machine-readable code a `catch` branches on.
947
1018
  *
948
1019
  * @remarks
949
1020
  * `SCHEMA` rejects a malformed schema, including a `key` naming no declared column. `COLUMN`
@@ -954,7 +1025,7 @@ export declare class TableError extends Error {
954
1025
  export declare type TableErrorCode = 'SCHEMA' | 'COLUMN' | 'KEY' | 'CELL' | 'DESTROYED';
955
1026
 
956
1027
  /**
957
- * Lists everything a table announces.
1028
+ * Lists everything a table announces, mapping each event to the payload its listeners receive.
958
1029
  *
959
1030
  * @remarks
960
1031
  * Every event fires after the state it reports is committed, and only when something actually
@@ -984,11 +1055,11 @@ export declare type TableEventMap = {
984
1055
  };
985
1056
 
986
1057
  /**
987
- * Represents any filter a table can hold.
1058
+ * Represents any filter a table can hold — the union discriminated on `operator`.
988
1059
  *
989
1060
  * @remarks
990
- * The union discriminates on `operator`, so each operator carries only the operands it uses and a
991
- * `between` missing a bound cannot be written down.
1061
+ * Each operator carries only the operands it uses, so a `between` missing a bound cannot be
1062
+ * written down.
992
1063
  *
993
1064
  * A table holds at most one filter per column and keeps every row all of them accept. There is no
994
1065
  * either-or composition in this version.
@@ -1049,31 +1120,32 @@ export declare interface TableInterface {
1049
1120
  /** Reports whether the table has been torn down. */
1050
1121
  readonly destroyed: boolean;
1051
1122
  /**
1052
- * Puts the table back the way it opened, holding nothing.
1123
+ * Puts the table back the way it opened, holding nothing. Rows, sort, filter, selection,
1124
+ * expansion, and the page all reset.
1053
1125
  *
1054
1126
  * @remarks
1055
- * Every row goes, and sort, filter, selection, expansion, and the page all reset. The table
1056
- * emits `clear` and nothing else, so a reset of ten thousand rows is one announcement.
1127
+ * The table emits `clear` and nothing else, so a reset of ten thousand rows is one
1128
+ * announcement.
1057
1129
  */
1058
1130
  clear(): void;
1059
1131
  /**
1060
- * Tears the table down.
1132
+ * Tears the table down. Idempotent; afterwards every write raises `DESTROYED` and every getter
1133
+ * still answers.
1061
1134
  *
1062
1135
  * @remarks
1063
- * Calling it twice does what calling it once did. Afterwards every write throws a
1064
- * {@link TableError} coded `DESTROYED`, while every getter still answers what the table last
1065
- * held, so a host can read its way out of teardown without catching anything.
1136
+ * The write throws a {@link TableError} carrying that code, and what a getter answers is what
1137
+ * the table last held, so a host can read its way out of teardown without catching anything.
1066
1138
  */
1067
1139
  destroy(): void;
1068
1140
  }
1069
1141
 
1070
1142
  /**
1071
- * Represents a row's identity.
1143
+ * Represents a row's identity — a `string`, carried in the cell the schema's `key` names.
1072
1144
  *
1073
1145
  * @remarks
1074
- * Every row carries its own identity in the cell named by {@link TableSchema.key}, as a non-empty
1075
- * string. A column's own identifier is a plain `string`; this names a row. Selection and expansion
1076
- * hold these keys and nothing else, so a row keeps its selection through a re-sort.
1146
+ * The identity must be non-empty. A column's own identifier is a plain `string`; this names a row.
1147
+ * Selection and expansion hold these keys and nothing else, so a row keeps its selection through a
1148
+ * re-sort.
1077
1149
  *
1078
1150
  * @example
1079
1151
  * ```ts
@@ -1083,7 +1155,9 @@ export declare interface TableInterface {
1083
1155
  export declare type TableKey = string;
1084
1156
 
1085
1157
  /**
1086
- * Describes how to open a table.
1158
+ * Describes how to open a table — the listeners wired at construction and where a throw from one
1159
+ * goes, the rows seeded into it, the per-column comparison and test replacements, and the page
1160
+ * size.
1087
1161
  *
1088
1162
  * @remarks
1089
1163
  * `on` wires listeners at construction and `error` receives any throw from one of them.
@@ -1117,11 +1191,12 @@ export declare interface TableOptions {
1117
1191
  }
1118
1192
 
1119
1193
  /**
1120
- * Represents one column's place in the sort.
1194
+ * Represents one column's place in the sort — the `column` and its `direction`. The list is read
1195
+ * left to right.
1121
1196
  *
1122
1197
  * @remarks
1123
- * The order list is read left to right: the first term decides, and each later term breaks the
1124
- * tie the terms before it left. Rows no term separates keep the order the table holds them in.
1198
+ * The first term decides, and each later term breaks the tie the terms before it left. Rows no
1199
+ * term separates keep the order the table holds them in.
1125
1200
  *
1126
1201
  * @example
1127
1202
  * ```ts
@@ -1134,12 +1209,11 @@ export declare interface TableOrder {
1134
1209
  }
1135
1210
 
1136
1211
  /**
1137
- * Represents one row, keyed by column.
1212
+ * Represents one row, keyed by column. A column nobody has filled has no key here.
1138
1213
  *
1139
1214
  * @remarks
1140
- * A row declares a cell for the columns it carries and omits the rest. It carries no key the
1141
- * schema does not declare, and the table clones and freezes it at admission, so nothing a caller
1142
- * holds afterwards can move a stored row.
1215
+ * A row carries no key the schema does not declare, and the table clones and freezes it at
1216
+ * admission, so nothing a caller holds afterwards can move a stored row.
1143
1217
  *
1144
1218
  * @example
1145
1219
  * ```ts
@@ -1149,7 +1223,8 @@ export declare interface TableOrder {
1149
1223
  export declare type TableRow = Readonly<Record<string, TableCell>>;
1150
1224
 
1151
1225
  /**
1152
- * Holds everything a table declares about itself.
1226
+ * Holds everything a table declares about itself — how the table is described, which column
1227
+ * carries row identity, and the columns it declares, in the order it declares them.
1153
1228
  *
1154
1229
  * @remarks
1155
1230
  * The schema is data. It carries no function, so all of it crosses a wire and nothing is dropped
@@ -1185,22 +1260,27 @@ export declare interface TableSchema {
1185
1260
  }
1186
1261
 
1187
1262
  /**
1188
- * Represents one entry of a lens list, held against one declared column.
1263
+ * Represents one entry of a lens list the `column` it names. A sort term and a filter each hold
1264
+ * one, which is why the two share a list engine.
1189
1265
  *
1190
1266
  * @remarks
1191
1267
  * A table holds at most one sort term and at most one filter per column, so `column` is what
1192
1268
  * places an entry in either list. {@link mergeTerms}, {@link removeTerms}, and
1193
- * {@link matchesTerms} work over this shape alone, which is how sorting and filtering share one
1194
- * list engine while keeping their own operands.
1269
+ * {@link matchesTerms} work over this shape alone, so each list keeps its own operands.
1195
1270
  */
1196
1271
  export declare interface TableTerm {
1197
1272
  readonly column: string;
1198
1273
  }
1199
1274
 
1200
- /** Names the maximum total length, in UTF-16 code units, of every string one schema retains. */
1275
+ /**
1276
+ * Names the maximum total length of every string one schema retains: 1048576 UTF-16 code units.
1277
+ */
1201
1278
  export declare const TEXT_LIMIT = 1048576;
1202
1279
 
1203
- /** Represents a column of text, compared lexically. */
1280
+ /**
1281
+ * Represents a column of text, compared lexically. Carries a date, a time, and a timestamp as ISO
1282
+ * strings.
1283
+ */
1204
1284
  export declare interface TextColumn extends ColumnBase {
1205
1285
  readonly cell: 'text';
1206
1286
  }