import Dexie from "dexie"; import { IDexieListOptions, IDexieModelMeta, PropType } from "../types"; import { IComparisonOperator } from "@forest-fire/types"; import { ConstructorFor, epoch } from "common-types"; import { Model } from "../models/Model"; /** * Provides a simple API for list based queries that resembles the Firemodel `List` API * but which works on the IndexDB using Dexie under the hood. */ export declare class DexieList { private modelConstructor; private table; private meta; constructor(modelConstructor: ConstructorFor, table: Dexie.Table, meta: IDexieModelMeta); /** * Get a full list of _all_ records of a given model type */ all(options?: IDexieListOptions): Promise; /** * Limit the list of records based on the evaluation of a single * properties value. Default comparison is equality but you can * change the `value` to a Tuple and include the `<` or `>` operator * as the first param to get other comparison operators. */ where(prop: K & string, value: PropType | [IComparisonOperator, PropType], options?: IDexieListOptions): Promise; /** * Get the "_x_" most recent records of a given type (based on the * `lastUpdated` property). */ recent(limit: number, skip?: number): Promise; /** * Get all records updated since a given timestamp. */ since(datetime: epoch, options?: IDexieListOptions): Promise; /** * Get the _last_ "x" records which were created. */ last(limit: number, skip?: number): Promise; /** * Get the _first_ "x" records which were created (aka, the earliest records created) */ first(limit: number, skip?: number): Promise; }