@agentshouse/app-bridge 0.1.0-cf2e2ca943fbc → 0.1.0-cf304386b60e3

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.
Files changed (101) hide show
  1. package/README.md +21 -16
  2. package/dist/index.d.ts +1075 -0
  3. package/dist/index.js +1 -0
  4. package/dist/mdmodel/blocks.d.ts +10 -0
  5. package/dist/mdmodel/definition.d.ts +81 -0
  6. package/dist/mdmodel/divide.d.ts +2 -0
  7. package/dist/mdmodel/document.d.ts +16 -0
  8. package/dist/mdmodel/event.d.ts +77 -0
  9. package/dist/mdmodel/facts.d.ts +14 -0
  10. package/dist/mdmodel/fields.d.ts +5 -0
  11. package/dist/mdmodel/index.d.ts +33 -0
  12. package/dist/mdmodel/kinds.d.ts +18 -0
  13. package/dist/mdmodel/links.d.ts +28 -0
  14. package/dist/mdmodel/paths.d.ts +25 -0
  15. package/dist/mdmodel/pattern.d.ts +9 -0
  16. package/dist/mdmodel/profile.d.ts +5 -0
  17. package/dist/mdmodel/project.d.ts +21 -0
  18. package/dist/mdmodel/query/language.d.ts +253 -0
  19. package/dist/mdmodel/query/match.d.ts +13 -0
  20. package/dist/mdmodel/query/rows.d.ts +31 -0
  21. package/dist/mdmodel/query/sql.d.ts +38 -0
  22. package/dist/mdmodel/references.d.ts +3 -0
  23. package/dist/mdmodel/reserved.d.ts +4 -0
  24. package/dist/mdmodel/types.d.ts +178 -0
  25. package/dist/mdmodel/validate.d.ts +33 -0
  26. package/dist/mdmodel/version.d.ts +1 -0
  27. package/dist/mdmodel/yaml.d.ts +55 -0
  28. package/dist/mdruntime/adapter.d.ts +546 -0
  29. package/dist/mdruntime/attached-model.d.ts +7 -0
  30. package/dist/mdruntime/binary.d.ts +17 -0
  31. package/dist/mdruntime/bootstrap.d.ts +43 -0
  32. package/dist/mdruntime/chain.d.ts +11 -0
  33. package/dist/mdruntime/change-set.d.ts +27 -0
  34. package/dist/mdruntime/change.d.ts +119 -0
  35. package/dist/mdruntime/client.d.ts +100 -0
  36. package/dist/mdruntime/collection.d.ts +28 -0
  37. package/dist/mdruntime/compile.d.ts +15 -0
  38. package/dist/mdruntime/connection.d.ts +129 -0
  39. package/dist/mdruntime/conversation-row.d.ts +32 -0
  40. package/dist/mdruntime/conversation.d.ts +127 -0
  41. package/dist/mdruntime/durability.d.ts +17 -0
  42. package/dist/mdruntime/failure.d.ts +12 -0
  43. package/dist/mdruntime/figures.d.ts +47 -0
  44. package/dist/mdruntime/identity.d.ts +5 -0
  45. package/dist/mdruntime/job.d.ts +32 -0
  46. package/dist/mdruntime/live.d.ts +22 -0
  47. package/dist/mdruntime/log.d.ts +5 -0
  48. package/dist/mdruntime/media.d.ts +7 -0
  49. package/dist/mdruntime/messages.d.ts +51 -0
  50. package/dist/mdruntime/model.d.ts +55 -0
  51. package/dist/mdruntime/observation.d.ts +44 -0
  52. package/dist/mdruntime/open.d.ts +1 -0
  53. package/dist/mdruntime/opened.d.ts +21 -0
  54. package/dist/mdruntime/outcome.d.ts +85 -0
  55. package/dist/mdruntime/overlay.d.ts +25 -0
  56. package/dist/mdruntime/query.d.ts +88 -0
  57. package/dist/mdruntime/reach.d.ts +53 -0
  58. package/dist/mdruntime/readiness.d.ts +49 -0
  59. package/dist/mdruntime/reads.d.ts +35 -0
  60. package/dist/mdruntime/recovery.d.ts +25 -0
  61. package/dist/mdruntime/refresh.d.ts +26 -0
  62. package/dist/mdruntime/replica.d.ts +67 -0
  63. package/dist/mdruntime/room-draft.d.ts +174 -0
  64. package/dist/mdruntime/room-drafts.d.ts +28 -0
  65. package/dist/mdruntime/save.d.ts +102 -0
  66. package/dist/mdruntime/saves.d.ts +95 -0
  67. package/dist/mdruntime/search.d.ts +21 -0
  68. package/dist/mdruntime/seed.d.ts +29 -0
  69. package/dist/mdruntime/socket/admission.d.ts +6 -0
  70. package/dist/mdruntime/socket/answers.d.ts +5 -0
  71. package/dist/mdruntime/socket.d.ts +42 -0
  72. package/dist/mdruntime/source.d.ts +60 -0
  73. package/dist/mdruntime/status.d.ts +25 -0
  74. package/dist/mdruntime/store/fences.d.ts +15 -0
  75. package/dist/mdruntime/store/installs.d.ts +29 -0
  76. package/dist/mdruntime/store/records.d.ts +211 -0
  77. package/dist/mdruntime/store/room-held.d.ts +7 -0
  78. package/dist/mdruntime/store/watchers.d.ts +14 -0
  79. package/dist/mdruntime/store/writes.d.ts +23 -0
  80. package/dist/mdruntime/store.d.ts +86 -0
  81. package/dist/mdruntime/stored.d.ts +155 -0
  82. package/dist/mdruntime/tables.d.ts +406 -0
  83. package/dist/mdruntime/tallies.d.ts +17 -0
  84. package/dist/mdruntime/transfer.d.ts +4 -0
  85. package/dist/mdruntime/turn.d.ts +8 -0
  86. package/dist/mdruntime/wire.d.ts +249 -0
  87. package/dist/{client/src/test-host.d.ts → test-host.d.ts} +10 -8
  88. package/dist/test-host.js +190 -0
  89. package/docs/families.md +101 -45
  90. package/package.json +12 -10
  91. package/dist/client/src/bridge.d.ts +0 -38
  92. package/dist/client/src/bridge.js +0 -320
  93. package/dist/client/src/index.d.ts +0 -3
  94. package/dist/client/src/index.js +0 -2
  95. package/dist/client/src/test-host.js +0 -185
  96. package/dist/client/src/wire.d.ts +0 -215
  97. package/dist/client/src/wire.js +0 -1
  98. package/dist/src/apps/remainder.d.ts +0 -2
  99. package/dist/src/apps/remainder.js +0 -16
  100. package/dist/src/apps/tab.d.ts +0 -6
  101. package/dist/src/apps/tab.js +0 -27
@@ -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,211 @@
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
+ import type { JobMarker } from '../job.js';
11
+ export type { ConversationWrite, HeldConversation, MessageWindow } from '../tables.js';
12
+ export type TransferRecord = {
13
+ readonly locator: string;
14
+ readonly transfer: string;
15
+ readonly selection: string;
16
+ readonly from: string;
17
+ readonly last: string;
18
+ readonly done: BootstrapInventory;
19
+ readonly models: {
20
+ readonly collection: ModelState;
21
+ };
22
+ readonly key: number | null;
23
+ };
24
+ export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
25
+ readonly model: StoredModel;
26
+ };
27
+ export type PendingState = {
28
+ readonly drafts: readonly SavedDraft[];
29
+ readonly submission: Submission;
30
+ readonly lost: boolean;
31
+ readonly upload?: unknown;
32
+ };
33
+ export type TargetRecord = {
34
+ established: boolean;
35
+ };
36
+ export type PresentationRecord = {
37
+ app: string;
38
+ value: unknown;
39
+ };
40
+ export type ChatSubmission = {
41
+ readonly operation: string;
42
+ readonly text: string;
43
+ readonly turn: string | null;
44
+ };
45
+ export type ChatDraftRecord = {
46
+ conversation: string;
47
+ text: string;
48
+ revision: string;
49
+ submitted?: readonly ChatSubmission[];
50
+ moves?: readonly string[];
51
+ };
52
+ export type CallRecord = {
53
+ readonly operation: string;
54
+ readonly name: string;
55
+ readonly input: unknown;
56
+ };
57
+ export type AuthoredWrite = {
58
+ locator: string;
59
+ queue?: readonly ChangeBatch[];
60
+ stored?: readonly ChangeBatch[];
61
+ founded?: readonly ChangeBatch[];
62
+ saved?: ReadonlyMap<string, readonly SavedDraft[]>;
63
+ roomDrafts?: readonly RoomDraftRecord[];
64
+ consumedRoomDrafts?: readonly string[];
65
+ };
66
+ export type StagedPage = {
67
+ readonly entries: readonly StoredEntry[];
68
+ readonly folders: readonly string[];
69
+ readonly part?: string;
70
+ };
71
+ export type ResumedTransfer = {
72
+ readonly key: number | null;
73
+ readonly transfer: string;
74
+ readonly staged: readonly string[];
75
+ };
76
+ export type RefreshedPage = StagedPage & {
77
+ readonly removals: readonly string[];
78
+ readonly folderRemovals: readonly string[];
79
+ };
80
+ export type HeldRoom = {
81
+ readonly record: StoredReplica;
82
+ readonly indexed: boolean;
83
+ readonly documents: number;
84
+ };
85
+ export type QueuedChange = {
86
+ readonly batch: ChangeBatch;
87
+ readonly state: PendingState;
88
+ };
89
+ export type HeldWork = {
90
+ readonly room: (HeldRoom & {
91
+ readonly overlaid: ReadonlySet<string>;
92
+ }) | null;
93
+ readonly queue: readonly QueuedChange[];
94
+ };
95
+ export type CoveredRoom = {
96
+ readonly key: number;
97
+ readonly transfer: string;
98
+ readonly roomVersion: string;
99
+ readonly indexed: boolean;
100
+ readonly documents: number;
101
+ readonly bytes: number;
102
+ readonly offline: string;
103
+ };
104
+ export type HeldCover = {
105
+ readonly rooms: ReadonlyMap<string, CoveredRoom>;
106
+ readonly queues: ReadonlyMap<string, readonly string[]>;
107
+ };
108
+ export type HeldStatus = {
109
+ readonly queued: readonly string[];
110
+ readonly lastCompleted: string | null;
111
+ readonly unsent: readonly {
112
+ readonly room: string;
113
+ readonly path: string;
114
+ }[];
115
+ readonly resets: readonly {
116
+ readonly locator: string;
117
+ readonly reset: string;
118
+ }[];
119
+ readonly returned: readonly RoomDraftRecord[];
120
+ };
121
+ export type Facts = {
122
+ readonly lastCompleted: string | null;
123
+ readonly providerLimits: readonly ProviderLimit[];
124
+ readonly capabilities: readonly Capability[];
125
+ readonly member: Member | null;
126
+ readonly targets: Readonly<Record<string, TargetRecord>>;
127
+ readonly conversationList: readonly ListedConversation[] | null;
128
+ readonly conversationCursor: string | null;
129
+ };
130
+ export type Commit = {
131
+ readonly rooms: readonly RoomCommit[];
132
+ readonly writes?: readonly AuthoredWrite[];
133
+ readonly files?: readonly StoredFile[];
134
+ readonly whole?: boolean;
135
+ };
136
+ export type RuntimeStore = {
137
+ opened(): Promise<ReplicaOpened>;
138
+ rooms(locators?: readonly string[]): Promise<readonly HeldRoom[]>;
139
+ room(locator: string): Promise<HeldWork>;
140
+ covering(): Promise<HeldCover>;
141
+ offline(locator: string): Promise<string | null>;
142
+ held(): Promise<{
143
+ readonly held: ReadonlySet<string>;
144
+ readonly staged: ReadonlySet<string>;
145
+ }>;
146
+ status(): Promise<HeldStatus>;
147
+ batch(locator: string, id: string): Promise<ChangeBatch | null>;
148
+ order(locator: string): Promise<readonly string[]>;
149
+ queued(): Promise<readonly string[]>;
150
+ moving(): Promise<{
151
+ readonly queued: ReadonlyMap<string, readonly string[]>;
152
+ readonly moving: readonly (QueuedChange & {
153
+ readonly locator: string;
154
+ })[];
155
+ }>;
156
+ pending(locator: string, id: string): Promise<{
157
+ readonly state: PendingState | undefined;
158
+ readonly room: boolean;
159
+ }>;
160
+ facts(): Promise<Facts>;
161
+ presentation(app: string): Promise<unknown>;
162
+ demote(): Promise<void>;
163
+ query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
164
+ changes(keys: readonly number[]): number;
165
+ entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
166
+ typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
167
+ referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
168
+ folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
169
+ typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
170
+ stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
171
+ resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
172
+ refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
173
+ unrefresh(key: number): Promise<void>;
174
+ commit(commit: Commit): Promise<CommittedWrite>;
175
+ fence(locators: readonly string[]): Promise<void>;
176
+ erase(locator: string | null, limit: number): Promise<boolean>;
177
+ abandon(locator: string): Promise<void>;
178
+ unfence(locators: readonly string[]): Promise<ReadonlySet<string>>;
179
+ release(key: number): Promise<void>;
180
+ rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
181
+ readonly done: boolean;
182
+ readonly text: number;
183
+ }>;
184
+ fact(name: string, value: unknown): Promise<void>;
185
+ submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
186
+ keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
187
+ roomDrafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
188
+ present(record: PresentationRecord): Promise<void>;
189
+ conversations(conversations?: readonly string[]): Promise<readonly HeldConversation[]>;
190
+ keepMessages(write: ConversationWrite): Promise<void>;
191
+ messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
192
+ messageCount(conversation: string, phrase?: string | null): Promise<number>;
193
+ turnArrived(conversation: string, turn: string): Promise<boolean>;
194
+ conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
195
+ jobMarkers(conversation: string): Promise<readonly JobMarker[]>;
196
+ dropConversations(conversations: readonly string[]): Promise<void>;
197
+ chatDrafts(): Promise<readonly ChatDraftRecord[]>;
198
+ chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
199
+ keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
200
+ dropChatDraft(conversation: string): Promise<void>;
201
+ calls(): Promise<readonly CallRecord[]>;
202
+ keepCall(record: CallRecord): Promise<void>;
203
+ dropCall(operation: string): Promise<void>;
204
+ keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
205
+ discardRoomDraft(locator: string, path: string): Promise<void>;
206
+ fences(): Promise<readonly string[]>;
207
+ generation(): Promise<string | null>;
208
+ rememberGeneration(value: string): Promise<void>;
209
+ file(key: string, type: string): Promise<Blob>;
210
+ };
211
+ export declare function openRuntimeStore(authored: 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,14 @@
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
+ watch(topic: string, notify: (value: unknown) => void): Watcher;
10
+ watching(topic: string, which?: Watching): readonly Watcher[];
11
+ close(): void;
12
+ };
13
+ export declare function createWatchers(unpublished: (error: unknown) => void): Watchers;
14
+ 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 {};
@@ -0,0 +1,86 @@
1
+ import type { TypedPath } from './adapter.js';
2
+ import { schemaTypes } from './attached-model.js';
3
+ import type { ChangeBatch } from './change.js';
4
+ import type { Composition } from './collection.js';
5
+ import type { Seeded } from './seed.js';
6
+ import type { ModelState } from './model.js';
7
+ import { type OpenedFiles } from './opened.js';
8
+ import { type HeldReplica, type ReplicaRecord } from './replica.js';
9
+ import type { RoomDraftRecord } from './room-draft.js';
10
+ import type { RuntimeDatabase } from './tables.js';
11
+ import { type Fences } from './store/fences.js';
12
+ import { type Installs } from './store/installs.js';
13
+ import { type HeldCover, type PendingState, type RuntimeStore } from './store/records.js';
14
+ import { type RoomHeld } from './store/room-held.js';
15
+ import { type Watcher, type Watching } from './store/watchers.js';
16
+ import { createWrites, type InstallHold } from './store/writes.js';
17
+ export { NO_INSTALL, type RoomInstall } from './store/installs.js';
18
+ export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
19
+ export type { InstallHold } from './store/writes.js';
20
+ export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
21
+ export type Stored = {
22
+ readonly record: ReplicaRecord;
23
+ readonly indexed: boolean;
24
+ readonly documents: number;
25
+ };
26
+ export type Held = HeldReplica & {
27
+ readonly states: ReadonlyMap<string, PendingState>;
28
+ };
29
+ export type Work = {
30
+ readonly replica: Held | undefined;
31
+ readonly queue: readonly ChangeBatch[];
32
+ readonly states: ReadonlyMap<string, PendingState>;
33
+ };
34
+ type LandedAhead = Readonly<Record<string, string | undefined>>;
35
+ type AttachedFile = {
36
+ readonly revision: string;
37
+ readonly mediaType: string;
38
+ };
39
+ type Seeds = {
40
+ of(key: string): Seeded | undefined;
41
+ keep(key: string, seed: Seeded): void;
42
+ drop(key: string): void;
43
+ };
44
+ type StoreOptions = {
45
+ readonly database: RuntimeDatabase;
46
+ readonly roomTypes: Parameters<typeof schemaTypes>[1];
47
+ readonly builtIn: ModelState;
48
+ readonly typedPaths: readonly TypedPath[];
49
+ opening(records: RuntimeStore): Promise<RuntimeStore>;
50
+ unpublished(error: unknown): void;
51
+ };
52
+ export type Store = {
53
+ open(): Promise<RuntimeStore>;
54
+ durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
55
+ exclusive<T>(work: () => Promise<T>): Promise<T>;
56
+ gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
57
+ written(): Promise<unknown>;
58
+ startingWrite<T>(work: () => Promise<T>): Promise<T>;
59
+ finishingWrite<T>(work: () => Promise<T>): Promise<T>;
60
+ ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
61
+ rederive: ReturnType<typeof createWrites>['rederive'];
62
+ refreshPage: ReturnType<typeof createWrites>['refreshPage'];
63
+ stageBytes(): number;
64
+ deriveBytes(): number;
65
+ rooms(locators?: readonly string[]): Promise<ReadonlyMap<string, Stored>>;
66
+ record(locator: string): Promise<ReplicaRecord | undefined>;
67
+ work(locator: string): Promise<Work>;
68
+ replica(locator: string): Promise<Held | undefined>;
69
+ covering(): Promise<HeldCover>;
70
+ drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
71
+ draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
72
+ composed(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>): Composition;
73
+ publication(work: () => Promise<void>): Promise<void>;
74
+ watch(topic: string, notify: (value: unknown) => void): Watcher;
75
+ watching(topic: string, which?: Watching): readonly Watcher[];
76
+ readonly fences: Fences;
77
+ readonly installs: Installs;
78
+ readonly seeds: Seeds;
79
+ readonly landed: RoomHeld<LandedAhead>;
80
+ readonly attached: RoomHeld<AttachedFile>;
81
+ readonly opened: OpenedFiles;
82
+ part(file: string, part: number): Promise<Uint8Array | null>;
83
+ forget(locator: string): void;
84
+ close(): void;
85
+ };
86
+ export declare function createStore(options: StoreOptions): Store;
@@ -0,0 +1,155 @@
1
+ import type { SavedFacts, HeadChange } from './adapter.js';
2
+ import { type Composed, type Composition } from './collection.js';
3
+ import type { HeldBinary } from './overlay.js';
4
+ import type { Connection } from './tables.js';
5
+ export declare const REPLICA_TABLES: readonly string[];
6
+ export type View = 'confirmed' | 'visible' | 'refreshed';
7
+ export type StoredEntry = {
8
+ readonly path: string;
9
+ readonly content: string | null;
10
+ readonly binary: HeldBinary | null;
11
+ readonly revision: string | null;
12
+ readonly fileId: string | null;
13
+ readonly created: string | null;
14
+ readonly change: HeadChange | null;
15
+ readonly written: string | null;
16
+ readonly facts: SavedFacts | null;
17
+ };
18
+ export type OverlayEntry = StoredEntry & {
19
+ readonly present: boolean;
20
+ };
21
+ export type HeldEntry = StoredEntry & {
22
+ readonly type: string | null;
23
+ };
24
+ export type TypedEntry = {
25
+ readonly path: string;
26
+ readonly type: string | null;
27
+ readonly binary: boolean;
28
+ };
29
+ export type Referrer = {
30
+ readonly path: string;
31
+ readonly target: string;
32
+ };
33
+ export type HeldRoomRow = {
34
+ readonly locator: string;
35
+ readonly key: number;
36
+ readonly record: string;
37
+ readonly indexed: boolean;
38
+ readonly documents: number;
39
+ };
40
+ export type HeldRoomWork = {
41
+ readonly room: (HeldRoomRow & {
42
+ readonly overlaid: readonly string[];
43
+ }) | null;
44
+ readonly queue: readonly {
45
+ readonly id: string;
46
+ readonly batch: string;
47
+ readonly state: string;
48
+ }[];
49
+ };
50
+ export type Covering = {
51
+ readonly rooms: readonly {
52
+ readonly locator: string;
53
+ readonly key: number;
54
+ readonly transfer: string;
55
+ readonly roomVersion: string;
56
+ readonly indexed: boolean;
57
+ readonly documents: number;
58
+ readonly bytes: number;
59
+ readonly offline: string;
60
+ }[];
61
+ readonly queues: readonly {
62
+ readonly locator: string;
63
+ readonly ids: readonly string[];
64
+ }[];
65
+ };
66
+ export type HeldLocators = {
67
+ readonly held: readonly string[];
68
+ readonly staged: readonly string[];
69
+ };
70
+ export type ReplicaOpened = {
71
+ readonly erasing: boolean;
72
+ readonly orphans: readonly number[];
73
+ };
74
+ export type RoomCommit = {
75
+ readonly locator: string;
76
+ readonly key: number;
77
+ readonly record?: string;
78
+ readonly roots?: readonly string[];
79
+ readonly published?: {
80
+ readonly from: number | null;
81
+ };
82
+ readonly refreshed?: true;
83
+ readonly composed: Composed;
84
+ readonly confirmed?: {
85
+ readonly set: readonly StoredEntry[];
86
+ readonly removed: readonly string[];
87
+ };
88
+ readonly overlay?: {
89
+ readonly set: readonly OverlayEntry[];
90
+ readonly cleared: readonly string[];
91
+ };
92
+ };
93
+ export type Committed = {
94
+ readonly changed: Readonly<Record<string, readonly string[] | null>>;
95
+ readonly indexed: Readonly<Record<string, boolean>>;
96
+ };
97
+ export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
98
+ export declare function stage(connection: Connection, request: {
99
+ readonly locator: string;
100
+ readonly transfer: string;
101
+ readonly key: number | null;
102
+ readonly fingerprint: string;
103
+ readonly entries: readonly StoredEntry[];
104
+ readonly folders: readonly string[];
105
+ readonly part: string | null;
106
+ }): number;
107
+ export type Resumed = {
108
+ readonly key: number | null;
109
+ readonly transfer: string;
110
+ readonly staged: readonly string[];
111
+ };
112
+ export declare function resume(connection: Connection, request: {
113
+ readonly locator: string;
114
+ readonly transfer: string;
115
+ readonly fingerprint: string;
116
+ readonly parts: readonly string[];
117
+ readonly published: number | null;
118
+ }): Resumed;
119
+ export declare function refreshing(connection: Connection, request: {
120
+ readonly key: number;
121
+ readonly composed: Composed;
122
+ readonly entries: readonly StoredEntry[];
123
+ readonly removals: readonly string[];
124
+ readonly folders: readonly string[];
125
+ readonly folderRemovals: readonly string[];
126
+ }): null;
127
+ export declare function unrefresh(connection: Connection, key: number): null;
128
+ export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
129
+ export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
130
+ export declare function abandon(connection: Connection, locator: string): null;
131
+ export declare function release(connection: Connection, key: number): null;
132
+ export declare function erase(connection: Connection, locator: string | null, limit: number): {
133
+ readonly remaining: boolean;
134
+ };
135
+ export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
136
+ readonly done: boolean;
137
+ readonly text: number;
138
+ };
139
+ export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
140
+ export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
141
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
142
+ export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
143
+ export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
144
+ export declare function opened(connection: Connection): ReplicaOpened;
145
+ export declare function heldRooms(connection: Connection, locators: readonly string[] | null): readonly HeldRoomRow[];
146
+ export declare function heldRoom(connection: Connection, locator: string): HeldRoomRow | null;
147
+ export declare function overlaid(connection: Connection, key: number): readonly string[];
148
+ export declare function covering(connection: Connection): Covering['rooms'];
149
+ export declare function offlineMode(connection: Connection, locator: string): string | null;
150
+ export declare function stagedLocators(connection: Connection): readonly string[];
151
+ export declare function heldLocators(connection: Connection): readonly string[];
152
+ export declare function demoted(connection: Connection): null;
153
+ export declare function facts(connection: Connection): Readonly<Record<string, string>>;
154
+ export declare function presentation(connection: Connection, app: string): string | null;
155
+ export declare function ended(connection: Connection): void;