@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8dd3de04bf64
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 +7 -7
- package/dist/index.d.ts +910 -19
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/document.d.ts +2 -1
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +19 -7
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/pattern.d.ts +9 -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 +11 -0
- package/dist/mdmodel/validate.d.ts +7 -5
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +107 -71
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +28 -11
- package/dist/mdruntime/collection.d.ts +7 -4
- package/dist/mdruntime/compile.d.ts +6 -6
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +41 -45
- package/dist/mdruntime/durability.d.ts +15 -1
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/listing.d.ts +52 -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 +27 -3
- package/dist/mdruntime/model.d.ts +8 -10
- package/dist/mdruntime/observation.d.ts +3 -2
- package/dist/mdruntime/outcome.d.ts +17 -6
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +18 -208
- package/dist/mdruntime/reach.d.ts +20 -11
- package/dist/mdruntime/readiness.d.ts +3 -18
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +1 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -12
- package/dist/mdruntime/room-draft.d.ts +21 -7
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +42 -0
- package/dist/mdruntime/save.d.ts +7 -1
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- 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 +43 -0
- package/dist/mdruntime/socket/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +69 -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 +211 -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 +105 -158
- package/dist/mdruntime/stored.d.ts +66 -55
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +131 -69
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +25 -9
- package/dist/test-host.d.ts +1 -4
- package/dist/test-host.js +2 -28
- package/docs/families.md +49 -53
- package/package.json +1 -1
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdmodel/condition.d.ts +0 -160
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -151
- package/dist/mdruntime/file.d.ts +0 -11
- package/dist/mdruntime/fulltext.d.ts +0 -26
- package/dist/mdruntime/shared.d.ts +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Definition,
|
|
1
|
+
import type { Definition, VerifiedModel } from '../mdmodel/index.js';
|
|
2
2
|
import type { Open } from './open.js';
|
|
3
3
|
export type ModelIdentity = {
|
|
4
4
|
identity: string;
|
|
@@ -8,7 +8,7 @@ export type ModelSnapshot = ModelIdentity & {
|
|
|
8
8
|
schema: string | null;
|
|
9
9
|
revision: string | null;
|
|
10
10
|
};
|
|
11
|
-
export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired'
|
|
11
|
+
export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired'>;
|
|
12
12
|
export type ModelResult = {
|
|
13
13
|
kind: 'model';
|
|
14
14
|
snapshot: ModelSnapshot;
|
|
@@ -20,20 +20,21 @@ export type MdType = Definition;
|
|
|
20
20
|
export type ModelState = {
|
|
21
21
|
status: 'unavailable';
|
|
22
22
|
reason: ModelUnavailableReason;
|
|
23
|
-
schema?: string | null;
|
|
24
|
-
revision?: string | null;
|
|
25
23
|
} | {
|
|
26
24
|
status: 'current' | 'cached';
|
|
27
25
|
snapshot: ModelSnapshot;
|
|
28
26
|
verifiedWith: ModelIdentity;
|
|
29
27
|
types: VerifiedModel['types'];
|
|
30
28
|
};
|
|
29
|
+
export type StoredModel = Extract<ModelState, {
|
|
30
|
+
status: 'unavailable';
|
|
31
|
+
}> | Omit<Extract<ModelState, {
|
|
32
|
+
status: 'current' | 'cached';
|
|
33
|
+
}>, 'types'>;
|
|
31
34
|
export type TypesResult = {
|
|
32
35
|
status: Open<'unavailable'>;
|
|
33
36
|
reason: ModelUnavailableReason;
|
|
34
37
|
types: null;
|
|
35
|
-
schema?: string | null;
|
|
36
|
-
revision?: string | null;
|
|
37
38
|
} | {
|
|
38
39
|
status: Open<'current' | 'cached'>;
|
|
39
40
|
identity: string;
|
|
@@ -51,7 +52,4 @@ export type ValidationReceipt = {
|
|
|
51
52
|
export declare const NO_MODEL: ModelState;
|
|
52
53
|
export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
|
|
53
54
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
54
|
-
export declare function
|
|
55
|
-
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
56
|
-
export declare function sameTyping(left: ModelState, right: ModelState): boolean;
|
|
57
|
-
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
55
|
+
export declare function storedModel(state: ModelState): StoredModel;
|
|
@@ -27,8 +27,8 @@ export declare function rowsOf(result: QueryResult): readonly (QueryDocument | Q
|
|
|
27
27
|
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
28
28
|
export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
|
|
29
29
|
export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
|
|
30
|
-
export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
31
|
-
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
30
|
+
export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
31
|
+
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
32
32
|
export type Digest = {
|
|
33
33
|
readonly pending: string;
|
|
34
34
|
} | {
|
|
@@ -38,6 +38,7 @@ export type Digest = {
|
|
|
38
38
|
readonly next: string | undefined;
|
|
39
39
|
readonly total: number | undefined;
|
|
40
40
|
};
|
|
41
|
+
export declare function hashed(text: string): number;
|
|
41
42
|
export declare function digestOf({ result, keys }: KeyedResult): Digest;
|
|
42
43
|
export declare function digestApplied(digest: Digest, message: QueryMessage): Digest;
|
|
43
44
|
export declare function changeOf(previous: Digest, next: KeyedResult): QueryMessage | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
import type { KeptBinary, KeptResult } from './opened.js';
|
|
4
4
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
@@ -13,7 +13,9 @@ export type CallResult = {
|
|
|
13
13
|
kind: 'action';
|
|
14
14
|
result: unknown;
|
|
15
15
|
at?: RoomVersionAt;
|
|
16
|
-
} | Refused<'rejected'>
|
|
16
|
+
} | (Refused<'rejected'> & {
|
|
17
|
+
reset?: string;
|
|
18
|
+
}) | Refused<'undeclared'> | Failure;
|
|
17
19
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
18
20
|
kind: Failure['kind'];
|
|
19
21
|
}> | Failure;
|
|
@@ -29,7 +31,17 @@ export type BinaryLinkAnswer = {
|
|
|
29
31
|
kind: 'link';
|
|
30
32
|
url: string;
|
|
31
33
|
name: string;
|
|
34
|
+
mediaType: string;
|
|
32
35
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
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;
|
|
33
45
|
export type Resolution = {
|
|
34
46
|
readonly kind: 'document';
|
|
35
47
|
readonly room: string;
|
|
@@ -45,7 +57,8 @@ export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
|
45
57
|
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
46
58
|
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
47
59
|
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
48
|
-
export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
|
|
60
|
+
export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
|
|
61
|
+
export declare function attachAnswer(result: AttachResult): AttachAnswer;
|
|
49
62
|
export declare const ROOM_LOCKED = "room-locked";
|
|
50
63
|
export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
|
|
51
64
|
locator: string;
|
|
@@ -54,6 +67,7 @@ export type Offline = {
|
|
|
54
67
|
readonly kind: 'offline';
|
|
55
68
|
};
|
|
56
69
|
export declare const OFFLINE: Offline;
|
|
70
|
+
export declare function answeredResult(value: unknown): boolean;
|
|
57
71
|
export declare const UNCERTAIN: Failure;
|
|
58
72
|
export declare function undeclared(name: string): CallResult;
|
|
59
73
|
export declare function failure(result: AdapterFailure): Failure;
|
|
@@ -69,8 +83,5 @@ export type QueueEntry = {
|
|
|
69
83
|
readonly batch: ChangeBatch;
|
|
70
84
|
} & (Submission | {
|
|
71
85
|
readonly state: 'local';
|
|
72
|
-
} | {
|
|
73
|
-
readonly state: 'accepted';
|
|
74
|
-
readonly roomVersion: string;
|
|
75
86
|
});
|
|
76
87
|
export {};
|
|
@@ -3,6 +3,7 @@ import type { ChangeBatch } from './change.js';
|
|
|
3
3
|
export type Heads = {
|
|
4
4
|
revisions: Readonly<Record<string, string>>;
|
|
5
5
|
fileIds: Readonly<Record<string, string>>;
|
|
6
|
+
created: Readonly<Record<string, string>>;
|
|
6
7
|
changes: Readonly<Record<string, HeadChange>>;
|
|
7
8
|
};
|
|
8
9
|
export type HeldBinary = ({
|
|
@@ -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,93 +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
4
|
import type { Open } from './open.js';
|
|
5
|
-
export type Value = string | number | boolean | null;
|
|
6
|
-
export type Predicate = Value | {
|
|
7
|
-
$eq: Value;
|
|
8
|
-
} | {
|
|
9
|
-
$ne: Value;
|
|
10
|
-
} | {
|
|
11
|
-
$in: readonly Value[];
|
|
12
|
-
} | {
|
|
13
|
-
$nin: readonly Value[];
|
|
14
|
-
} | {
|
|
15
|
-
$gt?: Value;
|
|
16
|
-
$gte?: Value;
|
|
17
|
-
$lt?: Value;
|
|
18
|
-
$lte?: Value;
|
|
19
|
-
} | {
|
|
20
|
-
$all: readonly Value[];
|
|
21
|
-
} | {
|
|
22
|
-
$size: number;
|
|
23
|
-
} | {
|
|
24
|
-
$exists: boolean;
|
|
25
|
-
};
|
|
26
|
-
export type Where = {
|
|
27
|
-
$and?: readonly Where[];
|
|
28
|
-
$or?: readonly Where[];
|
|
29
|
-
[field: string]: Predicate | readonly Where[] | undefined;
|
|
30
|
-
};
|
|
31
|
-
export type Related = {
|
|
32
|
-
types?: readonly string[];
|
|
33
|
-
where?: Where;
|
|
34
|
-
pathPrefix?: string;
|
|
35
|
-
};
|
|
36
|
-
export type Filter = {
|
|
37
|
-
rooms?: readonly string[];
|
|
38
|
-
types?: readonly string[];
|
|
39
|
-
where?: Where;
|
|
40
|
-
pathPrefix?: string;
|
|
41
|
-
folder?: string;
|
|
42
|
-
paths?: readonly string[];
|
|
43
|
-
hop?: Related & {
|
|
44
|
-
field: string;
|
|
45
|
-
};
|
|
46
|
-
backlinks?: Related & {
|
|
47
|
-
field?: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
51
|
-
field: string;
|
|
52
|
-
};
|
|
53
|
-
export type Select = 'all' | {
|
|
54
|
-
fields?: 'all' | readonly string[];
|
|
55
|
-
sections?: 'all' | readonly string[];
|
|
56
|
-
preamble?: true;
|
|
57
|
-
markdown?: true;
|
|
58
|
-
backlinks?: true;
|
|
59
|
-
change?: true;
|
|
60
|
-
fileId?: true;
|
|
61
|
-
revision?: true;
|
|
62
|
-
};
|
|
63
|
-
export type OrderOptions = {
|
|
64
|
-
nulls?: 'first' | 'last';
|
|
65
|
-
stringSort?: 'lexical' | 'locale';
|
|
66
|
-
locale?: string;
|
|
67
|
-
localeOptions?: Readonly<Record<string, unknown>>;
|
|
68
|
-
};
|
|
69
|
-
export type Direction = 'asc' | 'desc';
|
|
70
|
-
export type DocumentQuery = Filter & {
|
|
71
|
-
select: Select;
|
|
72
|
-
orderBy?: readonly ({
|
|
73
|
-
by: Key;
|
|
74
|
-
direction?: Direction;
|
|
75
|
-
} & OrderOptions)[];
|
|
76
|
-
limit?: number;
|
|
77
|
-
after?: string;
|
|
78
|
-
total?: true;
|
|
79
|
-
};
|
|
80
|
-
export type GroupQuery = Filter & {
|
|
81
|
-
groupBy: readonly Exclude<Key, 'path'>[];
|
|
82
|
-
orderBy?: readonly {
|
|
83
|
-
by: 'count' | Exclude<Key, 'path'>;
|
|
84
|
-
direction?: Direction;
|
|
85
|
-
}[];
|
|
86
|
-
limit?: number;
|
|
87
|
-
after?: string;
|
|
88
|
-
total?: true;
|
|
89
|
-
};
|
|
90
|
-
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
91
5
|
export type Backlink = {
|
|
92
6
|
path: string;
|
|
93
7
|
type: string;
|
|
@@ -106,10 +20,20 @@ export type QueryDocument = {
|
|
|
106
20
|
fileId?: string | null;
|
|
107
21
|
revision?: string | null;
|
|
108
22
|
binaryFile?: BinaryFileRecord;
|
|
23
|
+
size?: number | null;
|
|
24
|
+
created?: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type GroupTotal = {
|
|
27
|
+
count: number;
|
|
28
|
+
size: number;
|
|
109
29
|
};
|
|
110
30
|
export type QueryGroup = {
|
|
111
31
|
key: readonly unknown[];
|
|
112
32
|
count: number;
|
|
33
|
+
documents?: GroupTotal;
|
|
34
|
+
files?: GroupTotal;
|
|
35
|
+
updated?: string | null;
|
|
36
|
+
greatest?: unknown;
|
|
113
37
|
};
|
|
114
38
|
export type CoveredRoom = {
|
|
115
39
|
room: string;
|
|
@@ -118,7 +42,6 @@ export type CoveredRoom = {
|
|
|
118
42
|
};
|
|
119
43
|
export type QueryCoverage = {
|
|
120
44
|
rooms: readonly CoveredRoom[];
|
|
121
|
-
indexes: readonly string[];
|
|
122
45
|
overlay: readonly string[];
|
|
123
46
|
};
|
|
124
47
|
export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
|
|
@@ -147,131 +70,18 @@ export type GroupResult = GroupRows & {
|
|
|
147
70
|
coverage: QueryCoverage;
|
|
148
71
|
};
|
|
149
72
|
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
150
|
-
export type
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
types: readonly Definition[];
|
|
155
|
-
};
|
|
156
|
-
export type HeldRooms = {
|
|
157
|
-
listed: boolean;
|
|
158
|
-
rooms: readonly RoomFacts[];
|
|
159
|
-
};
|
|
160
|
-
export type Test = {
|
|
161
|
-
op: 'eq';
|
|
162
|
-
value: Value;
|
|
163
|
-
} | {
|
|
164
|
-
op: 'ne';
|
|
165
|
-
value: Value;
|
|
166
|
-
} | {
|
|
167
|
-
op: 'in';
|
|
168
|
-
values: readonly Value[];
|
|
169
|
-
} | {
|
|
170
|
-
op: 'nin';
|
|
171
|
-
values: readonly Value[];
|
|
172
|
-
} | {
|
|
173
|
-
op: 'range';
|
|
174
|
-
bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
|
|
175
|
-
} | {
|
|
176
|
-
op: 'all';
|
|
177
|
-
values: readonly Value[];
|
|
178
|
-
} | {
|
|
179
|
-
op: 'size';
|
|
180
|
-
size: number;
|
|
181
|
-
} | {
|
|
182
|
-
op: 'exists';
|
|
183
|
-
exists: boolean;
|
|
184
|
-
};
|
|
185
|
-
export type Condition = {
|
|
186
|
-
every: readonly Condition[];
|
|
187
|
-
} | {
|
|
188
|
-
some: readonly Condition[];
|
|
189
|
-
} | {
|
|
190
|
-
field: string;
|
|
191
|
-
test: Test;
|
|
192
|
-
};
|
|
193
|
-
export type Scope = {
|
|
194
|
-
types: readonly string[] | null;
|
|
195
|
-
where: Condition | null;
|
|
196
|
-
pathPrefix: string | null;
|
|
197
|
-
};
|
|
198
|
-
export type KeyPlan = {
|
|
199
|
-
of: 'room';
|
|
200
|
-
} | {
|
|
201
|
-
of: 'path';
|
|
202
|
-
} | {
|
|
203
|
-
of: 'type';
|
|
204
|
-
} | {
|
|
205
|
-
of: 'folder';
|
|
206
|
-
} | {
|
|
207
|
-
of: 'field';
|
|
208
|
-
field: string;
|
|
209
|
-
};
|
|
210
|
-
export type DocumentShape = {
|
|
211
|
-
kind: 'documents';
|
|
212
|
-
fields: 'all' | readonly string[] | null;
|
|
213
|
-
sections: 'all' | readonly string[] | null;
|
|
214
|
-
preamble: boolean;
|
|
215
|
-
markdown: boolean;
|
|
216
|
-
backlinks: boolean;
|
|
217
|
-
change: boolean;
|
|
218
|
-
fileId: boolean;
|
|
219
|
-
revision: boolean;
|
|
220
|
-
orderBy: readonly {
|
|
221
|
-
key: KeyPlan;
|
|
222
|
-
options: OrderOptions & {
|
|
223
|
-
direction: Direction;
|
|
224
|
-
};
|
|
225
|
-
}[];
|
|
226
|
-
};
|
|
227
|
-
export type GroupShape = {
|
|
228
|
-
kind: 'groups';
|
|
229
|
-
groupBy: readonly KeyPlan[];
|
|
230
|
-
orderBy: readonly {
|
|
231
|
-
by: 'count' | number;
|
|
232
|
-
direction: Direction;
|
|
233
|
-
}[];
|
|
73
|
+
export type PlanArea = {
|
|
74
|
+
room: string;
|
|
75
|
+
path: string;
|
|
76
|
+
open: readonly string[];
|
|
234
77
|
};
|
|
235
78
|
export type PlanReach = {
|
|
236
79
|
rooms: readonly string[];
|
|
237
80
|
documents: readonly string[];
|
|
81
|
+
areas: readonly PlanArea[];
|
|
238
82
|
};
|
|
239
|
-
export type
|
|
240
|
-
text: string;
|
|
241
|
-
values: readonly unknown[] | null;
|
|
242
|
-
};
|
|
243
|
-
export type Plan = {
|
|
244
|
-
key: string;
|
|
245
|
-
rooms: readonly string[] | null;
|
|
83
|
+
export type Plan = QueryPlan & {
|
|
246
84
|
reach: PlanReach | null;
|
|
247
85
|
locked: readonly string[];
|
|
248
|
-
root: Scope;
|
|
249
|
-
folder: string | null;
|
|
250
|
-
paths: readonly string[] | null;
|
|
251
|
-
hop: (Scope & {
|
|
252
|
-
field: string;
|
|
253
|
-
}) | null;
|
|
254
|
-
backlinks: (Scope & {
|
|
255
|
-
field: string | null;
|
|
256
|
-
}) | null;
|
|
257
|
-
shape: DocumentShape | GroupShape;
|
|
258
|
-
limit: number | null;
|
|
259
|
-
after: Continuation | null;
|
|
260
|
-
total: boolean;
|
|
261
86
|
};
|
|
262
|
-
export declare
|
|
263
|
-
readonly code: QueryErrorCode;
|
|
264
|
-
readonly retryable = false;
|
|
265
|
-
constructor(code: QueryErrorCode, at: string, problem: string);
|
|
266
|
-
}
|
|
267
|
-
type Entries = Readonly<Record<string, unknown>>;
|
|
268
|
-
export declare function invalid(at: string, problem: string): never;
|
|
269
|
-
export declare function plain(value: unknown): value is Entries;
|
|
270
|
-
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
271
|
-
export declare function flag(input: unknown, at: string): boolean;
|
|
272
|
-
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
273
|
-
export declare function limitOf(input: unknown): number | null;
|
|
274
|
-
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
275
|
-
export declare function queryKey(query: unknown): string;
|
|
276
|
-
export declare function identityOf(plan: Plan): string;
|
|
277
|
-
export {};
|
|
87
|
+
export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppRoom } from './listing.js';
|
|
2
|
+
import type { ReadinessPort } from './preparation.js';
|
|
3
|
+
import type { MdRuntime, RuntimeTopic } from './surface.js';
|
|
2
4
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
3
5
|
import type { Readiness } from './readiness.js';
|
|
4
|
-
import {
|
|
6
|
+
import type { SearchResult } from './search.js';
|
|
5
7
|
export type ReachedDocument = {
|
|
6
8
|
readonly room: string;
|
|
7
9
|
readonly path: string;
|
|
8
10
|
};
|
|
11
|
+
export type ReachedArea = {
|
|
12
|
+
readonly room: string;
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly open: readonly string[];
|
|
15
|
+
};
|
|
9
16
|
export type PortReach = {
|
|
10
17
|
readonly rooms: readonly string[];
|
|
11
18
|
readonly documents: readonly ReachedDocument[];
|
|
19
|
+
readonly areas?: readonly ReachedArea[];
|
|
12
20
|
readonly conversations: boolean;
|
|
13
21
|
};
|
|
14
22
|
export type Deliver = (message: unknown) => void;
|
|
15
|
-
export type
|
|
23
|
+
export type Fail = (error: unknown) => void;
|
|
24
|
+
export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
|
|
16
25
|
export type RuntimeView = {
|
|
17
26
|
md: MdRuntime;
|
|
18
27
|
watch: Watch;
|
|
19
28
|
};
|
|
20
29
|
export type NarrowedView = RuntimeView & {
|
|
21
30
|
narrow(reach: PortReach | null): void;
|
|
22
|
-
facts(port: ReadinessPort): void;
|
|
23
31
|
};
|
|
24
32
|
export type Reachable = RuntimeView & {
|
|
25
|
-
plan(input: unknown, reach: PortReach | null): Plan
|
|
33
|
+
plan(input: unknown, reach: PortReach | null): Promise<Plan>;
|
|
26
34
|
query(plan: Plan): Promise<QueryResult>;
|
|
27
|
-
watchPlan(plan: Plan, deliver:
|
|
28
|
-
search(input: unknown, reach: PortReach | null
|
|
35
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
36
|
+
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
29
37
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
30
|
-
locked(room: string): boolean
|
|
31
|
-
lockedRooms(): readonly string[]
|
|
38
|
+
locked(room: string): Promise<boolean>;
|
|
39
|
+
lockedRooms(): Promise<readonly string[]>;
|
|
32
40
|
watchLocks(notify: () => void): () => void;
|
|
33
|
-
located(room: string, path: string, destination: string): ReachedDocument | null
|
|
41
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
42
|
+
room(locator: string): Promise<AppRoom | undefined>;
|
|
34
43
|
};
|
|
35
44
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
36
45
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -43,4 +52,4 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
43
52
|
readonly selection: boolean;
|
|
44
53
|
};
|
|
45
54
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
46
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
55
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
@@ -1,46 +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
8
|
export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
|
|
9
|
-
export type SearchObligation = Open<'required' | 'unused'>;
|
|
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
19
|
export type Space = Open<'full'>;
|
|
22
|
-
export type
|
|
23
|
-
readonly room: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly file: string;
|
|
26
|
-
readonly rule: string;
|
|
27
|
-
readonly location: string | null;
|
|
28
|
-
};
|
|
29
|
-
export type InstallationStep = Open<'listing' | 'downloading' | 'writing' | 'replaying'>;
|
|
30
|
-
export type InstallationPause = Open<'hidden'>;
|
|
20
|
+
export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
|
|
31
21
|
export type InstallationAmount = {
|
|
32
22
|
readonly done: number;
|
|
33
23
|
readonly total: number;
|
|
34
24
|
};
|
|
35
25
|
export type Installation = {
|
|
36
26
|
readonly step: InstallationStep | null;
|
|
37
|
-
readonly paused: InstallationPause | null;
|
|
38
|
-
readonly rooms: InstallationAmount;
|
|
39
|
-
readonly parts: InstallationAmount;
|
|
40
27
|
readonly bytes: InstallationAmount;
|
|
41
|
-
readonly received: InstallationAmount;
|
|
42
28
|
};
|
|
43
|
-
export type ReadinessStatus = Open<'preparing' | 'paused' | '
|
|
29
|
+
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
44
30
|
export type Readiness = {
|
|
45
31
|
readonly status: ReadinessStatus;
|
|
46
32
|
readonly ready: boolean;
|
|
@@ -53,7 +39,6 @@ export type Readiness = {
|
|
|
53
39
|
readonly house: HouseOutcome;
|
|
54
40
|
readonly space: Space | null;
|
|
55
41
|
readonly installation: Installation;
|
|
56
|
-
readonly refused: readonly RefusedRoom[];
|
|
57
42
|
readonly lost: boolean;
|
|
58
43
|
};
|
|
59
44
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
@@ -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;
|
|
@@ -21,4 +21,5 @@ export type Recovery = {
|
|
|
21
21
|
retire(): Promise<void>;
|
|
22
22
|
};
|
|
23
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 {};
|