@agentshouse/app-bridge 0.1.0-ce42efd6bfc0c → 0.1.0-ce602e5dccd9f
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 +11 -11
- package/dist/index.d.ts +1043 -10
- package/dist/mdmodel/definition.d.ts +18 -1
- package/dist/mdmodel/document.d.ts +10 -6
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +26 -12
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/markdown.d.ts +50 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/query/language.d.ts +253 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/types.d.ts +46 -5
- package/dist/mdmodel/validate.d.ts +31 -4
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +166 -121
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/binary.d.ts +0 -5
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +11 -0
- package/dist/mdruntime/change-set.d.ts +9 -16
- package/dist/mdruntime/change.d.ts +32 -1
- package/dist/mdruntime/client.d.ts +38 -12
- package/dist/mdruntime/collection.d.ts +29 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/conversation-live.d.ts +134 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +54 -45
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +16 -4
- package/dist/mdruntime/failure.d.ts +1 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +5 -0
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/listing.d.ts +51 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +48 -0
- package/dist/mdruntime/model.d.ts +11 -13
- package/dist/mdruntime/observation.d.ts +17 -2
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +49 -8
- package/dist/mdruntime/overlay.d.ts +5 -5
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +27 -186
- package/dist/mdruntime/reach.d.ts +19 -9
- package/dist/mdruntime/readiness.d.ts +13 -17
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +50 -33
- package/dist/mdruntime/room-draft.d.ts +39 -9
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +43 -0
- package/dist/mdruntime/save.d.ts +54 -16
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +15 -77
- package/dist/mdruntime/seed.d.ts +24 -0
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +40 -0
- package/dist/mdruntime/socket/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +68 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +209 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +106 -148
- package/dist/mdruntime/stored.d.ts +155 -0
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +411 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +5 -3
- package/dist/mdruntime/wire.d.ts +183 -37
- package/dist/session-content/bounds.d.ts +7 -0
- package/dist/session-content/check.d.ts +18 -0
- package/dist/session-content/index.d.ts +7 -0
- package/dist/session-content/parts.d.ts +102 -0
- package/dist/session-content/state.d.ts +61 -0
- package/dist/session-content/turn.d.ts +328 -0
- package/dist/test-host.d.ts +7 -1
- package/dist/test-host.js +19 -2
- package/docs/families.md +71 -18
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -117
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -149
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/connection.d.ts +0 -138
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -36
- package/dist/mdruntime/shared.d.ts +0 -10
|
@@ -1,29 +1,73 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure,
|
|
1
|
+
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { KeptBinary, KeptResult } from './opened.js';
|
|
3
4
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
4
5
|
kind: Kind;
|
|
5
6
|
};
|
|
6
7
|
export type Failure = Refused<'transport-uncertainty'> | Refused<'revoked-authorization'> | (Refused<'room-not-readable'> & {
|
|
7
8
|
locator: string;
|
|
9
|
+
}) | (Refused<'room-locked'> & {
|
|
10
|
+
locator: string;
|
|
8
11
|
}) | ScopedRefusal;
|
|
9
12
|
export type CallResult = {
|
|
10
13
|
kind: 'action';
|
|
11
14
|
result: unknown;
|
|
12
15
|
at?: RoomVersionAt;
|
|
13
|
-
} | Refused<'rejected'>
|
|
16
|
+
} | (Refused<'rejected'> & {
|
|
17
|
+
reset?: string;
|
|
18
|
+
}) | Refused<'undeclared'> | Failure;
|
|
14
19
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
15
20
|
kind: Failure['kind'];
|
|
16
21
|
}> | Failure;
|
|
22
|
+
type BinaryRefusal = Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
17
23
|
export type BinaryAnswer = {
|
|
18
24
|
kind: 'binary';
|
|
19
|
-
|
|
25
|
+
stream: ReadableStream<Uint8Array>;
|
|
26
|
+
byteLength: number;
|
|
27
|
+
mediaType: string;
|
|
28
|
+
} | BinaryRefusal;
|
|
29
|
+
export type HeldBinaryAnswer = KeptBinary | BinaryRefusal;
|
|
30
|
+
export type BinaryLinkAnswer = {
|
|
31
|
+
kind: 'link';
|
|
32
|
+
url: string;
|
|
33
|
+
name: string;
|
|
34
|
+
mediaType: string;
|
|
20
35
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
|
-
export
|
|
22
|
-
export
|
|
36
|
+
export type HeldShownAnswer = KeptBinary | BinaryLinkAnswer;
|
|
37
|
+
export type ShownAnswer = BinaryAnswer | BinaryLinkAnswer;
|
|
38
|
+
export type AttachAnswer = {
|
|
39
|
+
kind: 'attached';
|
|
40
|
+
path: string;
|
|
41
|
+
} | Offline | Refused<'rejected'> | Failure;
|
|
42
|
+
export type DownloadAnswer = {
|
|
43
|
+
kind: 'started';
|
|
44
|
+
} | Refused<'rejected'> | Refused<'absent'> | Refused<'blocked'> | Failure;
|
|
45
|
+
export type Resolution = {
|
|
46
|
+
readonly kind: 'document';
|
|
47
|
+
readonly room: string;
|
|
48
|
+
readonly path: string;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: 'deleted';
|
|
51
|
+
readonly room: string;
|
|
52
|
+
readonly path: string;
|
|
53
|
+
readonly revision: HistoryRevision;
|
|
54
|
+
} | Refused<'unreadable'> | Refused<'absent'> | Failure;
|
|
55
|
+
export declare const UNREADABLE: Refused<'unreadable'>;
|
|
56
|
+
export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
57
|
+
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
58
|
+
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
59
|
+
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
60
|
+
export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
|
|
61
|
+
export declare function attachAnswer(result: AttachResult): AttachAnswer;
|
|
62
|
+
export declare const ROOM_LOCKED = "room-locked";
|
|
63
|
+
export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
|
|
64
|
+
locator: string;
|
|
65
|
+
};
|
|
23
66
|
export type Offline = {
|
|
24
67
|
readonly kind: 'offline';
|
|
25
68
|
};
|
|
26
69
|
export declare const OFFLINE: Offline;
|
|
70
|
+
export declare function answeredResult(value: unknown): boolean;
|
|
27
71
|
export declare const UNCERTAIN: Failure;
|
|
28
72
|
export declare function undeclared(name: string): CallResult;
|
|
29
73
|
export declare function failure(result: AdapterFailure): Failure;
|
|
@@ -39,8 +83,5 @@ export type QueueEntry = {
|
|
|
39
83
|
readonly batch: ChangeBatch;
|
|
40
84
|
} & (Submission | {
|
|
41
85
|
readonly state: 'local';
|
|
42
|
-
} | {
|
|
43
|
-
readonly state: 'accepted';
|
|
44
|
-
readonly roomVersion: string;
|
|
45
86
|
});
|
|
46
87
|
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
2
|
+
import { type Composition } from './collection.js';
|
|
2
3
|
import type { ChangeBatch } from './change.js';
|
|
3
4
|
export type Heads = {
|
|
4
5
|
revisions: Readonly<Record<string, string>>;
|
|
6
|
+
fileIds: Readonly<Record<string, string>>;
|
|
7
|
+
created: Readonly<Record<string, string>>;
|
|
5
8
|
changes: Readonly<Record<string, HeadChange>>;
|
|
6
9
|
};
|
|
7
10
|
export type HeldBinary = ({
|
|
@@ -17,10 +20,7 @@ export type Layer = Heads & {
|
|
|
17
20
|
documents: Readonly<Record<string, string>>;
|
|
18
21
|
binaries: Readonly<Record<string, HeldBinary>>;
|
|
19
22
|
};
|
|
20
|
-
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>):
|
|
23
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
|
|
21
24
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
22
25
|
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 changedPaths(left: Layer, right: Layer): ReadonlySet<string>;
|
|
26
|
-
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
|
26
|
+
export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], composition: Composition, unapplied?: () => void): Generator<number, Layer, void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PlanReach } from './query.js';
|
|
2
|
+
import { type PortReach } from './reach.js';
|
|
3
|
+
import { type CodeAvailability, type ConnectionAvailability, type Readiness } from './readiness.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
export type ReadinessPort = {
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly code: CodeAvailability;
|
|
8
|
+
};
|
|
9
|
+
export type ReadinessWatch = {
|
|
10
|
+
readonly port: ReadinessPort;
|
|
11
|
+
readonly reach: PortReach | null;
|
|
12
|
+
readonly deliver: (readiness: Readiness) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function prepare(runtime: Runtime, locators?: readonly string[]): void;
|
|
15
|
+
export declare function roomsOfReach(reach: PlanReach): ReadonlySet<string>;
|
|
16
|
+
export declare function connectionNow(runtime: Runtime): Promise<ConnectionAvailability>;
|
|
17
|
+
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[]): Promise<void>;
|
|
18
|
+
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
19
|
+
export declare function filled(runtime: Runtime): void;
|
|
@@ -1,84 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HeldRooms, type QueryPlan } from '../mdmodel/index.js';
|
|
2
2
|
import type { HeadChange } from './adapter.js';
|
|
3
3
|
import type { BinaryFileRecord } from './binary.js';
|
|
4
|
-
|
|
5
|
-
export type Predicate = Value | {
|
|
6
|
-
$eq: Value;
|
|
7
|
-
} | {
|
|
8
|
-
$ne: Value;
|
|
9
|
-
} | {
|
|
10
|
-
$in: readonly Value[];
|
|
11
|
-
} | {
|
|
12
|
-
$nin: readonly Value[];
|
|
13
|
-
} | {
|
|
14
|
-
$gt?: Value;
|
|
15
|
-
$gte?: Value;
|
|
16
|
-
$lt?: Value;
|
|
17
|
-
$lte?: Value;
|
|
18
|
-
} | {
|
|
19
|
-
$all: readonly Value[];
|
|
20
|
-
} | {
|
|
21
|
-
$size: number;
|
|
22
|
-
} | {
|
|
23
|
-
$exists: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type Where = {
|
|
26
|
-
$and?: readonly Where[];
|
|
27
|
-
$or?: readonly Where[];
|
|
28
|
-
[field: string]: Predicate | readonly Where[] | undefined;
|
|
29
|
-
};
|
|
30
|
-
export type Related = {
|
|
31
|
-
types?: readonly string[];
|
|
32
|
-
where?: Where;
|
|
33
|
-
pathPrefix?: string;
|
|
34
|
-
};
|
|
35
|
-
export type Filter = {
|
|
36
|
-
rooms?: readonly string[];
|
|
37
|
-
types?: readonly string[];
|
|
38
|
-
where?: Where;
|
|
39
|
-
pathPrefix?: string;
|
|
40
|
-
hop?: Related & {
|
|
41
|
-
field: string;
|
|
42
|
-
};
|
|
43
|
-
backlinks?: Related & {
|
|
44
|
-
field?: string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export type Key = 'room' | 'path' | 'type' | {
|
|
48
|
-
field: string;
|
|
49
|
-
};
|
|
50
|
-
export type Select = 'all' | {
|
|
51
|
-
fields?: 'all' | readonly string[];
|
|
52
|
-
sections?: 'all' | readonly string[];
|
|
53
|
-
preamble?: true;
|
|
54
|
-
markdown?: true;
|
|
55
|
-
backlinks?: true;
|
|
56
|
-
change?: true;
|
|
57
|
-
};
|
|
58
|
-
export type OrderOptions = {
|
|
59
|
-
nulls?: 'first' | 'last';
|
|
60
|
-
stringSort?: 'lexical' | 'locale';
|
|
61
|
-
locale?: string;
|
|
62
|
-
localeOptions?: Readonly<Record<string, unknown>>;
|
|
63
|
-
};
|
|
64
|
-
export type Direction = 'asc' | 'desc';
|
|
65
|
-
export type DocumentQuery = Filter & {
|
|
66
|
-
select: Select;
|
|
67
|
-
orderBy?: readonly ({
|
|
68
|
-
by: Key;
|
|
69
|
-
direction?: Direction;
|
|
70
|
-
} & OrderOptions)[];
|
|
71
|
-
limit?: number;
|
|
72
|
-
};
|
|
73
|
-
export type GroupQuery = Filter & {
|
|
74
|
-
groupBy: readonly Exclude<Key, 'path'>[];
|
|
75
|
-
orderBy?: readonly {
|
|
76
|
-
by: 'count' | Exclude<Key, 'path'>;
|
|
77
|
-
direction?: Direction;
|
|
78
|
-
}[];
|
|
79
|
-
limit?: number;
|
|
80
|
-
};
|
|
81
|
-
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
4
|
+
import type { Open } from './open.js';
|
|
82
5
|
export type Backlink = {
|
|
83
6
|
path: string;
|
|
84
7
|
type: string;
|
|
@@ -94,11 +17,23 @@ export type QueryDocument = {
|
|
|
94
17
|
markdown?: string;
|
|
95
18
|
backlinks?: readonly Backlink[];
|
|
96
19
|
change?: HeadChange | null;
|
|
20
|
+
fileId?: string | null;
|
|
21
|
+
revision?: string | null;
|
|
97
22
|
binaryFile?: BinaryFileRecord;
|
|
23
|
+
size?: number | null;
|
|
24
|
+
created?: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type GroupTotal = {
|
|
27
|
+
count: number;
|
|
28
|
+
size: number;
|
|
98
29
|
};
|
|
99
30
|
export type QueryGroup = {
|
|
100
31
|
key: readonly unknown[];
|
|
101
32
|
count: number;
|
|
33
|
+
documents?: GroupTotal;
|
|
34
|
+
files?: GroupTotal;
|
|
35
|
+
updated?: string | null;
|
|
36
|
+
greatest?: unknown;
|
|
102
37
|
};
|
|
103
38
|
export type CoveredRoom = {
|
|
104
39
|
room: string;
|
|
@@ -107,10 +42,9 @@ export type CoveredRoom = {
|
|
|
107
42
|
};
|
|
108
43
|
export type QueryCoverage = {
|
|
109
44
|
rooms: readonly CoveredRoom[];
|
|
110
|
-
indexes: readonly string[];
|
|
111
45
|
overlay: readonly string[];
|
|
112
46
|
};
|
|
113
|
-
export type Awaits = 'acquisition' | 'preparation' | '
|
|
47
|
+
export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
|
|
114
48
|
export type PendingRoom = {
|
|
115
49
|
room: string;
|
|
116
50
|
awaits: Awaits;
|
|
@@ -120,9 +54,13 @@ export type PendingResult = {
|
|
|
120
54
|
};
|
|
121
55
|
export type DocumentRows = {
|
|
122
56
|
documents: readonly QueryDocument[];
|
|
57
|
+
next?: string;
|
|
58
|
+
total?: number;
|
|
123
59
|
};
|
|
124
60
|
export type GroupRows = {
|
|
125
61
|
groups: readonly QueryGroup[];
|
|
62
|
+
next?: string;
|
|
63
|
+
total?: number;
|
|
126
64
|
};
|
|
127
65
|
export type QueryRows = DocumentRows | GroupRows;
|
|
128
66
|
export type DocumentResult = DocumentRows & {
|
|
@@ -132,115 +70,18 @@ export type GroupResult = GroupRows & {
|
|
|
132
70
|
coverage: QueryCoverage;
|
|
133
71
|
};
|
|
134
72
|
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
135
|
-
export type
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
types: readonly Definition[];
|
|
140
|
-
};
|
|
141
|
-
export type HeldRooms = {
|
|
142
|
-
listed: boolean;
|
|
143
|
-
rooms: readonly RoomFacts[];
|
|
144
|
-
};
|
|
145
|
-
export type Test = {
|
|
146
|
-
op: 'eq';
|
|
147
|
-
value: Value;
|
|
148
|
-
} | {
|
|
149
|
-
op: 'ne';
|
|
150
|
-
value: Value;
|
|
151
|
-
} | {
|
|
152
|
-
op: 'in';
|
|
153
|
-
values: readonly Value[];
|
|
154
|
-
} | {
|
|
155
|
-
op: 'nin';
|
|
156
|
-
values: readonly Value[];
|
|
157
|
-
} | {
|
|
158
|
-
op: 'range';
|
|
159
|
-
bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
|
|
160
|
-
} | {
|
|
161
|
-
op: 'all';
|
|
162
|
-
values: readonly Value[];
|
|
163
|
-
} | {
|
|
164
|
-
op: 'size';
|
|
165
|
-
size: number;
|
|
166
|
-
} | {
|
|
167
|
-
op: 'exists';
|
|
168
|
-
exists: boolean;
|
|
169
|
-
};
|
|
170
|
-
export type Condition = {
|
|
171
|
-
every: readonly Condition[];
|
|
172
|
-
} | {
|
|
173
|
-
some: readonly Condition[];
|
|
174
|
-
} | {
|
|
175
|
-
field: string;
|
|
176
|
-
test: Test;
|
|
177
|
-
};
|
|
178
|
-
export type Scope = {
|
|
179
|
-
types: readonly string[] | null;
|
|
180
|
-
where: Condition | null;
|
|
181
|
-
pathPrefix: string | null;
|
|
182
|
-
};
|
|
183
|
-
export type KeyPlan = {
|
|
184
|
-
of: 'room';
|
|
185
|
-
} | {
|
|
186
|
-
of: 'path';
|
|
187
|
-
} | {
|
|
188
|
-
of: 'type';
|
|
189
|
-
} | {
|
|
190
|
-
of: 'field';
|
|
191
|
-
field: string;
|
|
192
|
-
};
|
|
193
|
-
export type DocumentShape = {
|
|
194
|
-
kind: 'documents';
|
|
195
|
-
fields: 'all' | readonly string[] | null;
|
|
196
|
-
sections: 'all' | readonly string[] | null;
|
|
197
|
-
preamble: boolean;
|
|
198
|
-
markdown: boolean;
|
|
199
|
-
backlinks: boolean;
|
|
200
|
-
change: boolean;
|
|
201
|
-
orderBy: readonly {
|
|
202
|
-
key: KeyPlan;
|
|
203
|
-
options: OrderOptions & {
|
|
204
|
-
direction: Direction;
|
|
205
|
-
};
|
|
206
|
-
}[];
|
|
207
|
-
};
|
|
208
|
-
export type GroupShape = {
|
|
209
|
-
kind: 'groups';
|
|
210
|
-
groupBy: readonly KeyPlan[];
|
|
211
|
-
orderBy: readonly {
|
|
212
|
-
by: 'count' | number;
|
|
213
|
-
direction: Direction;
|
|
214
|
-
}[];
|
|
73
|
+
export type PlanArea = {
|
|
74
|
+
room: string;
|
|
75
|
+
path: string;
|
|
76
|
+
open: readonly string[];
|
|
215
77
|
};
|
|
216
78
|
export type PlanReach = {
|
|
217
79
|
rooms: readonly string[];
|
|
218
80
|
documents: readonly string[];
|
|
81
|
+
areas: readonly PlanArea[];
|
|
219
82
|
};
|
|
220
|
-
export type Plan = {
|
|
221
|
-
rooms: readonly string[] | null;
|
|
83
|
+
export type Plan = QueryPlan & {
|
|
222
84
|
reach: PlanReach | null;
|
|
223
|
-
|
|
224
|
-
hop: (Scope & {
|
|
225
|
-
field: string;
|
|
226
|
-
}) | null;
|
|
227
|
-
backlinks: (Scope & {
|
|
228
|
-
field: string | null;
|
|
229
|
-
}) | null;
|
|
230
|
-
shape: DocumentShape | GroupShape;
|
|
231
|
-
limit: number | null;
|
|
85
|
+
locked: readonly string[];
|
|
232
86
|
};
|
|
233
|
-
export declare
|
|
234
|
-
readonly code: QueryErrorCode;
|
|
235
|
-
readonly retryable = false;
|
|
236
|
-
constructor(code: QueryErrorCode, at: string, problem: string);
|
|
237
|
-
}
|
|
238
|
-
type Entries = Readonly<Record<string, unknown>>;
|
|
239
|
-
export declare function invalid(at: string, problem: string): never;
|
|
240
|
-
export declare function plain(value: unknown): value is Entries;
|
|
241
|
-
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
242
|
-
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
243
|
-
export declare function limitOf(input: unknown): number | null;
|
|
244
|
-
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
245
|
-
export declare function identityOf(plan: Plan): string;
|
|
246
|
-
export {};
|
|
87
|
+
export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { AppRoom } from './listing.js';
|
|
2
|
+
import type { ReadinessPort } from './preparation.js';
|
|
3
|
+
import type { MdRuntime, RuntimeTopic } from './surface.js';
|
|
3
4
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
4
5
|
import type { Readiness } from './readiness.js';
|
|
5
6
|
import type { SearchResult } from './search.js';
|
|
@@ -7,29 +8,38 @@ export type ReachedDocument = {
|
|
|
7
8
|
readonly room: string;
|
|
8
9
|
readonly path: string;
|
|
9
10
|
};
|
|
11
|
+
export type ReachedArea = {
|
|
12
|
+
readonly room: string;
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly open: readonly string[];
|
|
15
|
+
};
|
|
10
16
|
export type PortReach = {
|
|
11
17
|
readonly rooms: readonly string[];
|
|
12
18
|
readonly documents: readonly ReachedDocument[];
|
|
19
|
+
readonly areas?: readonly ReachedArea[];
|
|
13
20
|
readonly conversations: boolean;
|
|
14
21
|
};
|
|
15
22
|
export type Deliver = (message: unknown) => void;
|
|
16
|
-
export type
|
|
23
|
+
export type Fail = (error: unknown) => void;
|
|
24
|
+
export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
|
|
17
25
|
export type RuntimeView = {
|
|
18
26
|
md: MdRuntime;
|
|
19
27
|
watch: Watch;
|
|
20
28
|
};
|
|
21
29
|
export type NarrowedView = RuntimeView & {
|
|
22
30
|
narrow(reach: PortReach | null): void;
|
|
23
|
-
facts(port: ReadinessPort): void;
|
|
24
31
|
};
|
|
25
32
|
export type Reachable = RuntimeView & {
|
|
26
|
-
plan(input: unknown, reach: PortReach | null): Plan
|
|
33
|
+
plan(input: unknown, reach: PortReach | null): Promise<Plan>;
|
|
27
34
|
query(plan: Plan): Promise<QueryResult>;
|
|
28
|
-
watchPlan(plan: Plan, deliver:
|
|
35
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
29
36
|
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
30
|
-
searching(target: string): void;
|
|
31
37
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
32
|
-
|
|
38
|
+
locked(room: string): Promise<boolean>;
|
|
39
|
+
lockedRooms(): Promise<readonly string[]>;
|
|
40
|
+
watchLocks(notify: () => void): () => void;
|
|
41
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
42
|
+
room(locator: string): Promise<AppRoom | undefined>;
|
|
33
43
|
};
|
|
34
44
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
35
45
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -42,4 +52,4 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
42
52
|
readonly selection: boolean;
|
|
43
53
|
};
|
|
44
54
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
45
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
55
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
2
|
export type CodeAvailability = Open<'stored' | 'absent'>;
|
|
3
|
-
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | '
|
|
3
|
+
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
|
|
4
4
|
export type RoomCoverage = {
|
|
5
5
|
readonly room: string;
|
|
6
6
|
readonly state: RoomPreparation;
|
|
7
7
|
};
|
|
8
|
-
export type ConversationCoverage = Open<'complete' | 'acquiring' | '
|
|
9
|
-
export type SearchObligation = Open<'required' | 'unused'>;
|
|
8
|
+
export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
|
|
10
9
|
export type TargetCoverage = {
|
|
11
10
|
readonly complete: boolean;
|
|
12
11
|
readonly listed: boolean;
|
|
13
12
|
readonly rooms: readonly RoomCoverage[];
|
|
14
13
|
readonly conversations: ConversationCoverage;
|
|
15
|
-
readonly search: SearchObligation;
|
|
16
14
|
};
|
|
17
15
|
export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
|
|
18
16
|
export type Durability = Open<'persistent' | 'best-effort'>;
|
|
19
17
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
18
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly
|
|
19
|
+
export type Space = Open<'full'>;
|
|
20
|
+
export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
|
|
21
|
+
export type InstallationAmount = {
|
|
22
|
+
readonly done: number;
|
|
23
|
+
readonly total: number;
|
|
25
24
|
};
|
|
26
|
-
export type
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly rule: string;
|
|
30
|
-
readonly location: string | null;
|
|
25
|
+
export type Installation = {
|
|
26
|
+
readonly step: InstallationStep | null;
|
|
27
|
+
readonly bytes: InstallationAmount;
|
|
31
28
|
};
|
|
32
|
-
export type ReadinessStatus = Open<'preparing' | 'paused' | '
|
|
29
|
+
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
33
30
|
export type Readiness = {
|
|
34
31
|
readonly status: ReadinessStatus;
|
|
35
32
|
readonly ready: boolean;
|
|
@@ -40,13 +37,12 @@ export type Readiness = {
|
|
|
40
37
|
readonly persistence: Persistence;
|
|
41
38
|
readonly connection: ConnectionAvailability;
|
|
42
39
|
readonly house: HouseOutcome;
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
40
|
+
readonly space: Space | null;
|
|
41
|
+
readonly installation: Installation;
|
|
45
42
|
readonly lost: boolean;
|
|
46
43
|
};
|
|
47
44
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
48
45
|
readonly coverage: Omit<TargetCoverage, 'complete'>;
|
|
49
46
|
readonly established: boolean;
|
|
50
47
|
};
|
|
51
|
-
export declare const SETTLED_ROOMS: ReadonlySet<string>;
|
|
52
48
|
export declare function readinessOf(facts: ReadinessFacts): Readiness;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type CallResult } from './outcome.js';
|
|
2
|
+
import type { Recovery } from './recovery.js';
|
|
3
|
+
import type { Connection, RuntimeDatabase } from './tables.js';
|
|
4
|
+
export declare const READ_TABLES: readonly string[];
|
|
5
|
+
export type ReadAt = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly input: string;
|
|
8
|
+
readonly build: string;
|
|
9
|
+
};
|
|
10
|
+
export type ObservedRead = {
|
|
11
|
+
readonly answer: unknown;
|
|
12
|
+
readonly failure: CallResult | null;
|
|
13
|
+
readonly kept: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type ReadAnswers = {
|
|
16
|
+
watch(name: string, input: unknown, deliver: (read: ObservedRead) => void): () => void;
|
|
17
|
+
again(): void;
|
|
18
|
+
reopened(): void;
|
|
19
|
+
};
|
|
20
|
+
export type ReadAnswersOptions = {
|
|
21
|
+
readonly database: RuntimeDatabase;
|
|
22
|
+
readonly build: string;
|
|
23
|
+
readonly unkept: readonly string[];
|
|
24
|
+
readonly leading: readonly string[];
|
|
25
|
+
readonly recovery: Recovery;
|
|
26
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
27
|
+
online(): boolean;
|
|
28
|
+
streaming(): boolean;
|
|
29
|
+
closed(): boolean;
|
|
30
|
+
full(): boolean;
|
|
31
|
+
filled(): void;
|
|
32
|
+
};
|
|
33
|
+
export declare function storedRead(connection: Connection, { name, input, build }: ReadAt): string | null;
|
|
34
|
+
export declare function keptRead(connection: Connection, { name, input, build }: ReadAt, answer: string): null;
|
|
35
|
+
export declare function readsOfOtherBuildsForgotten(connection: Connection, build: string): null;
|
|
36
|
+
export declare function readAnswers(options: ReadAnswersOptions): ReadAnswers;
|
|
@@ -8,7 +8,7 @@ export type AttemptOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export type RecoveryOptions = {
|
|
10
10
|
readonly firstMs?: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly maxMs?: number;
|
|
12
12
|
readonly attempts?: number;
|
|
13
13
|
readonly inFlight?: number;
|
|
14
14
|
};
|
|
@@ -20,5 +20,6 @@ export type Recovery = {
|
|
|
20
20
|
scope(inFlight?: number): Recovery;
|
|
21
21
|
retire(): Promise<void>;
|
|
22
22
|
};
|
|
23
|
-
export declare function retryDelay(tries: number, firstMs?: number,
|
|
23
|
+
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
24
25
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AdapterFailure, Authorization, RefreshPage, RefreshRequest, RefreshResult, RetryableRefusal } from './adapter.js';
|
|
2
|
+
import type { Remodel } from './bootstrap.js';
|
|
3
|
+
import type { ReplicaRecord } from './replica.js';
|
|
4
|
+
import type { RefreshedPage } from './store.js';
|
|
5
|
+
import type { HeldEntry, StoredEntry } from './tables.js';
|
|
6
|
+
import { type Unconfirmed } from './transfer.js';
|
|
7
|
+
export type Advancement = {
|
|
8
|
+
kind: 'still-current';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'advanced';
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
changed: ReadonlySet<string>;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'beyond-horizon';
|
|
15
|
+
} | RetryableRefusal | Unconfirmed | AdapterFailure;
|
|
16
|
+
export type Refresher = (authorization: Authorization, request: RefreshRequest) => Promise<RefreshResult>;
|
|
17
|
+
export type Refreshing = {
|
|
18
|
+
turn(): void;
|
|
19
|
+
prior(paths: readonly string[]): Promise<ReadonlyMap<string, HeldEntry>>;
|
|
20
|
+
later(paths: readonly string[], roomVersion: string): Promise<ReadonlySet<string>>;
|
|
21
|
+
stage(page: RefreshedPage): Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
type PageContent = Pick<RefreshPage, 'documents' | 'facts' | 'revisions' | 'fileIds' | 'created' | 'changes' | 'binaryFiles'>;
|
|
24
|
+
export declare function pageEntries(page: PageContent, removals: readonly string[], roomVersion: string, prior: (paths: readonly string[]) => Promise<ReadonlyMap<string, HeldEntry>>): Promise<StoredEntry[]>;
|
|
25
|
+
export declare function advancement(refresh: Refresher, authorization: Authorization, held: ReplicaRecord, remodel: Remodel, continuing: () => boolean, staging: Refreshing): Promise<Advancement>;
|
|
26
|
+
export {};
|