@agentshouse/app-bridge 0.1.0-c8d97d63f2350 → 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 +6 -6
- package/dist/index.d.ts +196 -132
- 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 +45 -25
- 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 +23 -5
- package/dist/mdruntime/collection.d.ts +2 -1
- 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 +34 -38
- package/dist/mdruntime/durability.d.ts +15 -0
- 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 +1 -1
- package/dist/mdruntime/messages.d.ts +27 -3
- package/dist/mdruntime/model.d.ts +2 -9
- package/dist/mdruntime/observation.d.ts +2 -2
- package/dist/mdruntime/outcome.d.ts +4 -1
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +13 -209
- package/dist/mdruntime/reach.d.ts +14 -12
- package/dist/mdruntime/readiness.d.ts +0 -3
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +9 -8
- package/dist/mdruntime/room-draft.d.ts +4 -5
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +42 -0
- package/dist/mdruntime/save.d.ts +5 -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 +0 -2
- 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 +107 -145
- package/dist/mdruntime/stored.d.ts +59 -33
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +120 -29
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +17 -1
- package/dist/test-host.js +1 -1
- package/docs/families.md +20 -8
- package/package.json +1 -1
- package/dist/mdmodel/condition.d.ts +0 -167
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -152
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -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,91 +70,6 @@ export type GroupResult = GroupRows & {
|
|
|
147
70
|
coverage: QueryCoverage;
|
|
148
71
|
};
|
|
149
72
|
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
150
|
-
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
151
|
-
export type RoomFacts = {
|
|
152
|
-
locator: string;
|
|
153
|
-
available: boolean;
|
|
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
|
-
}[];
|
|
234
|
-
};
|
|
235
73
|
export type PlanArea = {
|
|
236
74
|
room: string;
|
|
237
75
|
path: string;
|
|
@@ -242,42 +80,8 @@ export type PlanReach = {
|
|
|
242
80
|
documents: readonly string[];
|
|
243
81
|
areas: readonly PlanArea[];
|
|
244
82
|
};
|
|
245
|
-
export type
|
|
246
|
-
text: string;
|
|
247
|
-
values: readonly unknown[] | null;
|
|
248
|
-
};
|
|
249
|
-
export type Plan = {
|
|
250
|
-
key: string;
|
|
251
|
-
rooms: readonly string[] | null;
|
|
83
|
+
export type Plan = QueryPlan & {
|
|
252
84
|
reach: PlanReach | null;
|
|
253
85
|
locked: readonly string[];
|
|
254
|
-
root: Scope;
|
|
255
|
-
folder: string | null;
|
|
256
|
-
paths: readonly string[] | null;
|
|
257
|
-
hop: (Scope & {
|
|
258
|
-
field: string;
|
|
259
|
-
}) | null;
|
|
260
|
-
backlinks: (Scope & {
|
|
261
|
-
field: string | null;
|
|
262
|
-
}) | null;
|
|
263
|
-
shape: DocumentShape | GroupShape;
|
|
264
|
-
limit: number | null;
|
|
265
|
-
after: Continuation | null;
|
|
266
|
-
total: boolean;
|
|
267
86
|
};
|
|
268
|
-
export declare
|
|
269
|
-
readonly code: QueryErrorCode;
|
|
270
|
-
readonly retryable = false;
|
|
271
|
-
constructor(code: QueryErrorCode, at: string, problem: string);
|
|
272
|
-
}
|
|
273
|
-
type Entries = Readonly<Record<string, unknown>>;
|
|
274
|
-
export declare function invalid(at: string, problem: string): never;
|
|
275
|
-
export declare function plain(value: unknown): value is Entries;
|
|
276
|
-
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
277
|
-
export declare function flag(input: unknown, at: string): boolean;
|
|
278
|
-
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
279
|
-
export declare function limitOf(input: unknown): number | null;
|
|
280
|
-
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
281
|
-
export declare function queryKey(query: unknown): string;
|
|
282
|
-
export declare function identityOf(plan: Plan): string;
|
|
283
|
-
export {};
|
|
87
|
+
export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AppRoom
|
|
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;
|
|
@@ -18,26 +20,26 @@ export type PortReach = {
|
|
|
18
20
|
readonly conversations: boolean;
|
|
19
21
|
};
|
|
20
22
|
export type Deliver = (message: unknown) => void;
|
|
21
|
-
export type
|
|
23
|
+
export type Fail = (error: unknown) => void;
|
|
24
|
+
export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
|
|
22
25
|
export type RuntimeView = {
|
|
23
26
|
md: MdRuntime;
|
|
24
27
|
watch: Watch;
|
|
25
28
|
};
|
|
26
29
|
export type NarrowedView = RuntimeView & {
|
|
27
30
|
narrow(reach: PortReach | null): void;
|
|
28
|
-
facts(port: ReadinessPort): void;
|
|
29
31
|
};
|
|
30
32
|
export type Reachable = RuntimeView & {
|
|
31
|
-
plan(input: unknown, reach: PortReach | null): Plan
|
|
33
|
+
plan(input: unknown, reach: PortReach | null): Promise<Plan>;
|
|
32
34
|
query(plan: Plan): Promise<QueryResult>;
|
|
33
|
-
watchPlan(plan: Plan, deliver:
|
|
34
|
-
search(input: unknown, reach: PortReach | null
|
|
35
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
36
|
+
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
35
37
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
36
|
-
locked(room: string): boolean
|
|
37
|
-
lockedRooms(): readonly string[]
|
|
38
|
+
locked(room: string): Promise<boolean>;
|
|
39
|
+
lockedRooms(): Promise<readonly string[]>;
|
|
38
40
|
watchLocks(notify: () => void): () => void;
|
|
39
|
-
located(room: string, path: string, destination: string): ReachedDocument | null
|
|
40
|
-
room(locator: string): AppRoom | undefined
|
|
41
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
42
|
+
room(locator: string): Promise<AppRoom | undefined>;
|
|
41
43
|
};
|
|
42
44
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
43
45
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -50,4 +52,4 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
50
52
|
readonly selection: boolean;
|
|
51
53
|
};
|
|
52
54
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
53
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
55
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
@@ -6,13 +6,11 @@ export type RoomCoverage = {
|
|
|
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'>;
|
|
@@ -26,7 +24,6 @@ export type InstallationAmount = {
|
|
|
26
24
|
};
|
|
27
25
|
export type Installation = {
|
|
28
26
|
readonly step: InstallationStep | null;
|
|
29
|
-
readonly rooms: InstallationAmount;
|
|
30
27
|
readonly bytes: InstallationAmount;
|
|
31
28
|
};
|
|
32
29
|
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type TypedPath } from '../mdmodel/index.js';
|
|
2
|
+
import type { BootstrapInventory, SavedFacts, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
3
|
import { type ChangeBatch, type Precondition } from './change.js';
|
|
3
4
|
import { type Collection, type Composition } from './collection.js';
|
|
4
5
|
import { type ModelState } from './model.js';
|
|
@@ -13,6 +14,7 @@ export type ReplicaRecord = {
|
|
|
13
14
|
readonly model: ModelState;
|
|
14
15
|
readonly typedSelection: TypedSelection | null;
|
|
15
16
|
readonly providerOwnedPaths: readonly string[];
|
|
17
|
+
readonly authoredPaths?: readonly string[];
|
|
16
18
|
readonly roomVersion: string;
|
|
17
19
|
readonly transfer: string;
|
|
18
20
|
readonly inventory: BootstrapInventory;
|
|
@@ -22,23 +24,22 @@ export type HeldReplica = {
|
|
|
22
24
|
readonly record: ReplicaRecord;
|
|
23
25
|
readonly queue: readonly ChangeBatch[];
|
|
24
26
|
readonly overlaid: ReadonlySet<string>;
|
|
25
|
-
readonly count: number;
|
|
26
|
-
readonly confirmed: number;
|
|
27
|
-
readonly indexed: boolean;
|
|
28
27
|
};
|
|
29
28
|
export type VisibleLayer = Layer & {
|
|
30
29
|
readonly collection: Collection;
|
|
31
30
|
};
|
|
32
31
|
export type Slice = Layer & {
|
|
33
32
|
readonly written: Readonly<Record<string, string>>;
|
|
33
|
+
readonly facts: Readonly<Record<string, SavedFacts>>;
|
|
34
34
|
readonly held: ReadonlySet<string>;
|
|
35
35
|
};
|
|
36
|
-
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
|
|
36
|
+
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState, typedPaths: readonly TypedPath[]): Composition;
|
|
37
37
|
export declare function storedRecord(record: ReplicaRecord): string;
|
|
38
38
|
export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
|
|
39
|
+
export type LayerEntry = Omit<StoredEntry, 'facts'>;
|
|
39
40
|
export declare function entryAt(layer: Layer & {
|
|
40
41
|
readonly written?: Readonly<Record<string, string>>;
|
|
41
|
-
}, path: string):
|
|
42
|
+
}, path: string): LayerEntry | null;
|
|
42
43
|
export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
|
|
43
44
|
export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
|
|
44
45
|
export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
|
|
@@ -47,7 +48,7 @@ export type Replayed = {
|
|
|
47
48
|
readonly touched: ReadonlySet<string>;
|
|
48
49
|
};
|
|
49
50
|
export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
|
|
50
|
-
export declare function overlayOf(visible:
|
|
51
|
+
export declare function overlayOf(visible: VisibleLayer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
|
|
51
52
|
export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
|
|
52
53
|
export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
|
|
53
54
|
export type Standing = {
|
|
@@ -63,5 +64,5 @@ export type Returned = {
|
|
|
63
64
|
readonly removed: readonly string[];
|
|
64
65
|
};
|
|
65
66
|
export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
|
|
66
|
-
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
|
|
67
|
+
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string, composition: Composition): Generator<number, Returned, void>;
|
|
67
68
|
export {};
|
|
@@ -90,9 +90,9 @@ type ChangedUnderneath = {
|
|
|
90
90
|
readonly file?: string | null;
|
|
91
91
|
};
|
|
92
92
|
export type ReturnReason = ProviderRefusal & {
|
|
93
|
-
readonly kind: Open<'conflicted' | 'rejected' | '
|
|
93
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
94
94
|
};
|
|
95
|
-
export declare function returnedBy(
|
|
95
|
+
export declare function returnedBy(): ReturnReason;
|
|
96
96
|
export type RoomDraft = {
|
|
97
97
|
readonly room: string;
|
|
98
98
|
readonly path: string;
|
|
@@ -106,8 +106,6 @@ export type RoomDraftWrite = {
|
|
|
106
106
|
readonly roomDraft: RoomDraft | null;
|
|
107
107
|
} | {
|
|
108
108
|
readonly outcome: 'stale';
|
|
109
|
-
readonly code: string;
|
|
110
|
-
readonly retryable: boolean;
|
|
111
109
|
readonly current: RoomDraft | null;
|
|
112
110
|
};
|
|
113
111
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
@@ -127,13 +125,14 @@ export type SavedDraft = {
|
|
|
127
125
|
readonly path: string;
|
|
128
126
|
readonly parts: HeldParts;
|
|
129
127
|
};
|
|
130
|
-
export declare function readParts(value: unknown): RoomDraftParts;
|
|
128
|
+
export declare function readParts(value: unknown, path: string): RoomDraftParts;
|
|
131
129
|
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
132
130
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
133
131
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
134
132
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
135
133
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
136
134
|
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
135
|
+
export declare function lineEnded(text: string): string;
|
|
137
136
|
export type TextParts = {
|
|
138
137
|
readonly fields?: Readonly<Record<string, {
|
|
139
138
|
readonly value: unknown;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ChangeSet } from './change-set.js';
|
|
2
|
+
import { type VisibleLayer } from './replica.js';
|
|
3
|
+
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
import type { Store } from './store.js';
|
|
6
|
+
export type RoomDraftSurface = {
|
|
7
|
+
list(): Promise<readonly RoomDraft[]>;
|
|
8
|
+
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
9
|
+
write(room: string, path: string, revision: string | null, parts: unknown, next?: string): Promise<RoomDraftWrite>;
|
|
10
|
+
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
11
|
+
};
|
|
12
|
+
export type PresentationSurface = {
|
|
13
|
+
read(app: string): Promise<unknown>;
|
|
14
|
+
write(app: string, value: unknown): Promise<void>;
|
|
15
|
+
edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare function visibleOf(store: Store, locator: string, paths: readonly string[]): Promise<VisibleLayer | undefined>;
|
|
18
|
+
export declare function publishRoomDrafts({ store, socket }: Runtime, waitingOnly: boolean, touched?: ChangeSet['documents'] | null): Promise<void>;
|
|
19
|
+
export declare function emitPresentation({ store, socket }: Runtime, app: string): Promise<void>;
|
|
20
|
+
export declare function roomDraftSurface(runtime: Runtime): RoomDraftSurface;
|
|
21
|
+
export declare function presentationSurface(runtime: Runtime): PresentationSurface;
|
|
22
|
+
export declare function watchRoomDrafts({ store, socket }: Runtime, deliver: (value: unknown) => void): () => void;
|
|
23
|
+
export declare function watchPresentation({ store, socket }: Runtime, app: string, deliver: (value: unknown) => void): () => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Authorization, DiscoveredRoom, PathRule, ScopedRefusal, TypedPath } from './adapter.js';
|
|
2
|
+
import type { ChangeSet } from './change-set.js';
|
|
3
|
+
import type { ChangeBatch } from './change.js';
|
|
4
|
+
import type { RuntimeShell } from './durability.js';
|
|
5
|
+
import type { LiveConversations } from './conversation-live.js';
|
|
6
|
+
import type { FiguresRead } from './figures.js';
|
|
7
|
+
import type { Withheld } from './install.js';
|
|
8
|
+
import type { LiveQueries } from './live.js';
|
|
9
|
+
import type { Log } from './log.js';
|
|
10
|
+
import type { ModelState } from './model.js';
|
|
11
|
+
import type { ReadAnswers } from './reads.js';
|
|
12
|
+
import type { Recovery } from './recovery.js';
|
|
13
|
+
import type { ReplicaRecord } from './replica.js';
|
|
14
|
+
import type { RuntimeSocket, RoomDeclaration } from './socket.js';
|
|
15
|
+
import type { CycleProgress } from './status.js';
|
|
16
|
+
import type { Settling } from './saves.js';
|
|
17
|
+
import type { HeldCover, RuntimeStore, Store, Work } from './store.js';
|
|
18
|
+
import type { schemaTypes } from './attached-model.js';
|
|
19
|
+
export type Runtime = {
|
|
20
|
+
readonly store: Store;
|
|
21
|
+
readonly socket: RuntimeSocket;
|
|
22
|
+
readonly journal: Log;
|
|
23
|
+
readonly recovery: Recovery;
|
|
24
|
+
readonly shell: RuntimeShell;
|
|
25
|
+
readonly localSaves: boolean;
|
|
26
|
+
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
27
|
+
readonly builtIn: ModelState;
|
|
28
|
+
readonly typedPaths: readonly TypedPath[];
|
|
29
|
+
readonly pathRule: PathRule;
|
|
30
|
+
readonly usableWhenHeld: readonly string[];
|
|
31
|
+
readonly build: string;
|
|
32
|
+
readonly conversations: LiveConversations;
|
|
33
|
+
readonly liveQueries: LiveQueries<HeldCover>;
|
|
34
|
+
readonly figures: FiguresRead;
|
|
35
|
+
readonly lastAnswers: ReadAnswers;
|
|
36
|
+
settle(local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
|
|
37
|
+
scoped(result: ScopedRefusal, room: RoomDeclaration, local: RuntimeStore): Promise<void>;
|
|
38
|
+
submitLater(locator: string): void;
|
|
39
|
+
unpair(local: RuntimeStore): Promise<void>;
|
|
40
|
+
advanced(room: DiscoveredRoom, local: RuntimeStore, authorized: Authorization): Promise<Withheld | null>;
|
|
41
|
+
withhold(withheld: Withheld, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress): Promise<void>;
|
|
42
|
+
};
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
-
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
2
|
+
import type { OperationScopes, PathRule, ProviderLimit } from './adapter.js';
|
|
3
3
|
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
4
4
|
import { type Composition } from './collection.js';
|
|
5
5
|
import { type Layer } from './overlay.js';
|
|
@@ -19,7 +19,9 @@ export type SaveInput = {
|
|
|
19
19
|
baseRoomVersion: string;
|
|
20
20
|
operations: import('./adapter.js').OperationScopes;
|
|
21
21
|
providerOwnedPaths: readonly string[];
|
|
22
|
+
authoredPaths?: readonly string[];
|
|
22
23
|
providerLimits: readonly ProviderLimit[];
|
|
24
|
+
pathRule: PathRule;
|
|
23
25
|
visible: VisibleLayer;
|
|
24
26
|
folders: ReadonlySet<string>;
|
|
25
27
|
handle: string;
|
|
@@ -75,6 +77,7 @@ export type MoveSide = {
|
|
|
75
77
|
composition: Composition;
|
|
76
78
|
operations: OperationScopes;
|
|
77
79
|
providerOwnedPaths: readonly string[];
|
|
80
|
+
authoredPaths?: readonly string[];
|
|
78
81
|
visible: VisibleLayer;
|
|
79
82
|
folders: ReadonlySet<string>;
|
|
80
83
|
queued: ReadonlySet<string>;
|
|
@@ -89,6 +92,7 @@ export type MoveInput = {
|
|
|
89
92
|
readonly to: string;
|
|
90
93
|
}[];
|
|
91
94
|
providerLimits: readonly ProviderLimit[];
|
|
95
|
+
pathRule: PathRule;
|
|
92
96
|
local: boolean;
|
|
93
97
|
writtenBy?: WrittenBy;
|
|
94
98
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ChangeSet } from './change-set.js';
|
|
2
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
3
|
+
import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
|
|
4
|
+
import { type HeldReplica, type ReplicaRecord, type Slice, type VisibleLayer } from './replica.js';
|
|
5
|
+
import { type ReturnReason, type RoomDraftParts } from './room-draft.js';
|
|
6
|
+
import type { Runtime } from './runtime.js';
|
|
7
|
+
import { type SaveRefusal } from './save.js';
|
|
8
|
+
import type { AuthoredWrite, CommittedWrite, PendingState, RoomCommit, RuntimeStore, Store, StoredEntry, View, Work } from './store.js';
|
|
9
|
+
export type SaveResult = {
|
|
10
|
+
outcome: 'saved';
|
|
11
|
+
identifier: string;
|
|
12
|
+
} | ({
|
|
13
|
+
outcome: 'refused';
|
|
14
|
+
} & SaveRefusal);
|
|
15
|
+
export type SavedRoomDraft = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly revision: string;
|
|
18
|
+
};
|
|
19
|
+
export type SavedParts = {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly parts: RoomDraftParts;
|
|
22
|
+
};
|
|
23
|
+
export type BinaryFileSurface = {
|
|
24
|
+
read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
|
|
25
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
26
|
+
show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
|
|
27
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
28
|
+
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
29
|
+
};
|
|
30
|
+
export type Leaving = {
|
|
31
|
+
batch: ChangeBatch;
|
|
32
|
+
returned: ReturnReason | null;
|
|
33
|
+
};
|
|
34
|
+
export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
|
|
35
|
+
export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
|
|
36
|
+
export declare function landedWhole(store: Store, locator: string, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
|
|
37
|
+
export type Settling = {
|
|
38
|
+
leaving?: readonly Leaving[];
|
|
39
|
+
room?: boolean;
|
|
40
|
+
view?: View;
|
|
41
|
+
commit?: Pick<RoomCommit, 'published' | 'refreshed'>;
|
|
42
|
+
changes?: {
|
|
43
|
+
readonly set: readonly StoredEntry[];
|
|
44
|
+
readonly removed: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare function preparedAfter(runtime: Runtime, locator: string, answer: CommittedWrite): void;
|
|
48
|
+
export declare function replayed(store: Store, record: ReplicaRecord, confirmedLayer: Slice, queue: readonly ChangeBatch[]): import("./turn.js").Later<import("./replica.js").Replayed>;
|
|
49
|
+
export declare function overlayDiff(record: ReplicaRecord, before: HeldReplica | undefined, visible: VisibleLayer, touched: ReadonlySet<string>): Promise<{
|
|
50
|
+
overlay: NonNullable<RoomCommit['overlay']>;
|
|
51
|
+
touched: ReadonlySet<string>;
|
|
52
|
+
}>;
|
|
53
|
+
export type Settlement = {
|
|
54
|
+
readonly locator: string;
|
|
55
|
+
readonly left: readonly ChangeBatch[];
|
|
56
|
+
readonly commit: {
|
|
57
|
+
readonly rooms: readonly RoomCommit[];
|
|
58
|
+
readonly writes: readonly AuthoredWrite[];
|
|
59
|
+
};
|
|
60
|
+
apply(answer: CommittedWrite): ChangeSet;
|
|
61
|
+
};
|
|
62
|
+
export declare function settle(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
|
|
63
|
+
export declare function together(runtime: Runtime, local: RuntimeStore, settlements: readonly Settlement[]): Promise<ChangeSet>;
|
|
64
|
+
export declare function settlement(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<Settlement>;
|
|
65
|
+
export declare function unpairing(runtime: Runtime, local: RuntimeStore, locator: string, batches: readonly ChangeBatch[]): Promise<Settlement>;
|
|
66
|
+
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
67
|
+
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
68
|
+
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
69
|
+
export declare function binaryFileSurface(runtime: Runtime): BinaryFileSurface;
|