Class: RoomBridgeStore

RoomBridgeStore

new RoomBridgeStore(db, opts)

Construct a store suitable for room bridging information.
Parameters:
Name Type Description
db Datastore The connected NEDB database instance
opts Object Options for this store.
Source:

Methods

getLinksByData(dataQuery)

Retrieve a list of links based on some information about the links themselves.
Parameters:
Name Type Description
dataQuery Object The keys and matching values the links share. This should use dot notation for nested types. For example: { "topLevel.midLevel.leaf": 42, "otherTopLevel": "foo" }
Source:
Throws:
If dataQuery isn't an object.
Returns:
{Promise<{RoomBridgeStore~Link[], Error>} Resolves to a possibly empty list of RoomBridgeStore~Link objects. Rejects with an error if there was a problem querying the store.
Example
store.linkRoomIds("!foo:bar", "_foo_bar", {
  custom: {
    stuff: "goes here"
  },
  or: "here"
});
store.getLinksByData({
  "custom.stuff": "goes here"
});
Retrieve a list of matrix room IDs linked to this remote ID.
Parameters:
Name Type Description
remoteId string The remote ID
Source:
Returns:
A list of room IDs.
Type
Promise.<Array.<RoomBridgeStore~Link>, Error>

getMatrixRoom(roomIdOrDataQuery) → {Promise.<?MatrixRoom, Error>}

Get a matrix room by its' room ID.
Parameters:
Name Type Description
roomIdOrDataQuery string | Object The room id or a data query object. If the data query returns multiple entries, only 1 will be returned.
Source:
Returns:
Resolves to the room or null if it does not exist. Rejects with an error if there was a problem querying the store.
Type
Promise.<?MatrixRoom, Error>

getMatrixRooms(dataQuery) → {Promise.<Array.<MatrixRoom>, Error>}

Get a list of matrix rooms by a data query.
Parameters:
Name Type Description
dataQuery Object A data query object.
Source:
Returns:
Type
Promise.<Array.<MatrixRoom>, Error>
Retrieve a list of remote IDs linked to this matrix room ID.
Parameters:
Name Type Description
matrixId string The matrix room ID
Source:
Returns:
A list of remote IDs.
Type
Promise.<Array.<RoomBridgeStore~Link>, Error>

getRemoteRoom(roomIdOrDataQuery) → {Promise.<?RemoteRoom, Error>}

Get a remote room by its' room ID.
Parameters:
Name Type Description
roomIdOrDataQuery string | Object The room id or a data query object. If the data query returns multiple entries, only 1 will be returned.
Source:
Returns:
Resolves to the room or null if it does not exist. Rejects with an error if there was a problem querying the store.
Type
Promise.<?RemoteRoom, Error>

getRemoteRooms(dataQuery) → {Promise.<Array.<RemoteRoom>, Error>}

Get a list of remote rooms by a data query.
Parameters:
Name Type Description
dataQuery Object A data query object.
Source:
Returns:
Type
Promise.<Array.<RemoteRoom>, Error>

linkRooms(matrixRoom, remoteRoom, dataopt) → {Promise}

Create a link between a matrix room and remote room. This will insert the given rooms if they do not exist before creating the mapping. This is done to ensure foreign key constraints are satisfied (so you cannot have a mapping to a room ID which does not exist).
Parameters:
Name Type Attributes Description
matrixRoom MatrixRoom The matrix room
remoteRoom RemoteRoom The remote room
data Object <optional>
Information about this mapping.
Source:
Returns:
Type
Promise

setMatrixRoom(matrixRoom, updateQuery) → {Promise}

Store a Matrix room. If it already exists, it will be updated. Equivalence is determined by the room ID.
Parameters:
Name Type Description
matrixRoom MatrixRoom The matrix room
updateQuery Object Update the room based on the data values given in this object rather than the matrix room ID.
Source:
Returns:
Type
Promise

setRemoteRoom(remoteRoom, updateQuery) → {Promise}

Store a Remote room. If it already exists, it will be updated. Equivalence is determined by the room ID.
Parameters:
Name Type Description
remoteRoom RemoteRoom The remote room
updateQuery Object Update the room based on the data values given in this object rather than the remote ID.
Source:
Returns:
Type
Promise

unlinkRoomIds(matrixRoomId, remoteRoomId) → {Promise.<Number, Error>}

Delete a link between a matrix room ID and a remote room ID.
Parameters:
Name Type Description
matrixRoomId string The matrix room ID
remoteRoomId string The remote room ID
Source:
Returns:
Resolves to the number of entries removed.
Type
Promise.<Number, Error>

unlinkRooms(matrixRoom, remoteRoom) → {Promise.<Number, Error>}

Delete a link between a matrix room and a remote room.
Parameters:
Name Type Description
matrixRoom MatrixUser The matrix user
remoteRoom RemoteUser The remote user
Source:
Returns:
Resolves to the number of entries removed.
Type
Promise.<Number, Error>

Type Definitions

Type:
  • Object
Properties:
Name Type Description
matrix string The matrix room ID
remote string The remote room ID
data Object Information about this mapping, which may be an empty object.
Source: