import { Exact } from './query'; import { KeyPath } from './type-helpers'; export declare const MAX_SHADOW_KEYS = 5; /** * * Represents a model in the database. When extending this class, * you **MUST** override the `.keys()` method, returning * exact queries for all indexes (access paths) of the model. * */ export declare abstract class Model> { __snapshot: string | undefined; __shadowSnapshots: string[]; /** * * Hydrates the model instance, populating it with given data. The given data must have enough * information to produce a primary key. * * The object will be converted to camel case befor being used * to create the model. * */ hydrate(source: any): void; /** * * Returns a list of exact queries that specify access keys (indexes) * of this object. Exactly one of the returned keys must be a primary key, * and all secondary keys must have separate labels. * */ abstract keys(): Exact[]; /** * * Return a list of shadowKey lists, containing exact queries that specify access keys * for each set of shadowKeys, each shadowKey list must have a primary, secondary keys must have separate labels. * shadowKeys list is limited to MAX_SHADOW_KEYS, UNSAFE_shadowKeysUnbounded allows unlimited shadowKeys * */ shadowKeys?(): Exact[][]; UNSAFE_shadowKeysUnbounded?(): Exact[][]; primary(keys?: Exact[]): string; secondaries(keys?: Exact[]): { label1?: string | undefined; label2?: string | undefined; label3?: string | undefined; label4?: string | undefined; label5?: string | undefined; }; /** * * Return shadow keys from either ShadowKeys or UNSAFE_shadowKeysUnbounded method * */ resolveShadowKeys(): Exact[][] | undefined; updateShadowSnapshots(): string[]; /** * * Will save the model to the database, as well as any shadows. If the primary key has changed, * the previous entry in the database will be deleted first, this also runs for primary shadow keys. * */ save(): Promise; /** * * Will delete the model and any shadows from the database. * */ delete(): Promise; /** * * Will return a clean JSON serializable version of the model. * This will remove internal data and convert the model to snake case. * * @param exclude Fields or key paths to be excluded. * */ clean(exclude?: KeyPath[]): any; }