lines-db 0.19.1 → 0.19.2
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.
- package/CHANGELOG.md +18 -0
- package/README.ja.md +5 -3
- package/README.md +5 -3
- package/bin/cli.mjs +321 -61
- package/dist/index.d.mts +40 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +321 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -80,6 +80,18 @@ export declare class LinesDB<Tables extends TableDefs> {
|
|
|
80
80
|
* back, also once the row's primary key changed and its line can no longer be found by it
|
|
81
81
|
*/
|
|
82
82
|
private linesWithUnknownFields;
|
|
83
|
+
/**
|
|
84
|
+
* For a table without a primary key, where each row's line stands in its file: the rows cannot be
|
|
85
|
+
* matched to their lines by key, and by order only while none is added or removed
|
|
86
|
+
*/
|
|
87
|
+
private linePositionsByRowid;
|
|
88
|
+
/**
|
|
89
|
+
* What happened to the positions of a table's rows since its rows were read for its write-back, in order: the
|
|
90
|
+
* positions that write-back computes describe the rows as they were, and are brought up to date with these
|
|
91
|
+
*/
|
|
92
|
+
private positionEdits;
|
|
93
|
+
/** Whether the temporary table that triggers log the rowid changes of rows to exists */
|
|
94
|
+
private movedRowsLogReady;
|
|
83
95
|
/** Whether a transaction's callback has returned and its files are being written back */
|
|
84
96
|
private transactionClosing;
|
|
85
97
|
/** Whether a transaction() call is past its guard but has not begun yet */
|
|
@@ -385,6 +397,25 @@ export declare class LinesDB<Tables extends TableDefs> {
|
|
|
385
397
|
* since this database last read or wrote it
|
|
386
398
|
*/
|
|
387
399
|
private prepareWriteBack;
|
|
400
|
+
private forgetPosition;
|
|
401
|
+
/**
|
|
402
|
+
* The rowid of the row each line was loaded into, in the order of the lines. Not the rowid order: an INTEGER
|
|
403
|
+
* PRIMARY KEY is the rowid, so the line `{"id":3}` first in its file is the row with rowid 3
|
|
404
|
+
*/
|
|
405
|
+
private rowidsInLineOrder;
|
|
406
|
+
/**
|
|
407
|
+
* Log each change of a row's rowid in the table: a foreign-key action or raw SQL can change an INTEGER PRIMARY
|
|
408
|
+
* KEY, which is the rowid, without a write through this database telling it which row moved
|
|
409
|
+
*/
|
|
410
|
+
private logMovedRows;
|
|
411
|
+
/** Move what is kept by rowid to the rowid each logged row moved to, in the order the rows moved */
|
|
412
|
+
private applyMovedRows;
|
|
413
|
+
/**
|
|
414
|
+
* Whether the lines of a table are remembered by position, so a row whose key changed, or that has none, is
|
|
415
|
+
* found again by where its line stood. Several data directories have the origin of each row instead
|
|
416
|
+
*/
|
|
417
|
+
private tracksLinePositions;
|
|
418
|
+
private hasNoPrimaryKey;
|
|
388
419
|
private prepareFileWriteBack;
|
|
389
420
|
/**
|
|
390
421
|
* Every row of a table in rowid order - the order the file was read in - as stored and as its line
|
|
@@ -418,11 +449,13 @@ export declare class LinesDB<Tables extends TableDefs> {
|
|
|
418
449
|
private applyResets;
|
|
419
450
|
/**
|
|
420
451
|
* Every row of a table with the fields the schema filled in rather than the file: the ones its line
|
|
421
|
-
* does not hold and no write set, which a write-back leaves out of the file
|
|
452
|
+
* does not hold and no write set, which a write-back leaves out of the file. `input` is the row as
|
|
453
|
+
* its line holds it - the values before the schema transformed them, without the defaulted fields.
|
|
422
454
|
*/
|
|
423
455
|
findWithDefaults<K extends keyof Tables & string>(tableName: K): Promise<Result<Array<{
|
|
424
456
|
row: Tables[K];
|
|
425
457
|
defaulted: string[];
|
|
458
|
+
input: JsonObject;
|
|
426
459
|
}>, Error>>;
|
|
427
460
|
private writePrepared;
|
|
428
461
|
/**
|
|
@@ -467,6 +500,12 @@ export declare class LinesDB<Tables extends TableDefs> {
|
|
|
467
500
|
* rejects them instead, since there the caller named both the table and the fields.
|
|
468
501
|
*/
|
|
469
502
|
private mergeWithExistingLines;
|
|
503
|
+
/**
|
|
504
|
+
* The primary key the schema makes of a line, which is how the stored rows hold it. The line's own key
|
|
505
|
+
* when the rows are in the line's terms (a `backward` transformation maps them back), when there is no
|
|
506
|
+
* schema, or when the schema refuses the line
|
|
507
|
+
*/
|
|
508
|
+
private outputKeyOfLine;
|
|
470
509
|
/**
|
|
471
510
|
* Pair each row with the JSONL line it came from, indexed the same way as `rows`.
|
|
472
511
|
* Returns undefined when the rows cannot be matched and the caller can do without it.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/sqlite-adapter.ts","../src/database.ts","../src/jsonl-writer.ts","../src/merge-fields.ts","../src/fill.ts","../src/schema-loader.ts","../src/directory-scanner.ts","../src/schema.ts","../src/type-generator.ts","../src/jsonl-migration.ts","../src/schema-extensions.ts","../src/error-formatter.ts","../src/runtime.ts","../src/dataset-config.ts"],"mappings":";;;;;;;UASiB;EACf,QAAQ,cAAc;EACtB,KAAK;EACL;;UAGe;EACf,OAAO;IAAkB;IAAiB;;EAC1C,OAAO;EACP,OAAO;;;;;UCoBQ;;EAEf;;;;;EAKA;;;;;UAMe;;;;;;;;;EASf;;;;;EAKA,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/sqlite-adapter.ts","../src/database.ts","../src/jsonl-writer.ts","../src/merge-fields.ts","../src/fill.ts","../src/schema-loader.ts","../src/directory-scanner.ts","../src/schema.ts","../src/type-generator.ts","../src/jsonl-migration.ts","../src/schema-extensions.ts","../src/error-formatter.ts","../src/runtime.ts","../src/dataset-config.ts"],"mappings":";;;;;;;UASiB;EACf,QAAQ,cAAc;EACtB,KAAK;EACL;;UAGe;EACf,OAAO;IAAkB;IAAiB;;EAC1C,OAAO;EACP,OAAO;;;;;UCoBQ;;EAEf;;;;;EAKA;;;;;UAMe;;;;;;;;;EASf;;;;;EAKA,oBAAoB;;qBAuLT,QAAQ,eAAe;UAC1B;mBACS;UACT;UACA;UACA;UACA;UACA;UACA;;UAEA;;UAEA;;;;;UAKA;UACA;;;;;UAKA;;UAEA;;;;;UAKA;;;;;U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