@minnowdb/core 0.6.9 → 0.7.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/block-format/block.js +254 -325
- package/dist/block-format/checksum.js +30 -52
- package/dist/block-format/codecs.js +112 -125
- package/dist/block-format/column.js +187 -205
- package/dist/block-format/index.js +5 -1
- package/dist/block-format/physical.js +371 -387
- package/dist/block-format/types.js +4 -1
- package/dist/block-format/unicode.js +30 -39
- package/dist/date-value.d.ts +5 -0
- package/dist/date-value.js +71 -41
- package/dist/engine/artifact-cache.js +106 -116
- package/dist/engine/batch.js +36 -44
- package/dist/engine/buffered-writer.js +156 -158
- package/dist/engine/byte-estimates.js +20 -22
- package/dist/engine/cache-limits.js +24 -25
- package/dist/engine/cancellation.js +5 -3
- package/dist/engine/catalog.js +64 -73
- package/dist/engine/client.js +715 -780
- package/dist/engine/database.js +15952 -18465
- package/dist/engine/defaults.js +104 -111
- package/dist/engine/errors.js +113 -128
- package/dist/engine/fts.js +233 -280
- package/dist/engine/group-index.js +287 -321
- package/dist/engine/index.js +23 -12
- package/dist/engine/join-index.js +177 -186
- package/dist/engine/keyed-live.js +168 -173
- package/dist/engine/live-api.js +0 -1
- package/dist/engine/live-equal.js +32 -37
- package/dist/engine/live.js +603 -647
- package/dist/engine/memory.js +109 -111
- package/dist/engine/optimizer.d.ts +19 -1
- package/dist/engine/optimizer.js +2642 -2515
- package/dist/engine/point-read.d.ts +4 -2
- package/dist/engine/point-read.js +121 -171
- package/dist/engine/query-api.js +12 -3
- package/dist/engine/query-cache.js +61 -69
- package/dist/engine/query.d.ts +45 -0
- package/dist/engine/query.js +8506 -9375
- package/dist/engine/result-wire.js +221 -252
- package/dist/engine/schema-wire.js +97 -112
- package/dist/engine/schema.js +1099 -1254
- package/dist/engine/sort-keys.js +315 -389
- package/dist/engine/sql-domains.d.ts +7 -1
- package/dist/engine/sql-domains.js +648 -734
- package/dist/engine/sql-driver.js +0 -1
- package/dist/engine/sql-functions.d.ts +11 -0
- package/dist/engine/sql-functions.js +1092 -0
- package/dist/engine/sql-json.js +199 -218
- package/dist/engine/sql-semantics.d.ts +25 -4
- package/dist/engine/sql-semantics.js +579 -513
- package/dist/engine/typed-live.js +271 -293
- package/dist/engine/vector.d.ts +7 -1
- package/dist/engine/vector.js +4513 -4580
- package/dist/engine/worker-host.d.ts +8 -63
- package/dist/engine/worker-host.js +28 -1130
- package/dist/engine/worker-indexeddb.d.ts +1 -0
- package/dist/engine/worker-indexeddb.js +3 -0
- package/dist/engine/worker-memory.d.ts +1 -0
- package/dist/engine/worker-memory.js +3 -0
- package/dist/engine/worker-opfs.d.ts +1 -0
- package/dist/engine/worker-opfs.js +3 -0
- package/dist/engine/worker-server.d.ts +93 -0
- package/dist/engine/worker-server.js +999 -0
- package/dist/engine/worker-store-indexeddb.d.ts +2 -0
- package/dist/engine/worker-store-indexeddb.js +11 -0
- package/dist/engine/worker-store-memory.d.ts +2 -0
- package/dist/engine/worker-store-memory.js +6 -0
- package/dist/engine/worker-store-opfs.d.ts +2 -0
- package/dist/engine/worker-store-opfs.js +9 -0
- package/dist/engine/worker.js +0 -12
- package/dist/engine/write-block-planner.js +93 -100
- package/dist/plan/index.js +15 -16
- package/dist/plan/model.d.ts +9 -1
- package/dist/plan/model.js +20 -27
- package/dist/storage/index.js +0 -12
- package/dist/storage/indexeddb.js +11776 -13171
- package/dist/storage/memory.js +1198 -1241
- package/dist/storage/opfs/files.js +238 -295
- package/dist/storage/opfs/index.js +9 -3
- package/dist/storage/opfs/leader.js +4386 -4856
- package/dist/storage/opfs/rpc.js +223 -259
- package/dist/storage/opfs/snapshot-ledger.js +219 -260
- package/dist/storage/opfs/store.js +884 -1003
- package/dist/storage/persistence.js +59 -74
- package/dist/storage/snapshot-stream.js +788 -826
- package/dist/storage/snapshot.js +36 -37
- package/dist/storage/toolkit/extents.js +444 -520
- package/dist/storage/toolkit/index.js +28 -29
- package/dist/storage/toolkit/record-core.js +5792 -6377
- package/dist/storage/toolkit/sync-file.js +34 -42
- package/dist/storage/toolkit/wal.js +92 -127
- package/dist/storage/toolkit/wire.js +232 -256
- package/dist/storage/types.js +2952 -3228
- package/dist/testing/block-store-conformance.js +1556 -1629
- package/dist/testing/index.js +310 -291
- package/dist/testing/opfs-shim.js +280 -312
- package/dist/testing/simulator.js +496 -534
- package/dist/testing/sqllogictest.js +425 -365
- package/dist/transactions/index.js +1464 -1712
- package/dist/worker-protocol/index.js +70 -69
- package/package.json +20 -2
- package/postgres-feature-profile.json +15 -5
- package/sql-feature-matrix.json +252 -2
package/dist/storage/snapshot.js
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
/** Public snapshot API over the bounded framed v1 container. */
|
|
2
1
|
export * from "./snapshot-stream.js";
|
|
3
2
|
import { SNAPSHOT_FRAME_KINDS } from "./types.js";
|
|
4
3
|
import { decodeSnapshotFrameStream } from "./snapshot-stream.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
throw new TypeError("Snapshot bytes must be a non-empty Uint8Array");
|
|
4
|
+
const SNAPSHOT_FORMAT_VERSION = 1;
|
|
5
|
+
const MAX_SNAPSHOT_STREAM_CHUNK_BYTES = 1024 * 1024;
|
|
6
|
+
async function readSnapshotSummary(bytes) {
|
|
7
|
+
if (!(bytes instanceof Uint8Array) || bytes.byteLength === 0) {
|
|
8
|
+
throw new TypeError("Snapshot bytes must be a non-empty Uint8Array");
|
|
9
|
+
}
|
|
10
|
+
const entries = decodeSnapshotFrameStream((async function* () {
|
|
11
|
+
for (let offset = 0; offset < bytes.byteLength; offset += MAX_SNAPSHOT_STREAM_CHUNK_BYTES) {
|
|
12
|
+
yield bytes.subarray(offset, offset + MAX_SNAPSHOT_STREAM_CHUNK_BYTES);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
await entries.return(undefined);
|
|
23
|
-
if (first.done || first.value.type !== "header")
|
|
24
|
-
throw new Error("Snapshot header is missing");
|
|
25
|
-
return summaryFromHeader(first.value.header, bytes.byteLength);
|
|
14
|
+
})());
|
|
15
|
+
const first = await entries.next();
|
|
16
|
+
await entries.return(void 0);
|
|
17
|
+
if (first.done || first.value.type !== "header")
|
|
18
|
+
throw new Error("Snapshot header is missing");
|
|
19
|
+
return summaryFromHeader(first.value.header, bytes.byteLength);
|
|
26
20
|
}
|
|
27
21
|
function summaryFromHeader(header, byteLength) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
let payloadBytes = 0;
|
|
23
|
+
for (const kind of SNAPSHOT_FRAME_KINDS) {
|
|
24
|
+
const next = payloadBytes + header.kinds[kind].storedBytes;
|
|
25
|
+
if (!Number.isSafeInteger(next))
|
|
26
|
+
throw new RangeError("Snapshot payload is too large");
|
|
27
|
+
payloadBytes = next;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
formatVersion: header.formatVersion,
|
|
31
|
+
version: header.databaseVersion,
|
|
32
|
+
createdAt: header.createdAt,
|
|
33
|
+
tableCount: header.kinds["catalog-page"].itemCount,
|
|
34
|
+
blockCount: header.kinds.block.itemCount,
|
|
35
|
+
payloadBytes,
|
|
36
|
+
byteLength
|
|
37
|
+
};
|
|
44
38
|
}
|
|
39
|
+
export {
|
|
40
|
+
MAX_SNAPSHOT_STREAM_CHUNK_BYTES,
|
|
41
|
+
SNAPSHOT_FORMAT_VERSION,
|
|
42
|
+
readSnapshotSummary
|
|
43
|
+
};
|