@may-db/core 0.1.1 → 0.1.3
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 +117 -5
- package/dist/IndexRuntime.d.ts +60 -0
- package/dist/IndexRuntime.d.ts.map +1 -0
- package/dist/IndexRuntime.js +340 -0
- package/dist/IndexRuntime.js.map +1 -0
- package/dist/MayDb.d.ts +26 -7
- package/dist/MayDb.d.ts.map +1 -1
- package/dist/MayDb.js +197 -54
- package/dist/MayDb.js.map +1 -1
- package/dist/Room.d.ts +32 -0
- package/dist/Room.d.ts.map +1 -1
- package/dist/Room.js +35 -0
- package/dist/Room.js.map +1 -1
- package/dist/RuntimeIndexHandle.d.ts +29 -0
- package/dist/RuntimeIndexHandle.d.ts.map +1 -0
- package/dist/RuntimeIndexHandle.js +48 -0
- package/dist/RuntimeIndexHandle.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/indexing/collaborativeSync.d.ts +25 -0
- package/dist/indexing/collaborativeSync.d.ts.map +1 -0
- package/dist/indexing/collaborativeSync.js +56 -0
- package/dist/indexing/collaborativeSync.js.map +1 -0
- package/dist/indexing/descriptor.d.ts +6 -0
- package/dist/indexing/descriptor.d.ts.map +1 -0
- package/dist/indexing/descriptor.js +2 -0
- package/dist/indexing/descriptor.js.map +1 -0
- package/dist/indexing/errors.d.ts +9 -0
- package/dist/indexing/errors.d.ts.map +1 -0
- package/dist/indexing/errors.js +11 -0
- package/dist/indexing/errors.js.map +1 -0
- package/dist/indexing/handle.d.ts +29 -0
- package/dist/indexing/handle.d.ts.map +1 -0
- package/dist/indexing/handle.js +48 -0
- package/dist/indexing/handle.js.map +1 -0
- package/dist/indexing/indexRoomStore.d.ts +18 -0
- package/dist/indexing/indexRoomStore.d.ts.map +1 -0
- package/dist/indexing/indexRoomStore.js +71 -0
- package/dist/indexing/indexRoomStore.js.map +1 -0
- package/dist/indexing/roomRegistry.d.ts +26 -0
- package/dist/indexing/roomRegistry.d.ts.map +1 -0
- package/dist/indexing/roomRegistry.js +125 -0
- package/dist/indexing/roomRegistry.js.map +1 -0
- package/dist/indexing/rows.d.ts +8 -0
- package/dist/indexing/rows.d.ts.map +1 -0
- package/dist/indexing/rows.js +86 -0
- package/dist/indexing/rows.js.map +1 -0
- package/dist/indexing/runtime.d.ts +61 -0
- package/dist/indexing/runtime.d.ts.map +1 -0
- package/dist/indexing/runtime.js +376 -0
- package/dist/indexing/runtime.js.map +1 -0
- package/dist/indexing.d.ts +93 -0
- package/dist/indexing.d.ts.map +1 -0
- package/dist/indexing.js +394 -0
- package/dist/indexing.js.map +1 -0
- package/dist/indexingErrors.d.ts +9 -0
- package/dist/indexingErrors.d.ts.map +1 -0
- package/dist/indexingErrors.js +11 -0
- package/dist/indexingErrors.js.map +1 -0
- package/dist/indexingRoomStore.d.ts +26 -0
- package/dist/indexingRoomStore.d.ts.map +1 -0
- package/dist/indexingRoomStore.js +125 -0
- package/dist/indexingRoomStore.js.map +1 -0
- package/dist/indexingRows.d.ts +8 -0
- package/dist/indexingRows.d.ts.map +1 -0
- package/dist/indexingRows.js +114 -0
- package/dist/indexingRows.js.map +1 -0
- package/dist/indexingTypes.d.ts +9 -0
- package/dist/indexingTypes.d.ts.map +1 -0
- package/dist/indexingTypes.js +2 -0
- package/dist/indexingTypes.js.map +1 -0
- package/dist/roomMetadata.d.ts +3 -0
- package/dist/roomMetadata.d.ts.map +1 -0
- package/dist/roomMetadata.js +3 -0
- package/dist/roomMetadata.js.map +1 -0
- package/dist/types.d.ts +56 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -5
- package/patches/matrix-crdt+0.2.1-alpha.1.patch +108 -0
package/README.md
CHANGED
|
@@ -9,6 +9,23 @@ Bring your own server. No app backend.
|
|
|
9
9
|
pnpm add @may-db/core @may-db/react
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
## Compatibility policy
|
|
13
|
+
|
|
14
|
+
It is early days.
|
|
15
|
+
|
|
16
|
+
`@may-db/core@0.1.x` is validated against this dependency pair:
|
|
17
|
+
|
|
18
|
+
- `matrix-crdt@0.2.1-alpha.1`
|
|
19
|
+
- `matrix-js-sdk@40.2.0`
|
|
20
|
+
|
|
21
|
+
The SDK applies a local `matrix-crdt` patch during `postinstall` to keep this pair working, including the `/events` polling `authedRequest` call shape used by current `matrix-js-sdk`.
|
|
22
|
+
|
|
23
|
+
Support policy:
|
|
24
|
+
|
|
25
|
+
- Treat `matrix-crdt` and `matrix-js-sdk` as a tested pair.
|
|
26
|
+
- Avoid overriding either package version unless you are validating the combo yourself.
|
|
27
|
+
- SDK releases should call out any change to the supported pair.
|
|
28
|
+
|
|
12
29
|
## Tiny React example
|
|
13
30
|
|
|
14
31
|
One shared value (`Y.Text`), manual Yjs subscription.
|
|
@@ -19,7 +36,13 @@ import type { MayDb } from "@may-db/core";
|
|
|
19
36
|
import { useMayDb, useRoom } from "@may-db/react";
|
|
20
37
|
|
|
21
38
|
export function TinyNoteApp() {
|
|
22
|
-
const { status, db, login, userId } = useMayDb({
|
|
39
|
+
const { status, db, login, userId } = useMayDb({
|
|
40
|
+
namespace: "com.may-db.tiny-note",
|
|
41
|
+
schema: {
|
|
42
|
+
roomTypes: { note: {} },
|
|
43
|
+
indexes: {},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
23
46
|
const [roomId, setRoomId] = useState<string | null>(null);
|
|
24
47
|
|
|
25
48
|
if (status === "signed_out") {
|
|
@@ -36,7 +59,10 @@ export function TinyNoteApp() {
|
|
|
36
59
|
<p>Connected as {userId}</p>
|
|
37
60
|
<button
|
|
38
61
|
onClick={async () => {
|
|
39
|
-
const room = await db.rooms.create({
|
|
62
|
+
const room = await db.rooms.create({
|
|
63
|
+
name: "Tiny Note",
|
|
64
|
+
roomType: "note",
|
|
65
|
+
});
|
|
40
66
|
setRoomId(room.id);
|
|
41
67
|
}}
|
|
42
68
|
>
|
|
@@ -81,14 +107,100 @@ function TinyNoteRoom({ db, roomId }: { db: MayDb; roomId: string }) {
|
|
|
81
107
|
}
|
|
82
108
|
```
|
|
83
109
|
|
|
110
|
+
## Multiplayer flows
|
|
111
|
+
|
|
112
|
+
This section focuses on patterns for room discovery and sharing.
|
|
113
|
+
|
|
114
|
+
(Collaborative index setup is intentionally not covered yet while that API stabilizes.)
|
|
115
|
+
|
|
116
|
+
### Find existing rooms with private indexes
|
|
117
|
+
|
|
118
|
+
Define a private index that captures the fields you need for matchmaking/lobby UI.
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import type { MayDbSchema } from "@may-db/core";
|
|
122
|
+
|
|
123
|
+
export const APP_SCHEMA: MayDbSchema = {
|
|
124
|
+
roomTypes: {
|
|
125
|
+
game_room: {},
|
|
126
|
+
},
|
|
127
|
+
indexes: {
|
|
128
|
+
rooms: {
|
|
129
|
+
scope: "private",
|
|
130
|
+
roomTypes: ["game_room"],
|
|
131
|
+
columns: {
|
|
132
|
+
roomName: {
|
|
133
|
+
source: { kind: "system", field: "roomName" },
|
|
134
|
+
},
|
|
135
|
+
status: {
|
|
136
|
+
source: { kind: "ytext", path: "status" }, // "lobby" | "playing" | "done"
|
|
137
|
+
},
|
|
138
|
+
updatedAt: {
|
|
139
|
+
source: { kind: "ytext", path: "updatedAt" }, // ISO timestamp string
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
defaultOrderBy: { column: "updatedAt", direction: "desc" },
|
|
143
|
+
maxEntries: 5000,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Open the index once per signed-in session and query it for room discovery:
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { useMayDbIndex, useMayDbQuery } from "@may-db/react";
|
|
153
|
+
|
|
154
|
+
const rooms = useMayDbIndex({
|
|
155
|
+
db,
|
|
156
|
+
indexName: "rooms",
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const lobbyRooms = useMayDbQuery({
|
|
160
|
+
index: rooms.index,
|
|
161
|
+
where: { status: "lobby" },
|
|
162
|
+
orderBy: { column: "updatedAt", direction: "desc" },
|
|
163
|
+
limit: 50,
|
|
164
|
+
after: null,
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Notes:
|
|
169
|
+
|
|
170
|
+
- `where` is exact-match equality per column; use `where: {}` for "all rooms".
|
|
171
|
+
- `queryPage` supports cursor pagination through `after`.
|
|
172
|
+
- Private indexes cover rooms this user can access (including invited rooms once joined).
|
|
173
|
+
- Rows refresh when this client ingests a room (create/open/invite join) and on this client's local writes.
|
|
174
|
+
|
|
175
|
+
### Share rooms and rely on automatic invite indexing
|
|
176
|
+
|
|
177
|
+
To share a room:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
const room = db.rooms.open(roomId);
|
|
181
|
+
await room.ensureJoined();
|
|
182
|
+
await room.members.invite("@friend:homeserver.tld", "editor");
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
When another user runs your app with the same `namespace` + schema:
|
|
186
|
+
|
|
187
|
+
1. may-db polls Matrix invites in the background.
|
|
188
|
+
2. It auto-joins invites for rooms that carry your app namespace state marker.
|
|
189
|
+
3. After joining, it indexes the room.
|
|
190
|
+
4. The invited room appears in that user's private-scope index queries.
|
|
191
|
+
|
|
192
|
+
You do not need a separate "add invite to index" step in app code.
|
|
193
|
+
|
|
194
|
+
Operationally, this is eventually consistent: invite ingestion runs on a poll interval and join retries use backoff on transient failures.
|
|
195
|
+
|
|
84
196
|
## API surface (app-facing)
|
|
85
197
|
|
|
86
|
-
- `useMayDb({ namespace })` -> Matrix auth/session + `db`
|
|
87
|
-
- `db.rooms.create/open/getOrCreateSingleton(...)`
|
|
198
|
+
- `useMayDb({ namespace, schema })` -> Matrix auth/session + `db`
|
|
199
|
+
- `db.rooms.create/open/getOrCreateSingleton(...)` with required `roomType` on creation APIs
|
|
88
200
|
- `useRoom({ db, roomId })` -> `doc`, `ready`, `canEdit`, `name`
|
|
89
201
|
- `room.members.*` to share a room with users
|
|
90
202
|
- `room.delegates.*` to share a room with the members of other rooms
|
|
91
|
-
- `db.
|
|
203
|
+
- `db.indexes.open(...)` for typed index handles and `queryPage(...)`
|
|
92
204
|
- `useRoomPresence(...)` to exchange presence/cursor with other users
|
|
93
205
|
|
|
94
206
|
## Mental model
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Room } from "./Room";
|
|
2
|
+
import { RuntimeIndexHandle } from "./RuntimeIndexHandle";
|
|
3
|
+
import type { MayDbIndexHandle, MayDbIndexQueryPageOptions, MayDbIndexQueryPageResult, MayDbSchema, MatrixClient } from "./types";
|
|
4
|
+
export declare class IndexRuntime {
|
|
5
|
+
private readonly namespace;
|
|
6
|
+
private readonly matrixClient;
|
|
7
|
+
private readonly schema;
|
|
8
|
+
private readonly openRoom;
|
|
9
|
+
private readonly roomStore;
|
|
10
|
+
private readonly indexEntries;
|
|
11
|
+
private readonly roomDescriptors;
|
|
12
|
+
private readonly trackedRooms;
|
|
13
|
+
private readonly handles;
|
|
14
|
+
private readonly activeHandles;
|
|
15
|
+
private readonly roomTypesInIndexes;
|
|
16
|
+
constructor(options: {
|
|
17
|
+
namespace: string;
|
|
18
|
+
matrixClient: MatrixClient;
|
|
19
|
+
schema: MayDbSchema;
|
|
20
|
+
openRoom: (roomId: string) => Room;
|
|
21
|
+
});
|
|
22
|
+
hasIndexes(): boolean;
|
|
23
|
+
isRoomTypeIndexed(roomType: string): boolean;
|
|
24
|
+
validateRoomType(roomType: string): void;
|
|
25
|
+
openIndex(options: {
|
|
26
|
+
indexName: string;
|
|
27
|
+
ownerRoomId?: string;
|
|
28
|
+
}): MayDbIndexHandle;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
registerRoom(room: Room): void;
|
|
31
|
+
onRoomAcquired(options: {
|
|
32
|
+
roomId: string;
|
|
33
|
+
roomName: string;
|
|
34
|
+
roomType: string;
|
|
35
|
+
ownerRoomId?: string | null;
|
|
36
|
+
activityAt?: string;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
onHandleActivated(handle: RuntimeIndexHandle): void;
|
|
39
|
+
onHandleDeactivated(handle: RuntimeIndexHandle): void;
|
|
40
|
+
ensureHandleReady(handle: RuntimeIndexHandle): Promise<void>;
|
|
41
|
+
queryHandlePage(handle: RuntimeIndexHandle, options: MayDbIndexQueryPageOptions): Promise<MayDbIndexQueryPageResult>;
|
|
42
|
+
private validateSchemaIndexes;
|
|
43
|
+
private getIndexDefinition;
|
|
44
|
+
private validateIndexScopeOptions;
|
|
45
|
+
private getOrCreateHandle;
|
|
46
|
+
private initializeHandle;
|
|
47
|
+
private maybeAttachRoomActivityListener;
|
|
48
|
+
private onRoomActivity;
|
|
49
|
+
private upsertRoomAcrossAllRelevantIndexes;
|
|
50
|
+
private upsertRoomAcrossActiveIndexes;
|
|
51
|
+
private isDescriptorRelevantForHandle;
|
|
52
|
+
private upsertRoomToIndex;
|
|
53
|
+
private getRoomDescriptor;
|
|
54
|
+
private readRoomDescriptorFromState;
|
|
55
|
+
private resolveRoomName;
|
|
56
|
+
private readRoomNameFromState;
|
|
57
|
+
private nowIso;
|
|
58
|
+
private handleKey;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=IndexRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexRuntime.d.ts","sourceRoot":"","sources":["../src/IndexRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAU9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAEV,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,EACX,YAAY,EACb,MAAM,S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CAAC;KACrB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAWnD,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAK/C,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5D,eAAe,CACnB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,yBAAyB,CAAC;IAcrC,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,yBAAyB;IAajC,OAAO,CAAC,iBAAiB;YAmBX,gBAAgB;YA0BhB,+BAA+B;YAuB/B,cAAc;YAQd,kCAAkC;YAelC,6BAA6B;IAW3C,OAAO,CAAC,6BAA6B;YASvB,iBAAiB;YAkCjB,iBAAiB;YAUjB,2BAA2B;YA8B3B,eAAe;IAY7B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import { Room } from "./Room";
|
|
3
|
+
import { IndexRoomStore } from "./indexingRoomStore";
|
|
4
|
+
import { buildIndexItem, compareIndexItems, pageRows, readQueryRows, } from "./indexingRows";
|
|
5
|
+
import { IndexCapacityError } from "./indexingErrors";
|
|
6
|
+
import { RuntimeIndexHandle } from "./RuntimeIndexHandle";
|
|
7
|
+
const INDEX_ROWS_MAP_KEY = "rows";
|
|
8
|
+
const DEFAULT_ROOM_NAME = "Untitled";
|
|
9
|
+
const ROOM_NAME_EVENT_TYPE = "m.room.name";
|
|
10
|
+
export class IndexRuntime {
|
|
11
|
+
namespace;
|
|
12
|
+
matrixClient;
|
|
13
|
+
schema;
|
|
14
|
+
openRoom;
|
|
15
|
+
roomStore;
|
|
16
|
+
indexEntries;
|
|
17
|
+
roomDescriptors = new Map();
|
|
18
|
+
trackedRooms = new Map();
|
|
19
|
+
handles = new Map();
|
|
20
|
+
activeHandles = new Set();
|
|
21
|
+
roomTypesInIndexes = new Set();
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this.namespace = options.namespace;
|
|
24
|
+
this.matrixClient = options.matrixClient;
|
|
25
|
+
this.schema = options.schema;
|
|
26
|
+
this.openRoom = options.openRoom;
|
|
27
|
+
this.roomStore = new IndexRoomStore({
|
|
28
|
+
namespace: this.namespace,
|
|
29
|
+
matrixClient: this.matrixClient,
|
|
30
|
+
openRoom: this.openRoom,
|
|
31
|
+
});
|
|
32
|
+
this.indexEntries = Object.entries(this.schema.indexes);
|
|
33
|
+
this.validateSchemaIndexes();
|
|
34
|
+
}
|
|
35
|
+
// Public runtime API (used by MayDb and index handles)
|
|
36
|
+
hasIndexes() {
|
|
37
|
+
return this.indexEntries.length > 0;
|
|
38
|
+
}
|
|
39
|
+
isRoomTypeIndexed(roomType) {
|
|
40
|
+
return this.roomTypesInIndexes.has(roomType);
|
|
41
|
+
}
|
|
42
|
+
validateRoomType(roomType) {
|
|
43
|
+
if (!(roomType in this.schema.roomTypes)) {
|
|
44
|
+
throw new Error(`Unknown roomType "${roomType}"`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
openIndex(options) {
|
|
48
|
+
const indexDefinition = this.getIndexDefinition(options.indexName);
|
|
49
|
+
const ownerRoomId = options.ownerRoomId ?? null;
|
|
50
|
+
this.validateIndexScopeOptions(options.indexName, indexDefinition, ownerRoomId);
|
|
51
|
+
return this.getOrCreateHandle(options.indexName, ownerRoomId);
|
|
52
|
+
}
|
|
53
|
+
dispose() {
|
|
54
|
+
for (const tracked of this.trackedRooms.values()) {
|
|
55
|
+
if (tracked.transactionListener) {
|
|
56
|
+
tracked.room.doc.off("afterTransaction", tracked.transactionListener);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this.trackedRooms.clear();
|
|
60
|
+
for (const handle of this.handles.values()) {
|
|
61
|
+
if (handle.roomObserverCleanup) {
|
|
62
|
+
handle.roomObserverCleanup();
|
|
63
|
+
}
|
|
64
|
+
handle.activeCount = 0;
|
|
65
|
+
}
|
|
66
|
+
this.activeHandles.clear();
|
|
67
|
+
}
|
|
68
|
+
registerRoom(room) {
|
|
69
|
+
const tracked = this.trackedRooms.get(room.id);
|
|
70
|
+
if (tracked)
|
|
71
|
+
return;
|
|
72
|
+
this.trackedRooms.set(room.id, {
|
|
73
|
+
room,
|
|
74
|
+
transactionListener: null,
|
|
75
|
+
});
|
|
76
|
+
if (this.activeHandles.size > 0) {
|
|
77
|
+
void this.maybeAttachRoomActivityListener(room.id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async onRoomAcquired(options) {
|
|
81
|
+
this.validateRoomType(options.roomType);
|
|
82
|
+
const now = options.activityAt ?? this.nowIso();
|
|
83
|
+
const descriptor = {
|
|
84
|
+
roomId: options.roomId,
|
|
85
|
+
roomName: options.roomName,
|
|
86
|
+
roomType: options.roomType,
|
|
87
|
+
ownerRoomId: options.ownerRoomId ?? null,
|
|
88
|
+
joinedAt: now,
|
|
89
|
+
lastActivityAt: now,
|
|
90
|
+
};
|
|
91
|
+
this.roomDescriptors.set(options.roomId, descriptor);
|
|
92
|
+
this.registerRoom(this.openRoom(options.roomId));
|
|
93
|
+
await this.upsertRoomAcrossAllRelevantIndexes(descriptor, now);
|
|
94
|
+
}
|
|
95
|
+
onHandleActivated(handle) {
|
|
96
|
+
this.activeHandles.add(handle);
|
|
97
|
+
void handle.ensureReady().catch((error) => {
|
|
98
|
+
console.error(`Failed to initialize index "${handle.indexName}"`, error);
|
|
99
|
+
});
|
|
100
|
+
for (const roomId of this.trackedRooms.keys()) {
|
|
101
|
+
void this.maybeAttachRoomActivityListener(roomId);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
onHandleDeactivated(handle) {
|
|
105
|
+
if (handle.activeCount > 0)
|
|
106
|
+
return;
|
|
107
|
+
this.activeHandles.delete(handle);
|
|
108
|
+
}
|
|
109
|
+
async ensureHandleReady(handle) {
|
|
110
|
+
if (handle.rowsMap && handle.indexRoom) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (handle.readyPromise) {
|
|
114
|
+
return handle.readyPromise;
|
|
115
|
+
}
|
|
116
|
+
handle.readyPromise = this.initializeHandle(handle);
|
|
117
|
+
try {
|
|
118
|
+
await handle.readyPromise;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
handle.readyPromise = null;
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async queryHandlePage(handle, options) {
|
|
126
|
+
await this.ensureHandleReady(handle);
|
|
127
|
+
const rowsMap = handle.rowsMap;
|
|
128
|
+
if (!rowsMap) {
|
|
129
|
+
return { items: [], hasMore: false };
|
|
130
|
+
}
|
|
131
|
+
const rows = readQueryRows(rowsMap, options.where);
|
|
132
|
+
rows.sort((a, b) => compareIndexItems(a, b, options.orderBy));
|
|
133
|
+
return pageRows(rows, options.limit, options.after?.roomId ?? null);
|
|
134
|
+
}
|
|
135
|
+
// Handle lifecycle and validation helpers
|
|
136
|
+
validateSchemaIndexes() {
|
|
137
|
+
for (const [indexName, definition] of this.indexEntries) {
|
|
138
|
+
if (definition.maxEntries <= 0) {
|
|
139
|
+
throw new Error(`Index "${indexName}" maxEntries must be > 0`);
|
|
140
|
+
}
|
|
141
|
+
if (!(definition.defaultOrderBy.column in definition.columns)) {
|
|
142
|
+
throw new Error(`Index "${indexName}" defaultOrderBy column must be in columns`);
|
|
143
|
+
}
|
|
144
|
+
for (const roomType of definition.roomTypes) {
|
|
145
|
+
if (!(roomType in this.schema.roomTypes)) {
|
|
146
|
+
throw new Error(`Index "${indexName}" references unknown roomType "${roomType}"`);
|
|
147
|
+
}
|
|
148
|
+
this.roomTypesInIndexes.add(roomType);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
getIndexDefinition(indexName) {
|
|
153
|
+
const definition = this.schema.indexes[indexName];
|
|
154
|
+
if (!definition) {
|
|
155
|
+
throw new Error(`Unknown index "${indexName}"`);
|
|
156
|
+
}
|
|
157
|
+
return definition;
|
|
158
|
+
}
|
|
159
|
+
validateIndexScopeOptions(indexName, definition, ownerRoomId) {
|
|
160
|
+
if (definition.scope === "collaborative" && !ownerRoomId) {
|
|
161
|
+
throw new Error(`Index "${indexName}" requires ownerRoomId`);
|
|
162
|
+
}
|
|
163
|
+
if (definition.scope === "private" && ownerRoomId) {
|
|
164
|
+
throw new Error(`Private index "${indexName}" must not set ownerRoomId`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
getOrCreateHandle(indexName, ownerRoomId) {
|
|
168
|
+
const key = this.handleKey(indexName, ownerRoomId);
|
|
169
|
+
let handle = this.handles.get(key);
|
|
170
|
+
if (!handle) {
|
|
171
|
+
const definition = this.schema.indexes[indexName];
|
|
172
|
+
handle = new RuntimeIndexHandle({
|
|
173
|
+
runtime: this,
|
|
174
|
+
indexName,
|
|
175
|
+
ownerRoomId,
|
|
176
|
+
definition,
|
|
177
|
+
});
|
|
178
|
+
this.handles.set(key, handle);
|
|
179
|
+
}
|
|
180
|
+
return handle;
|
|
181
|
+
}
|
|
182
|
+
async initializeHandle(handle) {
|
|
183
|
+
const roomId = await this.roomStore.resolveIndexRoomId({
|
|
184
|
+
indexName: handle.indexName,
|
|
185
|
+
scope: handle.definition.scope,
|
|
186
|
+
ownerRoomId: handle.ownerRoomId,
|
|
187
|
+
});
|
|
188
|
+
const room = this.openRoom(roomId);
|
|
189
|
+
this.registerRoom(room);
|
|
190
|
+
await room.ensureJoined();
|
|
191
|
+
await room.connect();
|
|
192
|
+
handle.indexRoom = room;
|
|
193
|
+
const rowsMap = room.doc.getMap(INDEX_ROWS_MAP_KEY);
|
|
194
|
+
handle.rowsMap = rowsMap;
|
|
195
|
+
if (handle.roomObserverCleanup) {
|
|
196
|
+
handle.roomObserverCleanup();
|
|
197
|
+
}
|
|
198
|
+
const observer = () => handle.notifyChange();
|
|
199
|
+
rowsMap.observe(observer);
|
|
200
|
+
handle.roomObserverCleanup = () => rowsMap.unobserve(observer);
|
|
201
|
+
handle.notifyChange();
|
|
202
|
+
}
|
|
203
|
+
// Room activity ingestion and index updates
|
|
204
|
+
async maybeAttachRoomActivityListener(roomId) {
|
|
205
|
+
const tracked = this.trackedRooms.get(roomId);
|
|
206
|
+
if (!tracked || tracked.transactionListener)
|
|
207
|
+
return;
|
|
208
|
+
const descriptor = await this.getRoomDescriptor(roomId);
|
|
209
|
+
if (!descriptor)
|
|
210
|
+
return;
|
|
211
|
+
const hasActiveRelevantHandle = Array.from(this.activeHandles).some((handle) => this.isDescriptorRelevantForHandle(descriptor, handle));
|
|
212
|
+
if (!hasActiveRelevantHandle)
|
|
213
|
+
return;
|
|
214
|
+
const onTransaction = (tx) => {
|
|
215
|
+
if (!tx.local)
|
|
216
|
+
return;
|
|
217
|
+
const activityAt = this.nowIso();
|
|
218
|
+
void this.onRoomActivity(roomId, activityAt);
|
|
219
|
+
};
|
|
220
|
+
tracked.room.doc.on("afterTransaction", onTransaction);
|
|
221
|
+
tracked.transactionListener = onTransaction;
|
|
222
|
+
await this.upsertRoomAcrossActiveIndexes(descriptor, this.nowIso());
|
|
223
|
+
}
|
|
224
|
+
async onRoomActivity(roomId, activityAt) {
|
|
225
|
+
const descriptor = await this.getRoomDescriptor(roomId);
|
|
226
|
+
if (!descriptor)
|
|
227
|
+
return;
|
|
228
|
+
descriptor.lastActivityAt = activityAt;
|
|
229
|
+
descriptor.roomName = await this.resolveRoomName(roomId, descriptor.roomName);
|
|
230
|
+
await this.upsertRoomAcrossActiveIndexes(descriptor, activityAt);
|
|
231
|
+
}
|
|
232
|
+
async upsertRoomAcrossAllRelevantIndexes(roomDescriptor, activityAt) {
|
|
233
|
+
const room = this.openRoom(roomDescriptor.roomId);
|
|
234
|
+
for (const [indexName, definition] of this.indexEntries) {
|
|
235
|
+
if (!definition.roomTypes.includes(roomDescriptor.roomType))
|
|
236
|
+
continue;
|
|
237
|
+
const ownerRoomId = definition.scope === "collaborative" ? roomDescriptor.ownerRoomId : null;
|
|
238
|
+
if (definition.scope === "collaborative" && !ownerRoomId)
|
|
239
|
+
continue;
|
|
240
|
+
const handle = this.getOrCreateHandle(indexName, ownerRoomId);
|
|
241
|
+
await this.upsertRoomToIndex(handle, roomDescriptor, room, activityAt);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async upsertRoomAcrossActiveIndexes(roomDescriptor, activityAt) {
|
|
245
|
+
const room = this.openRoom(roomDescriptor.roomId);
|
|
246
|
+
for (const handle of this.activeHandles) {
|
|
247
|
+
if (!this.isDescriptorRelevantForHandle(roomDescriptor, handle))
|
|
248
|
+
continue;
|
|
249
|
+
await this.upsertRoomToIndex(handle, roomDescriptor, room, activityAt);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
isDescriptorRelevantForHandle(roomDescriptor, indexHandle) {
|
|
253
|
+
if (!indexHandle.definition.roomTypes.includes(roomDescriptor.roomType))
|
|
254
|
+
return false;
|
|
255
|
+
if (indexHandle.definition.scope === "private")
|
|
256
|
+
return true;
|
|
257
|
+
return indexHandle.ownerRoomId === roomDescriptor.ownerRoomId;
|
|
258
|
+
}
|
|
259
|
+
async upsertRoomToIndex(indexHandle, roomDescriptor, sourceRoom, activityAt) {
|
|
260
|
+
if (indexHandle.paused) {
|
|
261
|
+
throw new IndexCapacityError({
|
|
262
|
+
indexName: indexHandle.indexName,
|
|
263
|
+
ownerRoomId: indexHandle.ownerRoomId,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
await this.ensureHandleReady(indexHandle);
|
|
267
|
+
const rowsMap = indexHandle.rowsMap;
|
|
268
|
+
if (!rowsMap)
|
|
269
|
+
return;
|
|
270
|
+
roomDescriptor.lastActivityAt = activityAt;
|
|
271
|
+
const item = buildIndexItem(indexHandle.definition, roomDescriptor, sourceRoom.doc);
|
|
272
|
+
const encoded = JSON.stringify(item);
|
|
273
|
+
const alreadyPresent = rowsMap.has(roomDescriptor.roomId);
|
|
274
|
+
if (!alreadyPresent && rowsMap.size >= indexHandle.definition.maxEntries) {
|
|
275
|
+
indexHandle.paused = true;
|
|
276
|
+
throw new IndexCapacityError({
|
|
277
|
+
indexName: indexHandle.indexName,
|
|
278
|
+
ownerRoomId: indexHandle.ownerRoomId,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (rowsMap.get(roomDescriptor.roomId) !== encoded) {
|
|
282
|
+
rowsMap.set(roomDescriptor.roomId, encoded);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
async getRoomDescriptor(roomId) {
|
|
286
|
+
const existing = this.roomDescriptors.get(roomId);
|
|
287
|
+
if (existing)
|
|
288
|
+
return existing;
|
|
289
|
+
const descriptor = await this.readRoomDescriptorFromState(roomId);
|
|
290
|
+
if (!descriptor)
|
|
291
|
+
return null;
|
|
292
|
+
this.roomDescriptors.set(roomId, descriptor);
|
|
293
|
+
return descriptor;
|
|
294
|
+
}
|
|
295
|
+
async readRoomDescriptorFromState(roomId) {
|
|
296
|
+
try {
|
|
297
|
+
const state = await this.matrixClient.roomState(roomId);
|
|
298
|
+
const appState = state.find((event) => event.type === this.namespace && event.state_key === "");
|
|
299
|
+
const content = (appState?.content ?? {});
|
|
300
|
+
const roomType = typeof content.roomType === "string" ? content.roomType : null;
|
|
301
|
+
if (!roomType)
|
|
302
|
+
return null;
|
|
303
|
+
const roomName = this.readRoomNameFromState(state, DEFAULT_ROOM_NAME);
|
|
304
|
+
const now = this.nowIso();
|
|
305
|
+
return {
|
|
306
|
+
roomId,
|
|
307
|
+
roomName,
|
|
308
|
+
roomType,
|
|
309
|
+
ownerRoomId: typeof content.ownerRoomId === "string" ? content.ownerRoomId : null,
|
|
310
|
+
joinedAt: now,
|
|
311
|
+
lastActivityAt: now,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async resolveRoomName(roomId, fallback) {
|
|
319
|
+
try {
|
|
320
|
+
const state = await this.matrixClient.roomState(roomId);
|
|
321
|
+
return this.readRoomNameFromState(state, fallback);
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
return fallback;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
readRoomNameFromState(state, fallback) {
|
|
328
|
+
const nameEvent = state.find((event) => event.type === ROOM_NAME_EVENT_TYPE);
|
|
329
|
+
return typeof nameEvent?.content?.name === "string"
|
|
330
|
+
? nameEvent.content.name
|
|
331
|
+
: fallback;
|
|
332
|
+
}
|
|
333
|
+
nowIso() {
|
|
334
|
+
return new Date().toISOString();
|
|
335
|
+
}
|
|
336
|
+
handleKey(indexName, ownerRoomId) {
|
|
337
|
+
return ownerRoomId ? `${indexName}::${ownerRoomId}` : `${indexName}::private`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=IndexRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexRuntime.js","sourceRoot":"","sources":["../src/IndexRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAe1D,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C,MAAM,OAA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AC;YACP,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAEO,qBAAqB,CAC3B,KAAiE,EACjE,QAAgB;QAEhB,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC;QAC7E,OAAO,OAAO,SAAS,EAAE,OAAO,EAAE,IAAI,KAAK,QAAQ;YACjD,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI;YACxB,CAAC,CAAC,QAAQ,CAAC;IACf,CAAC;IAEO,MAAM;QACZ,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAEO,SAAS,CAAC,SAAiB,EAAE,WAA0B;QAC7D,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,WAAW,CAAC;IAChF,CAAC;CACF"}
|
package/dist/MayDb.d.ts
CHANGED
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
import { Room } from "./Room";
|
|
2
|
-
import type {
|
|
2
|
+
import type { MayDbIndexHandle, MayDbSchema, MatrixClient, Session } from "./types";
|
|
3
3
|
export declare class MayDb {
|
|
4
4
|
readonly session: Session;
|
|
5
5
|
readonly userId: string;
|
|
6
6
|
readonly namespace: string;
|
|
7
|
+
readonly schema: MayDbSchema;
|
|
7
8
|
/** @internal */
|
|
8
9
|
readonly matrixClient: MatrixClient;
|
|
9
10
|
private readonly roomCache;
|
|
11
|
+
private readonly indexRuntime;
|
|
12
|
+
private invitePollInterval;
|
|
13
|
+
private invitePollInFlight;
|
|
14
|
+
private readonly inviteJoinInFlight;
|
|
15
|
+
private readonly inviteJoinRetryState;
|
|
10
16
|
constructor(options: {
|
|
11
17
|
session: Session;
|
|
12
18
|
namespace: string;
|
|
19
|
+
schema: MayDbSchema;
|
|
13
20
|
});
|
|
14
21
|
readonly rooms: {
|
|
15
22
|
open: (roomId: string) => Room;
|
|
16
23
|
create: (options: {
|
|
17
24
|
name: string;
|
|
18
|
-
|
|
25
|
+
roomType: string;
|
|
19
26
|
}) => Promise<Room>;
|
|
20
27
|
getOrCreateSingleton: (options: {
|
|
21
28
|
key: string;
|
|
22
29
|
name: string;
|
|
23
|
-
|
|
30
|
+
roomType: string;
|
|
24
31
|
}) => Promise<Room>;
|
|
25
32
|
};
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
readonly indexes: {
|
|
34
|
+
open: (options: {
|
|
35
|
+
indexName: string;
|
|
36
|
+
indexRoomId?: string;
|
|
37
|
+
}) => MayDbIndexHandle;
|
|
29
38
|
};
|
|
30
39
|
disposeAll(): void;
|
|
31
40
|
logout(): Promise<void>;
|
|
32
41
|
private openRoom;
|
|
33
42
|
private createMatrixRoom;
|
|
34
|
-
private
|
|
43
|
+
private resolveSingletonRoom;
|
|
44
|
+
private startInviteIndexer;
|
|
45
|
+
private stopInviteIndexer;
|
|
46
|
+
private pollPendingInvites;
|
|
47
|
+
private runInvitePoll;
|
|
48
|
+
private joinPendingInvite;
|
|
49
|
+
private msUntilInviteJoinAllowed;
|
|
50
|
+
private scheduleInviteJoinRetry;
|
|
51
|
+
private clearInviteJoinRetry;
|
|
52
|
+
private pruneInviteJoinRetryState;
|
|
35
53
|
private fetchPendingInvites;
|
|
54
|
+
private persistRoomTypeInDocument;
|
|
36
55
|
}
|
|
37
56
|
//# sourceMappingURL=MayDb.d.ts.map
|
package/dist/MayDb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MayDb.d.ts","sourceRoot":"","sources":["../src/MayDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"MayDb.d.ts","sourceRoot":"","sources":["../src/MayDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM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