@opendatalabs/personal-server-ts-core 1.43.3 → 1.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/localdb/byte-pages.d.ts +46 -0
- package/dist/localdb/byte-pages.d.ts.map +1 -0
- package/dist/localdb/byte-pages.js +84 -0
- package/dist/localdb/byte-pages.js.map +1 -0
- package/dist/localdb/import-readback.d.ts.map +1 -1
- package/dist/localdb/import-readback.js +6 -4
- package/dist/localdb/import-readback.js.map +1 -1
- package/dist/localdb/import-snapshot.d.ts +33 -3
- package/dist/localdb/import-snapshot.d.ts.map +1 -1
- package/dist/localdb/import-snapshot.js +98 -17
- package/dist/localdb/import-snapshot.js.map +1 -1
- package/dist/localdb/index.d.ts +3 -0
- package/dist/localdb/index.d.ts.map +1 -1
- package/dist/localdb/index.js +3 -0
- package/dist/localdb/index.js.map +1 -1
- package/dist/localdb/legacy-fold.d.ts +68 -0
- package/dist/localdb/legacy-fold.d.ts.map +1 -0
- package/dist/localdb/legacy-fold.js +225 -0
- package/dist/localdb/legacy-fold.js.map +1 -0
- package/dist/localdb/legacy-import-types.d.ts +11 -2
- package/dist/localdb/legacy-import-types.d.ts.map +1 -1
- package/dist/localdb/legacy-import.d.ts +13 -0
- package/dist/localdb/legacy-import.d.ts.map +1 -1
- package/dist/localdb/legacy-import.js +130 -20
- package/dist/localdb/legacy-import.js.map +1 -1
- package/dist/localdb/legacy-quarantine.d.ts +67 -0
- package/dist/localdb/legacy-quarantine.d.ts.map +1 -0
- package/dist/localdb/legacy-quarantine.js +108 -0
- package/dist/localdb/legacy-quarantine.js.map +1 -0
- package/dist/localdb/legacy-seed-producer.d.ts +71 -0
- package/dist/localdb/legacy-seed-producer.d.ts.map +1 -0
- package/dist/localdb/legacy-seed-producer.js +217 -0
- package/dist/localdb/legacy-seed-producer.js.map +1 -0
- package/dist/localdb/log-apply.d.ts +13 -1
- package/dist/localdb/log-apply.d.ts.map +1 -1
- package/dist/localdb/log-apply.js +60 -20
- package/dist/localdb/log-apply.js.map +1 -1
- package/dist/localdb/log-changed-keys.d.ts +33 -0
- package/dist/localdb/log-changed-keys.d.ts.map +1 -0
- package/dist/localdb/log-changed-keys.js +92 -0
- package/dist/localdb/log-changed-keys.js.map +1 -0
- package/dist/localdb/log-compact.d.ts +27 -10
- package/dist/localdb/log-compact.d.ts.map +1 -1
- package/dist/localdb/log-compact.js +81 -30
- package/dist/localdb/log-compact.js.map +1 -1
- package/dist/localdb/log-fold-workspace.d.ts +22 -0
- package/dist/localdb/log-fold-workspace.d.ts.map +1 -0
- package/dist/localdb/log-fold-workspace.js +246 -0
- package/dist/localdb/log-fold-workspace.js.map +1 -0
- package/dist/localdb/log-keyed.d.ts +1 -1
- package/dist/localdb/log-keyed.d.ts.map +1 -1
- package/dist/localdb/log-keyed.js +9 -2
- package/dist/localdb/log-keyed.js.map +1 -1
- package/dist/localdb/log-publish.d.ts +7 -1
- package/dist/localdb/log-publish.d.ts.map +1 -1
- package/dist/localdb/log-publish.js +535 -396
- package/dist/localdb/log-publish.js.map +1 -1
- package/dist/localdb/log-rebase.d.ts.map +1 -1
- package/dist/localdb/log-rebase.js +56 -31
- package/dist/localdb/log-rebase.js.map +1 -1
- package/dist/localdb/log-scratch.d.ts +16 -0
- package/dist/localdb/log-scratch.d.ts.map +1 -0
- package/dist/localdb/log-scratch.js +95 -0
- package/dist/localdb/log-scratch.js.map +1 -0
- package/dist/localdb/log-seed.d.ts +5 -5
- package/dist/localdb/log-seed.d.ts.map +1 -1
- package/dist/localdb/log-seed.js +4 -4
- package/dist/localdb/log-seed.js.map +1 -1
- package/dist/localdb/log-spool.d.ts +22 -0
- package/dist/localdb/log-spool.d.ts.map +1 -0
- package/dist/localdb/log-spool.js +92 -0
- package/dist/localdb/log-spool.js.map +1 -0
- package/dist/localdb/open.d.ts +4 -2
- package/dist/localdb/open.d.ts.map +1 -1
- package/dist/localdb/open.js +9 -2
- package/dist/localdb/open.js.map +1 -1
- package/dist/localdb/purge.d.ts.map +1 -1
- package/dist/localdb/purge.js +4 -0
- package/dist/localdb/purge.js.map +1 -1
- package/dist/localdb/schema.d.ts.map +1 -1
- package/dist/localdb/schema.js +19 -0
- package/dist/localdb/schema.js.map +1 -1
- package/dist/localdb/write-batches.d.ts +16 -0
- package/dist/localdb/write-batches.d.ts.map +1 -0
- package/dist/localdb/write-batches.js +114 -0
- package/dist/localdb/write-batches.js.map +1 -0
- package/dist-test/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SqlDriver, SqlValue } from "./driver.js";
|
|
2
|
+
/**
|
|
3
|
+
* What one request or one reply holds, at most, when two or more rows fit: a
|
|
4
|
+
* quarter of the bridge's 4 MiB frame, as the other byte-cut batches take
|
|
5
|
+
* (`BATCH_BYTES` of the seed staging, `WHOLE_STREAM_BATCH_BYTES` of the alias
|
|
6
|
+
* reads). The rest of the frame is the headroom for what the count leaves out:
|
|
7
|
+
* column names, keys and the shape of a result.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PAGE_BYTES: number;
|
|
10
|
+
/** Stored bytes of one chunk of a value read in pieces: a reply of a third more. */
|
|
11
|
+
export declare const CHUNK_BYTES: number;
|
|
12
|
+
/** Rows whose sizes are read at a time: a bound on a size query, not on a page. */
|
|
13
|
+
export declare const SIZE_ROWS = 2048;
|
|
14
|
+
/** The most stored bytes of one body that a reply holds beside other rows (`fitsPage` of its `replyBytes`). */
|
|
15
|
+
export declare const INLINE_BYTES: number;
|
|
16
|
+
/**
|
|
17
|
+
* A text column as a blob in a select list, or NULL when its `bytes` (an SQL
|
|
18
|
+
* expression for its stored size) are over `INLINE_BYTES`: the caller then
|
|
19
|
+
* reads that one value in chunks. A body that fits is a blob in the reply, so
|
|
20
|
+
* what escapes in JSON (quotes, backslashes, control characters) costs
|
|
21
|
+
* nothing more.
|
|
22
|
+
*/
|
|
23
|
+
export declare const blobIfFits: (column: string, bytes: string) => string;
|
|
24
|
+
/** The bytes of a reply that holds `stored` bytes of a blob: base64. */
|
|
25
|
+
export declare const replyBytes: (stored: number) => number;
|
|
26
|
+
/** Whether a row that costs `cost` fits a page with other rows. */
|
|
27
|
+
export declare const fitsPage: (cost: number) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* How many leading rows of `costs` (what each row's reply holds) fit
|
|
30
|
+
* `budget`: at least one, so a row over the budget is a page of its own, and
|
|
31
|
+
* none for no rows.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rowsWithin(costs: readonly number[], budget?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* A value of `bytes` stored bytes, read in blobs of at most `CHUNK_BYTES`.
|
|
36
|
+
* `chunk(offset, length)` is the statement for the bytes `[offset, offset +
|
|
37
|
+
* length)` counted from 1, as `substr` counts: it must return one row with the
|
|
38
|
+
* blob in its first column (`substr(CAST(column AS BLOB), ?, ?)`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function readChunked(db: Pick<SqlDriver, "query">, bytes: number, chunk: (offset: number, length: number) => {
|
|
41
|
+
sql: string;
|
|
42
|
+
params: readonly SqlValue[];
|
|
43
|
+
}): Promise<Uint8Array>;
|
|
44
|
+
/** A body read as a blob, as the text it was stored as. */
|
|
45
|
+
export declare const textOf: (bytes: Uint8Array) => string;
|
|
46
|
+
//# sourceMappingURL=byte-pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte-pages.d.ts","sourceRoot":"","sources":["../../src/localdb/byte-pages.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAc,CAAC;AACtC,oFAAoF;AACpF,eAAO,MAAM,WAAW,QAAc,CAAC;AACvC,mFAAmF;AACnF,eAAO,MAAM,SAAS,OAAO,CAAC;AAI9B,+GAA+G;AAC/G,eAAO,MAAM,YAAY,QAAkD,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,MACe,CAAC;AAE3E,wEAAwE;AACxE,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,KAAG,MAAmC,CAAC;AAEhF,mEAAmE;AACnE,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,OACL,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,GAAE,MAAmB,GAC1B,MAAM,CAUR;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CACL,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,KACX;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE,GAChD,OAAO,CAAC,UAAU,CAAC,CAgBrB;AAGD,2DAA2D;AAC3D,eAAO,MAAM,MAAM,GAAI,OAAO,UAAU,KAAG,MAA+B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Reads that hold row bodies are cut by the bytes the reply will hold, never
|
|
2
|
+
// by a row count or an estimate from rows already read.
|
|
3
|
+
//
|
|
4
|
+
// A phone's SQL bridge refuses a reply over 4 MiB of JSON. A text value in a
|
|
5
|
+
// reply is escaped a second time (a quote or a backslash is two bytes), so
|
|
6
|
+
// its worst case is twice its stored size; a blob travels as base64, a third
|
|
7
|
+
// larger and never more. A body is therefore read as a blob
|
|
8
|
+
// (`CAST(body AS BLOB)`) and decoded here, and a page costs `replyBytes` of its
|
|
9
|
+
// stored bytes, whatever the characters are.
|
|
10
|
+
//
|
|
11
|
+
// A caller first reads the sizes of the next rows alone (small rows: a key and
|
|
12
|
+
// a number), then fetches the longest run of them that fits the budget. A row
|
|
13
|
+
// that alone costs more than the budget is read by itself, in chunks
|
|
14
|
+
// (`readChunked`), each a blob of at most `CHUNK_BYTES`: a value larger than
|
|
15
|
+
// the frame still crosses it.
|
|
16
|
+
/**
|
|
17
|
+
* What one request or one reply holds, at most, when two or more rows fit: a
|
|
18
|
+
* quarter of the bridge's 4 MiB frame, as the other byte-cut batches take
|
|
19
|
+
* (`BATCH_BYTES` of the seed staging, `WHOLE_STREAM_BATCH_BYTES` of the alias
|
|
20
|
+
* reads). The rest of the frame is the headroom for what the count leaves out:
|
|
21
|
+
* column names, keys and the shape of a result.
|
|
22
|
+
*/
|
|
23
|
+
export const PAGE_BYTES = 1024 * 1024;
|
|
24
|
+
/** Stored bytes of one chunk of a value read in pieces: a reply of a third more. */
|
|
25
|
+
export const CHUNK_BYTES = 1024 * 1024;
|
|
26
|
+
/** Rows whose sizes are read at a time: a bound on a size query, not on a page. */
|
|
27
|
+
export const SIZE_ROWS = 2048;
|
|
28
|
+
/** What a row costs beyond its values: column names and the shape of a result. */
|
|
29
|
+
const ROW_OVERHEAD = 256;
|
|
30
|
+
/** The most stored bytes of one body that a reply holds beside other rows (`fitsPage` of its `replyBytes`). */
|
|
31
|
+
export const INLINE_BYTES = 3 * Math.floor((PAGE_BYTES - ROW_OVERHEAD) / 4);
|
|
32
|
+
/**
|
|
33
|
+
* A text column as a blob in a select list, or NULL when its `bytes` (an SQL
|
|
34
|
+
* expression for its stored size) are over `INLINE_BYTES`: the caller then
|
|
35
|
+
* reads that one value in chunks. A body that fits is a blob in the reply, so
|
|
36
|
+
* what escapes in JSON (quotes, backslashes, control characters) costs
|
|
37
|
+
* nothing more.
|
|
38
|
+
*/
|
|
39
|
+
export const blobIfFits = (column, bytes) => `CASE WHEN ${bytes} <= ${INLINE_BYTES} THEN CAST(${column} AS BLOB) END`;
|
|
40
|
+
/** The bytes of a reply that holds `stored` bytes of a blob: base64. */
|
|
41
|
+
export const replyBytes = (stored) => 4 * Math.ceil(stored / 3);
|
|
42
|
+
/** Whether a row that costs `cost` fits a page with other rows. */
|
|
43
|
+
export const fitsPage = (cost) => cost + ROW_OVERHEAD <= PAGE_BYTES;
|
|
44
|
+
/**
|
|
45
|
+
* How many leading rows of `costs` (what each row's reply holds) fit
|
|
46
|
+
* `budget`: at least one, so a row over the budget is a page of its own, and
|
|
47
|
+
* none for no rows.
|
|
48
|
+
*/
|
|
49
|
+
export function rowsWithin(costs, budget = PAGE_BYTES) {
|
|
50
|
+
let take = 0;
|
|
51
|
+
let bytes = 0;
|
|
52
|
+
while (take < costs.length) {
|
|
53
|
+
const next = costs[take] + ROW_OVERHEAD;
|
|
54
|
+
if (take > 0 && bytes + next > budget)
|
|
55
|
+
break;
|
|
56
|
+
bytes += next;
|
|
57
|
+
take += 1;
|
|
58
|
+
}
|
|
59
|
+
return take;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A value of `bytes` stored bytes, read in blobs of at most `CHUNK_BYTES`.
|
|
63
|
+
* `chunk(offset, length)` is the statement for the bytes `[offset, offset +
|
|
64
|
+
* length)` counted from 1, as `substr` counts: it must return one row with the
|
|
65
|
+
* blob in its first column (`substr(CAST(column AS BLOB), ?, ?)`).
|
|
66
|
+
*/
|
|
67
|
+
export async function readChunked(db, bytes, chunk) {
|
|
68
|
+
const whole = new Uint8Array(bytes);
|
|
69
|
+
let at = 0;
|
|
70
|
+
while (at < bytes) {
|
|
71
|
+
const { sql, params } = chunk(at + 1, Math.min(CHUNK_BYTES, bytes - at));
|
|
72
|
+
const [row] = await db.query(sql, params);
|
|
73
|
+
const part = row ? Object.values(row)[0] : null;
|
|
74
|
+
if (!part || part.length === 0)
|
|
75
|
+
throw new Error("a stored value is gone or cut short");
|
|
76
|
+
whole.set(part, at);
|
|
77
|
+
at += part.length;
|
|
78
|
+
}
|
|
79
|
+
return whole;
|
|
80
|
+
}
|
|
81
|
+
const decoder = new TextDecoder();
|
|
82
|
+
/** A body read as a blob, as the text it was stored as. */
|
|
83
|
+
export const textOf = (bytes) => decoder.decode(bytes);
|
|
84
|
+
//# sourceMappingURL=byte-pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte-pages.js","sourceRoot":"","sources":["../../src/localdb/byte-pages.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wDAAwD;AACxD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,4DAA4D;AAC5D,gFAAgF;AAChF,6CAA6C;AAC7C,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,qEAAqE;AACrE,6EAA6E;AAC7E,8BAA8B;AAI9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AACtC,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,mFAAmF;AACnF,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAC9B,kFAAkF;AAClF,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,+GAA+G;AAC/G,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,KAAa,EAAU,EAAE,CAClE,aAAa,KAAK,OAAO,YAAY,cAAc,MAAM,eAAe,CAAC;AAE3E,wEAAwE;AACxE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEhF,mEAAmE;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAW,EAAE,CAChD,IAAI,GAAG,YAAY,IAAI,UAAU,CAAC;AAEpC;;;;GAIG;AACH,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I,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-readback.d.ts","sourceRoot":"","sources":["../../src/localdb/import-readback.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC;;;8EAG8E;AAC9E,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"import-readback.d.ts","sourceRoot":"","sources":["../../src/localdb/import-readback.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC;;;8EAG8E;AAC9E,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,CA4FzB"}
|
|
@@ -26,17 +26,17 @@ export async function readBackLegacyImport(deps, source) {
|
|
|
26
26
|
return result("source_changed");
|
|
27
27
|
const op = deps.newOp();
|
|
28
28
|
try {
|
|
29
|
-
const expected = await stageImportSnapshot(deps.db, source, op);
|
|
29
|
+
const { fingerprint: expected } = await stageImportSnapshot(deps.db, source, op);
|
|
30
30
|
if (expected.rows !== receipt.rows ||
|
|
31
31
|
expected.fingerprint !== receipt.fingerprint)
|
|
32
32
|
return result("source_changed");
|
|
33
33
|
let mismatch = false;
|
|
34
34
|
actual = await importFingerprint((async function* () {
|
|
35
35
|
for await (const expectedRow of snapshotDigests(deps.db, op)) {
|
|
36
|
-
const [row] = await deps.db.query("SELECT pk_hash, record_key, body, body_sha256 FROM records WHERE connection_id = ? AND stream = ? AND
|
|
36
|
+
const [row] = await deps.db.query("SELECT pk_hash, record_key, body, body_sha256 FROM records WHERE connection_id = ? AND stream = ? AND record_key = ?", [
|
|
37
37
|
source.target.connectionId,
|
|
38
38
|
source.target.stream,
|
|
39
|
-
expectedRow.
|
|
39
|
+
expectedRow.record_key,
|
|
40
40
|
]);
|
|
41
41
|
if (!row) {
|
|
42
42
|
mismatch = true;
|
|
@@ -51,7 +51,9 @@ export async function readBackLegacyImport(deps, source) {
|
|
|
51
51
|
body_sha256: row.body_sha256,
|
|
52
52
|
}))
|
|
53
53
|
throw new Error("stored_row_invalid");
|
|
54
|
-
|
|
54
|
+
// The record key found the row; the digest keeps the snapshot's
|
|
55
|
+
// order, whichever typed key a live row holds.
|
|
56
|
+
yield { pk_hash: expectedRow.pk_hash, body_sha256: row.body_sha256 };
|
|
55
57
|
}
|
|
56
58
|
})());
|
|
57
59
|
return result(mismatch ? "record_mismatch" : null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-readback.js","sourceRoot":"","sources":["../../src/localdb/import-readback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAQ9B;;;8EAG8E;AAC9E,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAmB,EACnB,MAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,kBAA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E,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;YACvE,CAAC;QACH,CAAC,CAAC,EAAE,CACL,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,CACX,KAAK,YAAY,KAAK;YACpB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CACjE,KAAK,CAAC,OAAO,CACd;YACD,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,sBAAsB,CAC3B,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
|
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
import type { SqlDriver } from "./driver.js";
|
|
2
|
-
import type { ImportSource } from "./legacy-import-types.js";
|
|
2
|
+
import type { ImportFingerprint, ImportSource } from "./legacy-import-types.js";
|
|
3
|
+
import { type QuarantineCounts } from "./legacy-quarantine.js";
|
|
3
4
|
export type ImportRow = {
|
|
4
5
|
pk_hash: string;
|
|
5
6
|
record_key: string;
|
|
6
7
|
body: string;
|
|
7
8
|
body_sha256: string;
|
|
8
9
|
};
|
|
10
|
+
export type ClassifiedRow = {
|
|
11
|
+
readonly row: ImportRow;
|
|
12
|
+
} | {
|
|
13
|
+
readonly quarantine: string;
|
|
14
|
+
};
|
|
15
|
+
export type ClassifiedKey = {
|
|
16
|
+
readonly key: {
|
|
17
|
+
pk_hash: string;
|
|
18
|
+
record_key: string;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
readonly quarantine: string;
|
|
22
|
+
};
|
|
23
|
+
/** The row as an import row, or the reason it has no full identity. A source
|
|
24
|
+
* fault (a changed or unreadable source) is not a row fault and still throws. */
|
|
25
|
+
export declare function classifyImportRow(record: unknown, primaryKey: readonly string[]): Promise<ClassifiedRow>;
|
|
26
|
+
/** The key of a row (or of a deletion that names only its key fields), by the
|
|
27
|
+
* same rules and hashes as `classifyImportRow`. The body is not read. */
|
|
28
|
+
export declare function classifyImportKey(record: unknown, primaryKey: readonly string[]): Promise<ClassifiedKey>;
|
|
9
29
|
/** One operation's disk-sortable digest view; never retain source bodies.
|
|
10
30
|
* The replayable source supplies each body again for a checked merge. Owns canonical row composition,
|
|
11
31
|
* not key/hash algorithms: those stay at their existing PDPP/stream-sync owners.
|
|
12
|
-
*
|
|
13
|
-
|
|
32
|
+
* A row is identified by its legacy record key, the key the database keeps it
|
|
33
|
+
* under; its typed `pk_hash` is the storage form of that row (and the
|
|
34
|
+
* fingerprint's order), never a second identity. Two rows of one record key
|
|
35
|
+
* that differ in body or in typed key conflict, and the import refuses.
|
|
36
|
+
* A row with no full identity is left out and counted (`classifyImportRow`):
|
|
37
|
+
* the digest view holds only importable rows, so the receipt proves exactly
|
|
38
|
+
* what the import may bring. */
|
|
39
|
+
export declare function stageImportSnapshot(db: SqlDriver, source: ImportSource, op: string): Promise<{
|
|
40
|
+
readonly fingerprint: ImportFingerprint;
|
|
41
|
+
readonly quarantine: QuarantineCounts;
|
|
42
|
+
}>;
|
|
14
43
|
export declare function snapshotDigests(db: SqlDriver, op: string): AsyncGenerator<{
|
|
15
44
|
pk_hash: string;
|
|
45
|
+
record_key: string;
|
|
16
46
|
body_sha256: string;
|
|
17
47
|
}, void, unknown>;
|
|
18
48
|
export declare function clearImportSnapshot(db: SqlDriver, op: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-snapshot.d.ts","sourceRoot":"","sources":["../../src/localdb/import-snapshot.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,YA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,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;CACvC,CAAC,CAsED;AAED,wBAAuB,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM;aAIjD,MAAM;gBACH,MAAM;iBACL,MAAM;kBASxB;AACD,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,iBAIlE;AAED,kFAAkF;AAClF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,SAAS,CAAC,CAiBpB"}
|
|
@@ -2,6 +2,7 @@ import { canonicalJson, pkHash, } from "@opendatalabs/personal-server-ts-stream-
|
|
|
2
2
|
import { sha256 } from "@noble/hashes/sha2";
|
|
3
3
|
import { bytesToHex } from "@noble/hashes/utils";
|
|
4
4
|
import { computeRecordKeyFromData } from "../storage/pdpp-records/record-key.js";
|
|
5
|
+
import { quarantineTally, isQuarantinedRow, } from "./legacy-quarantine.js";
|
|
5
6
|
import { importFingerprint } from "./import-fingerprint.js";
|
|
6
7
|
/** Rows of digests per staging round trip; a digest row is about 100 bytes. */
|
|
7
8
|
const SNAPSHOT_CHUNK_ROWS = 256;
|
|
@@ -19,17 +20,77 @@ function bodyHash(body) {
|
|
|
19
20
|
}
|
|
20
21
|
return bytesToHex(hash.digest());
|
|
21
22
|
}
|
|
23
|
+
const isKeyValue = (value) => typeof value === "string" ||
|
|
24
|
+
typeof value === "boolean" ||
|
|
25
|
+
(typeof value === "number" && Number.isFinite(value));
|
|
26
|
+
/** Why `record` cannot hold a full identity over `primaryKey`, or null. */
|
|
27
|
+
function identityFault(record, primaryKey) {
|
|
28
|
+
if (isQuarantinedRow(record))
|
|
29
|
+
return record.reason;
|
|
30
|
+
if (!record || typeof record !== "object" || Array.isArray(record))
|
|
31
|
+
return "not_an_object";
|
|
32
|
+
const fields = record;
|
|
33
|
+
for (const field of primaryKey) {
|
|
34
|
+
if (!Object.hasOwn(fields, field))
|
|
35
|
+
return "missing_key_field";
|
|
36
|
+
if (!isKeyValue(fields[field]))
|
|
37
|
+
return "bad_key_value";
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/** The row as an import row, or the reason it has no full identity. A source
|
|
42
|
+
* fault (a changed or unreadable source) is not a row fault and still throws. */
|
|
43
|
+
export async function classifyImportRow(record, primaryKey) {
|
|
44
|
+
const fault = identityFault(record, primaryKey);
|
|
45
|
+
if (fault)
|
|
46
|
+
return { quarantine: fault };
|
|
47
|
+
try {
|
|
48
|
+
return {
|
|
49
|
+
row: await canonicalImportRow(record, primaryKey),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { quarantine: "unserializable_body" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** The key of a row (or of a deletion that names only its key fields), by the
|
|
57
|
+
* same rules and hashes as `classifyImportRow`. The body is not read. */
|
|
58
|
+
export async function classifyImportKey(record, primaryKey) {
|
|
59
|
+
const fault = identityFault(record, primaryKey);
|
|
60
|
+
if (fault)
|
|
61
|
+
return { quarantine: fault };
|
|
62
|
+
const fields = record;
|
|
63
|
+
try {
|
|
64
|
+
return {
|
|
65
|
+
key: {
|
|
66
|
+
record_key: computeRecordKeyFromData(fields, [...primaryKey]),
|
|
67
|
+
pk_hash: await pkHash(async (bytes) => sha256(bytes), fields, primaryKey),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return { quarantine: "bad_key_value" };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
22
75
|
/** One operation's disk-sortable digest view; never retain source bodies.
|
|
23
76
|
* The replayable source supplies each body again for a checked merge. Owns canonical row composition,
|
|
24
77
|
* not key/hash algorithms: those stay at their existing PDPP/stream-sync owners.
|
|
25
|
-
*
|
|
78
|
+
* A row is identified by its legacy record key, the key the database keeps it
|
|
79
|
+
* under; its typed `pk_hash` is the storage form of that row (and the
|
|
80
|
+
* fingerprint's order), never a second identity. Two rows of one record key
|
|
81
|
+
* that differ in body or in typed key conflict, and the import refuses.
|
|
82
|
+
* A row with no full identity is left out and counted (`classifyImportRow`):
|
|
83
|
+
* the digest view holds only importable rows, so the receipt proves exactly
|
|
84
|
+
* what the import may bring. */
|
|
26
85
|
export async function stageImportSnapshot(db, source, op) {
|
|
86
|
+
const quarantine = quarantineTally();
|
|
27
87
|
await db.batch([
|
|
28
88
|
{
|
|
29
89
|
sql: `CREATE TEMP TABLE IF NOT EXISTS import_snapshot (
|
|
30
|
-
op TEXT NOT NULL, pk_hash TEXT NOT NULL,
|
|
31
|
-
seen INTEGER NOT NULL DEFAULT 0,
|
|
32
|
-
|
|
90
|
+
op TEXT NOT NULL, pk_hash TEXT NOT NULL, record_key TEXT NOT NULL,
|
|
91
|
+
body_sha256 TEXT NOT NULL, seen INTEGER NOT NULL DEFAULT 0,
|
|
92
|
+
blocked INTEGER NOT NULL DEFAULT 0,
|
|
93
|
+
PRIMARY KEY (op, pk_hash), UNIQUE (op, record_key)) WITHOUT ROWID`,
|
|
33
94
|
},
|
|
34
95
|
]);
|
|
35
96
|
// One worker round trip per chunk, not per row: each driver call clones its
|
|
@@ -38,32 +99,52 @@ export async function stageImportSnapshot(db, source, op) {
|
|
|
38
99
|
const flush = async () => {
|
|
39
100
|
if (chunk.size === 0)
|
|
40
101
|
return;
|
|
41
|
-
const prior = await db.query("SELECT pk_hash, body_sha256 FROM import_snapshot WHERE op = ? AND
|
|
42
|
-
for (const row of prior)
|
|
43
|
-
|
|
102
|
+
const prior = await db.query("SELECT record_key, pk_hash, body_sha256 FROM import_snapshot WHERE op = ? AND record_key IN (SELECT value FROM json_each(?))", [op, JSON.stringify([...chunk.keys()])]);
|
|
103
|
+
for (const row of prior) {
|
|
104
|
+
const held = chunk.get(row.record_key);
|
|
105
|
+
if (row.pk_hash !== held.pk_hash || row.body_sha256 !== held.body_sha256)
|
|
44
106
|
throw new Error("invalid_record");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
107
|
+
// The same row again, from an earlier chunk: counted, as the fold does.
|
|
108
|
+
quarantine.add("duplicate_key");
|
|
109
|
+
}
|
|
110
|
+
await db.batch([...chunk].map(([recordKey, held]) => ({
|
|
111
|
+
sql: "INSERT OR IGNORE INTO import_snapshot (op, pk_hash, record_key, body_sha256) VALUES (?, ?, ?, ?)",
|
|
112
|
+
params: [op, held.pk_hash, recordKey, held.body_sha256],
|
|
48
113
|
})));
|
|
49
114
|
chunk = new Map();
|
|
50
115
|
};
|
|
51
116
|
for await (const record of source.records()) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
117
|
+
const classified = await classifyImportRow(record, source.target.primaryKey);
|
|
118
|
+
if ("quarantine" in classified) {
|
|
119
|
+
quarantine.add(classified.quarantine);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const row = classified.row;
|
|
123
|
+
const inChunk = chunk.get(row.record_key);
|
|
124
|
+
if (inChunk !== undefined) {
|
|
125
|
+
if (inChunk.pk_hash !== row.pk_hash ||
|
|
126
|
+
inChunk.body_sha256 !== row.body_sha256)
|
|
127
|
+
throw new Error("invalid_record");
|
|
128
|
+
quarantine.add("duplicate_key");
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
chunk.set(row.record_key, {
|
|
132
|
+
pk_hash: row.pk_hash,
|
|
133
|
+
body_sha256: row.body_sha256,
|
|
134
|
+
});
|
|
57
135
|
if (chunk.size >= SNAPSHOT_CHUNK_ROWS)
|
|
58
136
|
await flush();
|
|
59
137
|
}
|
|
60
138
|
await flush();
|
|
61
|
-
return
|
|
139
|
+
return {
|
|
140
|
+
fingerprint: await importFingerprint(snapshotDigests(db, op)),
|
|
141
|
+
quarantine: quarantine.counts(),
|
|
142
|
+
};
|
|
62
143
|
}
|
|
63
144
|
export async function* snapshotDigests(db, op) {
|
|
64
145
|
let after = "";
|
|
65
146
|
for (;;) {
|
|
66
|
-
const rows = await db.query("SELECT pk_hash, body_sha256 FROM import_snapshot WHERE op = ? AND pk_hash > ? ORDER BY pk_hash LIMIT 128", [op, after]);
|
|
147
|
+
const rows = await db.query("SELECT pk_hash, record_key, body_sha256 FROM import_snapshot WHERE op = ? AND pk_hash > ? ORDER BY pk_hash LIMIT 128", [op, after]);
|
|
67
148
|
if (rows.length === 0)
|
|
68
149
|
return;
|
|
69
150
|
yield* rows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-snapshot.js","sourceRoot":"","sources":["../../src/localdb/import-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,GAEP,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,+EAA+E;AAC/E,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAE5C;mFACmF;AACnF,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IAC7B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS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CAAC,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAA+B,EAC/B,UAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,GAAG,GAAG;YACV,UAAU,EAAE,wBAAwB,CAAC,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;YAC7D,OAAO,EAAE,MAAM,MAAM,CACnB,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9B,MAAoB,EACpB,UAAU,CACX;YACD,IAAI;YACJ,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC;SAC5B,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;AACH,CAAC"}
|
package/dist/localdb/index.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ export { createLinkedRecordQuery, type ConnectionLink, } from "./connection-link
|
|
|
37
37
|
export type * from "./legacy-import-types.js";
|
|
38
38
|
export * from "./import-ledger.js";
|
|
39
39
|
export * from "./legacy-import.js";
|
|
40
|
+
export * from "./legacy-quarantine.js";
|
|
41
|
+
export * from "./legacy-fold.js";
|
|
42
|
+
export * from "./legacy-seed-producer.js";
|
|
40
43
|
export * from "./import-readback.js";
|
|
41
44
|
export * from "./legacy-retire.js";
|
|
42
45
|
export * from "./import-fingerprint.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/localdb/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAA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CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,EACvB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAE9B,mBAAmB,0BAA0B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,KAAK,sBAAsB,GAC5B,MAAM,+BAA+B,CAAC"}
|
package/dist/localdb/index.js
CHANGED
|
@@ -33,6 +33,9 @@ export { createLocalRequirements, } from "./requirements.js";
|
|
|
33
33
|
export { createLinkedRecordQuery, } from "./connection-link.js";
|
|
34
34
|
export * from "./import-ledger.js";
|
|
35
35
|
export * from "./legacy-import.js";
|
|
36
|
+
export * from "./legacy-quarantine.js";
|
|
37
|
+
export * from "./legacy-fold.js";
|
|
38
|
+
export * from "./legacy-seed-producer.js";
|
|
36
39
|
export * from "./import-readback.js";
|
|
37
40
|
export * from "./legacy-retire.js";
|
|
38
41
|
export * from "./import-fingerprint.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/localdb/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,GAEX,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,WAAW,GAGZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAmC,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAoB,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,aAAa,EACb,eAAe,GAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,GAIf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBA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ions of one stream as one `ImportSource`.
|
|
4
|
+
*
|
|
5
|
+
* Old stores keep a stream as many layers: the `{records}` files each
|
|
6
|
+
* collection left. A key can sit in
|
|
7
|
+
* many layers. The import takes the newest layer's version of each key, so the
|
|
8
|
+
* result follows layer rank, not the order anything is read or submitted in.
|
|
9
|
+
*
|
|
10
|
+
* - Layers are given newest first. The first layer to name a key decides it.
|
|
11
|
+
* An older version is left out and counted as `superseded`: not a loss, a
|
|
12
|
+
* newer version of the key stands.
|
|
13
|
+
* - A layer that deleted a key decides it for every older layer: their rows
|
|
14
|
+
* for it are left out (`deleted_in_newer_layer`), and the fold reports the
|
|
15
|
+
* deletion (once) so the import can tombstone it. A newer layer that holds
|
|
16
|
+
* the key live restores it: that layer decided first.
|
|
17
|
+
* A layer names its deletions by typed key (`deletions`).
|
|
18
|
+
* - A layer may carry `$pdpp.sourceId` on its rows. With `sourceId` set, a
|
|
19
|
+
* row must carry exactly that source (`untagged` and `source_mismatch`
|
|
20
|
+
* rows are counted out, never guessed into a stream). The envelope is not
|
|
21
|
+
* part of the record: it is dropped.
|
|
22
|
+
* - A v1-full envelope names its operation in `$pdpp.record.op` and the key
|
|
23
|
+
* in `$pdpp.record.key` (the shape `sync/pdpp-import.ts` reads). `delete`
|
|
24
|
+
* makes the row a deletion of that layer, handled like `deletions()`, and
|
|
25
|
+
* applies only when the envelope is complete (version 1, source, declaration,
|
|
26
|
+
* stream name, scope and primary key, a record key object), names this
|
|
27
|
+
* stream and its primary key, and claims a full key that agrees with the
|
|
28
|
+
* payload's key fields when the payload has them. Otherwise it is counted
|
|
29
|
+
* out (`deletion_envelope_incomplete`, `deletion_stream_mismatch`,
|
|
30
|
+
* `deletion_<key fault>`) and deletes nothing. `upsert` or no op is a row,
|
|
31
|
+
* unless its envelope names another stream (`stream_mismatch`). Any other
|
|
32
|
+
* op is counted out as `unknown_op`.
|
|
33
|
+
* - A row whose body has no JSON form (a cycle, a BigInt) is counted out
|
|
34
|
+
* before it claims its key, so an older readable copy still stands.
|
|
35
|
+
* - A row with no full identity passes through for the import to count. A
|
|
36
|
+
* second row for a key within one layer is counted as `duplicate_key` when
|
|
37
|
+
* its body is the same. With another body it is a conflict: the fold throws
|
|
38
|
+
* `invalid_record`, and the import refuses the stream, as it does for a
|
|
39
|
+
* direct source (`stageImportSnapshot`).
|
|
40
|
+
*
|
|
41
|
+
* Identity is the legacy record key (`computeRecordKeyFromData`), the key the
|
|
42
|
+
* database keeps a row under, never the typed key hash: `{id: 42}` and
|
|
43
|
+
* `{id: "42"}` are one key, and the newest layer's row stands.
|
|
44
|
+
*
|
|
45
|
+
* Every stored record of `records()` is yielded once in the row pass, as a
|
|
46
|
+
* row or as a marker with its reason: a row left out by its reason, a valid
|
|
47
|
+
* delete envelope as `delete_envelope` (also when a live row shadows it), a
|
|
48
|
+
* malformed one as `deletion_<reason>`. So a host that reads only `records()`
|
|
49
|
+
* loses no count, and stored records = rows + markers. Keys a layer lists
|
|
50
|
+
* apart from its records (`deletions`) are not stored records; only a
|
|
51
|
+
* malformed `deletions()` key is counted.
|
|
52
|
+
*
|
|
53
|
+
* Memory: the record keys of the layers read so far,
|
|
54
|
+
* a body digest per key of the layer being read, and the key fields of
|
|
55
|
+
* the layer's delete envelopes. No body or payload is kept; each traversal
|
|
56
|
+
* reads the layers again.
|
|
57
|
+
*/
|
|
58
|
+
export interface FoldLayer {
|
|
59
|
+
records(): AsyncIterable<unknown>;
|
|
60
|
+
/** Keys this layer deleted, each an object holding the typed key fields. */
|
|
61
|
+
deletions?(): AsyncIterable<unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface FoldOptions {
|
|
64
|
+
/** The source id every row must carry in `$pdpp.sourceId`. */
|
|
65
|
+
readonly sourceId?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function foldLayers(base: Omit<ImportSource, "records" | "deletions">, layers: readonly FoldLayer[], options?: FoldOptions): ImportSource;
|
|
68
|
+
//# sourceMappingURL=legacy-fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-fold.d.ts","sourceRoot":"","sources":["../../src/localdb/legacy-fold.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAO7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC,4EAA4E;IAC5E,SAAS,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AA2JD,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,WAAW,CAAC,EACjD,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,OAAO,GAAE,WAAgB,GACxB,YAAY,CA2Gd"}
|