zonemapdb 0.8.0
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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/block-fetch.d.ts +11 -0
- package/dist/block-fetch.d.ts.map +1 -0
- package/dist/block-fetch.js +29 -0
- package/dist/block-fetch.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +584 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -0
- package/dist/fetch-file.d.ts +39 -0
- package/dist/fetch-file.d.ts.map +1 -0
- package/dist/fetch-file.js +179 -0
- package/dist/fetch-file.js.map +1 -0
- package/dist/filter.d.ts +9 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +104 -0
- package/dist/filter.js.map +1 -0
- package/dist/index-fetch.d.ts +3 -0
- package/dist/index-fetch.d.ts.map +1 -0
- package/dist/index-fetch.js +5 -0
- package/dist/index-fetch.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +127 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +86 -0
- package/dist/manifest.js.map +1 -0
- package/dist/normalize.d.ts +25 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +43 -0
- package/dist/normalize.js.map +1 -0
- package/dist/secondary-index.d.ts +32 -0
- package/dist/secondary-index.d.ts.map +1 -0
- package/dist/secondary-index.js +80 -0
- package/dist/secondary-index.js.map +1 -0
- package/dist/types.d.ts +319 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +164 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/dist/zonemap-fetch.d.ts +9 -0
- package/dist/zonemap-fetch.d.ts.map +1 -0
- package/dist/zonemap-fetch.js +11 -0
- package/dist/zonemap-fetch.js.map +1 -0
- package/dist/zonemap.d.ts +35 -0
- package/dist/zonemap.d.ts.map +1 -0
- package/dist/zonemap.js +139 -0
- package/dist/zonemap.js.map +1 -0
- package/package.json +53 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ZonemapDbError } from "./errors.js";
|
|
2
|
+
/** The suffix a compressed file carries. Duplicated in both packages and pinned by an equivalence test — the runtime must derive block paths without reading anything the CLI wrote. */
|
|
3
|
+
export function compressionSuffix(compression) {
|
|
4
|
+
return compression === "gzip" ? ".gz" : compression === "brotli" ? ".br" : "";
|
|
5
|
+
}
|
|
6
|
+
/** The `DecompressionStream` format name for a compression, or `undefined` when nothing was applied. */
|
|
7
|
+
export function decompressionFormat(compression) {
|
|
8
|
+
return compression === "none" ? undefined : compression;
|
|
9
|
+
}
|
|
10
|
+
const RUNTIME_RIDER_OPS = new Set(["not", "isNull", "isAbsent", "exists"]);
|
|
11
|
+
/** The operators of `field` that prune — from the manifest, or the pre-ADR-0013 rule for a hand-written schema. */
|
|
12
|
+
function pruningOpsOf(field) {
|
|
13
|
+
return field.pruning ?? field.operators.filter((op) => !RUNTIME_RIDER_OPS.has(op));
|
|
14
|
+
}
|
|
15
|
+
/** Whether one element filter of `some`/`every` can use the field's index. */
|
|
16
|
+
function elementPrunes(elementFilter, pruning) {
|
|
17
|
+
if (typeof elementFilter !== "object" || elementFilter === null)
|
|
18
|
+
return pruning.includes("equals");
|
|
19
|
+
return Object.keys(elementFilter).some((op) => filterOpPrunes(op, elementFilter[op], pruning));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Whether one operator, with this value, narrows which blocks are read. A pruning operator can still
|
|
23
|
+
* match everything: `contains` routes on the trigrams of its argument, so one shorter than three
|
|
24
|
+
* characters has none, and an empty `startsWith`/`endsWith` is a prefix of every value.
|
|
25
|
+
*/
|
|
26
|
+
function filterOpPrunes(op, value, pruning) {
|
|
27
|
+
if (value === undefined || !pruning.includes(op))
|
|
28
|
+
return false;
|
|
29
|
+
if (op === "contains")
|
|
30
|
+
return typeof value === "string" && value.length >= 3;
|
|
31
|
+
if (op === "startsWith" || op === "endsWith")
|
|
32
|
+
return typeof value === "string" && value.length > 0;
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
/** A list field's `hasEvery`/`isEmpty`: an empty `hasEvery` and `isEmpty: false` match every block. */
|
|
36
|
+
function listOpPrunes(op, value) {
|
|
37
|
+
if (op === "hasEvery")
|
|
38
|
+
return Array.isArray(value) && value.length > 0;
|
|
39
|
+
if (op === "isEmpty")
|
|
40
|
+
return value === true;
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `where` with every `undefined` left out: a filter set to `undefined`, an operator whose value is
|
|
45
|
+
* `undefined`, and a filter (or a list field's element filter) left empty by that. `undefined` means
|
|
46
|
+
* "no filter here", so `{ set: chosen ? { equals: chosen } : undefined }` and `{ year: { gte: from } }`
|
|
47
|
+
* with no `from` both drop out, the way they read. `findMany`, `count` and `wherePrunes` all see the
|
|
48
|
+
* compacted form, so the rider check and the query agree on what the `where` says.
|
|
49
|
+
*/
|
|
50
|
+
export function compactWhere(where) {
|
|
51
|
+
if (where === undefined)
|
|
52
|
+
return undefined;
|
|
53
|
+
const compactFilter = (filter, nested) => {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const [op, value] of Object.entries(filter)) {
|
|
56
|
+
if (value === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
if (!nested && (op === "some" || op === "every") && isPlainObject(value)) {
|
|
59
|
+
const element = compactFilter(value, true);
|
|
60
|
+
if (element !== undefined)
|
|
61
|
+
out[op] = element;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
out[op] = value;
|
|
65
|
+
}
|
|
66
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
67
|
+
};
|
|
68
|
+
const out = {};
|
|
69
|
+
for (const [field, filter] of Object.entries(where)) {
|
|
70
|
+
if (filter === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
const compacted = isPlainObject(filter) ? compactFilter(filter, false) : filter;
|
|
73
|
+
if (compacted !== undefined)
|
|
74
|
+
out[field] = compacted;
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
function isPlainObject(value) {
|
|
79
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Whether `where` has at least one filter that narrows which blocks are read, which is the rule
|
|
83
|
+
* `findMany` enforces with `NEEDS_PRUNING` (ADR-0013). For a `where` built from UI input: check it,
|
|
84
|
+
* and fall back (add a sort-field range, say) instead of catching the error. Pass the collection's
|
|
85
|
+
* `getSchema()`. An empty or missing `where` counts as pruning, since it is allowed.
|
|
86
|
+
*
|
|
87
|
+
* The rules the types can't see, because they depend on the value: `contains` prunes only with 3 or
|
|
88
|
+
* more characters (a shorter needle has no trigram to look up), and an empty `startsWith`/`endsWith`,
|
|
89
|
+
* an empty `hasEvery` and `isEmpty: false` match every block. Each of these rides.
|
|
90
|
+
*/
|
|
91
|
+
export function wherePrunes(where, schema) {
|
|
92
|
+
const entries = Object.entries(compactWhere(where) ?? {});
|
|
93
|
+
if (entries.length === 0)
|
|
94
|
+
return true;
|
|
95
|
+
return entries.some(([field, filter]) => {
|
|
96
|
+
const meta = schema.fields[field];
|
|
97
|
+
if (!meta)
|
|
98
|
+
return false;
|
|
99
|
+
const pruning = pruningOpsOf(meta);
|
|
100
|
+
return Object.entries(filter ?? {}).some(([op, value]) => {
|
|
101
|
+
if (meta.multi) {
|
|
102
|
+
if (op === "hasEvery" || op === "isEmpty")
|
|
103
|
+
return listOpPrunes(op, value);
|
|
104
|
+
if (op === "some" || op === "every")
|
|
105
|
+
return elementPrunes(value, pruning);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return filterOpPrunes(op, value, pruning);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Why a pruning operator in `where` (or in a list field's element filter) still rides, given its value:
|
|
114
|
+
* the notes NEEDS_PRUNING appends. The operator names are right in these cases, so without the note
|
|
115
|
+
* the error would look wrong.
|
|
116
|
+
*/
|
|
117
|
+
function valueRiderNotes(where) {
|
|
118
|
+
let shortContains = false;
|
|
119
|
+
let matchesAll = false;
|
|
120
|
+
const visit = (filter) => {
|
|
121
|
+
if (typeof filter !== "object" || filter === null)
|
|
122
|
+
return;
|
|
123
|
+
for (const [op, value] of Object.entries(filter)) {
|
|
124
|
+
if (op === "contains" && typeof value === "string" && value.length < 3)
|
|
125
|
+
shortContains = true;
|
|
126
|
+
if ((op === "startsWith" || op === "endsWith") && value === "")
|
|
127
|
+
matchesAll = true;
|
|
128
|
+
if ((op === "hasEvery" && Array.isArray(value) && value.length === 0) || (op === "isEmpty" && value === false))
|
|
129
|
+
matchesAll = true;
|
|
130
|
+
if (op === "some" || op === "every")
|
|
131
|
+
visit(value);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
Object.values(where).forEach(visit);
|
|
135
|
+
const notes = [];
|
|
136
|
+
if (shortContains)
|
|
137
|
+
notes.push(" A `contains` needs at least 3 characters to use its trigram index; a shorter one is a rider.");
|
|
138
|
+
if (matchesAll)
|
|
139
|
+
notes.push(" An empty `startsWith` or `endsWith`, an empty `hasEvery` and `isEmpty: false` match every block, so they are riders too.");
|
|
140
|
+
return notes;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The rider rule at runtime (ADR-0013), for untyped JS callers and `where` objects built dynamically
|
|
144
|
+
* (e.g. from UI input) that the compiler never sees. Throws `NEEDS_PRUNING` naming the fields that
|
|
145
|
+
* could prune on this dataset. `wherePrunes` is the non-throwing check.
|
|
146
|
+
*/
|
|
147
|
+
export function assertWhereHasPruning(where, schema) {
|
|
148
|
+
if (wherePrunes(where, schema))
|
|
149
|
+
return;
|
|
150
|
+
const prunable = Object.entries(schema.fields)
|
|
151
|
+
.filter(([name, meta]) => name !== schema.sortField && pruningOpsOf(meta).length > 0)
|
|
152
|
+
.map(([name]) => name);
|
|
153
|
+
throw new ZonemapDbError({
|
|
154
|
+
code: "NEEDS_PRUNING",
|
|
155
|
+
message: `zonemapdb: every filter in this where is a rider (it tests fetched records but can't narrow which blocks are read), ` +
|
|
156
|
+
`so the query would read the whole dataset. Add a filter on the sort field "${schema.sortField}"` +
|
|
157
|
+
(prunable.length > 0 ? ` or on an indexed field (${prunable.join(", ")})` : "") +
|
|
158
|
+
`.` +
|
|
159
|
+
valueRiderNotes(compactWhere(where) ?? {}).join("") +
|
|
160
|
+
` Check with wherePrunes() before querying. For a browse-style search that is rider-only on purpose, pass ` +
|
|
161
|
+
`scan: "block-order" with a limit, which reads files in sort order until the page is full. See "Riders" in docs/query-guide.md.`,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAY7C,wLAAwL;AACxL,MAAM,UAAU,iBAAiB,CAAC,WAAwB;IACxD,OAAO,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC1D,OAAO,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;AAC1D,CAAC;AA+MD,MAAM,iBAAiB,G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,KAAK,CAAC,CAAC;IACpC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,aAAa;QAAE,KAAK,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;IAC/H,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,2HAA2H,CAAC,CAAC;IACxJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAA0D,EAC1D,MAA6C;IAE7C,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QAAE,OAAO;IAEvC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACpF,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,IAAI,cAAc,CAAC;QACvB,IAAI,EAAE,eAAe;QACrB,OAAO,EACL,sHAAsH;YACtH,8EAA8E,MAAM,CAAC,SAAS,GAAG;YACjG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,4BAA4B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/E,GAAG;YACH,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,2GAA2G;YAC3G,gIAAgI;KACnI,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The on-disk/runtime compatibility contract (ADR-0005): `formatVersion` = the
|
|
3
|
+
* package major. One number governs both data-format and code-contract
|
|
4
|
+
* compatibility — a manifest whose major differs from this runtime's is
|
|
5
|
+
* rejected with `FORMAT_VERSION` when the manifest loads. Keep in sync with
|
|
6
|
+
* package.json's major (a test asserts exactly that).
|
|
7
|
+
*/
|
|
8
|
+
export declare const FORMAT_VERSION = 0;
|
|
9
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The on-disk/runtime compatibility contract (ADR-0005): `formatVersion` = the
|
|
3
|
+
* package major. One number governs both data-format and code-contract
|
|
4
|
+
* compatibility — a manifest whose major differs from this runtime's is
|
|
5
|
+
* rejected with `FORMAT_VERSION` when the manifest loads. Keep in sync with
|
|
6
|
+
* package.json's major (a test asserts exactly that).
|
|
7
|
+
*/
|
|
8
|
+
export const FORMAT_VERSION = 0;
|
|
9
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PairZonemapEntry } from "./manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lazily fetches a secondary field's zonemap sidecar (ADR-0003 §3) — only reached once a query
|
|
4
|
+
* actually needs that field's zonemap and finds a `{ sidecar }` reference in root instead of
|
|
5
|
+
* inline pairs. A missing sidecar 404s as DEPLOY_INTEGRITY, same as any other manifest-referenced
|
|
6
|
+
* file (`fetch-file.ts`'s shared "referenced" mapping) — the deploy is incomplete, not the caller's fault.
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchZonemapSidecar(basePath: string, file: string, fetchImpl: typeof fetch, signal?: AbortSignal): Promise<PairZonemapEntry>;
|
|
9
|
+
//# sourceMappingURL=zonemap-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zonemap-fetch.d.ts","sourceRoot":"","sources":["../src/zonemap-fetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO,KAAK,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAE3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fetchReferencedJson } from "./fetch-file.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lazily fetches a secondary field's zonemap sidecar (ADR-0003 §3) — only reached once a query
|
|
4
|
+
* actually needs that field's zonemap and finds a `{ sidecar }` reference in root instead of
|
|
5
|
+
* inline pairs. A missing sidecar 404s as DEPLOY_INTEGRITY, same as any other manifest-referenced
|
|
6
|
+
* file (`fetch-file.ts`'s shared "referenced" mapping) — the deploy is incomplete, not the caller's fault.
|
|
7
|
+
*/
|
|
8
|
+
export async function fetchZonemapSidecar(basePath, file, fetchImpl, signal) {
|
|
9
|
+
return (await fetchReferencedJson(`${basePath}/${file}`, fetchImpl, signal));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=zonemap-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zonemap-fetch.js","sourceRoot":"","sources":["../src/zonemap-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAgB,EAChB,IAAY,EACZ,SAAuB,EACvB,MAAoB;IAEpB,OAAO,CAAC,MAAM,mBAAmB,CAAC,GAAG,QAAQ,IAAI,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,CAAqB,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type SortValue = number | string;
|
|
2
|
+
export interface SortFieldFilter {
|
|
3
|
+
equals?: SortValue;
|
|
4
|
+
in?: SortValue[];
|
|
5
|
+
gt?: SortValue;
|
|
6
|
+
gte?: SortValue;
|
|
7
|
+
lt?: SortValue;
|
|
8
|
+
lte?: SortValue;
|
|
9
|
+
/** String sort fields only: a prefix is a contiguous range once values are sorted (ADR-0003 §7). */
|
|
10
|
+
startsWith?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Block ordinals (into `manifest.blocks`) that could satisfy `filter` on the sort field. */
|
|
13
|
+
export declare function candidateBlockIndices(splitPoints: readonly SortValue[], filter: SortFieldFilter | undefined): number[];
|
|
14
|
+
/**
|
|
15
|
+
* A secondary field's constraint, in the shapes a per-block [min,max] pair can prune (ADR-0003 §6
|
|
16
|
+
* step 1): point lookups (`equals`/`in`) and ranges (`gt`/`gte`/`lt`/`lte`).
|
|
17
|
+
*/
|
|
18
|
+
export interface PairRangeFilter {
|
|
19
|
+
equals?: unknown;
|
|
20
|
+
in?: unknown[];
|
|
21
|
+
gt?: unknown;
|
|
22
|
+
gte?: unknown;
|
|
23
|
+
lt?: unknown;
|
|
24
|
+
lte?: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Block ordinals whose per-block `[min,max]` pair could contain any of `filter`'s values — the
|
|
28
|
+
* secondary-field counterpart of `candidateBlockIndices` (ADR-0003 §6 step 1: "apply all free
|
|
29
|
+
* zonemap pruning first"). String bounds are truncated but never past the true value (ADR-0003
|
|
30
|
+
* §2), so this can only ever OVER-approximate — it never excludes a real match. `undefined` means
|
|
31
|
+
* the filter shape (e.g. `startsWith`) isn't one a min/max pair can prune; the caller should treat
|
|
32
|
+
* that as "no zonemap signal" rather than as an empty set.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pairCandidateBlockIndices(pairs: readonly (readonly [unknown, unknown])[], filter: PairRangeFilter): Set<number> | undefined;
|
|
35
|
+
//# sourceMappingURL=zonemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zonemap.d.ts","sourceRoot":"","sources":["../src/zonemap.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;IACjB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAqDD,6FAA6F;AAC7F,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,SAAS,SAAS,EAAE,EACjC,MAAM,EAAE,eAAe,GAAG,SAAS,GAClC,MAAM,EAAE,CAiCV;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AA+BD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,EAC/C,MAAM,EAAE,eAAe,GACtB,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAezB"}
|
package/dist/zonemap.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Zonemap pruning over the sort field's split-points (ADR-0002/0003): the
|
|
2
|
+
// split-points ARE the search structure — binary search finds the blocks that
|
|
3
|
+
// could possibly satisfy a where-filter on the sort field, so only those need
|
|
4
|
+
// to be fetched.
|
|
5
|
+
/** Higher than any realistic code point in a stored value, so `[p, p + this]` brackets every string starting with `p`. */
|
|
6
|
+
const PREFIX_UPPER_SENTINEL = "\u{10FFFF}";
|
|
7
|
+
function pointBlockIndex(splitPoints, value, blockCount) {
|
|
8
|
+
let lo = 0;
|
|
9
|
+
let hi = blockCount - 1;
|
|
10
|
+
let ans = 0;
|
|
11
|
+
while (lo <= hi) {
|
|
12
|
+
const mid = (lo + hi) >> 1;
|
|
13
|
+
if (splitPoints[mid] <= value) {
|
|
14
|
+
ans = mid;
|
|
15
|
+
lo = mid + 1;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
hi = mid - 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return ans;
|
|
22
|
+
}
|
|
23
|
+
function upperBoundBlockIndex(splitPoints, value, blockCount, strict) {
|
|
24
|
+
let lo = 0;
|
|
25
|
+
let hi = blockCount - 1;
|
|
26
|
+
let ans = -1;
|
|
27
|
+
while (lo <= hi) {
|
|
28
|
+
const mid = (lo + hi) >> 1;
|
|
29
|
+
const boundOk = strict ? splitPoints[mid] < value : splitPoints[mid] <= value;
|
|
30
|
+
if (boundOk) {
|
|
31
|
+
ans = mid;
|
|
32
|
+
lo = mid + 1;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
hi = mid - 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return ans;
|
|
39
|
+
}
|
|
40
|
+
function isWithinGlobalRange(splitPoints, value) {
|
|
41
|
+
return value >= splitPoints[0] && value <= splitPoints[splitPoints.length - 1];
|
|
42
|
+
}
|
|
43
|
+
function range(start, end) {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (let i = start; i <= end; i++)
|
|
46
|
+
out.push(i);
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/** Block ordinals (into `manifest.blocks`) that could satisfy `filter` on the sort field. */
|
|
50
|
+
export function candidateBlockIndices(splitPoints, filter) {
|
|
51
|
+
const blockCount = splitPoints.length - 1;
|
|
52
|
+
if (blockCount <= 0)
|
|
53
|
+
return [];
|
|
54
|
+
if (!filter || Object.keys(filter).length === 0)
|
|
55
|
+
return range(0, blockCount - 1);
|
|
56
|
+
if (filter.in !== undefined) {
|
|
57
|
+
const indices = new Set();
|
|
58
|
+
for (const value of filter.in) {
|
|
59
|
+
if (isWithinGlobalRange(splitPoints, value))
|
|
60
|
+
indices.add(pointBlockIndex(splitPoints, value, blockCount));
|
|
61
|
+
}
|
|
62
|
+
return [...indices].sort((a, b) => a - b);
|
|
63
|
+
}
|
|
64
|
+
if (filter.equals !== undefined) {
|
|
65
|
+
if (!isWithinGlobalRange(splitPoints, filter.equals))
|
|
66
|
+
return [];
|
|
67
|
+
return [pointBlockIndex(splitPoints, filter.equals, blockCount)];
|
|
68
|
+
}
|
|
69
|
+
// `startsWith(p)` IS the closed range [p, p+sentinel] on a sorted string field — free pruning off
|
|
70
|
+
// the split-points already in the manifest, no index chunk to fetch. Composes with an explicit
|
|
71
|
+
// range by intersecting: both bounds narrow the same span.
|
|
72
|
+
const lower = filter.startsWith !== undefined ? filter.startsWith : (filter.gte ?? filter.gt);
|
|
73
|
+
const upper = filter.startsWith !== undefined ? filter.startsWith + PREFIX_UPPER_SENTINEL : (filter.lte ?? filter.lt);
|
|
74
|
+
const strictUpper = filter.startsWith === undefined && filter.lt !== undefined;
|
|
75
|
+
const startIdx = lower !== undefined ? pointBlockIndex(splitPoints, lower, blockCount) : 0;
|
|
76
|
+
const endIdx = upper !== undefined ? upperBoundBlockIndex(splitPoints, upper, blockCount, strictUpper) : blockCount - 1;
|
|
77
|
+
if (endIdx < startIdx)
|
|
78
|
+
return [];
|
|
79
|
+
return range(startIdx, endIdx);
|
|
80
|
+
}
|
|
81
|
+
function withinPair(pair, value) {
|
|
82
|
+
const [min, max] = pair;
|
|
83
|
+
// A block with zero non-null values for this field has no bound to compare against (ADR-0002 §5/T7).
|
|
84
|
+
if (min === undefined || max === undefined)
|
|
85
|
+
return false;
|
|
86
|
+
return min <= value && value <= max;
|
|
87
|
+
}
|
|
88
|
+
function hasRangeBound(filter) {
|
|
89
|
+
return filter.gt !== undefined || filter.gte !== undefined || filter.lt !== undefined || filter.lte !== undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Whether a block's [min,max] overlaps the filter's range — the only question a pair can answer
|
|
93
|
+
* about a range. A block survives unless its whole span sits on one side of a bound.
|
|
94
|
+
*
|
|
95
|
+
* `gt`/`lt` differ from `gte`/`lte` only at the boundary: a block whose max is exactly the bound can
|
|
96
|
+
* satisfy `gte` but not `gt`. Since number/date pairs are exact (only string pairs are truncated —
|
|
97
|
+
* ADR-0003 §2), that distinction is sound rather than merely conservative.
|
|
98
|
+
*/
|
|
99
|
+
function overlapsRange(pair, filter) {
|
|
100
|
+
const [min, max] = pair;
|
|
101
|
+
if (min === undefined || max === undefined)
|
|
102
|
+
return false;
|
|
103
|
+
if (filter.gte !== undefined && max < filter.gte)
|
|
104
|
+
return false;
|
|
105
|
+
if (filter.gt !== undefined && max <= filter.gt)
|
|
106
|
+
return false;
|
|
107
|
+
if (filter.lte !== undefined && min > filter.lte)
|
|
108
|
+
return false;
|
|
109
|
+
if (filter.lt !== undefined && min >= filter.lt)
|
|
110
|
+
return false;
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Block ordinals whose per-block `[min,max]` pair could contain any of `filter`'s values — the
|
|
115
|
+
* secondary-field counterpart of `candidateBlockIndices` (ADR-0003 §6 step 1: "apply all free
|
|
116
|
+
* zonemap pruning first"). String bounds are truncated but never past the true value (ADR-0003
|
|
117
|
+
* §2), so this can only ever OVER-approximate — it never excludes a real match. `undefined` means
|
|
118
|
+
* the filter shape (e.g. `startsWith`) isn't one a min/max pair can prune; the caller should treat
|
|
119
|
+
* that as "no zonemap signal" rather than as an empty set.
|
|
120
|
+
*/
|
|
121
|
+
export function pairCandidateBlockIndices(pairs, filter) {
|
|
122
|
+
const hasPoint = filter.equals !== undefined || filter.in !== undefined;
|
|
123
|
+
const hasRange = hasRangeBound(filter);
|
|
124
|
+
if (!hasPoint && !hasRange)
|
|
125
|
+
return undefined;
|
|
126
|
+
// Point and range constraints on one field are ANDed, matching `matchesWhere`: `{ equals: 5, gte: 10 }`
|
|
127
|
+
// is unsatisfiable and must prune to nothing, not to the union of what each shape would admit.
|
|
128
|
+
const values = filter.in ?? [filter.equals];
|
|
129
|
+
const indices = new Set();
|
|
130
|
+
pairs.forEach((pair, i) => {
|
|
131
|
+
if (hasPoint && !values.some((value) => withinPair(pair, value)))
|
|
132
|
+
return;
|
|
133
|
+
if (hasRange && !overlapsRange(pair, filter))
|
|
134
|
+
return;
|
|
135
|
+
indices.add(i);
|
|
136
|
+
});
|
|
137
|
+
return indices;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=zonemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zonemap.js","sourceRoot":"","sources":["../src/zonemap.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E,iBAAiB;AAejB,0HAA0H;AAC1H,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,SAAS,eAAe,CAAC,WAAiC,EAAE,KAAgB,EAAE,UAAkB;IAC9F,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,UAAU,GAAG,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;QAChB,MAAM,GAAG,GAAG,CAAC,EAAE,GAA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C,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACxB,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,OAAO;QACzE,IAAI,QAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC;YAAE,OAAO;QACrD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zonemapdb",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Query large static datasets from any static host — partitioned into many small files, typed client, no WASM, no HTTP Range.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Emil Elgaard",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"static",
|
|
10
|
+
"database",
|
|
11
|
+
"partitioning",
|
|
12
|
+
"query",
|
|
13
|
+
"large-data",
|
|
14
|
+
"browser",
|
|
15
|
+
"static-site",
|
|
16
|
+
"typescript",
|
|
17
|
+
"typed",
|
|
18
|
+
"codegen",
|
|
19
|
+
"cdn",
|
|
20
|
+
"no-backend"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/shivan2418/blockdb.git",
|
|
39
|
+
"directory": "packages/zonemapdb"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/shivan2418/blockdb#readme",
|
|
42
|
+
"bugs": "https://github.com/shivan2418/blockdb/issues",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20.19.0",
|
|
45
|
+
"zonemapdb-cli": "0.8.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.json",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"pack:check": "pnpm pack --dry-run --json"
|
|
52
|
+
}
|
|
53
|
+
}
|