@crubal/host 0.0.0-stage → 0.4.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/README.md +137 -2
- package/dist/bin/crubal-host.d.ts +2 -0
- package/dist/bin/crubal-host.js +52 -0
- package/dist/bin/crubal-host.js.map +1 -0
- package/dist/src/credentials.d.ts +58 -0
- package/dist/src/credentials.js +161 -0
- package/dist/src/credentials.js.map +1 -0
- package/dist/src/emergency.d.ts +53 -0
- package/dist/src/emergency.js +90 -0
- package/dist/src/emergency.js.map +1 -0
- package/dist/src/host.d.ts +344 -0
- package/dist/src/host.js +913 -0
- package/dist/src/host.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/indexer.d.ts +136 -0
- package/dist/src/indexer.js +547 -0
- package/dist/src/indexer.js.map +1 -0
- package/dist/src/oidc.d.ts +29 -0
- package/dist/src/oidc.js +74 -0
- package/dist/src/oidc.js.map +1 -0
- package/dist/src/schema.sql +148 -0
- package/dist/src/secrets.d.ts +21 -0
- package/dist/src/secrets.js +36 -0
- package/dist/src/secrets.js.map +1 -0
- package/dist/src/server.d.ts +41 -0
- package/dist/src/server.js +530 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/signatures.d.ts +30 -0
- package/dist/src/signatures.js +53 -0
- package/dist/src/signatures.js.map +1 -0
- package/dist/src/terms.d.ts +21 -0
- package/dist/src/terms.js +55 -0
- package/dist/src/terms.js.map +1 -0
- package/package.json +48 -4
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
// indexer.ts: the reference index (spec 12.6.1, docs/design/index-and-forms.md). It reads a view's
|
|
2
|
+
// projection stream from the store into its own tables, idempotently by (view, audience, seq), and serves
|
|
3
|
+
// pages, counts, partitions, role marks, search and indexability over the rows it holds. It is never the
|
|
4
|
+
// truth: a contract checks the store, and the index can be dropped and rebuilt from the stream.
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { facetOf, Access } from "@crubal/engine";
|
|
7
|
+
import { partitionOf } from "@crubal/engine";
|
|
8
|
+
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
9
|
+
/** The text an index searches: every string slot of the row, and every text inside its values. */
|
|
10
|
+
function textOf(row) {
|
|
11
|
+
const out = [];
|
|
12
|
+
const walk = (v) => {
|
|
13
|
+
if (typeof v === "string")
|
|
14
|
+
out.push(v);
|
|
15
|
+
else if (Array.isArray(v))
|
|
16
|
+
v.forEach(walk);
|
|
17
|
+
else if (isObj(v))
|
|
18
|
+
for (const [k, x] of Object.entries(v))
|
|
19
|
+
if (!["record", "marks", "ancestors"].includes(k))
|
|
20
|
+
walk(x);
|
|
21
|
+
};
|
|
22
|
+
walk(row);
|
|
23
|
+
return out.join(" ");
|
|
24
|
+
}
|
|
25
|
+
/** A row's slot as a number, in SQL: money by its amount, a quantity by its count, a number as it is, a numeric text read, else nothing. */
|
|
26
|
+
const numericSql = (slot) => `coalesce((${slot} ->> '$money')::numeric, (${slot} ->> '$qty')::numeric, case when jsonb_typeof(${slot}) = 'number' then (${slot})::text::numeric when jsonb_typeof(${slot}) = 'string' and (${slot} #>> '{}') ~ '^-?[0-9]+(\\.[0-9]+)?$' then (${slot} #>> '{}')::numeric end, 0)`;
|
|
27
|
+
/** The same reading in memory, for the partitioned path. */
|
|
28
|
+
function numberIn(v) {
|
|
29
|
+
if (typeof v === "number")
|
|
30
|
+
return v;
|
|
31
|
+
if (typeof v === "string")
|
|
32
|
+
return /^-?\d+(\.\d+)?$/.test(v) ? Number(v) : 0;
|
|
33
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
34
|
+
const o = v;
|
|
35
|
+
if (typeof o.$money === "string")
|
|
36
|
+
return Number(o.$money) || 0;
|
|
37
|
+
if (o.$qty !== undefined)
|
|
38
|
+
return Number(o.$qty) || 0;
|
|
39
|
+
}
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
export class Index {
|
|
43
|
+
pool;
|
|
44
|
+
constructor(pool) {
|
|
45
|
+
this.pool = pool;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Pull a view's stream since the cursor into the rows, for the view's own audience. With `unlessBehind`,
|
|
49
|
+
* a backlog past that many entries is left where it is and the cursor comes back as it stands: a page
|
|
50
|
+
* served on a request applies a handful of entries, never a restamp's hundreds of thousands (the scale
|
|
51
|
+
* rule, 2026-10-26: a shop's home spent its thirty seconds inserting index rows); the host's index loop
|
|
52
|
+
* catches the view up (`behind`, brief 40), applying with `budgetMs` a tick at a time.
|
|
53
|
+
*/
|
|
54
|
+
async apply(store, view, o = {}) {
|
|
55
|
+
const p = await store.definitions();
|
|
56
|
+
const v = p.views.views.get(view);
|
|
57
|
+
if (!v)
|
|
58
|
+
throw new Error(`no view ${view}`);
|
|
59
|
+
const version = v.version ?? "";
|
|
60
|
+
const owner = store.owner;
|
|
61
|
+
const cur = (await this.pool.query("select seq from index_cursors where owner = $1 and view = $2 and version = $3 and audience = $4", [owner, view, version, v.show])).rows[0];
|
|
62
|
+
let seq = cur ? Number(cur.seq) : 0;
|
|
63
|
+
// A cursor past the stream's head means the stream was started over behind the index (a store
|
|
64
|
+
// rebuilt before 0.1.16 wiped its streams): the index takes the stream from its start again.
|
|
65
|
+
const head = await store.streamHead(view, v.show);
|
|
66
|
+
if (seq > 0 && seq > head)
|
|
67
|
+
seq = 0;
|
|
68
|
+
if (o.unlessBehind !== undefined && head - seq > o.unlessBehind) {
|
|
69
|
+
// Declined on a request (brief 40): a view with no cursor row yet gets one at 0, the mark that it is
|
|
70
|
+
// asked for, so the index loop builds it off the request path instead of nobody ever building it.
|
|
71
|
+
if (!cur)
|
|
72
|
+
await this.pool.query("insert into index_cursors (owner, view, version, audience, seq) values ($1, $2, $3, $4, 0) on conflict do nothing", [owner, view, version, v.show]);
|
|
73
|
+
return seq;
|
|
74
|
+
}
|
|
75
|
+
// The stream a page at a time: a first publish of a large view is more entries than memory should hold at once.
|
|
76
|
+
const page = 5000;
|
|
77
|
+
const until = o.budgetMs === undefined ? Number.POSITIVE_INFINITY : Date.now() + o.budgetMs;
|
|
78
|
+
for (;;) {
|
|
79
|
+
const entries = await store.entriesSince(view, seq, v.show, page);
|
|
80
|
+
if (!entries.length)
|
|
81
|
+
break;
|
|
82
|
+
seq = await this.ingest(owner, view, version, v.show, entries, seq);
|
|
83
|
+
if (entries.length < page || Date.now() > until)
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
return seq;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The store's current views whose index is behind its stream, most behind first (brief 40): one probe of
|
|
90
|
+
* the cursor table and one of the stream's head per view, never a pass over either. A view with no cursor
|
|
91
|
+
* row was never asked for and is not listed; `apply` leaves a row at 0 when it declines one on a request.
|
|
92
|
+
*/
|
|
93
|
+
async behind(store) {
|
|
94
|
+
const p = await store.definitions();
|
|
95
|
+
const out = [];
|
|
96
|
+
for (const v of p.views.views.values()) {
|
|
97
|
+
const cur = (await this.pool.query("select seq from index_cursors where owner = $1 and view = $2 and version = $3 and audience = $4", [store.owner, v.name, v.version ?? "", v.show])).rows[0];
|
|
98
|
+
if (!cur)
|
|
99
|
+
continue;
|
|
100
|
+
const seq = Number(cur.seq);
|
|
101
|
+
const head = await store.streamHead(v.name, v.show);
|
|
102
|
+
if (head > seq)
|
|
103
|
+
out.push({ view: v.name, audience: v.show, seq, head });
|
|
104
|
+
}
|
|
105
|
+
return out.sort((a, b) => b.head - b.seq - (a.head - a.seq));
|
|
106
|
+
}
|
|
107
|
+
/** Apply stream entries to the rows, idempotently by seq (12.6.2): from a store's stream or pushed by a presenter. */
|
|
108
|
+
async ingest(owner, view, version, audience, entries, from) {
|
|
109
|
+
await this.linkedReady();
|
|
110
|
+
const cur = (await this.pool.query("select seq from index_cursors where owner = $1 and view = $2 and version = $3 and audience = $4", [owner, view, version, audience])).rows[0];
|
|
111
|
+
let seq = from ?? (cur ? Number(cur.seq) : 0);
|
|
112
|
+
// Rows land in batches of 500, one statement each, in stream order: a reset or a removal flushes what
|
|
113
|
+
// is pending first (ME: 9,437 rows in one view's first publish).
|
|
114
|
+
// Within a batch a record appears once, as its latest entry (one statement may not touch a row twice).
|
|
115
|
+
let pending = [];
|
|
116
|
+
const flush = async () => {
|
|
117
|
+
if (!pending.length)
|
|
118
|
+
return;
|
|
119
|
+
const latest = new Map();
|
|
120
|
+
for (const e of pending)
|
|
121
|
+
latest.set(String(e.record), e);
|
|
122
|
+
pending = [...latest.values()];
|
|
123
|
+
await this.pool.query(`insert into index_rows (owner, view, version, audience, record, row, buckets, marks, ancestors, sort, pin, seq, search, linked)
|
|
124
|
+
select $1, $2, $3, $4, e ->> 'record', e -> 'row', coalesce(e -> 'buckets', '{}'::jsonb), e -> 'row' -> 'marks',
|
|
125
|
+
coalesce(array(select jsonb_array_elements_text(case when jsonb_typeof(e -> 'row' -> 'ancestors') = 'array' then e -> 'row' -> 'ancestors' else '[]'::jsonb end)), '{}'),
|
|
126
|
+
coalesce(e -> 'sort', '[]'::jsonb), (e ->> 'pin')::integer, (e ->> 'seq')::bigint, to_tsvector('simple', e ->> 'search'), e -> 'row' ->> 'linked'
|
|
127
|
+
from jsonb_array_elements($5::jsonb) as t(e)
|
|
128
|
+
on conflict (owner, view, version, audience, record) do update set row = excluded.row, buckets = excluded.buckets, marks = excluded.marks,
|
|
129
|
+
ancestors = excluded.ancestors, sort = excluded.sort, pin = excluded.pin, seq = excluded.seq, search = excluded.search, linked = excluded.linked`, [owner, view, version, audience, JSON.stringify(pending)]);
|
|
130
|
+
pending = [];
|
|
131
|
+
};
|
|
132
|
+
for (const e of entries) {
|
|
133
|
+
if (e.seq <= seq)
|
|
134
|
+
continue;
|
|
135
|
+
if (e.reset) {
|
|
136
|
+
await flush();
|
|
137
|
+
await this.pool.query("delete from index_rows where owner = $1 and view = $2 and audience = $3", [owner, view, audience]);
|
|
138
|
+
}
|
|
139
|
+
if (e.removed) {
|
|
140
|
+
await flush();
|
|
141
|
+
await this.pool.query("delete from index_rows where owner = $1 and view = $2 and version = $3 and audience = $4 and record = $5", [owner, view, version, audience, e.record]);
|
|
142
|
+
}
|
|
143
|
+
else if (e.row) {
|
|
144
|
+
pending.push({ record: e.record, row: e.row, buckets: e.buckets ?? {}, sort: e.sort ?? [], ...(e.pin ? { pin: e.pin } : {}), seq: e.seq, search: textOf(e.row) });
|
|
145
|
+
if (pending.length >= 500)
|
|
146
|
+
await flush();
|
|
147
|
+
}
|
|
148
|
+
seq = e.seq;
|
|
149
|
+
}
|
|
150
|
+
await flush();
|
|
151
|
+
await this.pool.query("insert into index_cursors (owner, view, version, audience, seq) values ($1, $2, $3, $4, $5) on conflict (owner, view, version, audience) do update set seq = excluded.seq", [owner, view, version, audience, seq]);
|
|
152
|
+
return seq;
|
|
153
|
+
}
|
|
154
|
+
/** The bucket names of a filter, in its order: declared buckets, else the facet's values. */
|
|
155
|
+
bucketNames(p, filter) {
|
|
156
|
+
const f = p.views.filters.get(filter);
|
|
157
|
+
if (!f)
|
|
158
|
+
return [];
|
|
159
|
+
if (f.buckets)
|
|
160
|
+
return f.buckets.map((b) => b.name);
|
|
161
|
+
// The facet an address finally reads: through a level prefix, a link step (works[*].genre) or a compound's child.
|
|
162
|
+
return (facetOf(f.facet, p.dict)?.values ?? []).map((v) => v.value);
|
|
163
|
+
}
|
|
164
|
+
/** Does the filter bucket by the values records carry, with no list known in advance (12.3)? */
|
|
165
|
+
unlisted(p, filter) {
|
|
166
|
+
const f = p.views.filters.get(filter);
|
|
167
|
+
return !!f && !f.buckets && !facetOf(f.facet, p.dict)?.values?.length;
|
|
168
|
+
}
|
|
169
|
+
/** The slot of the view's first shape that carries a facet (`price -> price`, `unit::price -> price`), for a sum over the rows. */
|
|
170
|
+
slotOf(p, v, facet) {
|
|
171
|
+
const shape = p.views.shapes.get(v.shapes[0] ?? "");
|
|
172
|
+
const bare = facet.replace(/^\w+::/, "");
|
|
173
|
+
return shape?.slots.find((sl) => sl.from.replace(/^!/, "").replace(/^\w+::/, "") === bare)?.to;
|
|
174
|
+
}
|
|
175
|
+
/** The names a filter's counts list: its buckets, or for an unlisted filter the ones the page asked for. */
|
|
176
|
+
namesFor(p, filter, o) {
|
|
177
|
+
if (!this.unlisted(p, filter))
|
|
178
|
+
return this.bucketNames(p, filter);
|
|
179
|
+
const asked = o.only?.[filter];
|
|
180
|
+
return asked?.length ? asked : undefined;
|
|
181
|
+
}
|
|
182
|
+
/** Serve a page of a view (12.2, 12.3, 12.5) to a caller, from the rows the index holds. */
|
|
183
|
+
async serve(store, view, o = {}) {
|
|
184
|
+
const p = await store.definitions();
|
|
185
|
+
const v = p.views.views.get(view);
|
|
186
|
+
if (!v)
|
|
187
|
+
throw new Error(`no view ${view}`);
|
|
188
|
+
const version = v.version ?? "";
|
|
189
|
+
const owner = store.owner;
|
|
190
|
+
// The caller's audience decides whether this view is theirs to read (14.4): never a higher one.
|
|
191
|
+
// Access only when the package declares permissions or relations: loading the state costs with the catalog.
|
|
192
|
+
// Access runs on a working set that loads the caller's records as it asks for them, never the catalog.
|
|
193
|
+
const needsAccess = !!(p.perms.menu.size || p.perms.relations.size);
|
|
194
|
+
const withAccess = (fn) => store.read((s) => { const a = new Access(p.dict, p.perms, s.records, [...s.edges.values()], owner); a.views = p.views; return fn(a); });
|
|
195
|
+
const rank = (a) => ["public", "member", "staff", "owner"].indexOf(a);
|
|
196
|
+
const audience = o.caller ? (needsAccess ? await withAccess((a) => a.audienceOf(o.caller)) : "member") : "public";
|
|
197
|
+
if (o.caller === owner) {
|
|
198
|
+
// the owner reads everything
|
|
199
|
+
}
|
|
200
|
+
else if (rank(audience) < rank(v.show))
|
|
201
|
+
throw Object.assign(new Error(`${view} is for ${v.show}`), { status: 403 });
|
|
202
|
+
const cur = (await this.pool.query("select seq from index_cursors where owner = $1 and view = $2 and version = $3 and audience = $4", [owner, view, version, v.show])).rows[0];
|
|
203
|
+
const seq = cur ? Number(cur.seq) : 0;
|
|
204
|
+
const picks = o.picks ?? {};
|
|
205
|
+
const pickList = Object.entries(picks).filter(([, c]) => c.length);
|
|
206
|
+
const page = Math.max(1, o.page ?? 1);
|
|
207
|
+
// The rows are selected, counted, ordered and paged by the database (brief 18 step 1): nothing here is
|
|
208
|
+
// proportional to the view. Picks are containments on the buckets document (the GIN answers), the
|
|
209
|
+
// search is the vector, the order is the stored sort and pin, the page a limit and an offset. The counts
|
|
210
|
+
// and the total are cached per index cursor: they change only when the index does.
|
|
211
|
+
const where = ["owner = $1", "view = $2", "version = $3", "audience = $4"];
|
|
212
|
+
const params = [owner, view, version, v.show];
|
|
213
|
+
if (o.q) {
|
|
214
|
+
params.push(o.q);
|
|
215
|
+
where.push(`search @@ plainto_tsquery('simple', $${params.length})`);
|
|
216
|
+
}
|
|
217
|
+
// Partition (12.6): a caller who isn't the owner is served the rows their edges stand in the relation to,
|
|
218
|
+
// or an ancestor; the candidates are bounded by the caller's own edges, never the view.
|
|
219
|
+
const partition = partitionOf(v);
|
|
220
|
+
// A `linked <facet>` partition (12.2): the row names whom the record links to, and a caller is served the
|
|
221
|
+
// rows that name them, bounded in the database by that column, never by the view or by their edges.
|
|
222
|
+
const linked = /^linked \S+$/.test(partition);
|
|
223
|
+
const roles = new Set();
|
|
224
|
+
let standsOn;
|
|
225
|
+
if (partition !== "none" && o.caller !== owner && linked) {
|
|
226
|
+
if (!o.caller)
|
|
227
|
+
standsOn = [];
|
|
228
|
+
else {
|
|
229
|
+
await this.linkedReady();
|
|
230
|
+
params.push(o.caller);
|
|
231
|
+
where.push(`linked = $${params.length}`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (partition !== "none" && o.caller !== owner) {
|
|
235
|
+
if (!needsAccess || !o.caller)
|
|
236
|
+
standsOn = [];
|
|
237
|
+
else {
|
|
238
|
+
const caller = o.caller;
|
|
239
|
+
standsOn = await store.read((st) => [...new Set([...st.edges.values()].filter((e) => e.who === caller).map((e) => String(e.on)))]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// An edge on the owner's root covers every record of the owner (14.2, 12.6): no partition clause at all,
|
|
243
|
+
// so the rows of a store from before ancestors ended at ROOT match as well as the rows written since.
|
|
244
|
+
if (standsOn?.includes("ROOT"))
|
|
245
|
+
standsOn = undefined;
|
|
246
|
+
if (standsOn) {
|
|
247
|
+
if (!standsOn.length)
|
|
248
|
+
return { view, version, audience: v.show, seq, page, pages: 1, total: 0, rows: [], counts: Object.fromEntries(v.filters.map((f) => [f, Object.fromEntries(this.bucketNames(p, f).map((b) => [b, 0]))])), indexable: false };
|
|
249
|
+
params.push(standsOn);
|
|
250
|
+
where.push(`(record = any($${params.length}) or ancestors && $${params.length}::text[])`);
|
|
251
|
+
}
|
|
252
|
+
// The stored order's first three keys always, so the order matches the index on them (index_rows_order).
|
|
253
|
+
const order = `pin asc nulls last, ${[0, 1, 2].map((i) => `(sort ->> ${i}) ${v.order[i]?.dir === "after" ? "desc" : "asc"}`).concat("record asc").join(", ")}`;
|
|
254
|
+
const baseWhere = where.join(" and ");
|
|
255
|
+
// Each query gets its own parameters: the base, the picks it applies (all but `except`), then any extra.
|
|
256
|
+
const build = (except, extra = []) => {
|
|
257
|
+
const ps = [...params];
|
|
258
|
+
const clauses = [baseWhere];
|
|
259
|
+
for (const [f, chosen] of pickList) {
|
|
260
|
+
if (f === except)
|
|
261
|
+
continue;
|
|
262
|
+
clauses.push(`(${chosen.map((c) => { ps.push(JSON.stringify({ [f]: [c] })); return `buckets @> $${ps.length}::jsonb`; }).join(" or ")})`);
|
|
263
|
+
}
|
|
264
|
+
for (const x of extra)
|
|
265
|
+
ps.push(x);
|
|
266
|
+
return { sql: clauses.join(" and "), ps };
|
|
267
|
+
};
|
|
268
|
+
// The caller's partition is checked row by row within the bounded candidates (14.10), so those are
|
|
269
|
+
// fetched whole and paged here; everyone else's page is the database's.
|
|
270
|
+
let onPage;
|
|
271
|
+
let total;
|
|
272
|
+
const counts = {};
|
|
273
|
+
const sums = {};
|
|
274
|
+
const nested = {};
|
|
275
|
+
const listed = {};
|
|
276
|
+
// The filters to list (0.3.80): unlisted ones of this view, each with its bound, at most 500.
|
|
277
|
+
const toList = Object.entries(o.list ?? {}).filter(([f, n]) => v.filters.includes(f) && this.unlisted(p, f) && n > 0).map(([f, n]) => [f, Math.min(500, Math.floor(n))]);
|
|
278
|
+
const key = `${owner}|${view}|${version}|${v.show}|${seq}|${JSON.stringify(pickList)}|${o.q ?? ""}|${standsOn ? standsOn.join(",") : ""}|${linked ? (o.caller ?? "") : ""}|${JSON.stringify(o.only ?? {})}${toList.length ? `|${JSON.stringify(toList)}` : ""}`;
|
|
279
|
+
// A standard ask (no search, no pick or one pick on an indexable filter): its tally is kept a week, any
|
|
280
|
+
// other's a day (pruneTallies), so crawlers walking combinations never fill the table. The page is not in
|
|
281
|
+
// the key, so every page of one selection shares the tally; it is not in the standard either (a crawler
|
|
282
|
+
// paging a list made a non-standard tally a page, 2026-10-28).
|
|
283
|
+
const standardAsk = !o.q && !linked && (pickList.length === 0 || (pickList.length === 1 && v.index.includes(pickList[0]?.[0]) && pickList[0]?.[1].length === 1));
|
|
284
|
+
// "standard": the host decides by its own rule whether a cold tally may be built here (the app's rule had
|
|
285
|
+
// drifted from it, and crawlers walking filter combinations built a thousand tallies an hour, ten seconds
|
|
286
|
+
// of database time each, 2026-10-28); any other ask is served with its total and the counts it has.
|
|
287
|
+
const mayBuild = o.counts === "always" || o.counts === undefined || (o.counts === "standard" && standardAsk);
|
|
288
|
+
if (standsOn && o.caller) {
|
|
289
|
+
const caller = o.caller;
|
|
290
|
+
const all = (await this.pool.query(`select record, row, buckets, marks, ancestors, sort, pin from index_rows where ${baseWhere} order by ${order}`, params)).rows;
|
|
291
|
+
const served = await withAccess((a) => {
|
|
292
|
+
const kept = all.filter((r) => a.standsIn(caller, String(r.record), partition));
|
|
293
|
+
for (const r of kept)
|
|
294
|
+
for (const e of a.effective(caller, String(r.record)).edges)
|
|
295
|
+
for (const g of e.grants)
|
|
296
|
+
if (p.perms.presets.has(g))
|
|
297
|
+
roles.add(g);
|
|
298
|
+
return kept;
|
|
299
|
+
});
|
|
300
|
+
const inPick = (r, f, chosen) => chosen.some((c) => (r.buckets?.[f] ?? []).includes(c));
|
|
301
|
+
const passes = (r, except) => pickList.every(([f, chosen]) => f === except || inPick(r, f, chosen));
|
|
302
|
+
for (const f of v.filters) {
|
|
303
|
+
const names = this.namesFor(p, f, o);
|
|
304
|
+
if (!names)
|
|
305
|
+
continue;
|
|
306
|
+
const pool = served.filter((r) => passes(r, f));
|
|
307
|
+
counts[f] = Object.fromEntries(names.map((b) => [b, pool.filter((r) => inPick(r, f, [b])).length]));
|
|
308
|
+
const summed = p.views.filters.get(f)?.sums ?? [];
|
|
309
|
+
if (summed.length)
|
|
310
|
+
sums[f] = Object.fromEntries(names.map((b) => [b, Object.fromEntries(summed.map((facet) => [facet, pool.filter((r) => inPick(r, f, [b])).reduce((t, r) => t + numberIn(r.row?.[this.slotOf(p, v, facet) ?? ""]), 0)]))]));
|
|
311
|
+
}
|
|
312
|
+
for (const [f, most] of toList) {
|
|
313
|
+
const by = new Map();
|
|
314
|
+
for (const r of served) {
|
|
315
|
+
if (!passes(r, f))
|
|
316
|
+
continue;
|
|
317
|
+
for (const b of r.buckets?.[f] ?? [])
|
|
318
|
+
if (by.has(b) || by.size < most)
|
|
319
|
+
by.set(b, (by.get(b) ?? 0) + 1);
|
|
320
|
+
}
|
|
321
|
+
listed[f] = [...by.keys()];
|
|
322
|
+
counts[f] = { ...(counts[f] ?? {}), ...Object.fromEntries(by) };
|
|
323
|
+
}
|
|
324
|
+
const chosen = served.filter((r) => passes(r));
|
|
325
|
+
total = chosen.length;
|
|
326
|
+
onPage = chosen.slice((page - 1) * v.page, page * v.page);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
// The tally kept in this process, or in the host's table by any process, under the same key (the
|
|
330
|
+
// index head is in it, so a moved index never answers from an old tally).
|
|
331
|
+
const hashed = createHash("sha256").update(key).digest("hex");
|
|
332
|
+
let cached = this.cache.get(key);
|
|
333
|
+
await this.talliesReady();
|
|
334
|
+
if (!cached) {
|
|
335
|
+
const stored = (await this.pool.query("select json from index_tallies where key = $1", [hashed])).rows[0];
|
|
336
|
+
if (stored) {
|
|
337
|
+
cached = stored.json;
|
|
338
|
+
this.remember(key, cached);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (cached) {
|
|
342
|
+
total = cached.total;
|
|
343
|
+
Object.assign(counts, cached.counts);
|
|
344
|
+
Object.assign(sums, cached.sums ?? {});
|
|
345
|
+
Object.assign(nested, cached.nested);
|
|
346
|
+
Object.assign(listed, cached.listed ?? {});
|
|
347
|
+
}
|
|
348
|
+
else if (!mayBuild) {
|
|
349
|
+
// No tally kept and none to be built here: the page's total, and the counts left empty.
|
|
350
|
+
const all = build();
|
|
351
|
+
total = Number((await this.pool.query(`select count(*) as n from index_rows where ${all.sql}`, all.ps)).rows[0]?.n ?? 0);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
try {
|
|
355
|
+
const all = build();
|
|
356
|
+
total = Number((await this.pool.query(`select count(*) as n from index_rows where ${all.sql}`, all.ps)).rows[0]?.n ?? 0);
|
|
357
|
+
// The listed filters the picks don't name share one condition (every pick), so they are tallied in one
|
|
358
|
+
// pass over the buckets document: one scan for all of them, not one each (a catalog of 300,000 rows
|
|
359
|
+
// with twenty filters took a scan per filter, seconds a page). A picked filter is tallied over the rows
|
|
360
|
+
// the other picks select, so it keeps a pass of its own; an unlisted one counts only the names asked.
|
|
361
|
+
const picked = new Set(pickList.map(([f]) => f));
|
|
362
|
+
const shared = v.filters.filter((f) => this.namesFor(p, f, o) && !this.unlisted(p, f) && !picked.has(f));
|
|
363
|
+
if (shared.length) {
|
|
364
|
+
const q = build(undefined, [shared]);
|
|
365
|
+
const tally = (await this.pool.query(`select e.key as filter, b.value as bucket, count(*) as n from index_rows, jsonb_each(buckets) e, jsonb_array_elements_text(e.value) b where ${q.sql} and e.key = any($${q.ps.length}) group by e.key, b.value`, q.ps)).rows;
|
|
366
|
+
const by = new Map();
|
|
367
|
+
for (const t of tally)
|
|
368
|
+
(by.get(t.filter) ?? by.set(t.filter, new Map()).get(t.filter))?.set(t.bucket, Number(t.n));
|
|
369
|
+
for (const f of shared)
|
|
370
|
+
counts[f] = Object.fromEntries(this.bucketNames(p, f).map((b) => [b, by.get(f)?.get(b) ?? 0]));
|
|
371
|
+
}
|
|
372
|
+
for (const f of v.filters) {
|
|
373
|
+
const names = this.namesFor(p, f, o);
|
|
374
|
+
if (!names)
|
|
375
|
+
continue;
|
|
376
|
+
const but = build(f);
|
|
377
|
+
// An unlisted filter counts only the names asked for, inside the query, not after it.
|
|
378
|
+
const asked = this.unlisted(p, f) ? ` and b.value = any($${but.ps.push(names)})` : "";
|
|
379
|
+
if (!counts[f]) {
|
|
380
|
+
const tally = (await this.pool.query(`select b.value as bucket, count(*) as n from index_rows, jsonb_array_elements_text(buckets -> '${f.replace(/'/g, "''")}') b where ${but.sql}${asked} group by b.value`, but.ps)).rows;
|
|
381
|
+
const by = new Map(tally.map((t) => [t.bucket, Number(t.n)]));
|
|
382
|
+
counts[f] = Object.fromEntries(names.map((b) => [b, by.get(b) ?? 0]));
|
|
383
|
+
}
|
|
384
|
+
// The sums a filter names (12.3): the facet's slot on the row totalled per bucket, money by its amount.
|
|
385
|
+
const summed = (p.views.filters.get(f)?.sums ?? []).map((facet) => ({ facet, slot: this.slotOf(p, v, facet) })).filter((x) => !!x.slot);
|
|
386
|
+
if (summed.length) {
|
|
387
|
+
const cols = summed.map((x, i) => `sum(${numericSql(`row -> '${x.slot.replace(/'/g, "''")}'`)}) as s${i}`).join(", ");
|
|
388
|
+
const totals = (await this.pool.query(`select b.value as bucket, ${cols} from index_rows, jsonb_array_elements_text(buckets -> '${f.replace(/'/g, "''")}') b where ${but.sql}${asked} group by b.value`, but.ps)).rows;
|
|
389
|
+
const per = new Map(totals.map((t) => [t.bucket, t]));
|
|
390
|
+
sums[f] = Object.fromEntries(names.map((b) => [b, Object.fromEntries(summed.map((x, i) => [x.facet, Number(per.get(b)?.[`s${i}`] ?? 0)]))]));
|
|
391
|
+
}
|
|
392
|
+
// Dependent facets (12.3): their values counted inside each of this filter's buckets.
|
|
393
|
+
const deps = p.views.filters.get(f)?.dependent ?? [];
|
|
394
|
+
if (!deps.length)
|
|
395
|
+
continue;
|
|
396
|
+
const inner = {};
|
|
397
|
+
for (const d of deps) {
|
|
398
|
+
const rows = (await this.pool.query(`select b.value as bucket, d.value as val, count(*) as n from index_rows, jsonb_array_elements_text(buckets -> '${f.replace(/'/g, "''")}') b, jsonb_array_elements_text(buckets -> '${d.replace(/'/g, "''")}') d where ${but.sql} group by b.value, d.value`, but.ps)).rows;
|
|
399
|
+
for (const r of rows) {
|
|
400
|
+
const slot = (inner[r.bucket] ??= {});
|
|
401
|
+
(slot[d] ??= {})[r.val] = Number(r.n);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
nested[f] = inner;
|
|
405
|
+
}
|
|
406
|
+
// The values listed (0.3.80): the first the selection's rows carry in the view's order, each counted over
|
|
407
|
+
// the rows the other picks select. One pass per filter, the cost of a tally, kept with it.
|
|
408
|
+
for (const [f, most] of toList) {
|
|
409
|
+
const but = build(f, [most]);
|
|
410
|
+
const rows = (await this.pool.query(`select b.value as bucket, count(*) as n from (select buckets, row_number() over (order by ${order}) as at from index_rows where ${but.sql}) t, jsonb_array_elements_text(t.buckets -> '${f.replace(/'/g, "''")}') b group by b.value order by min(t.at) limit $${but.ps.length}`, but.ps)).rows;
|
|
411
|
+
listed[f] = rows.map((r) => r.bucket);
|
|
412
|
+
counts[f] = { ...(counts[f] ?? {}), ...Object.fromEntries(rows.map((r) => [r.bucket, Number(r.n)])) };
|
|
413
|
+
}
|
|
414
|
+
const made = { total, counts: structuredClone(counts), sums: structuredClone(sums), nested: structuredClone(nested), ...(toList.length ? { listed: structuredClone(listed) } : {}) };
|
|
415
|
+
this.remember(key, made);
|
|
416
|
+
// Kept for every process; the tallies of earlier heads of this view go with it.
|
|
417
|
+
await this.pool.query("insert into index_tallies (key, owner, view, version, audience, seq, json, standard) values ($1, $2, $3, $4, $5, $6, $7, $8) on conflict (key) do nothing", [hashed, owner, view, version, v.show, seq, made, standardAsk]);
|
|
418
|
+
await this.pool.query("delete from index_tallies where owner = $1 and view = $2 and version = $3 and audience = $4 and seq < $5", [owner, view, version, v.show, seq]);
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
// A tally that cannot be built within the statement's time (a catalog under load) leaves the page
|
|
422
|
+
// served with its rows, a bounded total and no counts, never an error (the scale rule, 2026-10-26).
|
|
423
|
+
for (const k of Object.keys(counts))
|
|
424
|
+
delete counts[k];
|
|
425
|
+
for (const k of Object.keys(listed))
|
|
426
|
+
delete listed[k];
|
|
427
|
+
const all = build();
|
|
428
|
+
total = Number((await this.pool.query(`select count(*) as n from (select 1 from index_rows where ${all.sql} limit 10001) t`, all.ps)).rows[0]?.n ?? 0);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const paged = build(undefined, [v.page, (page - 1) * v.page]);
|
|
432
|
+
onPage = (await this.pool.query(`select record, row, buckets, marks, ancestors, sort, pin from index_rows where ${paged.sql} order by ${order} limit $${paged.ps.length - 1} offset $${paged.ps.length}`, paged.ps)).rows;
|
|
433
|
+
}
|
|
434
|
+
const pages = Math.max(1, Math.ceil(total / v.page));
|
|
435
|
+
const indexable = !o.q && !linked && page === 1 && (pickList.length === 0 || (pickList.length === 1 && v.index.includes(pickList[0]?.[0]) && pickList[0]?.[1].length === 1));
|
|
436
|
+
if (o.shape && !v.shapes.includes(o.shape))
|
|
437
|
+
throw Object.assign(new Error(`${view} has no shape ${o.shape}`), { status: 404 });
|
|
438
|
+
const out = onPage.map((r) => {
|
|
439
|
+
const stored = r.row;
|
|
440
|
+
// A further shape (12.1) serves what the store put under shapes; the first shape is the row itself.
|
|
441
|
+
if (o.shape && o.shape !== v.shapes[0])
|
|
442
|
+
return { record: stored.record, ...(isObj(stored.shapes) && stored.shapes[o.shape] !== undefined ? { [o.shape === "crubal:jsonld" ? "jsonld" : o.shape === "crubal:portable" ? "values" : "row"]: stored.shapes[o.shape] } : {}) };
|
|
443
|
+
const row = { ...stored };
|
|
444
|
+
delete row.shapes;
|
|
445
|
+
const marks = isObj(row.marks) ? row.marks : undefined;
|
|
446
|
+
if (marks) {
|
|
447
|
+
for (const [slot, need] of Object.entries(marks)) {
|
|
448
|
+
const needed = Array.isArray(need) ? need : [String(need)];
|
|
449
|
+
if (o.caller !== owner && !needed.some((n) => roles.has(n)))
|
|
450
|
+
delete row[slot];
|
|
451
|
+
}
|
|
452
|
+
delete row.marks;
|
|
453
|
+
}
|
|
454
|
+
delete row.ancestors;
|
|
455
|
+
delete row.linked;
|
|
456
|
+
return row;
|
|
457
|
+
});
|
|
458
|
+
return { view, version, audience: v.show, seq, page, pages, total, rows: out, counts, ...(Object.keys(listed).length ? { listed } : {}), ...(Object.keys(sums).length ? { sums } : {}), ...(Object.keys(nested).length ? { nested } : {}), indexable };
|
|
459
|
+
}
|
|
460
|
+
linkedColumn;
|
|
461
|
+
/**
|
|
462
|
+
* The `linked` column (a `linked <facet>` partition, 12.2) for a store from before it: looked for first,
|
|
463
|
+
* since an add-if-not-exists takes the table's lock before it looks; the add itself waits at most two
|
|
464
|
+
* seconds for the lock, so a serve or an ingest on a serverless host is never held behind a long scan (a
|
|
465
|
+
* request waited 155 s and died with the column still missing, 2026-10-31). A failed look or add is not
|
|
466
|
+
* remembered: the next call tries again. The partial index over the column is the host's migration
|
|
467
|
+
* (schema.sql), never built here: a request may not scan a million rows, and the column alone is correct.
|
|
468
|
+
*/
|
|
469
|
+
linkedReady() {
|
|
470
|
+
this.linkedColumn ??= (async () => {
|
|
471
|
+
const col = await this.pool.query("select 1 from information_schema.columns where table_schema = current_schema() and table_name = 'index_rows' and column_name = 'linked'");
|
|
472
|
+
if (!col.rows.length)
|
|
473
|
+
await this.pool.query("set lock_timeout = '2s'; alter table index_rows add column linked text; set lock_timeout = 0");
|
|
474
|
+
})().then(() => undefined, () => {
|
|
475
|
+
this.linkedColumn = undefined;
|
|
476
|
+
});
|
|
477
|
+
return this.linkedColumn;
|
|
478
|
+
}
|
|
479
|
+
/** Counts and totals per index cursor, picks and search: a few hundred recent answers, the oldest going first. */
|
|
480
|
+
tallies;
|
|
481
|
+
/** The tally table, made once per process for a store migrated before it existed (the schema carries it from 0.3.8). */
|
|
482
|
+
talliesReady() {
|
|
483
|
+
// The column and the index a store from before them lacks: looked for first, since an add-if-not-exists
|
|
484
|
+
// takes the table's lock before it looks (a lesson of 2026-10-25) and the table is hot.
|
|
485
|
+
const upgrade = async () => {
|
|
486
|
+
const col = await this.pool.query("select 1 from information_schema.columns where table_schema = current_schema() and table_name = 'index_tallies' and column_name = 'standard'");
|
|
487
|
+
if (!col.rows.length)
|
|
488
|
+
await this.pool.query("alter table index_tallies add column standard boolean not null default false");
|
|
489
|
+
const idx = await this.pool.query("select 1 from pg_indexes where schemaname = current_schema() and tablename = 'index_tallies' and indexname = 'index_tallies_at'");
|
|
490
|
+
if (!idx.rows.length)
|
|
491
|
+
await this.pool.query("create index index_tallies_at on index_tallies (at)");
|
|
492
|
+
};
|
|
493
|
+
this.tallies ??= this.pool
|
|
494
|
+
.query("create table if not exists index_tallies (key text primary key, owner text not null, view text not null, version text not null, audience text not null, seq bigint not null, json jsonb not null, at timestamptz not null default now()); create index if not exists index_tallies_view on index_tallies (owner, view, version, audience, seq)")
|
|
495
|
+
.then(upgrade)
|
|
496
|
+
.then(() => undefined, () => undefined);
|
|
497
|
+
return this.tallies;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* The tallies gone stale, deleted in batches within a budget: a standard ask's after `standardHours`
|
|
501
|
+
* (a week), any other's after `otherHours` (a day). How many went. The scale rule, 2026-10-26: crawlers
|
|
502
|
+
* walking filter combinations left 274,000 tallies (1.5 GB, more than the records) in three days.
|
|
503
|
+
*/
|
|
504
|
+
async pruneTallies(o = {}) {
|
|
505
|
+
await this.talliesReady();
|
|
506
|
+
const now = o.now ? Date.parse(o.now) : Date.now();
|
|
507
|
+
const std = new Date(now - (o.standardHours ?? 24 * 7) * 3_600_000).toISOString();
|
|
508
|
+
const other = new Date(now - (o.otherHours ?? 24) * 3_600_000).toISOString();
|
|
509
|
+
const batch = o.batch ?? 5000;
|
|
510
|
+
const until = Date.now() + (o.budgetMs ?? 60_000);
|
|
511
|
+
let gone = 0;
|
|
512
|
+
for (;;) {
|
|
513
|
+
const r = await this.pool.query("delete from index_tallies where key in (select key from index_tallies where (standard and at < $1) or (not standard and at < $2) limit $3)", [std, other, batch]);
|
|
514
|
+
gone += r.rowCount ?? 0;
|
|
515
|
+
if ((r.rowCount ?? 0) < batch || Date.now() > until)
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
this.cache.clear();
|
|
519
|
+
return gone;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The tally table's space returned (brief 50, decision 178): a cache written and deleted a thousand rows an
|
|
523
|
+
* hour leaves its disk far past its rows (10 MB of tallies on 1.27 GB, 2026-10-29), and autovacuum reclaims
|
|
524
|
+
* rows, never space. When the table's disk is `ratio` times its live rows and past `minBytes`, it is
|
|
525
|
+
* rewritten in place (`vacuum full`: an exclusive lock for the seconds a small table takes); the bytes
|
|
526
|
+
* freed, or 0 when nothing was owed. Run after a prune, by the same loop.
|
|
527
|
+
*/
|
|
528
|
+
async shrinkTallies(o = {}) {
|
|
529
|
+
await this.talliesReady();
|
|
530
|
+
const ratio = o.ratio ?? 10;
|
|
531
|
+
const minBytes = o.minBytes ?? 64 * 1024 * 1024;
|
|
532
|
+
const size = async () => Number((await this.pool.query("select pg_total_relation_size('index_tallies')::bigint as n")).rows[0]?.n ?? 0);
|
|
533
|
+
const disk = await size();
|
|
534
|
+
const live = Number((await this.pool.query("select coalesce(sum(pg_column_size(t.*)), 0)::bigint as n from index_tallies t")).rows[0]?.n ?? 0);
|
|
535
|
+
if (disk < minBytes || disk <= live * ratio)
|
|
536
|
+
return 0;
|
|
537
|
+
await this.pool.query("vacuum full index_tallies");
|
|
538
|
+
return Math.max(0, disk - (await size()));
|
|
539
|
+
}
|
|
540
|
+
cache = new Map();
|
|
541
|
+
remember(key, value) {
|
|
542
|
+
this.cache.set(key, value);
|
|
543
|
+
while (this.cache.size > 500)
|
|
544
|
+
this.cache.delete(this.cache.keys().next().value);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../src/indexer.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,0GAA0G;AAC1G,yGAAyG;AACzG,gGAAgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAe,WAAW,EAA+B,MAAM,gBAAgB,CAAC;AAKvF,MAAM,KAAK,GAAG,CAAC,CAAmB,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjH,kGAAkG;AAClG,SAAS,MAAM,CAAC,GAAe;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,CAAO,EAAE,EAAE;QACvB,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aACtC,IAAI,KAAK,CAAC,CAAC,CAAC;YAAE,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,C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