@agentshouse/app-bridge 0.1.0-ca354d1b3bbdd → 0.1.0-ca3af8d8e77bf
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 -9
- package/dist/index.d.ts +867 -5
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +178 -0
- package/dist/mdmodel/definition.d.ts +81 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +16 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +30 -0
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +25 -0
- package/dist/mdmodel/profile.d.ts +5 -0
- package/dist/mdmodel/project.d.ts +21 -0
- package/dist/mdmodel/query/language.d.ts +217 -0
- package/dist/mdmodel/query/match.d.ts +11 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/references.d.ts +3 -0
- package/dist/mdmodel/reserved.d.ts +4 -0
- package/dist/mdmodel/types.d.ts +179 -0
- package/dist/mdmodel/validate.d.ts +32 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/adapter.d.ts +551 -0
- package/dist/mdruntime/binary.d.ts +17 -0
- package/dist/mdruntime/chain.d.ts +11 -0
- package/dist/mdruntime/change-set.d.ts +27 -0
- package/dist/mdruntime/change.d.ts +118 -0
- package/dist/mdruntime/client.d.ts +91 -0
- package/dist/mdruntime/collection.d.ts +28 -0
- package/dist/mdruntime/compile.d.ts +10 -0
- package/dist/mdruntime/connection.d.ts +152 -0
- package/dist/mdruntime/conversation.d.ts +120 -0
- package/dist/mdruntime/durability.d.ts +11 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/identity.d.ts +6 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -0
- package/dist/mdruntime/model.d.ts +61 -0
- package/dist/mdruntime/observation.d.ts +44 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +84 -0
- package/dist/mdruntime/overlay.d.ts +24 -0
- package/dist/mdruntime/query.d.ts +79 -0
- package/dist/mdruntime/reach.d.ts +53 -0
- package/dist/mdruntime/readiness.d.ts +49 -0
- package/dist/mdruntime/recovery.d.ts +25 -0
- package/dist/mdruntime/replica.d.ts +68 -0
- package/dist/mdruntime/room-draft.d.ts +174 -0
- package/dist/mdruntime/save.d.ts +102 -0
- package/dist/mdruntime/search.d.ts +21 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/status.d.ts +27 -0
- package/dist/mdruntime/store.d.ts +162 -0
- package/dist/mdruntime/stored.d.ts +161 -0
- package/dist/mdruntime/tables.d.ts +352 -0
- package/dist/mdruntime/wire.d.ts +235 -0
- package/dist/test-host.d.ts +8 -2
- package/dist/test-host.js +48 -11
- package/docs/families.md +69 -13
- package/package.json +8 -6
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
+
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
3
|
+
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
4
|
+
import { type Composition } from './collection.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
6
|
+
import type { VisibleLayer } from './replica.js';
|
|
7
|
+
import type { ChangedPart } from './room-draft.js';
|
|
8
|
+
export type SaveRefusal = {
|
|
9
|
+
code: string;
|
|
10
|
+
retryable: boolean;
|
|
11
|
+
file?: string;
|
|
12
|
+
location?: string;
|
|
13
|
+
referrers?: readonly string[];
|
|
14
|
+
parts?: readonly ChangedPart[];
|
|
15
|
+
};
|
|
16
|
+
export type SaveInput = {
|
|
17
|
+
local: boolean;
|
|
18
|
+
composition: Composition;
|
|
19
|
+
baseRoomVersion: string;
|
|
20
|
+
operations: import('./adapter.js').OperationScopes;
|
|
21
|
+
providerOwnedPaths: readonly string[];
|
|
22
|
+
providerLimits: readonly ProviderLimit[];
|
|
23
|
+
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
25
|
+
handle: string;
|
|
26
|
+
changes: readonly Change[];
|
|
27
|
+
bases: readonly Precondition[];
|
|
28
|
+
queued?: ReadonlySet<string>;
|
|
29
|
+
writtenBy?: WrittenBy;
|
|
30
|
+
unmodeled: boolean;
|
|
31
|
+
validate: Validator;
|
|
32
|
+
};
|
|
33
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
34
|
+
type Refusing = {
|
|
35
|
+
kind: 'refused';
|
|
36
|
+
refusal: SaveRefusal;
|
|
37
|
+
};
|
|
38
|
+
export type BatchResult = {
|
|
39
|
+
kind: 'batch';
|
|
40
|
+
batch: ChangeBatch;
|
|
41
|
+
} | Refusing;
|
|
42
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
43
|
+
export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
44
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
45
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
46
|
+
export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
|
|
47
|
+
export type Requeued = {
|
|
48
|
+
kind: 'requeued';
|
|
49
|
+
queue: readonly ChangeBatch[];
|
|
50
|
+
changes: readonly Change[];
|
|
51
|
+
queued: ReadonlySet<string>;
|
|
52
|
+
withdrawn: ReadonlyMap<string, ChangeBatch | null>;
|
|
53
|
+
owners: ReadonlySet<string>;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'refused';
|
|
56
|
+
refusal: SaveRefusal;
|
|
57
|
+
};
|
|
58
|
+
export type Joining = {
|
|
59
|
+
kind: 'joined';
|
|
60
|
+
batch: ChangeBatch;
|
|
61
|
+
queue: readonly ChangeBatch[];
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'refused';
|
|
64
|
+
refusal: SaveRefusal;
|
|
65
|
+
};
|
|
66
|
+
type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
67
|
+
export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
|
|
68
|
+
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
69
|
+
export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
|
|
70
|
+
export declare const MOVE_DOCUMENTS = "move-documents";
|
|
71
|
+
export type MoveSide = {
|
|
72
|
+
room: string;
|
|
73
|
+
handle: string;
|
|
74
|
+
baseRoomVersion: string;
|
|
75
|
+
composition: Composition;
|
|
76
|
+
operations: OperationScopes;
|
|
77
|
+
providerOwnedPaths: readonly string[];
|
|
78
|
+
visible: VisibleLayer;
|
|
79
|
+
folders: ReadonlySet<string>;
|
|
80
|
+
queued: ReadonlySet<string>;
|
|
81
|
+
unmodeled: boolean;
|
|
82
|
+
validate: Validator;
|
|
83
|
+
};
|
|
84
|
+
export type MoveInput = {
|
|
85
|
+
source: MoveSide;
|
|
86
|
+
destination: MoveSide;
|
|
87
|
+
moves: readonly {
|
|
88
|
+
readonly path: string;
|
|
89
|
+
readonly to: string;
|
|
90
|
+
}[];
|
|
91
|
+
providerLimits: readonly ProviderLimit[];
|
|
92
|
+
local: boolean;
|
|
93
|
+
writtenBy?: WrittenBy;
|
|
94
|
+
};
|
|
95
|
+
export type MoveResult = {
|
|
96
|
+
kind: 'moved';
|
|
97
|
+
leaving: ChangeBatch;
|
|
98
|
+
arriving: ChangeBatch;
|
|
99
|
+
} | Refusing;
|
|
100
|
+
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
101
|
+
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProviderRefusal, SearchHit } from './adapter.js';
|
|
2
|
+
import type { Failure, Offline } from './outcome.js';
|
|
3
|
+
export type SearchRequest = {
|
|
4
|
+
text: string;
|
|
5
|
+
rooms?: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export type { SearchHit } from './adapter.js';
|
|
8
|
+
export type SearchFound = {
|
|
9
|
+
kind: 'found';
|
|
10
|
+
documents: readonly SearchHit[];
|
|
11
|
+
};
|
|
12
|
+
export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
|
|
13
|
+
kind: 'rejected';
|
|
14
|
+
}) | (ProviderRefusal & {
|
|
15
|
+
kind: 'undeclared';
|
|
16
|
+
}) | Failure;
|
|
17
|
+
export type SearchPlan = {
|
|
18
|
+
text: string;
|
|
19
|
+
rooms: readonly string[] | null;
|
|
20
|
+
};
|
|
21
|
+
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { KeyedResult } from './observation.js';
|
|
2
|
+
import type { QueryRows } from './query.js';
|
|
3
|
+
export type EntrySeed = {
|
|
4
|
+
readonly at: Readonly<Record<string, string>>;
|
|
5
|
+
readonly queries: readonly {
|
|
6
|
+
readonly query: unknown;
|
|
7
|
+
readonly rows: QueryRows;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export type Seeded = {
|
|
11
|
+
readonly rows: QueryRows;
|
|
12
|
+
readonly at: Readonly<Record<string, string>>;
|
|
13
|
+
};
|
|
14
|
+
export declare function entrySeedOf(value: unknown): EntrySeed | null;
|
|
15
|
+
export declare function seededResult(seed: Seeded): KeyedResult;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Open } from './open.js';
|
|
2
|
+
import type { ReturnReason } from './room-draft.js';
|
|
3
|
+
export type AttentionEntry = {
|
|
4
|
+
room: string;
|
|
5
|
+
path: string;
|
|
6
|
+
returned: ReturnReason;
|
|
7
|
+
};
|
|
8
|
+
export type UnsentChange = {
|
|
9
|
+
room: string;
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
export type SyncStatus = {
|
|
13
|
+
state: Open<'pending' | 'syncing' | 'synced'>;
|
|
14
|
+
lastCompleted: string | null;
|
|
15
|
+
providerUnreachable: boolean;
|
|
16
|
+
attentionRequired: readonly AttentionEntry[];
|
|
17
|
+
unsent: readonly UnsentChange[];
|
|
18
|
+
reset: string | null;
|
|
19
|
+
};
|
|
20
|
+
export type CycleProgress = {
|
|
21
|
+
complete: boolean;
|
|
22
|
+
reachable: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const STARTING: SyncStatus;
|
|
25
|
+
export declare function transferring(status: SyncStatus): SyncStatus;
|
|
26
|
+
export declare function saving(status: SyncStatus): SyncStatus;
|
|
27
|
+
export declare function same(one: SyncStatus, other: SyncStatus): boolean;
|
|
@@ -0,0 +1,162 @@
|
|
|
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, CountedRoom, HeldConversation, HeldEntry, HeldText, MessageWindow, QueryAnswer, QueryRoom, Referrer, 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 QueueRecord = {
|
|
36
|
+
locator: string;
|
|
37
|
+
pending: readonly {
|
|
38
|
+
batch: ChangeBatch;
|
|
39
|
+
state: PendingState;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
export type PresentationRecord = {
|
|
43
|
+
app: string;
|
|
44
|
+
value: unknown;
|
|
45
|
+
};
|
|
46
|
+
export type ChatSubmission = {
|
|
47
|
+
readonly operation: string;
|
|
48
|
+
readonly text: string;
|
|
49
|
+
readonly turn: string | null;
|
|
50
|
+
};
|
|
51
|
+
export type ChatDraftRecord = {
|
|
52
|
+
conversation: string;
|
|
53
|
+
text: string;
|
|
54
|
+
revision: string;
|
|
55
|
+
submitted?: readonly ChatSubmission[];
|
|
56
|
+
moves?: readonly string[];
|
|
57
|
+
};
|
|
58
|
+
export type CallRecord = {
|
|
59
|
+
readonly operation: string;
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly input: unknown;
|
|
62
|
+
};
|
|
63
|
+
export type AuthoredWrite = {
|
|
64
|
+
locator: string;
|
|
65
|
+
queue?: readonly ChangeBatch[];
|
|
66
|
+
founded?: readonly ChangeBatch[];
|
|
67
|
+
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
68
|
+
roomDrafts?: readonly RoomDraftRecord[];
|
|
69
|
+
consumedRoomDrafts?: readonly string[];
|
|
70
|
+
};
|
|
71
|
+
export type StagedPage = {
|
|
72
|
+
readonly entries: readonly StoredEntry[];
|
|
73
|
+
readonly folders: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
export type RefreshedPage = StagedPage & {
|
|
76
|
+
readonly removals: readonly string[];
|
|
77
|
+
readonly folderRemovals: readonly string[];
|
|
78
|
+
};
|
|
79
|
+
export type Opened = {
|
|
80
|
+
readonly rooms: ReadonlyMap<string, StoredReplica>;
|
|
81
|
+
readonly unindexed: ReadonlySet<number>;
|
|
82
|
+
readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
|
|
83
|
+
readonly erasing: boolean;
|
|
84
|
+
readonly orphans: readonly number[];
|
|
85
|
+
readonly lastCompleted: string | null;
|
|
86
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
87
|
+
readonly capabilities: readonly Capability[];
|
|
88
|
+
readonly member: Member | null;
|
|
89
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
90
|
+
readonly presentation: readonly PresentationRecord[];
|
|
91
|
+
readonly conversationList: readonly ListedConversation[] | null;
|
|
92
|
+
readonly conversationCursor: string | null;
|
|
93
|
+
};
|
|
94
|
+
export type Commit = {
|
|
95
|
+
readonly rooms: readonly RoomCommit[];
|
|
96
|
+
readonly writes?: readonly AuthoredWrite[];
|
|
97
|
+
readonly files?: readonly StoredFile[];
|
|
98
|
+
readonly whole?: boolean;
|
|
99
|
+
readonly discards?: readonly string[];
|
|
100
|
+
};
|
|
101
|
+
export type RuntimeStore = {
|
|
102
|
+
opened(): Promise<Opened>;
|
|
103
|
+
counts(rooms: readonly CountedRoom[]): Promise<readonly number[]>;
|
|
104
|
+
query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
|
|
105
|
+
changes(keys: readonly number[]): number;
|
|
106
|
+
entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
|
|
107
|
+
typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
|
|
108
|
+
referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
|
|
109
|
+
files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
|
|
110
|
+
readonly path: string;
|
|
111
|
+
readonly revision: string;
|
|
112
|
+
}[]>;
|
|
113
|
+
folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
|
|
114
|
+
typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
|
|
115
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
|
|
116
|
+
refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
117
|
+
unrefresh(key: number): Promise<void>;
|
|
118
|
+
hold(locator: string, key: number, composition: Composition, texts: readonly HeldText[]): Promise<readonly string[]>;
|
|
119
|
+
unhold(locator: string, key: number, composition: Composition): Promise<{
|
|
120
|
+
readonly paths: readonly string[];
|
|
121
|
+
readonly bytes: number;
|
|
122
|
+
}>;
|
|
123
|
+
wanted(locator: string, key: number): Promise<readonly {
|
|
124
|
+
readonly path: string;
|
|
125
|
+
readonly revision: string;
|
|
126
|
+
}[]>;
|
|
127
|
+
remember(locator: string, key: number, paths: readonly string[]): Promise<void>;
|
|
128
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
129
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
130
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
131
|
+
abandon(locator: string): Promise<void>;
|
|
132
|
+
release(key: number): Promise<void>;
|
|
133
|
+
rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
|
|
134
|
+
readonly done: boolean;
|
|
135
|
+
readonly text: number;
|
|
136
|
+
}>;
|
|
137
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
138
|
+
queues(): Promise<readonly QueueRecord[]>;
|
|
139
|
+
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
140
|
+
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
141
|
+
roomDrafts(): Promise<readonly RoomDraftRecord[]>;
|
|
142
|
+
present(record: PresentationRecord): Promise<void>;
|
|
143
|
+
conversations(): Promise<readonly HeldConversation[]>;
|
|
144
|
+
keepMessages(write: ConversationWrite): Promise<void>;
|
|
145
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
|
|
146
|
+
messageCount(conversation: string, phrase?: string | null): Promise<number>;
|
|
147
|
+
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
148
|
+
dropConversations(conversations: readonly string[]): Promise<void>;
|
|
149
|
+
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
150
|
+
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
151
|
+
dropChatDraft(conversation: string): Promise<void>;
|
|
152
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
153
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
154
|
+
dropCall(operation: string): Promise<void>;
|
|
155
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
156
|
+
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
157
|
+
fences(): Promise<readonly string[]>;
|
|
158
|
+
generation(): Promise<string | null>;
|
|
159
|
+
rememberGeneration(value: string): Promise<void>;
|
|
160
|
+
file(key: string, type: string): Promise<Blob>;
|
|
161
|
+
};
|
|
162
|
+
export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { type Outline } from '../mdmodel/index.js';
|
|
2
|
+
import type { HeadChange } from './adapter.js';
|
|
3
|
+
import { type Composed, type Composition } from './collection.js';
|
|
4
|
+
import type { HeldBinary } from './overlay.js';
|
|
5
|
+
import type { Connection } from './tables.js';
|
|
6
|
+
export declare const REPLICA_TABLES: readonly string[];
|
|
7
|
+
export type View = 'confirmed' | 'visible' | 'refreshed';
|
|
8
|
+
export type StoredEntry = {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly content: string | null;
|
|
11
|
+
readonly outline: Outline | null;
|
|
12
|
+
readonly binary: HeldBinary | null;
|
|
13
|
+
readonly revision: string | null;
|
|
14
|
+
readonly fileId: string | null;
|
|
15
|
+
readonly change: HeadChange | null;
|
|
16
|
+
readonly written: string | 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
|
+
readonly kind: string;
|
|
33
|
+
};
|
|
34
|
+
export type HeldKey = {
|
|
35
|
+
readonly key: number;
|
|
36
|
+
readonly locator: string;
|
|
37
|
+
readonly transfer: string;
|
|
38
|
+
readonly rederiving: number | null;
|
|
39
|
+
};
|
|
40
|
+
export type ReplicaOpened = {
|
|
41
|
+
readonly rooms: readonly {
|
|
42
|
+
readonly locator: string;
|
|
43
|
+
readonly key: number;
|
|
44
|
+
readonly record: string;
|
|
45
|
+
}[];
|
|
46
|
+
readonly keys: readonly HeldKey[];
|
|
47
|
+
readonly facts: Readonly<Record<string, string>>;
|
|
48
|
+
readonly presentation: readonly {
|
|
49
|
+
readonly app: string;
|
|
50
|
+
readonly value: string;
|
|
51
|
+
}[];
|
|
52
|
+
readonly overlaid: readonly {
|
|
53
|
+
readonly key: number;
|
|
54
|
+
readonly path: string;
|
|
55
|
+
}[];
|
|
56
|
+
readonly erasing: readonly {
|
|
57
|
+
readonly key: number;
|
|
58
|
+
readonly locator: string;
|
|
59
|
+
}[];
|
|
60
|
+
readonly orphans: readonly number[];
|
|
61
|
+
};
|
|
62
|
+
export type RoomCommit = {
|
|
63
|
+
readonly locator: string;
|
|
64
|
+
readonly key: number;
|
|
65
|
+
readonly record?: string;
|
|
66
|
+
readonly roots?: readonly string[];
|
|
67
|
+
readonly published?: {
|
|
68
|
+
readonly from: number | null;
|
|
69
|
+
};
|
|
70
|
+
readonly refreshed?: true;
|
|
71
|
+
readonly composed: Composed;
|
|
72
|
+
readonly confirmed?: {
|
|
73
|
+
readonly set: readonly StoredEntry[];
|
|
74
|
+
readonly removed: readonly string[];
|
|
75
|
+
};
|
|
76
|
+
readonly overlay?: {
|
|
77
|
+
readonly set: readonly OverlayEntry[];
|
|
78
|
+
readonly cleared: readonly string[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export type Committed = {
|
|
82
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
83
|
+
readonly changed: Readonly<Record<string, readonly string[] | null>>;
|
|
84
|
+
readonly indexed: Readonly<Record<string, boolean>>;
|
|
85
|
+
};
|
|
86
|
+
export type CountedRoom = {
|
|
87
|
+
readonly key: number;
|
|
88
|
+
readonly roots: readonly string[];
|
|
89
|
+
};
|
|
90
|
+
export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
|
|
91
|
+
export declare function stage(connection: Connection, request: {
|
|
92
|
+
readonly locator: string;
|
|
93
|
+
readonly transfer: string;
|
|
94
|
+
readonly key: number | null;
|
|
95
|
+
readonly fingerprint: string;
|
|
96
|
+
readonly entries: readonly StoredEntry[];
|
|
97
|
+
readonly folders: readonly string[];
|
|
98
|
+
}): number;
|
|
99
|
+
export declare function refreshing(connection: Connection, request: {
|
|
100
|
+
readonly key: number;
|
|
101
|
+
readonly composed: Composed;
|
|
102
|
+
readonly entries: readonly StoredEntry[];
|
|
103
|
+
readonly removals: readonly string[];
|
|
104
|
+
readonly folders: readonly string[];
|
|
105
|
+
readonly folderRemovals: readonly string[];
|
|
106
|
+
}): null;
|
|
107
|
+
export declare function unrefresh(connection: Connection, key: number): null;
|
|
108
|
+
export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
|
|
109
|
+
export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
|
|
110
|
+
export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
|
|
111
|
+
export declare function abandon(connection: Connection, locator: string): null;
|
|
112
|
+
export declare function release(connection: Connection, key: number): null;
|
|
113
|
+
export declare function erase(connection: Connection, locator: string | null, limit: number): {
|
|
114
|
+
readonly remaining: boolean;
|
|
115
|
+
};
|
|
116
|
+
export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
|
|
117
|
+
readonly done: boolean;
|
|
118
|
+
readonly text: number;
|
|
119
|
+
};
|
|
120
|
+
export type HeldText = {
|
|
121
|
+
readonly path: string;
|
|
122
|
+
readonly revision: string;
|
|
123
|
+
readonly content: string;
|
|
124
|
+
};
|
|
125
|
+
export declare function holdTexts(connection: Connection, request: {
|
|
126
|
+
readonly key: number;
|
|
127
|
+
readonly locator: string;
|
|
128
|
+
readonly composed: Composed;
|
|
129
|
+
readonly texts: readonly HeldText[];
|
|
130
|
+
}): string[];
|
|
131
|
+
export declare function unholdTexts(connection: Connection, request: {
|
|
132
|
+
readonly key: number;
|
|
133
|
+
readonly locator: string;
|
|
134
|
+
readonly composed: Composed;
|
|
135
|
+
}): {
|
|
136
|
+
readonly paths: readonly string[];
|
|
137
|
+
readonly bytes: number;
|
|
138
|
+
};
|
|
139
|
+
export declare function remembered(connection: Connection, request: {
|
|
140
|
+
readonly key: number;
|
|
141
|
+
readonly locator: string;
|
|
142
|
+
readonly paths: readonly string[];
|
|
143
|
+
}): null;
|
|
144
|
+
export declare function wanted(connection: Connection, request: {
|
|
145
|
+
readonly key: number;
|
|
146
|
+
readonly locator: string;
|
|
147
|
+
}): {
|
|
148
|
+
readonly path: string;
|
|
149
|
+
readonly revision: string;
|
|
150
|
+
}[];
|
|
151
|
+
export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
|
|
152
|
+
export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
|
|
153
|
+
export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
|
|
154
|
+
export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
|
|
155
|
+
readonly path: string;
|
|
156
|
+
readonly revision: string;
|
|
157
|
+
}[];
|
|
158
|
+
export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
|
|
159
|
+
export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
|
|
160
|
+
export declare function opened(connection: Connection): ReplicaOpened;
|
|
161
|
+
export declare function ended(connection: Connection): void;
|