@agentshouse/app-bridge 0.1.0-ccf413b4e709d → 0.1.0-cd2d3edbf9805
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 +9 -7
- package/dist/calls.d.ts +747 -0
- package/dist/calls.js +1 -0
- package/dist/index.d.ts +44 -6
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +167 -0
- package/dist/mdmodel/definition.d.ts +81 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +15 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +20 -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/references.d.ts +3 -0
- package/dist/mdmodel/types.d.ts +167 -0
- package/dist/mdmodel/validate.d.ts +31 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/adapter.d.ts +517 -0
- package/dist/mdruntime/binary.d.ts +17 -0
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +27 -0
- package/dist/mdruntime/change.d.ts +118 -0
- package/dist/mdruntime/client.d.ts +90 -0
- package/dist/mdruntime/collection.d.ts +27 -0
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/connection.d.ts +152 -0
- package/dist/mdruntime/conversation.d.ts +113 -0
- package/dist/mdruntime/durability.d.ts +11 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/fulltext.d.ts +26 -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 +62 -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 +283 -0
- package/dist/mdruntime/reach.d.ts +53 -0
- package/dist/mdruntime/readiness.d.ts +51 -0
- package/dist/mdruntime/recovery.d.ts +25 -0
- package/dist/mdruntime/replica.d.ts +67 -0
- package/dist/mdruntime/room-draft.d.ts +173 -0
- package/dist/mdruntime/save.d.ts +102 -0
- package/dist/mdruntime/search.d.ts +72 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/status.d.ts +27 -0
- package/dist/mdruntime/store.d.ts +153 -0
- package/dist/mdruntime/stored.d.ts +129 -0
- package/dist/mdruntime/tables.d.ts +324 -0
- package/dist/mdruntime/wire.d.ts +238 -0
- package/dist/test-host.d.ts +8 -2
- package/dist/test-host.js +47 -11
- package/docs/families.md +55 -12
- package/package.json +8 -6
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
|
+
import { type ChangeBatch, type Precondition } from './change.js';
|
|
3
|
+
import { type Collection, type Composition } from './collection.js';
|
|
4
|
+
import { type ModelState } from './model.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
6
|
+
import type { HeldEntry, OverlayEntry, StoredEntry } from './tables.js';
|
|
7
|
+
export type ReplicaRecord = {
|
|
8
|
+
readonly locator: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly handle: string;
|
|
11
|
+
readonly operations: OperationScopes;
|
|
12
|
+
readonly replica: ReplicaAdmission;
|
|
13
|
+
readonly model: ModelState;
|
|
14
|
+
readonly typedSelection: TypedSelection | null;
|
|
15
|
+
readonly providerOwnedPaths: readonly string[];
|
|
16
|
+
readonly roomVersion: string;
|
|
17
|
+
readonly transfer: string;
|
|
18
|
+
readonly inventory: BootstrapInventory;
|
|
19
|
+
readonly key: number;
|
|
20
|
+
};
|
|
21
|
+
export type HeldReplica = {
|
|
22
|
+
readonly record: ReplicaRecord;
|
|
23
|
+
readonly queue: readonly ChangeBatch[];
|
|
24
|
+
readonly overlaid: ReadonlySet<string>;
|
|
25
|
+
readonly count: number;
|
|
26
|
+
readonly confirmed: number;
|
|
27
|
+
readonly indexed: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type VisibleLayer = Layer & {
|
|
30
|
+
readonly collection: Collection;
|
|
31
|
+
};
|
|
32
|
+
export type Slice = Layer & {
|
|
33
|
+
readonly written: Readonly<Record<string, string>>;
|
|
34
|
+
readonly held: ReadonlySet<string>;
|
|
35
|
+
};
|
|
36
|
+
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
|
|
37
|
+
export declare function storedRecord(record: ReplicaRecord): string;
|
|
38
|
+
export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
|
|
39
|
+
export declare function entryAt(layer: Layer & {
|
|
40
|
+
readonly written?: Readonly<Record<string, string>>;
|
|
41
|
+
}, path: string): StoredEntry | null;
|
|
42
|
+
export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
|
|
43
|
+
export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
|
|
44
|
+
export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
|
|
45
|
+
export type Replayed = {
|
|
46
|
+
readonly visible: VisibleLayer;
|
|
47
|
+
readonly touched: ReadonlySet<string>;
|
|
48
|
+
};
|
|
49
|
+
export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
|
|
50
|
+
export declare function overlayOf(visible: Layer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
|
|
51
|
+
export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
|
|
52
|
+
export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
|
|
53
|
+
export type Standing = {
|
|
54
|
+
readonly withdrawn: readonly ChangeBatch[];
|
|
55
|
+
readonly kept: readonly ChangeBatch[];
|
|
56
|
+
};
|
|
57
|
+
export declare function standing(confirmed: Slice, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean, locator: string, composition: Composition): Generator<number, Standing, void>;
|
|
58
|
+
type Accepted = Extract<MutationResult, {
|
|
59
|
+
kind: 'accepted';
|
|
60
|
+
}>;
|
|
61
|
+
export type Returned = {
|
|
62
|
+
readonly set: readonly StoredEntry[];
|
|
63
|
+
readonly removed: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
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 {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
+
import type { Open } from './open.js';
|
|
3
|
+
import type { Change, Precondition } from './change.js';
|
|
4
|
+
import type { VisibleLayer } from './replica.js';
|
|
5
|
+
export type FieldValue = {
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
} | null;
|
|
8
|
+
export type RoomDraftCreation = {
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
12
|
+
} | {
|
|
13
|
+
readonly markdown: string;
|
|
14
|
+
};
|
|
15
|
+
export type RoomDraftParts = {
|
|
16
|
+
readonly fields?: Readonly<Record<string, {
|
|
17
|
+
readonly value: unknown;
|
|
18
|
+
readonly base?: FieldValue;
|
|
19
|
+
}>>;
|
|
20
|
+
readonly sections?: Readonly<Record<string, {
|
|
21
|
+
readonly value: string;
|
|
22
|
+
readonly base?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
readonly preamble?: {
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly base?: string;
|
|
27
|
+
};
|
|
28
|
+
readonly markdown?: {
|
|
29
|
+
readonly value: string;
|
|
30
|
+
readonly base?: string;
|
|
31
|
+
};
|
|
32
|
+
readonly creation?: RoomDraftCreation;
|
|
33
|
+
readonly move?: {
|
|
34
|
+
readonly to: string;
|
|
35
|
+
readonly room?: string;
|
|
36
|
+
readonly base?: string | null;
|
|
37
|
+
};
|
|
38
|
+
readonly removal?: {
|
|
39
|
+
readonly base?: string | null;
|
|
40
|
+
};
|
|
41
|
+
readonly file?: {
|
|
42
|
+
readonly blob: Blob;
|
|
43
|
+
readonly base?: string | null;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type HeldFile = {
|
|
47
|
+
readonly localId: string;
|
|
48
|
+
readonly name?: string;
|
|
49
|
+
readonly byteLength: number;
|
|
50
|
+
readonly mediaType: string;
|
|
51
|
+
readonly sha256: string;
|
|
52
|
+
readonly base: string | null;
|
|
53
|
+
};
|
|
54
|
+
type HeldParts = {
|
|
55
|
+
readonly fields?: Readonly<Record<string, {
|
|
56
|
+
readonly value: unknown;
|
|
57
|
+
readonly base: FieldValue;
|
|
58
|
+
}>>;
|
|
59
|
+
readonly sections?: Readonly<Record<string, {
|
|
60
|
+
readonly value: string;
|
|
61
|
+
readonly base: string;
|
|
62
|
+
}>>;
|
|
63
|
+
readonly preamble?: {
|
|
64
|
+
readonly value: string;
|
|
65
|
+
readonly base: string;
|
|
66
|
+
};
|
|
67
|
+
readonly markdown?: {
|
|
68
|
+
readonly value: string;
|
|
69
|
+
readonly base: string;
|
|
70
|
+
};
|
|
71
|
+
readonly creation?: RoomDraftCreation;
|
|
72
|
+
readonly move?: {
|
|
73
|
+
readonly to: string;
|
|
74
|
+
readonly room?: string;
|
|
75
|
+
readonly base: string | null;
|
|
76
|
+
};
|
|
77
|
+
readonly removal?: {
|
|
78
|
+
readonly base: string | null;
|
|
79
|
+
};
|
|
80
|
+
readonly file?: HeldFile;
|
|
81
|
+
};
|
|
82
|
+
type ChangedUnderneath = {
|
|
83
|
+
readonly fields?: Readonly<Record<string, FieldValue>>;
|
|
84
|
+
readonly sections?: Readonly<Record<string, string | null>>;
|
|
85
|
+
readonly preamble?: string | null;
|
|
86
|
+
readonly markdown?: string | null;
|
|
87
|
+
readonly creation?: string;
|
|
88
|
+
readonly move?: string | null;
|
|
89
|
+
readonly removal?: string | null;
|
|
90
|
+
readonly file?: string | null;
|
|
91
|
+
};
|
|
92
|
+
export type ReturnReason = ProviderRefusal & {
|
|
93
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'expired' | 'withdrawn'>;
|
|
94
|
+
};
|
|
95
|
+
export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
|
|
96
|
+
export type RoomDraft = {
|
|
97
|
+
readonly room: string;
|
|
98
|
+
readonly path: string;
|
|
99
|
+
readonly revision: string;
|
|
100
|
+
readonly parts: HeldParts;
|
|
101
|
+
readonly changedUnderneath: ChangedUnderneath;
|
|
102
|
+
readonly returned: ReturnReason | null;
|
|
103
|
+
};
|
|
104
|
+
export type RoomDraftWrite = {
|
|
105
|
+
readonly outcome: 'written';
|
|
106
|
+
readonly roomDraft: RoomDraft | null;
|
|
107
|
+
} | {
|
|
108
|
+
readonly outcome: 'stale';
|
|
109
|
+
readonly code: string;
|
|
110
|
+
readonly retryable: boolean;
|
|
111
|
+
readonly current: RoomDraft | null;
|
|
112
|
+
};
|
|
113
|
+
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
114
|
+
export type ChangedPart = {
|
|
115
|
+
readonly path: string;
|
|
116
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
|
|
117
|
+
readonly name?: string;
|
|
118
|
+
};
|
|
119
|
+
export type RoomDraftRecord = {
|
|
120
|
+
readonly locator: string;
|
|
121
|
+
readonly path: string;
|
|
122
|
+
readonly revision: string;
|
|
123
|
+
readonly parts: HeldParts;
|
|
124
|
+
readonly returned: ReturnReason | null;
|
|
125
|
+
};
|
|
126
|
+
export type SavedDraft = {
|
|
127
|
+
readonly path: string;
|
|
128
|
+
readonly parts: HeldParts;
|
|
129
|
+
};
|
|
130
|
+
export declare function readParts(value: unknown): RoomDraftParts;
|
|
131
|
+
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
132
|
+
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
133
|
+
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
134
|
+
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
135
|
+
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
136
|
+
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
137
|
+
export type TextParts = {
|
|
138
|
+
readonly fields?: Readonly<Record<string, {
|
|
139
|
+
readonly value: unknown;
|
|
140
|
+
}>>;
|
|
141
|
+
readonly sections?: Readonly<Record<string, {
|
|
142
|
+
readonly value: string;
|
|
143
|
+
}>>;
|
|
144
|
+
readonly preamble?: {
|
|
145
|
+
readonly value: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
149
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
150
|
+
export declare function moveTarget(move: {
|
|
151
|
+
readonly to: string;
|
|
152
|
+
}): string;
|
|
153
|
+
export declare function readSavedParts(named: readonly {
|
|
154
|
+
readonly path: string;
|
|
155
|
+
readonly parts: unknown;
|
|
156
|
+
}[]): readonly {
|
|
157
|
+
readonly path: string;
|
|
158
|
+
readonly parts: RoomDraftParts;
|
|
159
|
+
}[];
|
|
160
|
+
export declare function partsChanges(named: readonly {
|
|
161
|
+
readonly path: string;
|
|
162
|
+
readonly parts: unknown;
|
|
163
|
+
}[]): {
|
|
164
|
+
readonly changes: readonly Change[];
|
|
165
|
+
readonly preconditions: readonly Precondition[];
|
|
166
|
+
};
|
|
167
|
+
export declare function changesOf(path: string, parts: HeldParts): {
|
|
168
|
+
changes: readonly Change[];
|
|
169
|
+
bases: readonly Precondition[];
|
|
170
|
+
};
|
|
171
|
+
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
172
|
+
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
173
|
+
export {};
|
|
@@ -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,72 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
+
import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
|
|
3
|
+
import type { Open } from './open.js';
|
|
4
|
+
export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
5
|
+
export type SearchRequest = {
|
|
6
|
+
text: string;
|
|
7
|
+
documents?: Filter;
|
|
8
|
+
collection?: true;
|
|
9
|
+
conversations?: readonly string[];
|
|
10
|
+
limit?: number;
|
|
11
|
+
after?: string;
|
|
12
|
+
total?: true;
|
|
13
|
+
};
|
|
14
|
+
export type MessagePart = Open<'text'>;
|
|
15
|
+
export type Snippet<Part extends string> = {
|
|
16
|
+
part: Part;
|
|
17
|
+
text: string;
|
|
18
|
+
at: readonly [number, number];
|
|
19
|
+
};
|
|
20
|
+
export type DocumentHit = {
|
|
21
|
+
room: string;
|
|
22
|
+
path: string;
|
|
23
|
+
type: string;
|
|
24
|
+
score: number;
|
|
25
|
+
matches: Readonly<Record<string, readonly DocumentPart[]>>;
|
|
26
|
+
snippet?: Snippet<DocumentPart>;
|
|
27
|
+
};
|
|
28
|
+
export type MessageHit = {
|
|
29
|
+
conversation: string;
|
|
30
|
+
identity: string;
|
|
31
|
+
score: number;
|
|
32
|
+
matches: Readonly<Record<string, readonly MessagePart[]>>;
|
|
33
|
+
snippet?: Snippet<MessagePart>;
|
|
34
|
+
};
|
|
35
|
+
export type SearchCoverage = {
|
|
36
|
+
rooms: readonly CoveredRoom[];
|
|
37
|
+
conversations: readonly string[];
|
|
38
|
+
overlay: readonly string[];
|
|
39
|
+
};
|
|
40
|
+
export type SearchHits = {
|
|
41
|
+
documents: readonly DocumentHit[];
|
|
42
|
+
messages: readonly MessageHit[];
|
|
43
|
+
};
|
|
44
|
+
export type SearchWindow = SearchHits & {
|
|
45
|
+
next?: string;
|
|
46
|
+
total?: {
|
|
47
|
+
documents: number;
|
|
48
|
+
messages: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type SearchPending = SearchHits & {
|
|
52
|
+
pending: readonly PendingRoom[];
|
|
53
|
+
coverage: SearchCoverage;
|
|
54
|
+
};
|
|
55
|
+
export type SearchUndeclared = ProviderRefusal & {
|
|
56
|
+
kind: 'undeclared';
|
|
57
|
+
};
|
|
58
|
+
export type SearchResult = (SearchWindow & {
|
|
59
|
+
coverage: SearchCoverage;
|
|
60
|
+
}) | SearchPending | SearchUndeclared;
|
|
61
|
+
export declare function undeclaredSearch(): SearchUndeclared;
|
|
62
|
+
export type HitCursor = readonly [number, string, string] | readonly [] | null;
|
|
63
|
+
export type SearchPlan = {
|
|
64
|
+
text: string;
|
|
65
|
+
documents: unknown;
|
|
66
|
+
collection: boolean;
|
|
67
|
+
conversations: readonly string[] | null;
|
|
68
|
+
limit: number | null;
|
|
69
|
+
after: readonly [HitCursor, HitCursor] | null;
|
|
70
|
+
total: boolean;
|
|
71
|
+
};
|
|
72
|
+
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,153 @@
|
|
|
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 { SearchWindow } from './search.js';
|
|
10
|
+
import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.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 QueueRecord = {
|
|
37
|
+
locator: string;
|
|
38
|
+
pending: readonly {
|
|
39
|
+
batch: ChangeBatch;
|
|
40
|
+
state: PendingState;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
export type PresentationRecord = {
|
|
44
|
+
app: string;
|
|
45
|
+
value: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type ChatSubmission = {
|
|
48
|
+
readonly operation: string;
|
|
49
|
+
readonly text: string;
|
|
50
|
+
readonly turn: string | null;
|
|
51
|
+
};
|
|
52
|
+
export type ChatDraftRecord = {
|
|
53
|
+
conversation: string;
|
|
54
|
+
text: string;
|
|
55
|
+
revision: string;
|
|
56
|
+
submitted?: readonly ChatSubmission[];
|
|
57
|
+
moves?: readonly string[];
|
|
58
|
+
};
|
|
59
|
+
export type CallRecord = {
|
|
60
|
+
readonly operation: string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly input: unknown;
|
|
63
|
+
};
|
|
64
|
+
export type AuthoredWrite = {
|
|
65
|
+
locator: string;
|
|
66
|
+
queue?: readonly ChangeBatch[];
|
|
67
|
+
founded?: readonly ChangeBatch[];
|
|
68
|
+
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
69
|
+
roomDrafts?: readonly RoomDraftRecord[];
|
|
70
|
+
consumedRoomDrafts?: readonly string[];
|
|
71
|
+
};
|
|
72
|
+
export type StagedPage = {
|
|
73
|
+
readonly entries: readonly StoredEntry[];
|
|
74
|
+
readonly folders: readonly string[];
|
|
75
|
+
};
|
|
76
|
+
export type RefreshedPage = StagedPage & {
|
|
77
|
+
readonly removals: readonly string[];
|
|
78
|
+
readonly folderRemovals: readonly string[];
|
|
79
|
+
};
|
|
80
|
+
export type Opened = {
|
|
81
|
+
readonly rooms: ReadonlyMap<string, StoredReplica>;
|
|
82
|
+
readonly unindexed: ReadonlySet<number>;
|
|
83
|
+
readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
|
|
84
|
+
readonly erasing: boolean;
|
|
85
|
+
readonly orphans: readonly number[];
|
|
86
|
+
readonly lastCompleted: string | null;
|
|
87
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
88
|
+
readonly capabilities: readonly Capability[];
|
|
89
|
+
readonly member: Member | null;
|
|
90
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
91
|
+
readonly presentation: readonly PresentationRecord[];
|
|
92
|
+
readonly conversationList: readonly ListedConversation[] | 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
|
+
search(ask: SearchAsk): Promise<SearchWindow>;
|
|
116
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
|
|
117
|
+
refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
118
|
+
unrefresh(key: number): Promise<void>;
|
|
119
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
120
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
121
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
122
|
+
abandon(locator: string): Promise<void>;
|
|
123
|
+
release(key: number): Promise<void>;
|
|
124
|
+
rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
|
|
125
|
+
readonly done: boolean;
|
|
126
|
+
readonly text: number;
|
|
127
|
+
}>;
|
|
128
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
129
|
+
queues(): Promise<readonly QueueRecord[]>;
|
|
130
|
+
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
131
|
+
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
132
|
+
roomDrafts(): Promise<readonly RoomDraftRecord[]>;
|
|
133
|
+
present(record: PresentationRecord): Promise<void>;
|
|
134
|
+
conversations(): Promise<readonly HeldConversation[]>;
|
|
135
|
+
keepMessages(write: ConversationWrite): Promise<void>;
|
|
136
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
|
|
137
|
+
messageCount(conversation: string): Promise<number>;
|
|
138
|
+
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
139
|
+
dropConversations(conversations: readonly string[]): Promise<void>;
|
|
140
|
+
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
141
|
+
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
142
|
+
dropChatDraft(conversation: string): Promise<void>;
|
|
143
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
144
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
145
|
+
dropCall(operation: string): Promise<void>;
|
|
146
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
147
|
+
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
148
|
+
fences(): Promise<readonly string[]>;
|
|
149
|
+
generation(): Promise<string | null>;
|
|
150
|
+
rememberGeneration(value: string): Promise<void>;
|
|
151
|
+
file(key: string, type: string): Promise<Blob>;
|
|
152
|
+
};
|
|
153
|
+
export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
|