Base class for bridge stores.

Hierarchy (view full)

Constructors

Properties

db: Nedb<any>

Methods

  • Convenience method to convert a document to something.

    Type Parameters

    • T

    • O

    Parameters

    • func: ((input) => O)

      The function which will be called with a single document object. Guaranteed not to be null.

        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns ((doc) => O)

    A transformFn function to pass to the standard select/delete/upsert/etc methods.

      • (doc): O
      • Parameters

        • doc: T

        Returns O

  • Get Matrix users by some data about them, previously stored via the set method on the Matrix user.

    Parameters

    • dataQuery: Record<string, unknown>

      The keys and matching values the remote users share. This should use dot notation for nested types. For example: { "topLevel.midLevel.leaf": 42, "otherTopLevel": "foo" }

    Returns Promise<MatrixUser[]>

    Resolves to a possibly empty list of MatrixUsers. Rejects with an error if there was a problem querying the store.

    Throws

    If dataQuery isn't an object.

    Example

    matrixUser.set({
    toplevel: "foo",
    nested: {
    bar: {
    baz: 43
    }
    }
    });
    store.setMatrixUser(matrixUser).then(function() {
    store.getByMatrixData({
    "toplevel": "foo",
    "nested.bar.baz": 43
    })
    });
  • Retrieve a MatrixUser based on their user ID localpart. If there is more than one match (e.g. same localpart, different domains) then this will return an arbitrary matching user.

    Parameters

    • localpart: string

      The user localpart

    Returns Promise<null | MatrixUser>

    Resolves to a MatrixUser or null.

  • Get remote users by some data about them, previously stored via the set method on the Remote user.

    Parameters

    • dataQuery: Record<string, unknown>

      The keys and matching values the remote users share. This should use dot notation for nested types. For example: { "topLevel.midLevel.leaf": 42, "otherTopLevel": "foo" }

    Returns Promise<RemoteUser[]>

    Resolves to a possibly empty list of RemoteUsers. Rejects with an error if there was a problem querying the store.

    Throws

    If dataQuery isn't an object.

    Example

    remoteUser.set({
    toplevel: "foo",
    nested: {
    bar: {
    baz: 43
    }
    }
    });
    store.setRemoteUser(remoteUser).then(function() {
    store.getByRemoteData({
    "toplevel": "foo",
    "nested.bar.baz": 43
    })
    });
  • Retrieve a list of matrix user IDs linked to this remote ID.

    Parameters

    • remoteId: string

      The remote ID

    Returns Promise<null | string[]>

    A list of user IDs.

  • Get a matrix user by their user ID.

    Parameters

    • userId: string

      The user_id

    Returns Promise<null | MatrixUser>

    Resolves to the user or null if they do not exist. Rejects with an error if there was a problem querying the store.

  • Retrieve a list of remote IDs linked to this matrix user ID.

    Parameters

    • matrixId: string

      The matrix user ID

    Returns Promise<null | string[]>

    A list of remote IDs.

  • Get a remote user by their remote ID.

    Parameters

    • id: string

      The remote ID

    Returns Promise<null | RemoteUser>

    Resolves to the user or null if they do not exist. Rejects with an error if there was a problem querying the store.

  • Retrieve a list of corresponding remote users for the given matrix user ID.

    Parameters

    • userId: string

      The Matrix user ID

    Returns Promise<RemoteUser[]>

    Resolves to a list of Remote users.

  • Create a link between a matrix and remote user. If either user does not exist, they will be inserted prior to linking. This is done to ensure foreign key constraints are satisfied (so you cannot have a mapping to a user ID which does not exist).

    Parameters

    Returns Promise<void>

  • Store a Matrix user. If they already exist, they will be updated. Equivalence is determined by their user ID.

    Parameters

    Returns Promise<void>

  • Store a Remote user. If they already exist, they will be updated. Equivalence is determined by the Remote ID.

    Parameters

    Returns Promise<void>

  • Set a UNIQUE key constraint on the given field.

    Parameters

    • fieldName: string

      The field name. Use dot notation for nested objects.

    • sparse: boolean = false

      Allow sparse entries (undefined won't cause a key violation).

    Returns void

  • Delete a link between a matrix user ID and a remote user ID.

    Parameters

    • matrixUserId: string

      The matrix user ID

    • remoteUserId: string

      The remote user ID

    Returns Promise<number>

    Resolves to the number of entries removed.

  • Delete a link between a matrix user and a remote user.

    Parameters

    Returns Promise<number>

    Resolves to the number of entries removed.

  • UPDATE a single document. If the document already exists, this will NOT update it.

    Parameters

    • query: Query
    • updateVals: Record<string, unknown>

    Returns Promise<void>

Generated using TypeDoc