export = BaseModel; declare class BaseModel { /** * Register a new model * * @param {Model} ModelClass */ static register(ModelClass: Model): void; /** * Loads an instance from the database * * @param {String} id * * @returns {BaseModel} */ static load(id: string): BaseModel; /** * Deletes all instances matching the given query. * - the instance delete method will be called on each occurence * * @param {Object} query - Search query (e.g. { match_all: {} }) * @param {Object} options - refresh (undefined) * * @returns {Promise} */ static deleteByQuery(query: any, { refresh }?: any): Promise; /** * Returns instances matching the given query * * @param {Object} searchBody * @param {Object} options - from, size, scroll * * @returns {Promise} - Array of instances */ static search(searchBody: any, options: any): Promise; /** * Deletes all instances of the collection * * @param {Object} options - refresh (undefined) * * @returns {Promise} */ static truncate({ refresh }?: any): Promise; static batchExecute(query: any, callback: any): Promise; /** * Must be overriden by children */ static get collection(): void; /** * Must be overriden by children */ static get fields(): void; /** * Instantiate the model from a document * * @param {Object} document - { _id, _source } * * @returns {BaseModel} */ static _instantiateFromDb({ _id, _source }: any): BaseModel; constructor(_source?: {}, _id?: any); __id: any; __source: {}; set _id(_id: any); get _id(): any; set _source(_source: {}); get _source(): {}; /** * Save the current instance in the database. * - use update if the instance already exists * - use create otherwise * * @param {Object} options - userId (null), refresh (undefined) * * @returns {Promise} */ save({ userId, refresh }?: any): Promise; __persisted: boolean; /** * Delete the current instance from the database. * - call the _afterDelete hook after deletion * * @param {Object} options - refresh (undefined) * * @returns {Promise} */ delete({ refresh }?: any): Promise; /** * Returns a plain object representing the instance * * @returns {Object} { _id, _source } */ serialize(): any; /** * Hook called in the delete method after deletion from the database * * @returns {Promise} */ _afterDelete(): Promise; }