@agentshouse/mdruntime 0.1.0-c382efc9f3695 → 0.1.0-c38dcfe165d81
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 +1 -1
- package/dist/adapter.d.ts +23 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +2 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +9 -8
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/client.d.ts +5 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/collection.d.ts +2 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/compile.d.ts +1 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +58 -258
- package/dist/connection.d.ts +5 -5
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +154 -191
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation.d.ts +5 -4
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +25 -36
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +13 -5
- package/dist/host.d.ts +3 -5
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +12 -18
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +2 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +9 -5
- package/dist/memory.d.ts +3 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +5 -5
- package/dist/messages.d.ts +2 -2
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +15 -16
- package/dist/model.d.ts +1 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -3
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +7 -2
- package/dist/query.d.ts +3 -208
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/reach.d.ts +6 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +16 -22
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +0 -2
- package/dist/readiness.d.ts.map +1 -1
- package/dist/replica.d.ts +2 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -1
- package/dist/room-draft.d.ts +4 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +65 -52
- package/dist/rows.d.ts +1 -17
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +4 -137
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/store.d.ts +3 -6
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +8 -13
- package/dist/stored.d.ts +0 -1
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +34 -99
- package/dist/tables.d.ts +6 -5
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +8 -12
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +4 -1
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +1 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +1 -0
- package/package.json +2 -2
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -370
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -156
package/dist/compile.js
CHANGED
|
@@ -1,125 +1,11 @@
|
|
|
1
|
-
import { ARRAY_INDEX, parse, pointerSegments } from '@agentshouse/mdmodel';
|
|
1
|
+
import { ARRAY_INDEX, bodied, byCodePoint, compared, cursorOf, heldKind, parse, pointerSegments, sql, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { binaryRecord } from './binary.js';
|
|
3
|
-
import { documentKey,
|
|
4
|
-
import {
|
|
3
|
+
import { documentKey, pathOfKey, roomOfKey } from './rows.js';
|
|
4
|
+
import { FROM_START, MAXIMUM_WINDOW } from './windows.js';
|
|
5
|
+
const { all, any, exists, fragment, grouped, joined, listed } = sql;
|
|
5
6
|
const VISIBLE = (alias) => `${alias}.visible = 1 AND ${alias}.present = 1 AND ${alias}.queried = 1`;
|
|
6
|
-
function
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
function joined(parts, separator) {
|
|
10
|
-
return {
|
|
11
|
-
sql: parts.map((part) => part.sql).join(separator),
|
|
12
|
-
bind: parts.flatMap((part) => part.bind),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function balanced(parts, separator) {
|
|
16
|
-
if (parts.length === 1)
|
|
17
|
-
return grouped(parts[0]);
|
|
18
|
-
const half = Math.ceil(parts.length / 2);
|
|
19
|
-
return grouped(joined([balanced(parts.slice(0, half), separator), balanced(parts.slice(half), separator)], separator));
|
|
20
|
-
}
|
|
21
|
-
function all(parts) {
|
|
22
|
-
return parts.length === 0 ? fragment('1') : balanced(parts, ' AND ');
|
|
23
|
-
}
|
|
24
|
-
function any(parts) {
|
|
25
|
-
return parts.length === 0 ? fragment('0') : balanced(parts, ' OR ');
|
|
26
|
-
}
|
|
27
|
-
function grouped(part) {
|
|
28
|
-
return { sql: `(${part.sql})`, bind: part.bind };
|
|
29
|
-
}
|
|
30
|
-
function list(values) {
|
|
31
|
-
return fragment(`(${values.map(() => '?').join(', ')})`, values);
|
|
32
|
-
}
|
|
33
|
-
function sqlValue(value) {
|
|
34
|
-
if (value === null)
|
|
35
|
-
return { kind: 'null', value: null };
|
|
36
|
-
if (typeof value === 'boolean')
|
|
37
|
-
return { kind: 'boolean', value: value ? 1 : 0 };
|
|
38
|
-
if (typeof value === 'number')
|
|
39
|
-
return { kind: 'number', value };
|
|
40
|
-
return { kind: 'string', value };
|
|
41
|
-
}
|
|
42
|
-
function same(alias, value) {
|
|
43
|
-
const held = sqlValue(value);
|
|
44
|
-
return held.kind === 'null'
|
|
45
|
-
? fragment(`${alias}.kind = 'null'`)
|
|
46
|
-
: fragment(`${alias}.kind = ? AND ${alias}.value = ?`, [held.kind, held.value]);
|
|
47
|
-
}
|
|
48
|
-
const BOUNDS = { gt: '>', gte: '>=', lt: '<', lte: '<=' };
|
|
49
|
-
function pointed(alias, field, reach) {
|
|
50
|
-
const { keys, places, glob } = placedOf(field, reach);
|
|
51
|
-
return fragment(`${alias}.keys = ? AND ${alias}.places ${glob ? 'GLOB' : '='} ?`, [keys, places]);
|
|
52
|
-
}
|
|
53
|
-
function heldValues(doc, field, alias, where) {
|
|
54
|
-
return joined([
|
|
55
|
-
fragment(`SELECT 1 FROM replica_values ${alias} WHERE ${alias}.doc = ${doc}.id AND `),
|
|
56
|
-
grouped(pointed(alias, field, 'value')),
|
|
57
|
-
fragment(' AND '),
|
|
58
|
-
grouped(where),
|
|
59
|
-
], '');
|
|
60
|
-
}
|
|
61
|
-
function exists(part) {
|
|
62
|
-
return { sql: `EXISTS (${part.sql})`, bind: part.bind };
|
|
63
|
-
}
|
|
64
|
-
function itemOf(held, where) {
|
|
65
|
-
return exists(joined([
|
|
66
|
-
fragment(`SELECT 1 FROM replica_values i WHERE i.doc = ${held}.doc AND i.keys = ${held}.keys AND i.places = ${held}.places AND i.item >= 0 AND `),
|
|
67
|
-
grouped(where),
|
|
68
|
-
], ''));
|
|
69
|
-
}
|
|
70
|
-
function matching(held, values) {
|
|
71
|
-
return any(values.map((value) => any([
|
|
72
|
-
same(held, value),
|
|
73
|
-
all([fragment(`${held}.kind = 'array'`), itemOf(held, same('i', value))]),
|
|
74
|
-
])));
|
|
75
|
-
}
|
|
76
|
-
function tested(doc, field, test) {
|
|
77
|
-
const reached = exists(heldValues(doc, field, 'r', fragment('r.item = -1')));
|
|
78
|
-
if (test.op === 'exists')
|
|
79
|
-
return test.exists ? reached : fragment(`NOT ${reached.sql}`, reached.bind);
|
|
80
|
-
if (test.op === 'eq' || test.op === 'in') {
|
|
81
|
-
const values = test.op === 'eq' ? [test.value] : test.values;
|
|
82
|
-
return exists(heldValues(doc, field, 'v', any(values.map((value) => same('v', value)))));
|
|
83
|
-
}
|
|
84
|
-
if (test.op === 'ne' || test.op === 'nin') {
|
|
85
|
-
const values = test.op === 'ne' ? [test.value] : test.values;
|
|
86
|
-
const unmatched = matching('h', values);
|
|
87
|
-
return any([
|
|
88
|
-
fragment(`NOT ${reached.sql}`, reached.bind),
|
|
89
|
-
exists(heldValues(doc, field, 'h', all([fragment('h.item = -1'), fragment(`NOT (${unmatched.sql})`, unmatched.bind)]))),
|
|
90
|
-
]);
|
|
91
|
-
}
|
|
92
|
-
if (test.op === 'range') {
|
|
93
|
-
return exists(heldValues(doc, field, 'v', all([
|
|
94
|
-
fragment('v.item = -1'),
|
|
95
|
-
...test.bounds.map(([operator, bound]) => {
|
|
96
|
-
const held = sqlValue(bound);
|
|
97
|
-
return fragment(`v.kind = ? AND v.value ${BOUNDS[operator]} ?`, [
|
|
98
|
-
held.kind,
|
|
99
|
-
held.value,
|
|
100
|
-
]);
|
|
101
|
-
}),
|
|
102
|
-
])));
|
|
103
|
-
}
|
|
104
|
-
if (test.op === 'all') {
|
|
105
|
-
return exists(heldValues(doc, field, 'h', all([
|
|
106
|
-
fragment("h.item = -1 AND h.kind = 'array'"),
|
|
107
|
-
...test.values.map((value) => itemOf('h', same('i', value))),
|
|
108
|
-
])));
|
|
109
|
-
}
|
|
110
|
-
return exists(heldValues(doc, field, 'v', fragment("v.item = -1 AND v.kind = 'array' AND v.size = ?", [test.size])));
|
|
111
|
-
}
|
|
112
|
-
function conditioned(doc, condition) {
|
|
113
|
-
if ('every' in condition)
|
|
114
|
-
return all(condition.every.map((one) => conditioned(doc, one)));
|
|
115
|
-
if ('some' in condition)
|
|
116
|
-
return any(condition.some.map((one) => conditioned(doc, one)));
|
|
117
|
-
return tested(doc, condition.field, condition.test);
|
|
118
|
-
}
|
|
119
|
-
function located(bound, alias) {
|
|
120
|
-
if (bound.rooms.length === 0)
|
|
121
|
-
return fragment("''");
|
|
122
|
-
return fragment(`CASE ${alias}.key ${bound.rooms.map(() => 'WHEN ? THEN ?').join(' ')} END`, bound.rooms.flatMap(({ key, locator }) => [key, locator]));
|
|
7
|
+
function located(alias) {
|
|
8
|
+
return fragment(`(SELECT k.locator FROM replica_keys k WHERE k.key = ${alias}.key)`);
|
|
123
9
|
}
|
|
124
10
|
function within(alias, path) {
|
|
125
11
|
return fragment(`(${alias}.path = ? OR (${alias}.path >= ? AND ${alias}.path < ?))`, [
|
|
@@ -164,7 +50,7 @@ function reached(bound, alias) {
|
|
|
164
50
|
}));
|
|
165
51
|
return all([
|
|
166
52
|
any([
|
|
167
|
-
...(rooms.length === 0 ? [] : [fragment(`${alias}.key IN ${
|
|
53
|
+
...(rooms.length === 0 ? [] : [fragment(`${alias}.key IN ${listed(rooms).sql}`, rooms)]),
|
|
168
54
|
...(documents.length === 0
|
|
169
55
|
? []
|
|
170
56
|
: [
|
|
@@ -174,40 +60,22 @@ function reached(bound, alias) {
|
|
|
174
60
|
...(reach.areas.length === 0 ? [] : [fragment(`NOT ${grouped(outside).sql}`, outside.bind)]),
|
|
175
61
|
]);
|
|
176
62
|
}
|
|
177
|
-
function unindexed(column) {
|
|
178
|
-
return `+${column}`;
|
|
179
|
-
}
|
|
180
|
-
function scoped(alias, scope, byPaths = false) {
|
|
181
|
-
const type = byPaths ? unindexed(`${alias}.type`) : `${alias}.type`;
|
|
182
|
-
return all([
|
|
183
|
-
...(scope.types === null ? [] : [fragment(`${type} IN ${list(scope.types).sql}`, scope.types)]),
|
|
184
|
-
...(scope.pathPrefix === null || scope.pathPrefix === ''
|
|
185
|
-
? []
|
|
186
|
-
: [
|
|
187
|
-
fragment(`${alias}.path >= ? AND ${alias}.path < ?`, [
|
|
188
|
-
`${scope.pathPrefix}/`,
|
|
189
|
-
`${scope.pathPrefix}0`,
|
|
190
|
-
]),
|
|
191
|
-
]),
|
|
192
|
-
...(scope.where === null ? [] : [conditioned(alias, scope.where)]),
|
|
193
|
-
]);
|
|
194
|
-
}
|
|
195
63
|
function related(bound, plan) {
|
|
196
64
|
const parts = [];
|
|
197
65
|
if (plan.hop !== null) {
|
|
198
66
|
parts.push(exists(joined([
|
|
199
67
|
fragment(`SELECT 1 FROM replica_links l JOIN replica_entries m ON m.key = d.key AND m.path = l.target AND ${VISIBLE('m')} WHERE l.doc = d.id AND l.kind = 'field' AND`),
|
|
200
|
-
grouped(
|
|
68
|
+
grouped(sql.placed('l', plan.hop.field, 'link')),
|
|
201
69
|
fragment('AND'),
|
|
202
|
-
grouped(all([scoped('m', plan.hop), reached(bound, 'm')])),
|
|
70
|
+
grouped(all([sql.scoped('m', plan.hop), reached(bound, 'm')])),
|
|
203
71
|
], ' ')));
|
|
204
72
|
}
|
|
205
73
|
if (plan.backlinks !== null) {
|
|
206
74
|
const field = plan.backlinks.field;
|
|
207
75
|
parts.push(exists(joined([
|
|
208
76
|
fragment(`SELECT 1 FROM replica_links l JOIN replica_entries s ON s.id = l.doc AND ${VISIBLE('s')} WHERE l.key = d.key AND l.target = d.path AND l.kind = 'field' AND`),
|
|
209
|
-
...(field === null ? [] : [grouped(
|
|
210
|
-
grouped(all([scoped('s', plan.backlinks), reached(bound, 's')])),
|
|
77
|
+
...(field === null ? [] : [grouped(sql.placed('l', field, 'link')), fragment('AND')]),
|
|
78
|
+
grouped(all([sql.scoped('s', plan.backlinks), reached(bound, 's')])),
|
|
211
79
|
], ' ')));
|
|
212
80
|
}
|
|
213
81
|
return parts;
|
|
@@ -215,11 +83,9 @@ function related(bound, plan) {
|
|
|
215
83
|
function filtered(bound, plan) {
|
|
216
84
|
const keys = bound.rooms.map(({ key }) => key);
|
|
217
85
|
return all([
|
|
218
|
-
fragment(`d.key IN ${
|
|
219
|
-
...(plan.paths === null ? [] : [fragment(`d.path IN ${list(plan.paths).sql}`, plan.paths)]),
|
|
220
|
-
...(plan.folder === null ? [] : [fragment('d.folder = ?', [plan.folder])]),
|
|
86
|
+
fragment(`d.key IN ${listed(keys).sql} AND ${VISIBLE('d')}`, keys),
|
|
221
87
|
reached(bound, 'd'),
|
|
222
|
-
|
|
88
|
+
sql.tests('d', plan),
|
|
223
89
|
...related(bound, plan),
|
|
224
90
|
]);
|
|
225
91
|
}
|
|
@@ -250,103 +116,25 @@ const GROUP_TIES = {
|
|
|
250
116
|
locale: undefined,
|
|
251
117
|
localeOptions: undefined,
|
|
252
118
|
};
|
|
253
|
-
function
|
|
254
|
-
if (value === null || value === undefined) {
|
|
255
|
-
return { placement: ordering.nulls === 'first' ? 0 : 2, klass: 0, scalar: null };
|
|
256
|
-
}
|
|
257
|
-
if (typeof value === 'boolean')
|
|
258
|
-
return { placement: 1, klass: 1, scalar: value ? 1 : 0 };
|
|
259
|
-
if (typeof value === 'number')
|
|
260
|
-
return { placement: 1, klass: 1, scalar: value };
|
|
261
|
-
if (typeof value === 'string')
|
|
262
|
-
return { placement: 1, klass: 2, scalar: value };
|
|
263
|
-
return { placement: 1, klass: 3, scalar: JSON.stringify(value) };
|
|
264
|
-
}
|
|
265
|
-
function placement(term) {
|
|
266
|
-
const nulls = term.ordering.nulls === 'first' ? 0 : 2;
|
|
267
|
-
return fragment(`CASE WHEN ${term.kind.sql} IS NULL OR ${term.kind.sql} = 'null' THEN ${nulls} ELSE 1 END`, [...term.kind.bind, ...term.kind.bind]);
|
|
268
|
-
}
|
|
269
|
-
function klass(term) {
|
|
270
|
-
return fragment(`CASE ${term.kind.sql} WHEN 'boolean' THEN 1 WHEN 'number' THEN 1 WHEN 'string' THEN 2 WHEN 'array' THEN 3 ELSE 4 END`, term.kind.bind);
|
|
271
|
-
}
|
|
272
|
-
function classed(term, which) {
|
|
273
|
-
const kinds = which === 1 ? "('boolean', 'number')" : which === 2 ? "('string')" : "('array')";
|
|
274
|
-
return fragment(`(CASE WHEN ${term.kind.sql} IN ${kinds} THEN ${term.value.sql} END)`, [
|
|
275
|
-
...term.kind.bind,
|
|
276
|
-
...term.value.bind,
|
|
277
|
-
]);
|
|
278
|
-
}
|
|
279
|
-
function collated(bound, term, which) {
|
|
280
|
-
if (which === 1)
|
|
281
|
-
return '';
|
|
282
|
-
const name = bound.collate(term.ordering, which === 3, term.total === true);
|
|
283
|
-
return name === null ? '' : ` COLLATE ${name}`;
|
|
284
|
-
}
|
|
285
|
-
function sorted(bound, term) {
|
|
286
|
-
const direction = term.ordering.direction === 'desc' ? 'DESC' : 'ASC';
|
|
287
|
-
return joined([
|
|
288
|
-
placement(term),
|
|
289
|
-
fragment(`${klass(term).sql} ${direction}`, klass(term).bind),
|
|
290
|
-
...[1, 2, 3].map((which) => {
|
|
291
|
-
const value = classed(term, which);
|
|
292
|
-
return fragment(`${value.sql}${collated(bound, term, which)} ${direction}`, value.bind);
|
|
293
|
-
}),
|
|
294
|
-
], ', ');
|
|
295
|
-
}
|
|
296
|
-
function beyond(bound, term, value) {
|
|
297
|
-
const held = classOf(value, term.ordering);
|
|
298
|
-
const place = placement(term);
|
|
299
|
-
if (held.placement !== 1) {
|
|
300
|
-
return {
|
|
301
|
-
beyond: fragment(`${place.sql} > ${held.placement}`, place.bind),
|
|
302
|
-
equal: fragment(`${place.sql} = ${held.placement}`, place.bind),
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
const after = term.ordering.direction === 'desc' ? '<' : '>';
|
|
306
|
-
const kind = klass(term);
|
|
307
|
-
const scalar = classed(term, held.klass);
|
|
308
|
-
const collation = collated(bound, term, held.klass);
|
|
309
|
-
return {
|
|
310
|
-
beyond: any([
|
|
311
|
-
fragment(`${place.sql} > 1`, place.bind),
|
|
312
|
-
all([
|
|
313
|
-
fragment(`${place.sql} = 1`, place.bind),
|
|
314
|
-
any([
|
|
315
|
-
fragment(`${kind.sql} ${after} ${held.klass}`, kind.bind),
|
|
316
|
-
all([
|
|
317
|
-
fragment(`${kind.sql} = ${held.klass}`, kind.bind),
|
|
318
|
-
fragment(`${scalar.sql} ${after} ?${collation}`, [...scalar.bind, held.scalar]),
|
|
319
|
-
]),
|
|
320
|
-
]),
|
|
321
|
-
]),
|
|
322
|
-
]),
|
|
323
|
-
equal: all([
|
|
324
|
-
fragment(`${place.sql} = 1 AND ${kind.sql} = ${held.klass}`, [...place.bind, ...kind.bind]),
|
|
325
|
-
fragment(`${scalar.sql} = ?${collation}`, [...scalar.bind, held.scalar]),
|
|
326
|
-
]),
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function following(parts, tie) {
|
|
330
|
-
let condition = tie;
|
|
331
|
-
for (const part of [...parts].reverse()) {
|
|
332
|
-
condition = any([part.beyond, all([part.equal, condition])]);
|
|
333
|
-
}
|
|
334
|
-
return condition;
|
|
335
|
-
}
|
|
336
|
-
function keyTerm(bound, key, ordering, index) {
|
|
119
|
+
function keyTerm(key, ordering, index) {
|
|
337
120
|
if (key.of === 'field') {
|
|
338
121
|
const alias = `o${index}`;
|
|
339
122
|
return {
|
|
340
|
-
term: {
|
|
123
|
+
term: {
|
|
124
|
+
ordering,
|
|
125
|
+
kind: fragment(`${alias}.kind`),
|
|
126
|
+
value: fragment(`${alias}.value`),
|
|
127
|
+
instant: fragment(`${alias}.instant`),
|
|
128
|
+
},
|
|
341
129
|
join: joined([
|
|
342
130
|
fragment(`LEFT JOIN replica_values ${alias} ON ${alias}.doc = d.id AND `),
|
|
343
|
-
grouped(
|
|
131
|
+
grouped(sql.placed(alias, key.field, 'exact')),
|
|
344
132
|
fragment(` AND ${alias}.item = -1 AND ${alias}.kind NOT IN ('object', 'undefined')`),
|
|
345
133
|
], ''),
|
|
346
134
|
};
|
|
347
135
|
}
|
|
348
136
|
const expression = key.of === 'room'
|
|
349
|
-
? located(
|
|
137
|
+
? located('d')
|
|
350
138
|
: key.of === 'path'
|
|
351
139
|
? fragment('d.path')
|
|
352
140
|
: key.of === 'type'
|
|
@@ -372,13 +160,20 @@ function decoded(kind, value) {
|
|
|
372
160
|
return JSON.parse(value);
|
|
373
161
|
return null;
|
|
374
162
|
}
|
|
163
|
+
function sortedValue(row, index) {
|
|
164
|
+
const kind = row[`k${index}`];
|
|
165
|
+
return sql.sortValue(kind, decoded(kind, row[`v${index}`]), row[`i${index}`]);
|
|
166
|
+
}
|
|
375
167
|
function decodedKey(key, row, index) {
|
|
376
168
|
if (key.of === 'field') {
|
|
377
169
|
const kind = row[`k${index}`];
|
|
378
|
-
return kind === null || kind === undefined ? undefined :
|
|
170
|
+
return kind === null || kind === undefined ? undefined : sortedValue(row, index);
|
|
379
171
|
}
|
|
380
172
|
return row[`v${index}`] ?? null;
|
|
381
173
|
}
|
|
174
|
+
function instantOf(term) {
|
|
175
|
+
return term.instant ?? fragment('NULL');
|
|
176
|
+
}
|
|
382
177
|
const registered = new WeakMap();
|
|
383
178
|
function hashed(text) {
|
|
384
179
|
let hash = 0x811c9dc5;
|
|
@@ -428,9 +223,6 @@ function collating(connection) {
|
|
|
428
223
|
return name;
|
|
429
224
|
};
|
|
430
225
|
}
|
|
431
|
-
function bodied(shape) {
|
|
432
|
-
return shape.sections !== null || shape.preamble || shape.markdown;
|
|
433
|
-
}
|
|
434
226
|
function masked(pointers) {
|
|
435
227
|
const root = { whole: false, members: new Map() };
|
|
436
228
|
for (const pointer of pointers) {
|
|
@@ -555,10 +347,10 @@ function backlinksOf(connection, bound, rows) {
|
|
|
555
347
|
return linked;
|
|
556
348
|
}
|
|
557
349
|
function documents(connection, bound, plan, shape, budget) {
|
|
558
|
-
const terms = shape.orderBy.map(({ key, options }, index) => keyTerm(
|
|
350
|
+
const terms = shape.orderBy.map(({ key, options }, index) => keyTerm(key, orderingOf(options), index));
|
|
559
351
|
const filter = filtered(bound, plan);
|
|
560
352
|
const cursor = plan.after?.values ?? null;
|
|
561
|
-
const room = located(
|
|
353
|
+
const room = located('d');
|
|
562
354
|
const tie = cursor === null
|
|
563
355
|
? null
|
|
564
356
|
: (() => {
|
|
@@ -574,19 +366,20 @@ function documents(connection, bound, plan, shape, budget) {
|
|
|
574
366
|
})();
|
|
575
367
|
const after = cursor === null || tie === null
|
|
576
368
|
? null
|
|
577
|
-
: following(terms.map(({ term }, index) => beyond(bound, term, cursor[index])), tie);
|
|
369
|
+
: sql.following(terms.map(({ term }, index) => sql.beyond(bound.collate, term, cursor[index])), tie);
|
|
578
370
|
const selected = joined([
|
|
579
371
|
fragment('SELECT d.id, d.key, d.path, d.type, d.binary, d.revision, d.fields, d.change, d.file_id'),
|
|
580
372
|
...terms.map(({ term }, index) => joined([
|
|
581
373
|
fragment(`, ${term.kind.sql} AS k${index}`, term.kind.bind),
|
|
582
374
|
fragment(`, ${term.value.sql} AS v${index}`, term.value.bind),
|
|
375
|
+
fragment(`, ${instantOf(term).sql} AS i${index}`, instantOf(term).bind),
|
|
583
376
|
], '')),
|
|
584
377
|
fragment(' FROM replica_entries d'),
|
|
585
378
|
...terms.flatMap(({ join }) => (join === null ? [] : [fragment(' '), join])),
|
|
586
379
|
fragment(' WHERE '),
|
|
587
380
|
after === null ? filter : all([filter, after]),
|
|
588
381
|
fragment(' ORDER BY '),
|
|
589
|
-
joined([...terms.map(({ term }) => sorted(bound, term)), room, fragment('d.path')], ', '),
|
|
382
|
+
joined([...terms.map(({ term }) => sql.sorted(bound.collate, term)), room, fragment('d.path')], ', '),
|
|
590
383
|
...(plan.limit === null ? [] : [fragment(' LIMIT ?', [plan.limit + 1])]),
|
|
591
384
|
], '');
|
|
592
385
|
const rows = connection.rows(selected.sql, selected.bind);
|
|
@@ -625,7 +418,7 @@ function withContent(connection, rows, budget) {
|
|
|
625
418
|
return rows;
|
|
626
419
|
const ids = rows.map((row) => row.id);
|
|
627
420
|
const sizes = new Map(connection
|
|
628
|
-
.rows(`SELECT id, octet_length(content) AS size FROM replica_entries WHERE id IN ${
|
|
421
|
+
.rows(`SELECT id, octet_length(content) AS size FROM replica_entries WHERE id IN ${listed(ids).sql}`, ids)
|
|
629
422
|
.map((row) => [row.id, Number(row.size ?? 0)]));
|
|
630
423
|
let cut = rows.length;
|
|
631
424
|
let spent = 0;
|
|
@@ -640,12 +433,14 @@ function withContent(connection, rows, budget) {
|
|
|
640
433
|
const kept = rows.slice(0, cut);
|
|
641
434
|
const read = kept.map((row) => row.id);
|
|
642
435
|
const held = new Map(connection
|
|
643
|
-
.rows(`SELECT id, content FROM replica_entries WHERE id IN ${
|
|
436
|
+
.rows(`SELECT id, content FROM replica_entries WHERE id IN ${listed(read).sql}`, read)
|
|
644
437
|
.map((row) => [row.id, row.content]));
|
|
645
438
|
return kept.map((row) => ({ ...row, content: held.get(row.id) ?? null }));
|
|
646
439
|
}
|
|
647
440
|
function storedFolders(bound, plan) {
|
|
648
|
-
if (plan.paths !== null || plan.
|
|
441
|
+
if (plan.paths !== null || plan.fileIds !== null)
|
|
442
|
+
return null;
|
|
443
|
+
if (plan.hop !== null || plan.backlinks !== null)
|
|
649
444
|
return null;
|
|
650
445
|
const whole = bound.rooms.filter(({ locator }) => bound.reach === null || bound.reach.rooms.includes(locator));
|
|
651
446
|
if (whole.length === 0)
|
|
@@ -660,7 +455,7 @@ function storedFolders(bound, plan) {
|
|
|
660
455
|
return [fragment(`NOT ${grouped(fence).sql}`, fence.bind)];
|
|
661
456
|
});
|
|
662
457
|
return all([
|
|
663
|
-
fragment(`f.key IN ${
|
|
458
|
+
fragment(`f.key IN ${listed(keys).sql} AND f.layer = 0 AND f.present = 1`, keys),
|
|
664
459
|
...outside,
|
|
665
460
|
...(prefix === null || prefix === ''
|
|
666
461
|
? []
|
|
@@ -676,7 +471,7 @@ function storedFolders(bound, plan) {
|
|
|
676
471
|
}
|
|
677
472
|
function groups(connection, bound, plan, shape) {
|
|
678
473
|
const keyed = shape.groupBy.map((key, index) => {
|
|
679
|
-
const { term, join } = keyTerm(
|
|
474
|
+
const { term, join } = keyTerm(key, GROUP_ORDER, index);
|
|
680
475
|
const kind = fragment(`COALESCE(${term.kind.sql}, 'null')`, term.kind.bind);
|
|
681
476
|
return { term: { ...term, kind }, join };
|
|
682
477
|
});
|
|
@@ -686,6 +481,7 @@ function groups(connection, bound, plan, shape) {
|
|
|
686
481
|
joined(keyed.map(({ term }, index) => joined([
|
|
687
482
|
fragment(`${term.kind.sql} AS k${index}`, term.kind.bind),
|
|
688
483
|
fragment(`, ${term.value.sql} AS v${index}`, term.value.bind),
|
|
484
|
+
fragment(`, ${instantOf(term).sql} AS i${index}`, instantOf(term).bind),
|
|
689
485
|
], '')), ', '),
|
|
690
486
|
fragment(', 1 AS n FROM replica_entries d'),
|
|
691
487
|
...keyed.flatMap(({ join }) => (join === null ? [] : [fragment(' '), join])),
|
|
@@ -699,10 +495,15 @@ function groups(connection, bound, plan, shape) {
|
|
|
699
495
|
? inner
|
|
700
496
|
: joined([
|
|
701
497
|
inner,
|
|
702
|
-
fragment(" UNION ALL SELECT 'string' AS k0, f.path AS v0, 0 AS n FROM replica_folders f WHERE "),
|
|
498
|
+
fragment(" UNION ALL SELECT 'string' AS k0, f.path AS v0, NULL AS i0, 0 AS n FROM replica_folders f WHERE "),
|
|
703
499
|
folders,
|
|
704
500
|
], '');
|
|
705
|
-
const columns = keyed
|
|
501
|
+
const columns = keyed
|
|
502
|
+
.map((_, index) => `k${index}, min(v${index}) AS v${index}, i${index}`)
|
|
503
|
+
.join(', ');
|
|
504
|
+
const held = keyed
|
|
505
|
+
.map((_, index) => `k${index}, i${index}, CASE WHEN i${index} IS NULL THEN v${index} END`)
|
|
506
|
+
.join(', ');
|
|
706
507
|
const counted = {
|
|
707
508
|
ordering: { ...GROUP_ORDER },
|
|
708
509
|
kind: fragment("'number'"),
|
|
@@ -715,7 +516,7 @@ function groups(connection, bound, plan, shape) {
|
|
|
715
516
|
});
|
|
716
517
|
const ordered = shape.orderBy.map(({ by, direction }) => by === 'count'
|
|
717
518
|
? { ...counted, ordering: { ...GROUP_ORDER, direction } }
|
|
718
|
-
: outer(by, { ...GROUP_ORDER, direction }));
|
|
519
|
+
: { ...outer(by, { ...GROUP_ORDER, direction }), instant: fragment(`i${by}`) });
|
|
719
520
|
const ties = keyed.flatMap((_, index) => [
|
|
720
521
|
{ ...outer(index, GROUP_TIES), total: true },
|
|
721
522
|
{ ordering: GROUP_TIES, kind: fragment("'string'"), value: fragment(`k${index}`) },
|
|
@@ -725,19 +526,21 @@ function groups(connection, bound, plan, shape) {
|
|
|
725
526
|
? null
|
|
726
527
|
: cursor[shape.orderBy.length].flatMap((value) => [
|
|
727
528
|
value,
|
|
728
|
-
|
|
529
|
+
heldKind(value ?? null),
|
|
729
530
|
]);
|
|
730
531
|
const after = cursor === null || tieValues === null
|
|
731
532
|
? null
|
|
732
|
-
: following(ordered.map((term, index) => beyond(bound, term, cursor[index])), following(ties
|
|
733
|
-
|
|
533
|
+
: sql.following(ordered.map((term, index) => sql.beyond(bound.collate, term, cursor[index])), sql.following(ties
|
|
534
|
+
.slice(0, -1)
|
|
535
|
+
.map((term, index) => sql.beyond(bound.collate, term, tieValues[index])), sql.beyond(bound.collate, ties.at(-1), tieValues.at(-1)).beyond));
|
|
536
|
+
const grouping = joined([fragment(`SELECT ${columns}, sum(n) AS n FROM (`), source, fragment(`) GROUP BY ${held}`)], '');
|
|
734
537
|
const windowed = joined([
|
|
735
538
|
fragment('SELECT * FROM ('),
|
|
736
539
|
grouping,
|
|
737
540
|
fragment(')'),
|
|
738
541
|
...(after === null ? [] : [fragment(' WHERE '), after]),
|
|
739
542
|
fragment(' ORDER BY '),
|
|
740
|
-
joined([...ordered, ...ties].map((term) => sorted(bound, term)), ', '),
|
|
543
|
+
joined([...ordered, ...ties].map((term) => sql.sorted(bound.collate, term)), ', '),
|
|
741
544
|
...(plan.limit === null ? [] : [fragment(' LIMIT ?', [plan.limit + 1])]),
|
|
742
545
|
], '');
|
|
743
546
|
const rows = connection.rows(windowed.sql, windowed.bind);
|
|
@@ -750,7 +553,7 @@ function groups(connection, bound, plan, shape) {
|
|
|
750
553
|
: last === undefined
|
|
751
554
|
? (plan.after?.text ?? FROM_START)
|
|
752
555
|
: cursorOf([
|
|
753
|
-
...shape.orderBy.map(({ by }) => by === 'count' ? Number(last.n) :
|
|
556
|
+
...shape.orderBy.map(({ by }) => by === 'count' ? Number(last.n) : sortedValue(last, by)),
|
|
754
557
|
keyOf(last),
|
|
755
558
|
]);
|
|
756
559
|
const total = plan.total
|
|
@@ -770,9 +573,6 @@ function boundOf(connection, plan, rooms) {
|
|
|
770
573
|
collate: collating(connection),
|
|
771
574
|
};
|
|
772
575
|
}
|
|
773
|
-
export function selected(connection, plan, rooms) {
|
|
774
|
-
return filtered(boundOf(connection, plan, rooms), plan);
|
|
775
|
-
}
|
|
776
576
|
export function answerQuery(connection, plan, rooms, budget = null) {
|
|
777
577
|
const bound = boundOf(connection, plan, rooms);
|
|
778
578
|
if (rooms.length === 0) {
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type DocumentQuery, type GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import { type TypesResult } from './model.js';
|
|
2
3
|
import { type Observation } from './observation.js';
|
|
3
|
-
import { type
|
|
4
|
+
import { type DocumentResult, type GroupResult, type PendingResult } from './query.js';
|
|
4
5
|
import { type EntrySeed } from './seed.js';
|
|
5
6
|
import { type SearchRequest, type SearchResult } from './search.js';
|
|
6
7
|
import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
|
|
@@ -13,7 +14,7 @@ import { type SaveRefusal } from './save.js';
|
|
|
13
14
|
import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
|
|
14
15
|
import { type SyncStatus } from './status.js';
|
|
15
16
|
import { type RuntimeShell } from './durability.js';
|
|
16
|
-
import { type CodeAvailability, type Persistence, type Readiness
|
|
17
|
+
import { type CodeAvailability, type Persistence, type Readiness } from './readiness.js';
|
|
17
18
|
import type { RuntimeDatabase } from './tables.js';
|
|
18
19
|
import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
|
|
19
20
|
export type AppTypedSelection = {
|
|
@@ -124,6 +125,7 @@ export type MdRuntime = {
|
|
|
124
125
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
125
126
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
126
127
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
128
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
127
129
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
128
130
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
129
131
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -135,12 +137,10 @@ export type MdRuntime = {
|
|
|
135
137
|
};
|
|
136
138
|
reauthorize(): Promise<void>;
|
|
137
139
|
};
|
|
138
|
-
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
|
|
140
|
+
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
|
|
139
141
|
export type ReadinessPort = {
|
|
140
142
|
readonly target: string;
|
|
141
143
|
readonly code: CodeAvailability;
|
|
142
|
-
readonly space: Space | null;
|
|
143
|
-
readonly search: SearchObligation;
|
|
144
144
|
};
|
|
145
145
|
export type ComposedRuntime = RuntimeView & {
|
|
146
146
|
seed(entry: EntrySeed): void;
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"m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