@agentshouse/app-bridge 0.1.0-c646d0da70608 → 0.1.0-c66ec79ae3f1a
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 +4 -4
- package/dist/calls.d.ts +897 -66
- package/dist/index.d.ts +15 -4
- package/dist/mdmodel/condition.d.ts +20 -8
- package/dist/mdmodel/definition.d.ts +16 -1
- package/dist/mdmodel/document.d.ts +5 -5
- package/dist/mdmodel/index.d.ts +10 -8
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/types.d.ts +27 -4
- package/dist/mdmodel/validate.d.ts +27 -3
- package/dist/mdruntime/adapter.d.ts +67 -24
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +8 -9
- package/dist/mdruntime/change.d.ts +31 -1
- package/dist/mdruntime/client.d.ts +11 -2
- package/dist/mdruntime/collection.d.ts +6 -19
- package/dist/mdruntime/compile.d.ts +10 -0
- package/dist/mdruntime/connection.d.ts +23 -9
- package/dist/mdruntime/conversation.d.ts +15 -3
- package/dist/mdruntime/durability.d.ts +2 -1
- package/dist/mdruntime/file.d.ts +2 -10
- package/dist/mdruntime/observation.d.ts +14 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +35 -4
- package/dist/mdruntime/overlay.d.ts +3 -5
- package/dist/mdruntime/query.d.ts +29 -2
- package/dist/mdruntime/reach.d.ts +6 -3
- package/dist/mdruntime/readiness.d.ts +1 -1
- package/dist/mdruntime/recovery.d.ts +2 -2
- package/dist/mdruntime/replica.d.ts +55 -33
- package/dist/mdruntime/room-draft.d.ts +15 -1
- package/dist/mdruntime/save.d.ts +51 -14
- package/dist/mdruntime/search.d.ts +25 -5
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +8 -3
- package/dist/mdruntime/store.d.ts +99 -71
- package/dist/mdruntime/stored.d.ts +142 -0
- package/dist/mdruntime/tables.d.ts +319 -0
- package/dist/mdruntime/turn.d.ts +5 -3
- package/dist/mdruntime/wire.d.ts +32 -0
- package/dist/test-host.js +1 -1
- package/docs/families.md +8 -5
- package/package.json +1 -1
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/rows.d.ts +0 -36
|
@@ -2,7 +2,7 @@ import type { ReferrerScope } from './adapter.js';
|
|
|
2
2
|
import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
3
3
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
4
4
|
import type { Readiness } from './readiness.js';
|
|
5
|
-
import type
|
|
5
|
+
import { type SearchResult } from './search.js';
|
|
6
6
|
export type ReachedDocument = {
|
|
7
7
|
readonly room: string;
|
|
8
8
|
readonly path: string;
|
|
@@ -26,10 +26,13 @@ export type Reachable = RuntimeView & {
|
|
|
26
26
|
plan(input: unknown, reach: PortReach | null): Plan;
|
|
27
27
|
query(plan: Plan): Promise<QueryResult>;
|
|
28
28
|
watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
|
|
29
|
-
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
30
|
-
searching(target: string): void;
|
|
29
|
+
search(input: unknown, reach: PortReach | null, locked: readonly string[]): Promise<SearchResult>;
|
|
31
30
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
32
31
|
referrerScope(referrer: unknown): ReferrerScope | null;
|
|
32
|
+
locked(room: string): boolean;
|
|
33
|
+
lockedRooms(): readonly string[];
|
|
34
|
+
watchLocks(notify: () => void): () => void;
|
|
35
|
+
located(room: string, path: string, destination: string): ReachedDocument | null;
|
|
33
36
|
};
|
|
34
37
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
35
38
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -19,7 +19,7 @@ export type Durability = Open<'persistent' | 'best-effort'>;
|
|
|
19
19
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
20
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
21
21
|
export type CapacityCause = {
|
|
22
|
-
readonly cause: Open<'insufficient-space' | '
|
|
22
|
+
readonly cause: Open<'insufficient-space' | 'storage-exceeded'>;
|
|
23
23
|
readonly needed: number | null;
|
|
24
24
|
readonly available: number | null;
|
|
25
25
|
};
|
|
@@ -8,7 +8,7 @@ export type AttemptOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export type RecoveryOptions = {
|
|
10
10
|
readonly firstMs?: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly maxMs?: number;
|
|
12
12
|
readonly attempts?: number;
|
|
13
13
|
readonly inFlight?: number;
|
|
14
14
|
};
|
|
@@ -20,5 +20,5 @@ export type Recovery = {
|
|
|
20
20
|
scope(inFlight?: number): Recovery;
|
|
21
21
|
retire(): Promise<void>;
|
|
22
22
|
};
|
|
23
|
-
export declare function retryDelay(tries: number, firstMs?: number,
|
|
23
|
+
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
24
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
@@ -1,45 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
|
+
import { type ChangeBatch, type Precondition } from './change.js';
|
|
2
3
|
import { type Collection, type Composition } from './collection.js';
|
|
4
|
+
import type { ModelState } from './model.js';
|
|
3
5
|
import { type Layer } from './overlay.js';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 selectionModel: ModelState;
|
|
16
|
+
readonly providerOwnedPaths: readonly string[];
|
|
17
|
+
readonly roomVersion: string;
|
|
18
|
+
readonly transfer: string;
|
|
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;
|
|
10
27
|
};
|
|
11
28
|
export type VisibleLayer = Layer & {
|
|
12
|
-
collection: Collection;
|
|
29
|
+
readonly collection: Collection;
|
|
13
30
|
};
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} | Refused;
|
|
18
|
-
export type Replica = {
|
|
19
|
-
confirmed: ConfirmedLayer;
|
|
20
|
-
queue: readonly ChangeBatch[];
|
|
21
|
-
visible: VisibleLayer;
|
|
22
|
-
replay: readonly ReplayStep[];
|
|
31
|
+
export type Slice = Layer & {
|
|
32
|
+
readonly written: Readonly<Record<string, string>>;
|
|
33
|
+
readonly held: ReadonlySet<string>;
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection' | 'selectionModel'>): Composition;
|
|
36
|
+
export declare function sameMembership(record: Pick<ReplicaRecord, 'typedSelection'>, other: Pick<ReplicaRecord, 'typedSelection'>): boolean;
|
|
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>;
|
|
30
48
|
};
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export
|
|
36
|
-
|
|
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[];
|
|
37
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>;
|
|
38
58
|
type Accepted = Extract<MutationResult, {
|
|
39
59
|
kind: 'accepted';
|
|
40
60
|
}>;
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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>;
|
|
45
67
|
export {};
|
|
@@ -32,6 +32,7 @@ export type RoomDraftParts = {
|
|
|
32
32
|
readonly creation?: RoomDraftCreation;
|
|
33
33
|
readonly move?: {
|
|
34
34
|
readonly to: string;
|
|
35
|
+
readonly room?: string;
|
|
35
36
|
readonly base?: string | null;
|
|
36
37
|
};
|
|
37
38
|
readonly removal?: {
|
|
@@ -42,8 +43,8 @@ export type RoomDraftParts = {
|
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
export type HeldFile = {
|
|
45
|
-
readonly blob: Blob;
|
|
46
46
|
readonly localId: string;
|
|
47
|
+
readonly name?: string;
|
|
47
48
|
readonly byteLength: number;
|
|
48
49
|
readonly mediaType: string;
|
|
49
50
|
readonly sha256: string;
|
|
@@ -69,6 +70,7 @@ type HeldParts = {
|
|
|
69
70
|
readonly creation?: RoomDraftCreation;
|
|
70
71
|
readonly move?: {
|
|
71
72
|
readonly to: string;
|
|
73
|
+
readonly room?: string;
|
|
72
74
|
readonly base: string | null;
|
|
73
75
|
};
|
|
74
76
|
readonly removal?: {
|
|
@@ -130,6 +132,18 @@ export declare function underneath(parts: HeldParts, path: string, visible: Visi
|
|
|
130
132
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
131
133
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
132
134
|
export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
|
|
135
|
+
export type TextParts = {
|
|
136
|
+
readonly fields?: Readonly<Record<string, {
|
|
137
|
+
readonly value: unknown;
|
|
138
|
+
}>>;
|
|
139
|
+
readonly sections?: Readonly<Record<string, {
|
|
140
|
+
readonly value: string;
|
|
141
|
+
}>>;
|
|
142
|
+
readonly preamble?: {
|
|
143
|
+
readonly value: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
133
147
|
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
134
148
|
export declare function moveTarget(move: {
|
|
135
149
|
readonly to: string;
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
+
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
2
3
|
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
3
4
|
import { type Composition } from './collection.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
4
6
|
import type { VisibleLayer } from './replica.js';
|
|
5
7
|
import type { ChangedPart } from './room-draft.js';
|
|
6
8
|
export type SaveRefusal = {
|
|
@@ -24,20 +26,23 @@ export type SaveInput = {
|
|
|
24
26
|
bases: readonly Precondition[];
|
|
25
27
|
queued?: ReadonlySet<string>;
|
|
26
28
|
writtenBy?: WrittenBy;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
binaries: Readonly<Record<string, unknown>>;
|
|
30
|
-
composition: Composition;
|
|
31
|
-
};
|
|
29
|
+
unmodeled: boolean;
|
|
30
|
+
validate: Validator;
|
|
32
31
|
};
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
batch: ChangeBatch;
|
|
36
|
-
} | {
|
|
32
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
33
|
+
type Refusing = {
|
|
37
34
|
kind: 'refused';
|
|
38
35
|
refusal: SaveRefusal;
|
|
39
36
|
};
|
|
40
|
-
export
|
|
37
|
+
export type BatchResult = {
|
|
38
|
+
kind: 'batch';
|
|
39
|
+
batch: ChangeBatch;
|
|
40
|
+
} | Refusing;
|
|
41
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
42
|
+
export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
43
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
44
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
45
|
+
export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
|
|
41
46
|
export type Requeued = {
|
|
42
47
|
kind: 'requeued';
|
|
43
48
|
queue: readonly ChangeBatch[];
|
|
@@ -57,7 +62,39 @@ export type Joining = {
|
|
|
57
62
|
kind: 'refused';
|
|
58
63
|
refusal: SaveRefusal;
|
|
59
64
|
};
|
|
60
|
-
|
|
65
|
+
type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
66
|
+
export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
|
|
61
67
|
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
62
|
-
export declare function
|
|
63
|
-
export declare
|
|
68
|
+
export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
|
|
69
|
+
export declare const MOVE_DOCUMENTS = "move-documents";
|
|
70
|
+
export type MoveSide = {
|
|
71
|
+
room: string;
|
|
72
|
+
handle: string;
|
|
73
|
+
baseRoomVersion: string;
|
|
74
|
+
composition: Composition;
|
|
75
|
+
operations: OperationScopes;
|
|
76
|
+
providerOwnedPaths: readonly string[];
|
|
77
|
+
visible: VisibleLayer;
|
|
78
|
+
queued: ReadonlySet<string>;
|
|
79
|
+
unmodeled: boolean;
|
|
80
|
+
validate: Validator;
|
|
81
|
+
};
|
|
82
|
+
export type MoveInput = {
|
|
83
|
+
source: MoveSide;
|
|
84
|
+
destination: MoveSide;
|
|
85
|
+
moves: readonly {
|
|
86
|
+
readonly path: string;
|
|
87
|
+
readonly to: string;
|
|
88
|
+
}[];
|
|
89
|
+
providerLimits: readonly ProviderLimit[];
|
|
90
|
+
local: boolean;
|
|
91
|
+
writtenBy?: WrittenBy;
|
|
92
|
+
};
|
|
93
|
+
export type MoveResult = {
|
|
94
|
+
kind: 'moved';
|
|
95
|
+
leaving: ChangeBatch;
|
|
96
|
+
arriving: ChangeBatch;
|
|
97
|
+
} | Refusing;
|
|
98
|
+
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
99
|
+
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
100
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
1
2
|
import type { ChangeSet } from './change-set.js';
|
|
2
3
|
import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
|
|
3
4
|
import type { Open } from './open.js';
|
|
@@ -5,8 +6,11 @@ export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
|
5
6
|
export type SearchRequest = {
|
|
6
7
|
text: string;
|
|
7
8
|
documents?: Filter;
|
|
9
|
+
collection?: true;
|
|
8
10
|
conversations?: readonly string[];
|
|
9
11
|
limit?: number;
|
|
12
|
+
after?: string;
|
|
13
|
+
total?: true;
|
|
10
14
|
};
|
|
11
15
|
export type DocumentHit = {
|
|
12
16
|
room: string;
|
|
@@ -35,13 +39,24 @@ export type SearchHits = {
|
|
|
35
39
|
documents: readonly DocumentHit[];
|
|
36
40
|
messages: readonly MessageHit[];
|
|
37
41
|
};
|
|
42
|
+
export type SearchWindow = SearchHits & {
|
|
43
|
+
next?: string;
|
|
44
|
+
total?: {
|
|
45
|
+
documents: number;
|
|
46
|
+
messages: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
38
49
|
export type SearchPending = SearchHits & {
|
|
39
50
|
pending: readonly (PendingRoom | PendingConversation)[];
|
|
40
51
|
coverage: SearchCoverage;
|
|
41
52
|
};
|
|
42
|
-
export type
|
|
53
|
+
export type SearchUndeclared = ProviderRefusal & {
|
|
54
|
+
kind: 'undeclared';
|
|
55
|
+
};
|
|
56
|
+
export type SearchResult = (SearchWindow & {
|
|
43
57
|
coverage: SearchCoverage;
|
|
44
|
-
}) | SearchPending;
|
|
58
|
+
}) | SearchPending | SearchUndeclared;
|
|
59
|
+
export declare function undeclaredSearch(): SearchUndeclared;
|
|
45
60
|
export type SearchedDocument = {
|
|
46
61
|
room: string;
|
|
47
62
|
path: string;
|
|
@@ -56,14 +71,18 @@ export type SearchedMessage = {
|
|
|
56
71
|
text: string;
|
|
57
72
|
};
|
|
58
73
|
export type SearchSource = {
|
|
59
|
-
room(room: string): readonly
|
|
60
|
-
|
|
74
|
+
room(room: string): AsyncIterable<readonly SearchedDocument[]>;
|
|
75
|
+
documents(room: string, paths: readonly string[]): Promise<readonly SearchedDocument[]>;
|
|
61
76
|
};
|
|
77
|
+
type HitCursor = readonly [number, string, string] | readonly [] | null;
|
|
62
78
|
export type SearchPlan = {
|
|
63
79
|
text: string;
|
|
64
80
|
documents: unknown;
|
|
81
|
+
collection: boolean;
|
|
65
82
|
conversations: readonly string[] | null;
|
|
66
83
|
limit: number | null;
|
|
84
|
+
after: readonly [HitCursor, HitCursor] | null;
|
|
85
|
+
total: boolean;
|
|
67
86
|
};
|
|
68
87
|
export type SearchIndex = {
|
|
69
88
|
generation(): string;
|
|
@@ -78,7 +97,8 @@ export type SearchIndex = {
|
|
|
78
97
|
search(plan: SearchPlan, documents: readonly {
|
|
79
98
|
room: string;
|
|
80
99
|
path: string;
|
|
81
|
-
}[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null):
|
|
100
|
+
}[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchWindow;
|
|
82
101
|
};
|
|
83
102
|
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
84
103
|
export declare function createSearchIndex(source: SearchSource): SearchIndex;
|
|
104
|
+
export {};
|
|
@@ -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;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export type Paths<V> = Readonly<Record<string, V>>;
|
|
2
|
-
|
|
2
|
+
export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
|
|
3
|
+
export declare function keysIn(...maps: readonly Paths<unknown>[]): Generator<number, Set<string>, void>;
|
|
4
|
+
export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
|
|
5
|
+
export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
|
|
6
|
+
export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
|
|
3
7
|
export declare function shared<V>(map: Paths<V>): Paths<V>;
|
|
4
8
|
export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
|
|
5
|
-
export declare function
|
|
9
|
+
export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
|
|
6
10
|
export declare function sizeOf<V>(map: Paths<V>): number;
|
|
11
|
+
export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
|
|
7
12
|
export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
|
|
8
13
|
export declare function drafted<V>(base: Paths<V>): Record<string, V>;
|
|
9
14
|
export declare function settled<V>(draft: Record<string, V>): Paths<V>;
|
|
10
|
-
export
|
|
15
|
+
export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
|
|
@@ -1,43 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Capability, HeadChange, Member, OperationScopes, ProviderLimit, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
1
|
+
import type { Capability, Member, ProviderLimit } from './adapter.js';
|
|
3
2
|
import type { AcceptedMessage, KeptReceipt } from './adapter.js';
|
|
4
3
|
import type { ChangeBatch } from './change.js';
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
4
|
+
import type { Composition } from './collection.js';
|
|
5
|
+
import type { Plan } from './query.js';
|
|
6
|
+
import type { ReplicaRecord } from './replica.js';
|
|
7
|
+
import type { Later } from './turn.js';
|
|
7
8
|
import type { Submission } from './outcome.js';
|
|
8
9
|
import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
name: string;
|
|
14
|
-
handle: string;
|
|
15
|
-
operations: OperationScopes;
|
|
16
|
-
replica: ReplicaAdmission;
|
|
17
|
-
model: ModelState;
|
|
18
|
-
typedSelection: TypedSelection | null;
|
|
19
|
-
selectionModel: ModelState;
|
|
20
|
-
providerOwnedPaths: readonly string[];
|
|
21
|
-
roomVersion: string;
|
|
22
|
-
transfer: string;
|
|
23
|
-
documents: Readonly<Record<string, string>>;
|
|
24
|
-
binaries: Readonly<Record<string, HeldBinary>>;
|
|
25
|
-
revisions: Readonly<Record<string, string>>;
|
|
26
|
-
changes: Readonly<Record<string, HeadChange>>;
|
|
27
|
-
written: Readonly<Record<string, string>>;
|
|
28
|
-
};
|
|
29
|
-
export type StagedLayer = Pick<ReplicaRecord, 'documents' | 'binaries' | 'revisions' | 'changes' | 'written'>;
|
|
10
|
+
import type { ModelState } from './model.js';
|
|
11
|
+
import type { SearchedDocument } from './search.js';
|
|
12
|
+
import type { CommittedWrite, CountedRoom, HeldEntry, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View, Walked } from './tables.js';
|
|
13
|
+
export declare const STORE_SCHEMA = 26;
|
|
30
14
|
export type TransferRecord = {
|
|
31
|
-
locator: string;
|
|
32
|
-
transfer: string;
|
|
33
|
-
selection: string;
|
|
34
|
-
from: string;
|
|
35
|
-
last: string;
|
|
36
|
-
pageToken: string | null;
|
|
37
|
-
models: {
|
|
38
|
-
collection: ModelState;
|
|
39
|
-
selection: ModelState;
|
|
15
|
+
readonly locator: string;
|
|
16
|
+
readonly transfer: string;
|
|
17
|
+
readonly selection: string;
|
|
18
|
+
readonly from: string;
|
|
19
|
+
readonly last: string;
|
|
20
|
+
readonly pageToken: string | null;
|
|
21
|
+
readonly models: {
|
|
22
|
+
readonly collection: ModelState;
|
|
23
|
+
readonly selection: ModelState;
|
|
40
24
|
};
|
|
25
|
+
readonly key: number | null;
|
|
41
26
|
};
|
|
42
27
|
export type PendingState = {
|
|
43
28
|
readonly drafts: readonly SavedDraft[];
|
|
@@ -48,7 +33,6 @@ export type PendingState = {
|
|
|
48
33
|
};
|
|
49
34
|
export type TargetRecord = {
|
|
50
35
|
established: boolean;
|
|
51
|
-
search: boolean;
|
|
52
36
|
};
|
|
53
37
|
export type QueueRecord = {
|
|
54
38
|
locator: string;
|
|
@@ -66,6 +50,10 @@ export type HeldConversation = {
|
|
|
66
50
|
read: string | null | undefined;
|
|
67
51
|
partial: boolean;
|
|
68
52
|
};
|
|
53
|
+
export type MessageWindow = {
|
|
54
|
+
messages: AcceptedMessage[];
|
|
55
|
+
more: boolean;
|
|
56
|
+
};
|
|
69
57
|
export type ConversationWrite = {
|
|
70
58
|
conversation: string;
|
|
71
59
|
messages: readonly AcceptedMessage[];
|
|
@@ -77,53 +65,98 @@ export type ConversationWrite = {
|
|
|
77
65
|
export type ChatSubmission = {
|
|
78
66
|
readonly operation: string;
|
|
79
67
|
readonly text: string;
|
|
80
|
-
readonly files: readonly ChatDraftFile[];
|
|
81
68
|
readonly turn: string | null;
|
|
82
69
|
};
|
|
83
70
|
export type ChatDraftRecord = {
|
|
84
71
|
conversation: string;
|
|
85
72
|
text: string;
|
|
86
|
-
files: readonly ChatDraftFile[];
|
|
87
73
|
revision: string;
|
|
88
74
|
submitted?: readonly ChatSubmission[];
|
|
89
75
|
moves?: readonly string[];
|
|
90
76
|
};
|
|
91
|
-
export type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
export type CallRecord = {
|
|
78
|
+
readonly operation: string;
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly input: unknown;
|
|
95
81
|
};
|
|
96
82
|
export type AuthoredWrite = {
|
|
97
83
|
locator: string;
|
|
98
|
-
queue
|
|
84
|
+
queue?: readonly ChangeBatch[];
|
|
85
|
+
founded?: readonly ChangeBatch[];
|
|
99
86
|
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
100
87
|
roomDrafts?: readonly RoomDraftRecord[];
|
|
101
88
|
consumedRoomDrafts?: readonly string[];
|
|
89
|
+
accepted?: readonly {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly roomVersion: string;
|
|
92
|
+
}[];
|
|
93
|
+
};
|
|
94
|
+
export type StagedPage = {
|
|
95
|
+
readonly entries: readonly StoredEntry[];
|
|
96
|
+
readonly folders: readonly string[];
|
|
97
|
+
};
|
|
98
|
+
export type RefreshedPage = StagedPage & {
|
|
99
|
+
readonly removals: readonly string[];
|
|
100
|
+
readonly folderRemovals: readonly string[];
|
|
101
|
+
};
|
|
102
|
+
export type Opened = {
|
|
103
|
+
readonly rooms: ReadonlyMap<string, ReplicaRecord>;
|
|
104
|
+
readonly transfers: ReadonlyMap<string, TransferRecord>;
|
|
105
|
+
readonly unprepared: ReadonlySet<number>;
|
|
106
|
+
readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
|
|
107
|
+
readonly erasing: boolean;
|
|
108
|
+
readonly orphans: readonly number[];
|
|
109
|
+
readonly lastCompleted: string | null;
|
|
110
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
111
|
+
readonly capabilities: readonly Capability[];
|
|
112
|
+
readonly member: Member | null;
|
|
113
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
114
|
+
readonly presentation: readonly PresentationRecord[];
|
|
115
|
+
};
|
|
116
|
+
export type Commit = {
|
|
117
|
+
readonly rooms: readonly RoomCommit[];
|
|
118
|
+
readonly writes?: readonly AuthoredWrite[];
|
|
119
|
+
readonly files?: readonly StoredFile[];
|
|
120
|
+
readonly whole?: boolean;
|
|
121
|
+
readonly discards?: readonly string[];
|
|
102
122
|
};
|
|
103
123
|
export type RuntimeStore = {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
opened(): Promise<Opened>;
|
|
125
|
+
counts(rooms: readonly CountedRoom[]): Promise<readonly number[]>;
|
|
126
|
+
query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
|
|
127
|
+
changes(keys: readonly number[]): number;
|
|
128
|
+
entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
|
|
129
|
+
typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
|
|
130
|
+
referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
|
|
131
|
+
walk(key: number, view: View, after: string | null, bytes: number): Promise<Walked>;
|
|
132
|
+
files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
|
|
133
|
+
readonly path: string;
|
|
134
|
+
readonly revision: string;
|
|
135
|
+
}[]>;
|
|
136
|
+
typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
|
|
137
|
+
searched(key: number, locator: string, after: string | null, limit: number, paths: readonly string[] | null): Promise<{
|
|
138
|
+
readonly documents: readonly SearchedDocument[];
|
|
139
|
+
readonly next: string | null;
|
|
140
|
+
}>;
|
|
141
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage, key: number | null, last: boolean): Promise<number | null>;
|
|
142
|
+
refresh(key: number, page: RefreshedPage): Promise<void>;
|
|
143
|
+
unrefresh(key: number): Promise<void>;
|
|
144
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
145
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
146
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
147
|
+
abandon(locator: string, kept?: boolean): Promise<number | null>;
|
|
148
|
+
release(key: number): Promise<void>;
|
|
149
|
+
rederive(key: number, limit: number): Promise<boolean>;
|
|
150
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
117
151
|
queues(): Promise<readonly QueueRecord[]>;
|
|
118
152
|
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
119
|
-
accept(locator: string, id: string, roomVersion: string): Promise<void>;
|
|
120
153
|
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
121
154
|
roomDrafts(): Promise<readonly RoomDraftRecord[]>;
|
|
122
|
-
presentation(): Promise<readonly PresentationRecord[]>;
|
|
123
155
|
present(record: PresentationRecord): Promise<void>;
|
|
124
156
|
conversations(): Promise<readonly HeldConversation[]>;
|
|
125
157
|
keepMessages(write: ConversationWrite): Promise<void>;
|
|
126
|
-
messageWindow(conversation: string, limit: number |
|
|
158
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
|
|
159
|
+
messageCount(conversation: string): Promise<number>;
|
|
127
160
|
messagesAfter(conversation: string, identity: string | null): Promise<AcceptedMessage[]>;
|
|
128
161
|
messageIdentities(conversation: string): Promise<readonly string[]>;
|
|
129
162
|
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
@@ -131,15 +164,12 @@ export type RuntimeStore = {
|
|
|
131
164
|
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
132
165
|
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
133
166
|
dropChatDraft(conversation: string): Promise<void>;
|
|
134
|
-
|
|
167
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
168
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
169
|
+
dropCall(operation: string): Promise<void>;
|
|
170
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
135
171
|
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
136
172
|
fences(): Promise<readonly string[]>;
|
|
137
|
-
erase(locators: readonly string[]): Promise<void>;
|
|
138
|
-
discard(locator: string): Promise<void>;
|
|
139
|
-
transfers(): Promise<readonly TransferRecord[]>;
|
|
140
|
-
staged(record: TransferRecord): Promise<StagedLayer>;
|
|
141
|
-
stage(record: TransferRecord, page: StagedLayer): Promise<void>;
|
|
142
|
-
abandon(locator: string): Promise<void>;
|
|
143
173
|
receivedHeads(): Promise<readonly KeptReceipt[]>;
|
|
144
174
|
receivedParts(key: string, count: number): Promise<readonly unknown[]>;
|
|
145
175
|
keepReceived(key: string, head: unknown, part?: {
|
|
@@ -149,12 +179,10 @@ export type RuntimeStore = {
|
|
|
149
179
|
dropReceived(keys: readonly string[]): Promise<void>;
|
|
150
180
|
generation(): Promise<string | null>;
|
|
151
181
|
rememberGeneration(value: string): Promise<void>;
|
|
182
|
+
file(key: string, type: string): Promise<Blob>;
|
|
152
183
|
close(): void;
|
|
153
184
|
};
|
|
154
|
-
export declare function
|
|
155
|
-
export declare function
|
|
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>;
|
|
185
|
+
export declare function transacted<T>(database: IDBDatabase, stores: string | readonly string[], mode: IDBTransactionMode, work: (transaction: IDBTransaction) => Later<T>): Promise<T>;
|
|
186
|
+
export declare function endRuntimeStore(database: RuntimeDatabase, holder: string | undefined): Promise<boolean>;
|
|
159
187
|
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>;
|
|
188
|
+
export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): Promise<RuntimeStore>;
|