import { Collection } from 'collect.js'; import Fluent from '../Models/Fluent'; import Repository, { type SearchCollection, type Where } from './Repository'; export type Searchable = (search: string, item: Fluent) => boolean; export default abstract class CollectionRepository extends Repository { /** * Collection of the items. */ protected collection: Collection; /** * Initiate repository instance. */ constructor(items?: any[]); /** * Resolve items from the store path. */ protected resolveItems(): Record; /** * Prepare given items for collection. */ protected prepareItems(items: any[]): Fluent[]; /** * Search storage for given query string. */ search(search: string, page?: number, perPage?: number): Promise>; /** * Find all model's for the given conditions. */ all(wheres?: Where[]): Promise; /** * Search collection for given query string. */ protected searchCollection(search?: string): Collection; /** * Get the collection with applied constraints. */ protected getCollection(): Collection; /** * Apply the where constraint on the collection item. */ protected checkAgainstWhere(item: Fluent, where: Where): boolean; /** * Perform searches on the given item. */ protected performSearches(search: string, item: Fluent): boolean; /** * Store given model into the storage. */ store(model: Fluent): Promise; /** * Find first model for the given conditions. */ first(wheres?: Where[]): Promise; /** * Store given model into the storage. */ update(model: Fluent): Promise; /** * Delete model for the given key. */ delete(key: string | number): Promise; /** * Write given items to storage. */ protected write(items: Fluent[]): any; /** * Create new instance of model. */ model(): Fluent; /** * Generate new id for storing item. */ newId(): string | number; /** * Get key name of the item. */ abstract searchables(): Searchable[]; /** * Get path of the stored files. */ abstract filepath(): string; } //# sourceMappingURL=CollectionRepository.d.ts.map