@agentshouse/app-bridge 0.1.0-ca559eade7c19 → 0.1.0-ca61ac777c0b7
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 +1033 -20
- 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 +25 -11
- 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 +161 -116
- 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 +13 -16
- package/dist/mdruntime/change.d.ts +32 -1
- package/dist/mdruntime/client.d.ts +36 -11
- package/dist/mdruntime/collection.d.ts +29 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +54 -46
- 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/listing.d.ts +47 -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 +8 -11
- 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 +4 -5
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/presence.d.ts +51 -0
- package/dist/mdruntime/query.d.ts +25 -191
- package/dist/mdruntime/reach.d.ts +20 -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 +28 -11
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +33 -0
- package/dist/mdruntime/save.d.ts +42 -48
- package/dist/mdruntime/saves.d.ts +31 -0
- package/dist/mdruntime/search.d.ts +12 -82
- 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/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +66 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- 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 +109 -150
- 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/wire.d.ts +54 -10
- 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 -4
- package/dist/test-host.js +19 -29
- package/docs/families.md +69 -56
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -118
- 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 -141
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -37
- package/dist/mdruntime/shared.d.ts +0 -10
- package/dist/mdruntime/turn.d.ts +0 -6
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { InstallationAmount } from '../readiness.js';
|
|
2
|
+
import type { TransferRecord } from './records.js';
|
|
3
|
+
type OwedIndex = {
|
|
4
|
+
readonly bytes: number;
|
|
5
|
+
readonly text: number;
|
|
6
|
+
};
|
|
7
|
+
export type RoomInstall = {
|
|
8
|
+
readonly transfer: TransferRecord | null;
|
|
9
|
+
readonly arrived: number | null;
|
|
10
|
+
readonly streaming: boolean;
|
|
11
|
+
readonly underived: number;
|
|
12
|
+
readonly unindexed: readonly OwedIndex[];
|
|
13
|
+
readonly startedOver: InstallationAmount | null;
|
|
14
|
+
readonly installing: boolean;
|
|
15
|
+
readonly catching: boolean;
|
|
16
|
+
readonly highest: string | null;
|
|
17
|
+
readonly beyondHorizon: boolean;
|
|
18
|
+
readonly confirmations: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const NO_INSTALL: RoomInstall;
|
|
21
|
+
export type Installs = {
|
|
22
|
+
of(locator: string): RoomInstall;
|
|
23
|
+
change(locator: string, next: (held: RoomInstall) => RoomInstall): void;
|
|
24
|
+
underway(): ReadonlySet<string>;
|
|
25
|
+
transferring(): readonly string[];
|
|
26
|
+
arrivalDue(now: number, everyMs: number): boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function createInstalls(): Installs;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ReadinessQueue<W> = {
|
|
2
|
+
add(watch: W): () => void;
|
|
3
|
+
held(watch: W): boolean;
|
|
4
|
+
changed(watch: W, reading: string): boolean;
|
|
5
|
+
owe(watches: readonly W[]): void;
|
|
6
|
+
queue(): void;
|
|
7
|
+
close(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare function createReadinessQueue<W>(deliver: (owed: readonly W[]) => Promise<void>, unpublished: (error: unknown) => void): ReadinessQueue<W>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { BootstrapInventory, Capability, ListedConversation, Member, ProviderLimit } from '../adapter.js';
|
|
2
|
+
import type { ChangeBatch } from '../change.js';
|
|
3
|
+
import { type Composition } from '../collection.js';
|
|
4
|
+
import type { Plan } from '../query.js';
|
|
5
|
+
import type { ReplicaRecord } from '../replica.js';
|
|
6
|
+
import type { Submission } from '../outcome.js';
|
|
7
|
+
import type { RoomDraftRecord, SavedDraft } from '../room-draft.js';
|
|
8
|
+
import type { ModelState, StoredModel } from '../model.js';
|
|
9
|
+
import type { CommittedWrite, ConversationWrite, HeldConversation, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
|
|
10
|
+
export type { ConversationWrite, HeldConversation, MessageWindow } from '../tables.js';
|
|
11
|
+
export type TransferRecord = {
|
|
12
|
+
readonly locator: string;
|
|
13
|
+
readonly transfer: string;
|
|
14
|
+
readonly selection: string;
|
|
15
|
+
readonly from: string;
|
|
16
|
+
readonly last: string;
|
|
17
|
+
readonly done: BootstrapInventory;
|
|
18
|
+
readonly models: {
|
|
19
|
+
readonly collection: ModelState;
|
|
20
|
+
};
|
|
21
|
+
readonly key: number | null;
|
|
22
|
+
};
|
|
23
|
+
export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
|
|
24
|
+
readonly model: StoredModel;
|
|
25
|
+
};
|
|
26
|
+
export type PendingState = {
|
|
27
|
+
readonly drafts: readonly SavedDraft[];
|
|
28
|
+
readonly submission: Submission;
|
|
29
|
+
readonly lost: boolean;
|
|
30
|
+
readonly upload?: unknown;
|
|
31
|
+
};
|
|
32
|
+
export type TargetRecord = {
|
|
33
|
+
established: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type PresentationRecord = {
|
|
36
|
+
app: string;
|
|
37
|
+
value: unknown;
|
|
38
|
+
};
|
|
39
|
+
export type ChatSubmission = {
|
|
40
|
+
readonly operation: string;
|
|
41
|
+
readonly text: string;
|
|
42
|
+
readonly turn: string | null;
|
|
43
|
+
};
|
|
44
|
+
export type ChatDraftRecord = {
|
|
45
|
+
conversation: string;
|
|
46
|
+
text: string;
|
|
47
|
+
revision: string;
|
|
48
|
+
submitted?: readonly ChatSubmission[];
|
|
49
|
+
moves?: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
export type CallRecord = {
|
|
52
|
+
readonly operation: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly input: unknown;
|
|
55
|
+
};
|
|
56
|
+
export type AuthoredWrite = {
|
|
57
|
+
locator: string;
|
|
58
|
+
queue?: readonly ChangeBatch[];
|
|
59
|
+
stored?: readonly ChangeBatch[];
|
|
60
|
+
founded?: readonly ChangeBatch[];
|
|
61
|
+
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
62
|
+
roomDrafts?: readonly RoomDraftRecord[];
|
|
63
|
+
consumedRoomDrafts?: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
export type StagedPage = {
|
|
66
|
+
readonly entries: readonly StoredEntry[];
|
|
67
|
+
readonly folders: readonly string[];
|
|
68
|
+
readonly part?: string;
|
|
69
|
+
};
|
|
70
|
+
export type ResumedTransfer = {
|
|
71
|
+
readonly key: number | null;
|
|
72
|
+
readonly transfer: string;
|
|
73
|
+
readonly staged: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
export type RefreshedPage = StagedPage & {
|
|
76
|
+
readonly removals: readonly string[];
|
|
77
|
+
readonly folderRemovals: readonly string[];
|
|
78
|
+
};
|
|
79
|
+
export type HeldRoom = {
|
|
80
|
+
readonly record: StoredReplica;
|
|
81
|
+
readonly indexed: boolean;
|
|
82
|
+
readonly documents: number;
|
|
83
|
+
};
|
|
84
|
+
export type QueuedChange = {
|
|
85
|
+
readonly batch: ChangeBatch;
|
|
86
|
+
readonly state: PendingState;
|
|
87
|
+
};
|
|
88
|
+
export type HeldWork = {
|
|
89
|
+
readonly room: (HeldRoom & {
|
|
90
|
+
readonly overlaid: ReadonlySet<string>;
|
|
91
|
+
}) | null;
|
|
92
|
+
readonly queue: readonly QueuedChange[];
|
|
93
|
+
};
|
|
94
|
+
export type CoveredRoom = {
|
|
95
|
+
readonly key: number;
|
|
96
|
+
readonly transfer: string;
|
|
97
|
+
readonly roomVersion: string;
|
|
98
|
+
readonly indexed: boolean;
|
|
99
|
+
readonly documents: number;
|
|
100
|
+
readonly bytes: number;
|
|
101
|
+
readonly offline: string;
|
|
102
|
+
};
|
|
103
|
+
export type HeldCover = {
|
|
104
|
+
readonly rooms: ReadonlyMap<string, CoveredRoom>;
|
|
105
|
+
readonly queues: ReadonlyMap<string, readonly string[]>;
|
|
106
|
+
};
|
|
107
|
+
export type HeldStatus = {
|
|
108
|
+
readonly queued: readonly string[];
|
|
109
|
+
readonly lastCompleted: string | null;
|
|
110
|
+
readonly unsent: readonly {
|
|
111
|
+
readonly room: string;
|
|
112
|
+
readonly path: string;
|
|
113
|
+
}[];
|
|
114
|
+
readonly resets: readonly {
|
|
115
|
+
readonly locator: string;
|
|
116
|
+
readonly reset: string;
|
|
117
|
+
}[];
|
|
118
|
+
readonly returned: readonly RoomDraftRecord[];
|
|
119
|
+
};
|
|
120
|
+
export type Facts = {
|
|
121
|
+
readonly lastCompleted: string | null;
|
|
122
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
123
|
+
readonly capabilities: readonly Capability[];
|
|
124
|
+
readonly member: Member | null;
|
|
125
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
126
|
+
readonly conversationList: readonly ListedConversation[] | null;
|
|
127
|
+
readonly conversationCursor: string | null;
|
|
128
|
+
};
|
|
129
|
+
export type Commit = {
|
|
130
|
+
readonly rooms: readonly RoomCommit[];
|
|
131
|
+
readonly writes?: readonly AuthoredWrite[];
|
|
132
|
+
readonly files?: readonly StoredFile[];
|
|
133
|
+
readonly whole?: boolean;
|
|
134
|
+
};
|
|
135
|
+
export type RuntimeStore = {
|
|
136
|
+
opened(): Promise<ReplicaOpened>;
|
|
137
|
+
rooms(locators?: readonly string[]): Promise<readonly HeldRoom[]>;
|
|
138
|
+
room(locator: string): Promise<HeldWork>;
|
|
139
|
+
covering(): Promise<HeldCover>;
|
|
140
|
+
offline(locator: string): Promise<string | null>;
|
|
141
|
+
held(): Promise<{
|
|
142
|
+
readonly held: ReadonlySet<string>;
|
|
143
|
+
readonly staged: ReadonlySet<string>;
|
|
144
|
+
}>;
|
|
145
|
+
status(): Promise<HeldStatus>;
|
|
146
|
+
batch(locator: string, id: string): Promise<ChangeBatch | null>;
|
|
147
|
+
order(locator: string): Promise<readonly string[]>;
|
|
148
|
+
queued(): Promise<readonly string[]>;
|
|
149
|
+
moving(): Promise<{
|
|
150
|
+
readonly queued: ReadonlyMap<string, readonly string[]>;
|
|
151
|
+
readonly moving: readonly (QueuedChange & {
|
|
152
|
+
readonly locator: string;
|
|
153
|
+
})[];
|
|
154
|
+
}>;
|
|
155
|
+
pending(locator: string, id: string): Promise<{
|
|
156
|
+
readonly state: PendingState | undefined;
|
|
157
|
+
readonly room: boolean;
|
|
158
|
+
}>;
|
|
159
|
+
facts(): Promise<Facts>;
|
|
160
|
+
presentation(app: string): Promise<unknown>;
|
|
161
|
+
demote(): Promise<void>;
|
|
162
|
+
query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
|
|
163
|
+
changes(keys: readonly number[]): number;
|
|
164
|
+
entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
|
|
165
|
+
typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
|
|
166
|
+
referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
|
|
167
|
+
folders(key: number, paths: readonly string[]): Promise<readonly string[]>;
|
|
168
|
+
typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
|
|
169
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
|
|
170
|
+
resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
|
|
171
|
+
refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
172
|
+
unrefresh(key: number): Promise<void>;
|
|
173
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
174
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
175
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
176
|
+
abandon(locator: string): Promise<void>;
|
|
177
|
+
unfence(locators: readonly string[]): Promise<ReadonlySet<string>>;
|
|
178
|
+
release(key: number): Promise<void>;
|
|
179
|
+
rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
|
|
180
|
+
readonly done: boolean;
|
|
181
|
+
readonly text: number;
|
|
182
|
+
}>;
|
|
183
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
184
|
+
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
185
|
+
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
186
|
+
roomDrafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
|
|
187
|
+
present(record: PresentationRecord): Promise<void>;
|
|
188
|
+
conversations(conversations?: readonly string[]): Promise<readonly HeldConversation[]>;
|
|
189
|
+
keepMessages(write: ConversationWrite): Promise<void>;
|
|
190
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
|
|
191
|
+
messageCount(conversation: string, phrase?: string | null): Promise<number>;
|
|
192
|
+
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
193
|
+
conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
|
|
194
|
+
dropConversations(conversations: readonly string[]): Promise<void>;
|
|
195
|
+
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
196
|
+
chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
|
|
197
|
+
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
198
|
+
dropChatDraft(conversation: string): Promise<void>;
|
|
199
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
200
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
201
|
+
dropCall(operation: string): Promise<void>;
|
|
202
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
203
|
+
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
204
|
+
fences(): Promise<readonly string[]>;
|
|
205
|
+
generation(): Promise<string | null>;
|
|
206
|
+
rememberGeneration(value: string): Promise<void>;
|
|
207
|
+
file(key: string, type: string): Promise<Blob>;
|
|
208
|
+
};
|
|
209
|
+
export declare function openRuntimeStore(database: RuntimeDatabase): RuntimeStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type RoomHeld<T> = {
|
|
2
|
+
of(locator: string, key: string): T | undefined;
|
|
3
|
+
hold(locator: string, key: string, value: T): void;
|
|
4
|
+
drop(locator: string, key: string): void;
|
|
5
|
+
forget(locator: string): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createRoomHeld<T>(): RoomHeld<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuntimeDatabase } from '../tables.js';
|
|
2
|
+
export type Space = {
|
|
3
|
+
full(): boolean;
|
|
4
|
+
fill(): boolean;
|
|
5
|
+
probing(): boolean;
|
|
6
|
+
probeEachMinute(): void;
|
|
7
|
+
probe(): Promise<void>;
|
|
8
|
+
stop(): void;
|
|
9
|
+
};
|
|
10
|
+
export declare function createSpace(database: RuntimeDatabase, freed: () => void): Space;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Watcher = {
|
|
2
|
+
held(): boolean;
|
|
3
|
+
stop(): void;
|
|
4
|
+
answer(value: unknown): void;
|
|
5
|
+
};
|
|
6
|
+
export type Watching = 'all' | 'waiting' | 'ready';
|
|
7
|
+
type Watchers = {
|
|
8
|
+
publication(work: () => Promise<void>): Promise<void>;
|
|
9
|
+
owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
|
|
10
|
+
watch(topic: string, notify: (value: unknown) => void): Watcher;
|
|
11
|
+
watching(topic: string, which?: Watching): readonly Watcher[];
|
|
12
|
+
tell(topic: string, value: unknown): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
};
|
|
15
|
+
export declare function createWatchers(unpublished: (error: unknown) => void): Watchers;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Composition } from '../collection.js';
|
|
2
|
+
import type { RefreshedPage, RuntimeStore } from './records.js';
|
|
3
|
+
export type InstallHold = {
|
|
4
|
+
take(): void;
|
|
5
|
+
release(): void;
|
|
6
|
+
};
|
|
7
|
+
type Writes = {
|
|
8
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
9
|
+
gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
|
|
10
|
+
written(): Promise<unknown>;
|
|
11
|
+
startingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
12
|
+
finishingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
13
|
+
ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
|
|
14
|
+
rederive(local: RuntimeStore, key: number, composition: Composition): Promise<{
|
|
15
|
+
readonly done: boolean;
|
|
16
|
+
readonly text: number;
|
|
17
|
+
}>;
|
|
18
|
+
refreshPage(local: RuntimeStore, key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
19
|
+
stageBytes(): number;
|
|
20
|
+
deriveBytes(): number;
|
|
21
|
+
};
|
|
22
|
+
export declare function createWrites(): Writes;
|
|
23
|
+
export {};
|
|
@@ -1,160 +1,119 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import type { TypedPath } from './adapter.js';
|
|
2
|
+
import { schemaTypes } from './attached-model.js';
|
|
3
|
+
import { type Cell } from './cell.js';
|
|
4
4
|
import type { ChangeBatch } from './change.js';
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
locator: string;
|
|
33
|
-
transfer: string;
|
|
34
|
-
selection: string;
|
|
35
|
-
from: string;
|
|
36
|
-
last: string;
|
|
37
|
-
pageToken: string | null;
|
|
38
|
-
models: {
|
|
39
|
-
collection: ModelState;
|
|
40
|
-
selection: ModelState;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type PendingState = {
|
|
44
|
-
readonly drafts: readonly SavedDraft[];
|
|
45
|
-
readonly submission: Submission;
|
|
46
|
-
readonly lost: boolean;
|
|
47
|
-
readonly upload?: unknown;
|
|
48
|
-
readonly accepted?: string;
|
|
49
|
-
};
|
|
50
|
-
export type TargetRecord = {
|
|
51
|
-
established: boolean;
|
|
52
|
-
};
|
|
53
|
-
export type QueueRecord = {
|
|
54
|
-
locator: string;
|
|
55
|
-
pending: readonly {
|
|
56
|
-
batch: ChangeBatch;
|
|
57
|
-
state: PendingState;
|
|
58
|
-
}[];
|
|
59
|
-
};
|
|
60
|
-
export type PresentationRecord = {
|
|
61
|
-
app: string;
|
|
62
|
-
value: unknown;
|
|
5
|
+
import type { ChangeSet } from './change-set.js';
|
|
6
|
+
import type { Composition } from './collection.js';
|
|
7
|
+
import type { ReadinessWatch } from './preparation.js';
|
|
8
|
+
import type { Persistence } from './readiness.js';
|
|
9
|
+
import type { Listing } from './listing.js';
|
|
10
|
+
import type { Seeded } from './seed.js';
|
|
11
|
+
import type { ModelState } from './model.js';
|
|
12
|
+
import { type OpenedFiles } from './opened.js';
|
|
13
|
+
import { type HeldReplica, type ReplicaRecord } from './replica.js';
|
|
14
|
+
import type { RoomDraftRecord } from './room-draft.js';
|
|
15
|
+
import { type SyncStatus } from './status.js';
|
|
16
|
+
import type { RuntimeDatabase } from './tables.js';
|
|
17
|
+
import { type Installs } from './store/installs.js';
|
|
18
|
+
import { type HeldCover, type HeldStatus, type PendingState, type RuntimeStore } from './store/records.js';
|
|
19
|
+
import { type ReadinessQueue } from './store/readiness.js';
|
|
20
|
+
import { type RoomHeld } from './store/room-held.js';
|
|
21
|
+
import { type Space } from './store/space.js';
|
|
22
|
+
import { type Watcher, type Watching } from './store/watchers.js';
|
|
23
|
+
import { createWrites, type InstallHold } from './store/writes.js';
|
|
24
|
+
export type { RoomInstall } from './store/installs.js';
|
|
25
|
+
export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
|
|
26
|
+
export type { InstallHold } from './store/writes.js';
|
|
27
|
+
export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
|
|
28
|
+
export type Stored = {
|
|
29
|
+
readonly record: ReplicaRecord;
|
|
30
|
+
readonly indexed: boolean;
|
|
31
|
+
readonly documents: number;
|
|
63
32
|
};
|
|
64
|
-
export type
|
|
65
|
-
|
|
66
|
-
read: string | null | undefined;
|
|
67
|
-
partial: boolean;
|
|
33
|
+
export type Held = HeldReplica & {
|
|
34
|
+
readonly states: ReadonlyMap<string, PendingState>;
|
|
68
35
|
};
|
|
69
|
-
export type
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
at: string | null;
|
|
74
|
-
partial: boolean;
|
|
75
|
-
};
|
|
36
|
+
export type Work = {
|
|
37
|
+
readonly replica: Held | undefined;
|
|
38
|
+
readonly queue: readonly ChangeBatch[];
|
|
39
|
+
readonly states: ReadonlyMap<string, PendingState>;
|
|
76
40
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
readonly
|
|
80
|
-
readonly
|
|
81
|
-
readonly turn: string | null;
|
|
41
|
+
type LandedAhead = Readonly<Record<string, string | undefined>>;
|
|
42
|
+
type AttachedFile = {
|
|
43
|
+
readonly revision: string;
|
|
44
|
+
readonly mediaType: string;
|
|
82
45
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
revision: string;
|
|
88
|
-
submitted?: readonly ChatSubmission[];
|
|
89
|
-
moves?: readonly string[];
|
|
46
|
+
type Seeds = {
|
|
47
|
+
of(key: string): Seeded | undefined;
|
|
48
|
+
keep(key: string, seed: Seeded): void;
|
|
49
|
+
drop(key: string): void;
|
|
90
50
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
51
|
+
type Device = {
|
|
52
|
+
readonly persistence: Persistence;
|
|
53
|
+
readonly storageLoss: string | null;
|
|
54
|
+
readonly heldWhenOpened: boolean;
|
|
55
|
+
readonly preparing: boolean;
|
|
56
|
+
readonly sweeping: boolean;
|
|
57
|
+
readonly unpreparedDemand: ReadonlySet<string>;
|
|
58
|
+
readonly unpreparable: ReadonlySet<string>;
|
|
59
|
+
readonly establishing: ReadonlySet<string>;
|
|
60
|
+
readonly status: SyncStatus;
|
|
61
|
+
readonly roomsShown: Listing | null;
|
|
95
62
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
63
|
+
type StoreOptions = {
|
|
64
|
+
readonly database: RuntimeDatabase;
|
|
65
|
+
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
66
|
+
readonly builtIn: ModelState;
|
|
67
|
+
readonly typedPaths: readonly TypedPath[];
|
|
68
|
+
readonly persistence: Persistence;
|
|
69
|
+
lost(locator: string): boolean;
|
|
70
|
+
opening(records: RuntimeStore): Promise<RuntimeStore>;
|
|
71
|
+
unpublished(error: unknown): void;
|
|
72
|
+
changed(set: ChangeSet): Promise<void>;
|
|
73
|
+
deliverReadiness(owed: readonly ReadinessWatch[]): Promise<void>;
|
|
74
|
+
spaceFreed(): void;
|
|
102
75
|
};
|
|
103
|
-
export type
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
receivedParts(key: string, count: number): Promise<readonly unknown[]>;
|
|
145
|
-
keepReceived(key: string, head: unknown, part?: {
|
|
146
|
-
index: number;
|
|
147
|
-
value: unknown;
|
|
148
|
-
}): Promise<void>;
|
|
149
|
-
dropReceived(keys: readonly string[]): Promise<void>;
|
|
150
|
-
generation(): Promise<string | null>;
|
|
151
|
-
rememberGeneration(value: string): Promise<void>;
|
|
76
|
+
export type Store = {
|
|
77
|
+
readonly device: Cell<Device>;
|
|
78
|
+
readonly space: Space;
|
|
79
|
+
readonly readiness: ReadinessQueue<ReadinessWatch>;
|
|
80
|
+
ask: RuntimeDatabase['ask'];
|
|
81
|
+
changed(set: ChangeSet): Promise<void>;
|
|
82
|
+
open(): Promise<RuntimeStore>;
|
|
83
|
+
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
84
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
85
|
+
gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
|
|
86
|
+
written(): Promise<unknown>;
|
|
87
|
+
startingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
88
|
+
finishingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
89
|
+
ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
|
|
90
|
+
rederive: ReturnType<typeof createWrites>['rederive'];
|
|
91
|
+
refreshPage: ReturnType<typeof createWrites>['refreshPage'];
|
|
92
|
+
stageBytes(): number;
|
|
93
|
+
deriveBytes(): number;
|
|
94
|
+
rooms(locators?: readonly string[]): Promise<ReadonlyMap<string, Stored>>;
|
|
95
|
+
record(locator: string): Promise<ReplicaRecord | undefined>;
|
|
96
|
+
work(locator: string): Promise<Work>;
|
|
97
|
+
replica(locator: string): Promise<Held | undefined>;
|
|
98
|
+
covering(): Promise<HeldCover>;
|
|
99
|
+
status(): Promise<HeldStatus>;
|
|
100
|
+
queued(): Promise<readonly string[]>;
|
|
101
|
+
drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
|
|
102
|
+
draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
|
|
103
|
+
composed(record: Pick<ReplicaRecord, 'model' | 'declaration'>): Composition;
|
|
104
|
+
publication(work: () => Promise<void>): Promise<void>;
|
|
105
|
+
owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
|
|
106
|
+
watch(topic: string, notify: (value: unknown) => void): Watcher;
|
|
107
|
+
watching(topic: string, which?: Watching): readonly Watcher[];
|
|
108
|
+
tell(topic: string, value: unknown): void;
|
|
109
|
+
readonly installs: Installs;
|
|
110
|
+
readonly seeds: Seeds;
|
|
111
|
+
readonly landed: RoomHeld<LandedAhead>;
|
|
112
|
+
readonly attached: RoomHeld<AttachedFile>;
|
|
113
|
+
readonly opened: OpenedFiles;
|
|
114
|
+
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
115
|
+
prepareAgain(locator?: string): void;
|
|
116
|
+
forget(locator: string): void;
|
|
152
117
|
close(): void;
|
|
153
118
|
};
|
|
154
|
-
export declare function
|
|
155
|
-
export declare function authoredBy(holder: string): Promise<boolean>;
|
|
156
|
-
export declare function authoredBinding(): Promise<string | null>;
|
|
157
|
-
export declare function bindAuthored(binding: string): Promise<void>;
|
|
158
|
-
export declare function removeRuntimeStore(holder?: string): Promise<boolean>;
|
|
159
|
-
export declare function openDatabase(name: string, version: number, upgrade: (opening: IDBOpenDBRequest, oldVersion: number) => void): Promise<IDBDatabase>;
|
|
160
|
-
export declare function openRuntimeStore(fenced: (locator: string) => boolean): Promise<RuntimeStore>;
|
|
119
|
+
export declare function createStore(options: StoreOptions): Store;
|