@agentshouse/mdruntime 0.1.0-c8ca66ac9e99d → 0.1.0-c8eac46931574
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 +19 -16
- package/dist/adapter.d.ts +152 -53
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +38 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +27 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +184 -81
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -63
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/client.d.ts +28 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +98 -12
- package/dist/collection.d.ts +10 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +38 -79
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +789 -0
- package/dist/connection.d.ts +44 -16
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3840 -967
- package/dist/conversation.d.ts +39 -17
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +704 -259
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +4 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +152 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/host.d.ts +11 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +127 -17
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +3 -0
- package/dist/index.d.ts +17 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/job.d.ts +8 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +13 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +127 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +16 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +214 -94
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +9 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -2
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +22 -4
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +120 -14
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +49 -7
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +40 -0
- package/dist/overlay.d.ts +3 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +100 -182
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/phrase.d.ts +3 -0
- package/dist/phrase.d.ts.map +1 -0
- package/dist/phrase.js +8 -0
- package/dist/query.d.ts +70 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +67 -7
- package/dist/reach.d.ts +19 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +227 -80
- package/dist/react.d.ts +9 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/readiness.d.ts +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +224 -0
- package/dist/refresh.d.ts +17 -14
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -51
- package/dist/replica.d.ts +55 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +300 -154
- package/dist/room-draft.d.ts +36 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +161 -74
- package/dist/rows.d.ts +38 -37
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +178 -104
- package/dist/save.d.ts +52 -9
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +539 -171
- package/dist/search.d.ts +15 -55
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -0
- package/dist/status.d.ts +5 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +111 -78
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +342 -478
- package/dist/stored.d.ts +162 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +549 -0
- package/dist/tables.d.ts +353 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +585 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +101 -0
- package/dist/windows.d.ts +22 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +89 -0
- package/dist/wire.d.ts +165 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +56 -31
- package/package.json +22 -19
- package/AGENTS.md +0 -299
- package/dist/chat/acts.d.ts +0 -34
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/context.js +0 -10
- package/dist/chat/input.d.ts +0 -9
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -99
- package/dist/chat/kit.d.ts +0 -60
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -26
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -62
- package/dist/chat/markdown.d.ts +0 -20
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -188
- package/dist/chat/message.d.ts +0 -6
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -192
- package/dist/chat/messages.d.ts +0 -21
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -151
- package/dist/chat/name.d.ts +0 -6
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -11
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -17
- package/dist/chat/overlay.d.ts +0 -31
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -97
- package/dist/chat/parts.d.ts +0 -57
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -119
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -63
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -645
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -80
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -33
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -91
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -302
- package/dist/chat.d.ts +0 -14
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -440
package/dist/outcome.js
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
|
+
export const UNREADABLE = {
|
|
2
|
+
kind: 'unreadable',
|
|
3
|
+
code: 'room-not-readable',
|
|
4
|
+
fields: {},
|
|
5
|
+
retryable: false,
|
|
6
|
+
};
|
|
7
|
+
export const LOCKED_UNREADABLE = {
|
|
8
|
+
kind: 'unreadable',
|
|
9
|
+
code: 'room-locked',
|
|
10
|
+
fields: {},
|
|
11
|
+
retryable: true,
|
|
12
|
+
};
|
|
13
|
+
export const ABSENT_TARGET = {
|
|
14
|
+
kind: 'absent',
|
|
15
|
+
code: 'reference-absent',
|
|
16
|
+
fields: {},
|
|
17
|
+
retryable: false,
|
|
18
|
+
};
|
|
1
19
|
export function absentBinary(path) {
|
|
2
20
|
return { kind: 'absent', code: 'binary-file-absent', fields: { path }, retryable: false };
|
|
3
21
|
}
|
|
4
22
|
export function binaryAnswer(result) {
|
|
5
23
|
return result.kind === 'binary' || result.kind === 'rejected' ? result : failure(result);
|
|
6
24
|
}
|
|
25
|
+
const OCTET_STREAM = 'application/octet-stream';
|
|
26
|
+
export function binaryLinkAnswer(result, held) {
|
|
27
|
+
if (result.kind === 'link') {
|
|
28
|
+
return {
|
|
29
|
+
kind: 'link',
|
|
30
|
+
url: result.url,
|
|
31
|
+
name: result.name,
|
|
32
|
+
mediaType: result.mediaType ?? held ?? OCTET_STREAM,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return result.kind === 'rejected' ? result : failure(result);
|
|
36
|
+
}
|
|
37
|
+
export function attachAnswer(result) {
|
|
38
|
+
if (result.kind === 'attached')
|
|
39
|
+
return { kind: 'attached', path: result.path };
|
|
40
|
+
return result.kind === 'rejected' ? result : failure(result);
|
|
41
|
+
}
|
|
42
|
+
export const ROOM_LOCKED = 'room-locked';
|
|
43
|
+
export function lockedRoom(locator) {
|
|
44
|
+
return { kind: ROOM_LOCKED, locator, code: ROOM_LOCKED, fields: {}, retryable: true };
|
|
45
|
+
}
|
|
46
|
+
export const OFFLINE = { kind: 'offline' };
|
|
7
47
|
export const UNCERTAIN = {
|
|
8
48
|
kind: 'transport-uncertainty',
|
|
9
49
|
code: 'transport-uncertainty',
|
package/dist/overlay.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { BinaryFile, HeadChange } from './adapter.js';
|
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type Heads = {
|
|
4
4
|
revisions: Readonly<Record<string, string>>;
|
|
5
|
+
fileIds: Readonly<Record<string, string>>;
|
|
5
6
|
changes: Readonly<Record<string, HeadChange>>;
|
|
6
7
|
};
|
|
7
8
|
export type HeldBinary = ({
|
|
@@ -17,10 +18,8 @@ export type Layer = Heads & {
|
|
|
17
18
|
documents: Readonly<Record<string, string>>;
|
|
18
19
|
binaries: Readonly<Record<string, HeldBinary>>;
|
|
19
20
|
};
|
|
20
|
-
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>):
|
|
21
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
|
|
21
22
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
22
23
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
|
25
|
-
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
|
24
|
+
export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Generator<number, Layer, void>;
|
|
26
25
|
//# sourceMappingURL=overlay.d.ts.map
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAIrE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,UAAU,CAAC,GAC7C;IACE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG;IAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAiB,gBAAgB,CAC/B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC1C,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAE1C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAW/F;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAQ/F;AAqMD,wBAAiB,UAAU,CACzB,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAoChC"}
|
package/dist/overlay.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { apply, parse, serialize } from '@agentshouse/mdmodel';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { apply, frontmatterValue, parse, serialize, } from '@agentshouse/mdmodel';
|
|
2
|
+
import { drafted, entriesIn, settling } from './shared.js';
|
|
3
|
+
import { ROW_WEIGHT } from './turn.js';
|
|
4
|
+
export function* acceptedBinaries(files) {
|
|
5
|
+
for (const [path, file] of entriesIn(files))
|
|
6
|
+
yield [path, { state: 'accepted', ...file }];
|
|
4
7
|
}
|
|
5
8
|
export function sameBinary(left, right) {
|
|
6
9
|
if (left === undefined || right === undefined)
|
|
@@ -10,7 +13,7 @@ export function sameBinary(left, right) {
|
|
|
10
13
|
left.mediaType === right.mediaType &&
|
|
11
14
|
left.sha256 === right.sha256 &&
|
|
12
15
|
(left.state === 'accepted'
|
|
13
|
-
? right.state === 'accepted'
|
|
16
|
+
? right.state === 'accepted'
|
|
14
17
|
: right.state === 'pending' && left.localId === right.localId));
|
|
15
18
|
}
|
|
16
19
|
export function sameChange(left, right) {
|
|
@@ -22,10 +25,13 @@ export function sameChange(left, right) {
|
|
|
22
25
|
left.author?.name === right.author?.name);
|
|
23
26
|
}
|
|
24
27
|
const EMPTY_FRONTMATTER = '---\n---\n';
|
|
28
|
+
function isPart(change) {
|
|
29
|
+
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
30
|
+
}
|
|
25
31
|
function at(path, name) {
|
|
26
32
|
return `${path} ${name}`;
|
|
27
33
|
}
|
|
28
|
-
function priorsOf(preconditions) {
|
|
34
|
+
function* priorsOf(preconditions) {
|
|
29
35
|
const fields = new Map();
|
|
30
36
|
const sections = new Map();
|
|
31
37
|
const preambles = new Map();
|
|
@@ -39,6 +45,7 @@ function priorsOf(preconditions) {
|
|
|
39
45
|
if (precondition.kind === 'preamble') {
|
|
40
46
|
preambles.set(precondition.path, precondition.value);
|
|
41
47
|
}
|
|
48
|
+
yield ROW_WEIGHT;
|
|
42
49
|
}
|
|
43
50
|
return {
|
|
44
51
|
field: (path, name) => fields.get(at(path, name)),
|
|
@@ -54,51 +61,50 @@ function compose(fields, sections) {
|
|
|
54
61
|
const opened = parse(skeleton);
|
|
55
62
|
if (!opened.ok)
|
|
56
63
|
return skeleton;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const next = apply(document, { kind: 'field', name, value, prior: undefined });
|
|
60
|
-
if (next.outcome === 'applied')
|
|
61
|
-
document = next.document;
|
|
62
|
-
}
|
|
63
|
-
return serialize(document);
|
|
64
|
+
const next = apply(opened.document, Object.entries(fields).flatMap(([name, value]) => frontmatterValue(value) ? [{ kind: 'field', name, value, prior: undefined }] : []));
|
|
65
|
+
return serialize(next.outcome === 'applied' ? next.document : opened.document);
|
|
64
66
|
}
|
|
65
|
-
function edited(
|
|
66
|
-
if (change.kind === 'field')
|
|
67
|
-
return
|
|
67
|
+
function edited(change, priors) {
|
|
68
|
+
if (change.kind === 'field')
|
|
69
|
+
return {
|
|
68
70
|
kind: 'field',
|
|
69
71
|
name: change.name,
|
|
70
72
|
value: change.value,
|
|
71
73
|
prior: priors.field(change.path, change.name),
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
kind: 'preamble',
|
|
77
|
-
value: change.value,
|
|
78
|
-
prior: priors.preamble(change.path),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (change.kind !== 'section')
|
|
82
|
-
return null;
|
|
83
|
-
return apply(document, {
|
|
74
|
+
};
|
|
75
|
+
if (change.kind === 'preamble')
|
|
76
|
+
return { kind: 'preamble', value: change.value, prior: priors.preamble(change.path) };
|
|
77
|
+
return {
|
|
84
78
|
kind: 'section',
|
|
85
79
|
name: change.name,
|
|
86
80
|
value: change.value,
|
|
87
81
|
prior: priors.section(change.path, change.name),
|
|
88
|
-
}
|
|
82
|
+
};
|
|
89
83
|
}
|
|
90
|
-
function edit(staged,
|
|
91
|
-
const
|
|
84
|
+
function edit(staged, changes, priors) {
|
|
85
|
+
const path = changes[0].path;
|
|
86
|
+
delete staged.revisions[path];
|
|
87
|
+
const text = staged.documents[path];
|
|
92
88
|
if (text === undefined)
|
|
93
|
-
return
|
|
94
|
-
const parsed = parse(text,
|
|
89
|
+
return changes.length;
|
|
90
|
+
const parsed = parse(text, path);
|
|
95
91
|
if (!parsed.ok)
|
|
96
|
-
return
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
return changes.length;
|
|
93
|
+
const wanted = changes.map((change) => edited(change, priors));
|
|
94
|
+
const first = apply(parsed.document, wanted);
|
|
95
|
+
if (first.outcome === 'refuse')
|
|
96
|
+
return changes.length;
|
|
97
|
+
if (first.outcome === 'applied') {
|
|
98
|
+
staged.documents[path] = serialize(first.document);
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
const stale = new Set(first.stale);
|
|
102
|
+
const kept = wanted.filter((_, at) => !stale.has(at));
|
|
103
|
+
const rest = apply(parsed.document, kept);
|
|
104
|
+
if (rest.outcome !== 'applied')
|
|
105
|
+
return changes.length;
|
|
106
|
+
staged.documents[path] = serialize(rest.document);
|
|
107
|
+
return first.stale.length;
|
|
102
108
|
}
|
|
103
109
|
function relocate(staged, from, to) {
|
|
104
110
|
const text = staged.documents[from];
|
|
@@ -118,32 +124,37 @@ function relocate(staged, from, to) {
|
|
|
118
124
|
}
|
|
119
125
|
function moveHead(heads, from, to) {
|
|
120
126
|
const revision = heads.revisions[from];
|
|
127
|
+
const fileId = heads.fileIds[from];
|
|
121
128
|
const change = heads.changes[from];
|
|
122
129
|
delete heads.revisions[from];
|
|
130
|
+
delete heads.fileIds[from];
|
|
123
131
|
delete heads.changes[from];
|
|
132
|
+
delete heads.fileIds[to];
|
|
124
133
|
delete heads.changes[to];
|
|
125
134
|
if (revision !== undefined)
|
|
126
135
|
heads.revisions[to] = revision;
|
|
136
|
+
if (fileId !== undefined)
|
|
137
|
+
heads.fileIds[to] = fileId;
|
|
127
138
|
if (change !== undefined)
|
|
128
139
|
heads.changes[to] = change;
|
|
129
140
|
}
|
|
130
141
|
function erase(staged, path) {
|
|
131
142
|
delete staged.documents[path];
|
|
132
143
|
delete staged.revisions[path];
|
|
144
|
+
delete staged.fileIds[path];
|
|
133
145
|
delete staged.changes[path];
|
|
134
146
|
delete staged.binaries[path];
|
|
135
147
|
}
|
|
136
|
-
function stage(staged, change
|
|
137
|
-
if (change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble') {
|
|
138
|
-
return edit(staged, change, priors);
|
|
139
|
-
}
|
|
148
|
+
function stage(staged, change) {
|
|
140
149
|
if (change.kind === 'create') {
|
|
141
150
|
staged.documents[change.path] =
|
|
142
151
|
'content' in change ? change.content : compose(change.fields, change.sections);
|
|
152
|
+
delete staged.fileIds[change.path];
|
|
143
153
|
delete staged.changes[change.path];
|
|
144
154
|
return true;
|
|
145
155
|
}
|
|
146
156
|
if (change.kind === 'replace') {
|
|
157
|
+
delete staged.revisions[change.path];
|
|
147
158
|
if (staged.documents[change.path] === undefined)
|
|
148
159
|
return false;
|
|
149
160
|
staged.documents[change.path] = change.content;
|
|
@@ -166,156 +177,63 @@ function stage(staged, change, priors) {
|
|
|
166
177
|
if (change.kind === 'move') {
|
|
167
178
|
return relocate(staged, change.path, change.to);
|
|
168
179
|
}
|
|
180
|
+
if (change.kind === 'arrival') {
|
|
181
|
+
erase(staged, change.path);
|
|
182
|
+
if ('content' in change)
|
|
183
|
+
staged.documents[change.path] = change.content;
|
|
184
|
+
else
|
|
185
|
+
staged.binaries[change.path] = { state: 'accepted', ...change.binary };
|
|
186
|
+
arrive(staged, change);
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
169
189
|
erase(staged, change.path);
|
|
170
190
|
return true;
|
|
171
191
|
}
|
|
172
|
-
|
|
192
|
+
function arrive(heads, change) {
|
|
193
|
+
if (change.revision !== undefined)
|
|
194
|
+
heads.revisions[change.path] = change.revision;
|
|
195
|
+
if (change.fileId !== undefined)
|
|
196
|
+
heads.fileIds[change.path] = change.fileId;
|
|
197
|
+
if (change.change !== undefined)
|
|
198
|
+
heads.changes[change.path] = change.change;
|
|
199
|
+
}
|
|
200
|
+
export function* overlaying(base, queue, unapplied) {
|
|
173
201
|
const staged = {
|
|
174
|
-
documents:
|
|
175
|
-
binaries:
|
|
176
|
-
revisions:
|
|
177
|
-
|
|
202
|
+
documents: drafted(base.documents),
|
|
203
|
+
binaries: drafted(base.binaries),
|
|
204
|
+
revisions: drafted(base.revisions),
|
|
205
|
+
fileIds: drafted(base.fileIds),
|
|
206
|
+
changes: drafted(base.changes),
|
|
178
207
|
};
|
|
179
208
|
for (const batch of queue) {
|
|
180
|
-
const priors = priorsOf(batch.preconditions);
|
|
181
|
-
for (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
documents: staged.documents,
|
|
188
|
-
binaries: staged.binaries,
|
|
189
|
-
revisions: staged.revisions,
|
|
190
|
-
changes: staged.changes,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function pathsOf(batch) {
|
|
194
|
-
return batch.changes.flatMap((change) => change.kind === 'move' ? [change.path, change.to] : [change.path]);
|
|
195
|
-
}
|
|
196
|
-
export function sameLayerText(left, right) {
|
|
197
|
-
const paths = Object.keys(left.documents);
|
|
198
|
-
return (paths.length === Object.keys(right.documents).length &&
|
|
199
|
-
paths.every((path) => left.documents[path] === right.documents[path]) &&
|
|
200
|
-
sameBinaries(left.binaries, right.binaries));
|
|
201
|
-
}
|
|
202
|
-
function sameBinaries(left, right) {
|
|
203
|
-
const paths = Object.keys(left);
|
|
204
|
-
return (paths.length === Object.keys(right).length &&
|
|
205
|
-
paths.every((path) => sameBinary(left[path], right[path])));
|
|
206
|
-
}
|
|
207
|
-
function replayHeads(base, queue) {
|
|
208
|
-
const heads = { revisions: { ...base.revisions }, changes: { ...base.changes } };
|
|
209
|
-
for (const batch of queue) {
|
|
210
|
-
for (const change of batch.changes) {
|
|
211
|
-
if (change.kind === 'remove') {
|
|
212
|
-
delete heads.revisions[change.path];
|
|
213
|
-
delete heads.changes[change.path];
|
|
214
|
-
}
|
|
215
|
-
else if (change.kind === 'create') {
|
|
216
|
-
delete heads.changes[change.path];
|
|
217
|
-
}
|
|
218
|
-
else if (change.kind === 'binary') {
|
|
219
|
-
delete heads.revisions[change.path];
|
|
220
|
-
delete heads.changes[change.path];
|
|
221
|
-
}
|
|
222
|
-
else if (change.kind === 'move') {
|
|
223
|
-
moveHead(heads, change.path, change.to);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return heads;
|
|
228
|
-
}
|
|
229
|
-
export function overlayChanged(base, queue, previousBase, previousQueue, previousVisible) {
|
|
230
|
-
const before = previousQueue.map((batch) => JSON.stringify(batch));
|
|
231
|
-
const after = queue.map((batch) => JSON.stringify(batch));
|
|
232
|
-
if (before.length === after.length &&
|
|
233
|
-
before.every((id, index) => id === after[index]) &&
|
|
234
|
-
sameLayerText(base, previousBase)) {
|
|
235
|
-
return {
|
|
236
|
-
documents: previousVisible.documents,
|
|
237
|
-
binaries: previousVisible.binaries,
|
|
238
|
-
...replayHeads(base, queue),
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
const affected = new Set();
|
|
242
|
-
const paths = new Set([
|
|
243
|
-
...Object.keys(base.documents),
|
|
244
|
-
...Object.keys(previousBase.documents),
|
|
245
|
-
...Object.keys(base.revisions),
|
|
246
|
-
...Object.keys(previousBase.revisions),
|
|
247
|
-
...Object.keys(base.changes),
|
|
248
|
-
...Object.keys(previousBase.changes),
|
|
249
|
-
...Object.keys(base.binaries),
|
|
250
|
-
...Object.keys(previousBase.binaries),
|
|
251
|
-
]);
|
|
252
|
-
for (const path of paths) {
|
|
253
|
-
if (base.documents[path] !== previousBase.documents[path] ||
|
|
254
|
-
base.revisions[path] !== previousBase.revisions[path] ||
|
|
255
|
-
!sameChange(base.changes[path], previousBase.changes[path]) ||
|
|
256
|
-
!sameBinary(base.binaries[path], previousBase.binaries[path]))
|
|
257
|
-
affected.add(path);
|
|
258
|
-
}
|
|
259
|
-
const oldIds = new Set(before);
|
|
260
|
-
const newIds = new Set(after);
|
|
261
|
-
for (const batch of previousQueue) {
|
|
262
|
-
if (!newIds.has(JSON.stringify(batch)))
|
|
263
|
-
for (const path of pathsOf(batch))
|
|
264
|
-
affected.add(path);
|
|
265
|
-
}
|
|
266
|
-
for (const batch of queue) {
|
|
267
|
-
if (!oldIds.has(JSON.stringify(batch)))
|
|
268
|
-
for (const path of pathsOf(batch))
|
|
269
|
-
affected.add(path);
|
|
270
|
-
}
|
|
271
|
-
let expanded = true;
|
|
272
|
-
while (expanded) {
|
|
273
|
-
expanded = false;
|
|
274
|
-
for (const batch of queue) {
|
|
275
|
-
const touched = pathsOf(batch);
|
|
276
|
-
if (!touched.some((path) => affected.has(path)))
|
|
209
|
+
const priors = yield* priorsOf(batch.preconditions);
|
|
210
|
+
for (let index = 0; index < batch.changes.length; index += 1) {
|
|
211
|
+
const change = batch.changes[index];
|
|
212
|
+
if (!isPart(change)) {
|
|
213
|
+
if (!stage(staged, change))
|
|
214
|
+
unapplied?.();
|
|
215
|
+
yield ROW_WEIGHT;
|
|
277
216
|
continue;
|
|
278
|
-
for (const path of touched) {
|
|
279
|
-
if (affected.has(path))
|
|
280
|
-
continue;
|
|
281
|
-
affected.add(path);
|
|
282
|
-
expanded = true;
|
|
283
217
|
}
|
|
218
|
+
const run = [change];
|
|
219
|
+
while (index + 1 < batch.changes.length) {
|
|
220
|
+
const next = batch.changes[index + 1];
|
|
221
|
+
if (!isPart(next) || next.path !== change.path)
|
|
222
|
+
break;
|
|
223
|
+
run.push(next);
|
|
224
|
+
index += 1;
|
|
225
|
+
}
|
|
226
|
+
const text = staged.documents[change.path] ?? '';
|
|
227
|
+
for (let left = edit(staged, run, priors); left > 0; left -= 1)
|
|
228
|
+
unapplied?.();
|
|
229
|
+
yield ROW_WEIGHT + text.length;
|
|
284
230
|
}
|
|
285
231
|
}
|
|
286
|
-
const documents = {};
|
|
287
|
-
const revisions = {};
|
|
288
|
-
const changes = {};
|
|
289
|
-
const binaries = {};
|
|
290
|
-
for (const path of affected) {
|
|
291
|
-
if (base.documents[path] !== undefined)
|
|
292
|
-
documents[path] = base.documents[path];
|
|
293
|
-
if (base.revisions[path] !== undefined)
|
|
294
|
-
revisions[path] = base.revisions[path];
|
|
295
|
-
if (base.changes[path] !== undefined)
|
|
296
|
-
changes[path] = base.changes[path];
|
|
297
|
-
if (base.binaries[path] !== undefined)
|
|
298
|
-
binaries[path] = base.binaries[path];
|
|
299
|
-
}
|
|
300
|
-
const staged = overlay({ documents, revisions, changes, binaries }, queue.filter((batch) => pathsOf(batch).some((path) => affected.has(path))));
|
|
301
|
-
const mergedDocuments = { ...previousVisible.documents };
|
|
302
|
-
const mergedRevisions = { ...previousVisible.revisions };
|
|
303
|
-
const mergedChanges = { ...previousVisible.changes };
|
|
304
|
-
const mergedBinaries = { ...previousVisible.binaries };
|
|
305
|
-
for (const path of affected) {
|
|
306
|
-
delete mergedDocuments[path];
|
|
307
|
-
delete mergedRevisions[path];
|
|
308
|
-
delete mergedChanges[path];
|
|
309
|
-
delete mergedBinaries[path];
|
|
310
|
-
}
|
|
311
|
-
Object.assign(mergedDocuments, staged.documents);
|
|
312
|
-
Object.assign(mergedRevisions, staged.revisions);
|
|
313
|
-
Object.assign(mergedChanges, staged.changes);
|
|
314
|
-
Object.assign(mergedBinaries, staged.binaries);
|
|
315
232
|
return {
|
|
316
|
-
documents:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
233
|
+
documents: yield* settling(staged.documents),
|
|
234
|
+
binaries: yield* settling(staged.binaries),
|
|
235
|
+
revisions: yield* settling(staged.revisions),
|
|
236
|
+
fileIds: yield* settling(staged.fileIds),
|
|
237
|
+
changes: yield* settling(staged.changes),
|
|
320
238
|
};
|
|
321
239
|
}
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function normalize(path: string): string | null;
|
|
2
2
|
export declare function beneath(prefix: string, path: string): boolean;
|
|
3
3
|
export declare function covered(prefixes: readonly string[], path: string): boolean;
|
|
4
|
+
export declare function ancestors(path: string): readonly string[];
|
|
4
5
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAK1E"}
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAK1E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAGzD"}
|
package/dist/paths.js
CHANGED
|
@@ -22,3 +22,7 @@ export function covered(prefixes, path) {
|
|
|
22
22
|
return normalized !== null && (normalized === '' || beneath(normalized, path));
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
export function ancestors(path) {
|
|
26
|
+
const parts = path.split('/');
|
|
27
|
+
return parts.slice(1).map((_, at) => parts.slice(0, at + 1).join('/'));
|
|
28
|
+
}
|
package/dist/phrase.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phrase.d.ts","sourceRoot":"","sources":["../src/phrase.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAMpF"}
|
package/dist/phrase.js
ADDED
package/dist/query.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Definition } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { HeadChange } from './adapter.js';
|
|
3
3
|
import type { BinaryFileRecord } from './binary.js';
|
|
4
|
+
import type { Open } from './open.js';
|
|
4
5
|
export type Value = string | number | boolean | null;
|
|
5
6
|
export type Predicate = Value | {
|
|
6
7
|
$eq: Value;
|
|
@@ -37,14 +38,17 @@ export type Filter = {
|
|
|
37
38
|
types?: readonly string[];
|
|
38
39
|
where?: Where;
|
|
39
40
|
pathPrefix?: string;
|
|
41
|
+
folder?: string;
|
|
42
|
+
paths?: readonly string[];
|
|
40
43
|
hop?: Related & {
|
|
41
44
|
field: string;
|
|
42
45
|
};
|
|
43
46
|
backlinks?: Related & {
|
|
44
47
|
field?: string;
|
|
45
48
|
};
|
|
49
|
+
text?: string;
|
|
46
50
|
};
|
|
47
|
-
export type Key = 'room' | 'path' | 'type' | {
|
|
51
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
48
52
|
field: string;
|
|
49
53
|
};
|
|
50
54
|
export type Select = 'all' | {
|
|
@@ -54,6 +58,8 @@ export type Select = 'all' | {
|
|
|
54
58
|
markdown?: true;
|
|
55
59
|
backlinks?: true;
|
|
56
60
|
change?: true;
|
|
61
|
+
fileId?: true;
|
|
62
|
+
revision?: true;
|
|
57
63
|
};
|
|
58
64
|
export type OrderOptions = {
|
|
59
65
|
nulls?: 'first' | 'last';
|
|
@@ -69,6 +75,8 @@ export type DocumentQuery = Filter & {
|
|
|
69
75
|
direction?: Direction;
|
|
70
76
|
} & OrderOptions)[];
|
|
71
77
|
limit?: number;
|
|
78
|
+
after?: string;
|
|
79
|
+
total?: true;
|
|
72
80
|
};
|
|
73
81
|
export type GroupQuery = Filter & {
|
|
74
82
|
groupBy: readonly Exclude<Key, 'path'>[];
|
|
@@ -77,6 +85,8 @@ export type GroupQuery = Filter & {
|
|
|
77
85
|
direction?: Direction;
|
|
78
86
|
}[];
|
|
79
87
|
limit?: number;
|
|
88
|
+
after?: string;
|
|
89
|
+
total?: true;
|
|
80
90
|
};
|
|
81
91
|
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
82
92
|
export type Backlink = {
|
|
@@ -92,21 +102,53 @@ export type QueryDocument = {
|
|
|
92
102
|
sections?: Readonly<Record<string, string>>;
|
|
93
103
|
preamble?: string;
|
|
94
104
|
markdown?: string;
|
|
105
|
+
textHeld?: false;
|
|
95
106
|
backlinks?: readonly Backlink[];
|
|
96
107
|
change?: HeadChange | null;
|
|
108
|
+
fileId?: string | null;
|
|
109
|
+
revision?: string | null;
|
|
97
110
|
binaryFile?: BinaryFileRecord;
|
|
98
111
|
};
|
|
99
112
|
export type QueryGroup = {
|
|
100
113
|
key: readonly unknown[];
|
|
101
114
|
count: number;
|
|
102
115
|
};
|
|
103
|
-
export type
|
|
116
|
+
export type CoveredRoom = {
|
|
117
|
+
room: string;
|
|
118
|
+
generation: string;
|
|
119
|
+
current: boolean;
|
|
120
|
+
};
|
|
121
|
+
export type QueryCoverage = {
|
|
122
|
+
rooms: readonly CoveredRoom[];
|
|
123
|
+
indexes: readonly string[];
|
|
124
|
+
overlay: readonly string[];
|
|
125
|
+
};
|
|
126
|
+
export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
|
|
127
|
+
export type PendingRoom = {
|
|
128
|
+
room: string;
|
|
129
|
+
awaits: Awaits;
|
|
130
|
+
};
|
|
131
|
+
export type PendingResult = {
|
|
132
|
+
pending: readonly PendingRoom[];
|
|
133
|
+
};
|
|
134
|
+
export type DocumentRows = {
|
|
104
135
|
documents: readonly QueryDocument[];
|
|
136
|
+
next?: string;
|
|
137
|
+
total?: number;
|
|
105
138
|
};
|
|
106
|
-
export type
|
|
139
|
+
export type GroupRows = {
|
|
107
140
|
groups: readonly QueryGroup[];
|
|
141
|
+
next?: string;
|
|
142
|
+
total?: number;
|
|
143
|
+
};
|
|
144
|
+
export type QueryRows = DocumentRows | GroupRows;
|
|
145
|
+
export type DocumentResult = DocumentRows & {
|
|
146
|
+
coverage: QueryCoverage;
|
|
108
147
|
};
|
|
109
|
-
export type
|
|
148
|
+
export type GroupResult = GroupRows & {
|
|
149
|
+
coverage: QueryCoverage;
|
|
150
|
+
};
|
|
151
|
+
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
110
152
|
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
111
153
|
export type RoomFacts = {
|
|
112
154
|
locator: string;
|
|
@@ -161,6 +203,8 @@ export type KeyPlan = {
|
|
|
161
203
|
of: 'path';
|
|
162
204
|
} | {
|
|
163
205
|
of: 'type';
|
|
206
|
+
} | {
|
|
207
|
+
of: 'folder';
|
|
164
208
|
} | {
|
|
165
209
|
of: 'field';
|
|
166
210
|
field: string;
|
|
@@ -173,6 +217,8 @@ export type DocumentShape = {
|
|
|
173
217
|
markdown: boolean;
|
|
174
218
|
backlinks: boolean;
|
|
175
219
|
change: boolean;
|
|
220
|
+
fileId: boolean;
|
|
221
|
+
revision: boolean;
|
|
176
222
|
orderBy: readonly {
|
|
177
223
|
key: KeyPlan;
|
|
178
224
|
options: OrderOptions & {
|
|
@@ -180,6 +226,7 @@ export type DocumentShape = {
|
|
|
180
226
|
};
|
|
181
227
|
}[];
|
|
182
228
|
};
|
|
229
|
+
export declare function bodied(shape: DocumentShape): boolean;
|
|
183
230
|
export type GroupShape = {
|
|
184
231
|
kind: 'groups';
|
|
185
232
|
groupBy: readonly KeyPlan[];
|
|
@@ -188,22 +235,39 @@ export type GroupShape = {
|
|
|
188
235
|
direction: Direction;
|
|
189
236
|
}[];
|
|
190
237
|
};
|
|
238
|
+
export type PlanArea = {
|
|
239
|
+
room: string;
|
|
240
|
+
path: string;
|
|
241
|
+
open: readonly string[];
|
|
242
|
+
};
|
|
191
243
|
export type PlanReach = {
|
|
192
244
|
rooms: readonly string[];
|
|
193
245
|
documents: readonly string[];
|
|
246
|
+
areas: readonly PlanArea[];
|
|
247
|
+
};
|
|
248
|
+
export type Continuation = {
|
|
249
|
+
text: string;
|
|
250
|
+
values: readonly unknown[] | null;
|
|
194
251
|
};
|
|
195
252
|
export type Plan = {
|
|
253
|
+
key: string;
|
|
196
254
|
rooms: readonly string[] | null;
|
|
197
255
|
reach: PlanReach | null;
|
|
256
|
+
locked: readonly string[];
|
|
198
257
|
root: Scope;
|
|
258
|
+
folder: string | null;
|
|
259
|
+
paths: readonly string[] | null;
|
|
199
260
|
hop: (Scope & {
|
|
200
261
|
field: string;
|
|
201
262
|
}) | null;
|
|
202
263
|
backlinks: (Scope & {
|
|
203
264
|
field: string | null;
|
|
204
265
|
}) | null;
|
|
266
|
+
text: string | null;
|
|
205
267
|
shape: DocumentShape | GroupShape;
|
|
206
268
|
limit: number | null;
|
|
269
|
+
after: Continuation | null;
|
|
270
|
+
total: boolean;
|
|
207
271
|
};
|
|
208
272
|
export declare class QueryError extends Error {
|
|
209
273
|
readonly code: QueryErrorCode;
|
|
@@ -214,9 +278,11 @@ type Entries = Readonly<Record<string, unknown>>;
|
|
|
214
278
|
export declare function invalid(at: string, problem: string): never;
|
|
215
279
|
export declare function plain(value: unknown): value is Entries;
|
|
216
280
|
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
281
|
+
export declare function flag(input: unknown, at: string): boolean;
|
|
217
282
|
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
218
283
|
export declare function limitOf(input: unknown): number | null;
|
|
219
284
|
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
285
|
+
export declare function queryKey(query: unknown): string;
|
|
220
286
|
export declare function identityOf(plan: Plan): string;
|
|
221
287
|
export {};
|
|
222
288
|
//# sourceMappingURL=query.d.ts.map
|