import { SearchCriteria } from './search/search.criteria.interface'; import { SearchOptions } from './search/search.options.interface'; import { UpdateCriteria } from './update/update.criteria.interface'; /** * A read-write invariant repository type for domain objects. * * @typeparam `Detached` is an invariant type of domain object that was not yet persisted. This type contains only manually assignable properties. * @typeparam `Attached` is an invariant type of already persisted domain object. This type contains all properties including those set by DB engine. */ export interface IDomainRepository extends IReadDomainRepository, IWriteDomainRepository { } /** * A read-only invariant repository type for domain objects. * @typeparam `Attached` is an invariant type of already persisted domain object. This type contains all properties including those set by DB engine. */ export interface IReadDomainRepository { /** * Finds a single object by specified criteria. * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @returns An attached object or undefined if object was not found. */ findOne(criteria: SearchCriteria): Promise; /** * Finds a single object by specified criteria. * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @throws `SingleEntityNotFound` error if not a single entity was found. * @returns An attached object. */ findOneOrFail(criteria: SearchCriteria): Promise; /** * Finds all objects by specified criteria. * * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @param options specifies additional result options (skip, limit, sort). * * @returns A list of attached objects. */ findAll(criteria?: SearchCriteria, options?: SearchOptions): Promise; /** * Counts the number of objects by specified criteria. * * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @returns A number of found objects. */ countAll(criteria: SearchCriteria): Promise; } /** * A write-only repository for domain objects. * @typeparam `Detached` is an invariant type of domain object that was not yet persisted. This type contains only manually assignable properties. * @typeparam `Attached` is an invariant type of already persisted domain object. This type contains all properties including those set by DB engine. */ export interface IWriteDomainRepository { /** * Creates a new object based on detached entity. * * @param object Detached object. * @returns Attached object. */ create(object: Detached): Promise; /** * Creates a new objects based on array of detached entity. * * @param objects Array of detached objects. * @returns Attached object. */ createMany(objects: Detached[]): Promise; /** * Finds a single object by specified criteria and updates it. * * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @param update Contains the list of properties to update. * To run complex updates, use `UpdateWith` options. * * @returns Attached object or undefined if object was not found. */ findOneAndUpdate(criteria: SearchCriteria, update: UpdateCriteria): Promise; /** * Finds all objects that meet specified criteria and updates them. * * @param update Contains the list of properties to update. * To run complex updates, use `UpdateWith` options. * * @returns Object with a number of updated entities. */ findAllAndUpdate(criteria: SearchCriteria, update: UpdateCriteria): Promise<{ numberOfUpdatedObjects: number; }>; /** * Finds a single object by specified criteria and deletes it. * * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @returns Attached object or undefined if object was not found. */ findOneAndDelete(criteria: SearchCriteria): Promise; /** * Finds all objects that meet specified criteria and deletes them. Returns an object with a number of deleted entities. * * @param criteria Contains the list of optional properties to search by. * To run complex searches, use `SearchBy` conditions. * All conditions are `AND`ed. To use (OR) logic, run multiple searches. * * @returns Object with a number of deleted entities. */ findAllAndDelete(criteria: SearchCriteria): Promise<{ numberOfDeletedObjects: number; }>; } //# sourceMappingURL=repository.interface.d.ts.map