Options
All
  • Public
  • Public/Protected
  • All
Menu

Construct a store suitable for event mapping information. Data is stored as StoredEvents.

param

The connected NEDB database instance

Hierarchy

Index

Constructors

constructor

Properties

Readonly db

db: Datastore

Methods

convertTo

  • convertTo<T, O>(func: (input: T) => O): (Anonymous function)
  • Convenience method to convert a document to something.

    Type parameters

    • T

    • O

    Parameters

    • func: (input: T) => O

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

        • (input: T): O
        • Parameters

          • input: T

          Returns O

    Returns (Anonymous function)

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

delete

  • delete(query: Query): Promise<number>

getEntryByMatrixId

  • getEntryByMatrixId(roomId: string, eventId: string): Promise<StoredEvent | null>
  • Get an existing event based on the provided matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<StoredEvent | null>

    A promise which resolves to the StoredEvent or null.

getEntryByRemoteId

  • getEntryByRemoteId(roomId: string, eventId: string): Promise<null | StoredEvent>
  • Get an existing event based on the provided remote IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<null | StoredEvent>

    A promise which resolves to the StoredEvent or null.

insert

  • insert(objects: unknown): Promise<any[]>

insertIfNotExists

  • insertIfNotExists(query: Query, insertObj: Record<string, unknown>): Promise<void>

removeEvent

removeEventByMatrixId

  • removeEventByMatrixId(roomId: string, eventId: string): Promise<number>
  • Remove entries based on the matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<number>

removeEventByRemoteId

  • removeEventByRemoteId(roomId: string, eventId: string): Promise<number>
  • Remove entries based on the matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<number>

select

  • select<T, O>(query: Query, transformFn?: undefined | ((input: T) => O)): Promise<O[]>

selectOne

  • selectOne<T, O>(query: Query, transformFn?: undefined | ((input: T) => O)): Promise<O | null>

setUnique

  • setUnique(fieldName: string, sparse?: boolean): void
  • Set a UNIQUE key constraint on the given field.

    Parameters

    • fieldName: string

      The field name. Use dot notation for nested objects.

    • Default value sparse: boolean = false

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

    Returns void

update

  • update(query: Query, updateVals: Record<string, unknown>): Promise<number>

upsert

  • upsert<T>(query: Query, updateVals: T): Promise<number>

upsertEvent

Generated using TypeDoc