@minnowdb/core 0.7.0 → 0.7.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/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.js +67 -78
- 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 +15942 -19313
- 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 +2691 -2933
- package/dist/engine/point-read.js +122 -182
- package/dist/engine/query-api.js +12 -3
- package/dist/engine/query-cache.js +61 -69
- package/dist/engine/query.d.ts +6 -0
- package/dist/engine/query.js +8511 -9980
- 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.js +646 -769
- package/dist/engine/sql-driver.js +0 -1
- package/dist/engine/sql-functions.js +1031 -1125
- package/dist/engine/sql-json.js +199 -218
- package/dist/engine/sql-semantics.js +572 -639
- package/dist/engine/typed-live.js +271 -293
- package/dist/engine/vector.js +4484 -5145
- 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 +6 -0
- package/dist/plan/model.js +20 -27
- package/dist/storage/index.js +0 -12
- package/dist/storage/indexeddb.js +11784 -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 +5804 -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 +2948 -3250
- 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/sql-feature-matrix.json +2 -2
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const protocolVersion = 3;
|
|
2
|
+
const MAX_DATABASE_RPC_IN_FLIGHT = 256;
|
|
3
|
+
function serializeError(error) {
|
|
4
|
+
if (!(error instanceof Error)) {
|
|
5
|
+
return { name: "Error", message: String(error) };
|
|
6
|
+
}
|
|
7
|
+
const props = {};
|
|
8
|
+
for (const key of Object.keys(error)) {
|
|
9
|
+
if (key === "name" || key === "message" || key === "stack")
|
|
10
|
+
continue;
|
|
11
|
+
const value = error[key];
|
|
12
|
+
try {
|
|
13
|
+
structuredClone(value);
|
|
14
|
+
props[key] = value;
|
|
15
|
+
} catch {
|
|
7
16
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
props[key] = value;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// A non-cloneable field would poison the whole postMessage; drop it.
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
name: error.name,
|
|
23
|
-
message: error.message,
|
|
24
|
-
...(error.stack === undefined ? {} : { stack: error.stack }),
|
|
25
|
-
...(Object.keys(props).length === 0 ? {} : { props }),
|
|
26
|
-
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
name: error.name,
|
|
20
|
+
message: error.message,
|
|
21
|
+
...error.stack === void 0 ? {} : { stack: error.stack },
|
|
22
|
+
...Object.keys(props).length === 0 ? {} : { props }
|
|
23
|
+
};
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
function rpcResult(requestId, result) {
|
|
26
|
+
return { version: protocolVersion, requestId, kind: "rpc-result", result };
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
function rpcFailure(requestId, error) {
|
|
29
|
+
return { version: protocolVersion, requestId, kind: "rpc-failure", error: serializeError(error) };
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
function rpcEvent(handleId, event, payload) {
|
|
32
|
+
return { version: protocolVersion, requestId: null, kind: "rpc-event", handleId, event, payload };
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
function parseRpcRequest(value) {
|
|
35
|
+
if (typeof value !== "object" || value === null)
|
|
36
|
+
return null;
|
|
37
|
+
const candidate = value;
|
|
38
|
+
if (candidate.kind !== "rpc-init" && candidate.kind !== "rpc-call" && candidate.kind !== "rpc-cancel") {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (candidate.version !== protocolVersion)
|
|
42
|
+
throw new Error("Unsupported protocol version");
|
|
43
|
+
if (typeof candidate.requestId !== "string" || candidate.requestId.length === 0) {
|
|
44
|
+
throw new TypeError("Request ID must be a non-empty string");
|
|
45
|
+
}
|
|
46
|
+
if (candidate.kind === "rpc-call") {
|
|
47
|
+
const call = candidate;
|
|
48
|
+
if (call.handleId !== null && typeof call.handleId !== "string") {
|
|
49
|
+
throw new TypeError("Handle ID must be a string or null");
|
|
51
50
|
}
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
if (call.handleId !== null && typeof call.handleId !== "string") {
|
|
55
|
-
throw new TypeError("Handle ID must be a string or null");
|
|
56
|
-
}
|
|
57
|
-
if (typeof call.method !== "string" || call.method.length === 0) {
|
|
58
|
-
throw new TypeError("Method must be a non-empty string");
|
|
59
|
-
}
|
|
60
|
-
if (!Array.isArray(call.args))
|
|
61
|
-
throw new TypeError("Arguments must be an array");
|
|
51
|
+
if (typeof call.method !== "string" || call.method.length === 0) {
|
|
52
|
+
throw new TypeError("Method must be a non-empty string");
|
|
62
53
|
}
|
|
63
|
-
|
|
54
|
+
if (!Array.isArray(call.args))
|
|
55
|
+
throw new TypeError("Arguments must be an array");
|
|
56
|
+
}
|
|
57
|
+
return candidate;
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (candidate.version !== protocolVersion)
|
|
76
|
-
throw new Error("Unsupported protocol version");
|
|
77
|
-
return candidate;
|
|
59
|
+
function parseRpcResponse(value) {
|
|
60
|
+
if (typeof value !== "object" || value === null)
|
|
61
|
+
return null;
|
|
62
|
+
const candidate = value;
|
|
63
|
+
if (candidate.kind !== "rpc-result" && candidate.kind !== "rpc-failure" && candidate.kind !== "rpc-event") {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (candidate.version !== protocolVersion)
|
|
67
|
+
throw new Error("Unsupported protocol version");
|
|
68
|
+
return candidate;
|
|
78
69
|
}
|
|
70
|
+
export {
|
|
71
|
+
MAX_DATABASE_RPC_IN_FLIGHT,
|
|
72
|
+
parseRpcRequest,
|
|
73
|
+
parseRpcResponse,
|
|
74
|
+
protocolVersion,
|
|
75
|
+
rpcEvent,
|
|
76
|
+
rpcFailure,
|
|
77
|
+
rpcResult,
|
|
78
|
+
serializeError
|
|
79
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minnowdb/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "A columnar SQL database for the browser: PostgreSQL-style SQL over durable IndexedDB or OPFS data, with no server or WebAssembly module.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eric Wilhite",
|
|
@@ -26,8 +26,14 @@
|
|
|
26
26
|
],
|
|
27
27
|
"type": "module",
|
|
28
28
|
"sideEffects": [
|
|
29
|
-
"./dist/engine/worker.js"
|
|
29
|
+
"./dist/engine/worker.js",
|
|
30
|
+
"./dist/engine/worker-indexeddb.js",
|
|
31
|
+
"./dist/engine/worker-opfs.js",
|
|
32
|
+
"./dist/engine/worker-memory.js"
|
|
30
33
|
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "node ../../scripts/strip-dist-comments.mjs dist"
|
|
36
|
+
},
|
|
31
37
|
"exports": {
|
|
32
38
|
".": {
|
|
33
39
|
"types": "./dist/index.d.ts",
|
|
@@ -61,6 +67,18 @@
|
|
|
61
67
|
"types": "./dist/engine/worker.d.ts",
|
|
62
68
|
"default": "./dist/engine/worker.js"
|
|
63
69
|
},
|
|
70
|
+
"./worker/indexeddb": {
|
|
71
|
+
"types": "./dist/engine/worker-indexeddb.d.ts",
|
|
72
|
+
"default": "./dist/engine/worker-indexeddb.js"
|
|
73
|
+
},
|
|
74
|
+
"./worker/opfs": {
|
|
75
|
+
"types": "./dist/engine/worker-opfs.d.ts",
|
|
76
|
+
"default": "./dist/engine/worker-opfs.js"
|
|
77
|
+
},
|
|
78
|
+
"./worker/memory": {
|
|
79
|
+
"types": "./dist/engine/worker-memory.d.ts",
|
|
80
|
+
"default": "./dist/engine/worker-memory.js"
|
|
81
|
+
},
|
|
64
82
|
"./worker-host": {
|
|
65
83
|
"types": "./dist/engine/worker-host.d.ts",
|
|
66
84
|
"default": "./dist/engine/worker-host.js"
|
package/sql-feature-matrix.json
CHANGED
|
@@ -420,8 +420,8 @@
|
|
|
420
420
|
{
|
|
421
421
|
"id": "subquery.correlated-select",
|
|
422
422
|
"status": "supported",
|
|
423
|
-
"example": "SELECT r.region, (SELECT
|
|
424
|
-
"notes": "Correlated scalar aggregates and single-row projections decorrelate in the select list. In a grouped query,
|
|
423
|
+
"example": "SELECT r.region, (SELECT MAX(q.amount + r.amount) FROM rows q WHERE q.region = r.region) AS regional FROM rows r",
|
|
424
|
+
"notes": "Correlated scalar aggregates and single-row projections decorrelate in the select list. Every qualified outer column used by the inner predicates or projection becomes part of the distinct probe tuple. In a grouped query, outer references must be GROUP BY columns and the scalar cannot sit inside an outer aggregate."
|
|
425
425
|
},
|
|
426
426
|
{
|
|
427
427
|
"id": "subquery.correlated-select-limit",
|