Construct a store suitable for room bridging information. Data is stored as RoomBridgeStoreEntrys which have the following serialized format:
{
id: "unique_id", // customisable
matrix_id: "room_id",
remote_id: "remote_room_id",
matrix: { serialised matrix room info },
remote: { serialised remote room info },
data: { ... any additional info ... }
}
If a unique 'id' is not given, the store will generate one by concatenating
the matrix_id
and the remote_id
. The delimiter
used is a property on this store and can be modified.
The structure of Entry objects means that it is efficient to select based off the 'id', 'matrix_id' or 'remote_id'. Additional indexes can be added manually.
The connected NEDB database instance
Readonly
dbA batched version of getLinkedRemoteRooms
.
A mapping of room_id to RemoteRoom.
RoomBridgeStore#getLinkedRemoteRooms
Convenience method to convert a document to something.
A transformFn
function to pass to the standard
select/delete/upsert/etc methods.
The function which will be called with a single document object. Guaranteed not to be null.
Get a list of entries based on the link's data value.
store.linkRooms(matrixRoom, remoteRoom, { some_key: "some_val" });
store.getEntriesByLinkData({
some_key: "some_val"
});
The data values to retrieve based from.
Get a list of entries based on the matrix_id of each entry.
A batch version of getEntriesByMatrixId
.
Resolves to a map of room_id => Entry[]
Get a list of entries based on a MatrixRoom data value.
matrixRoom.set("some_key", "some_val");
// store matrixRoom and then:
store.getEntriesByMatrixRoomData({
some_key: "some_val"
});
The data values to retrieve based from.
Get a list of entries based on the remote_id of each entry.
Get a list of entries based on a RemoteRoom data value.
remoteRoom.set("some_key", "some_val");
// store remoteRoom and then:
store.getEntriesByRemoteRoomData({
some_key: "some_val"
});
The data values to retrieve based from.
Get an existing entry based on the provided entry ID.
The ID of the entry to retrieve.
Get all entries with the given remote_id which have a Matrix room within.
Get all entries with the given matrix_id which have a Remote room within.
Get an entry's Matrix room based on the provided room_id. The entry MUST have an 'id' of the room_id and there MUST be a Matrix room contained within the entry for this to return.
RoomBridgeStore#setMatrixRoom
Create a link between a matrix room and remote room. This will create an entry with:
The matrix room
The remote room
Information about this mapping.
Optional
linkId: stringThe id value to set. If not given, a unique ID will be created from the matrix_id and remote_id.
Remove entries based on the link's data value.
store.linkRooms(matrixRoom, remoteRoom, { a_key: "a_val" });
store.removeEntriesByLinkData({
a_key: "a_val"
});
The data to match.
Remove entries based on matrix room data.
matrixRoom.set("a_key", "a_val");
// store matrixRoom and then:
store.removeEntriesByMatrixRoomData({
a_key: "a_val"
});
The data to match.
Remove entries with this matrix room id.
new MatrixRoom("!foobar:matrix.org");
// store the MatrixRoom and then:
store.removeEntriesByMatrixRoomId("!foobar:matrix.org");
The matrix id.
Remove entries based on remote room data.
remoteRoom.set("a_key", "a_val");
// store remoteRoom and then:
store.removeEntriesByRemoteRoomData({
a_key: "a_val"
});
The data to match.
Create an entry with only a matrix room. Sets the 'id' of the entry to the Matrix room ID. If an entry already exists with this 'id', it will be replaced. This function is useful if you just want to store a room with some data and not worry about any mappings.
RoomBridgeStore#getMatrixRoom
Insert an entry, clobbering based on the ID of the entry.
Static
createGenerated using TypeDoc
Base class for bridge stores.