UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

46 lines (44 loc) 875 B
import { toPageList } from "./chunk-GYJHZJKL.mjs"; import { choose, resolve } from "./chunk-AVHYDITZ.mjs"; // src/process/Search.ts var Search = class { constructor(repo) { this.repo = repo; } all(options) { return this.repo.all(options); } byId(id) { return this.repo.byId(id); } byIds(...ids) { return this.repo.byIds(...ids); } byKey(key, options) { return this.repo.byKey(key, options); } query({ query, skip, take }) { return this.search(query, { skip, take }); } search(query, options) { return choose(query).is.not.empty( (q) => q, (q) => this.repo.search(q, options) ).else(() => resolve(toPageList())); } filter(options) { return this.repo.filter(options); } exists(id) { return this.repo.exists(id); } }; export { Search }; //# sourceMappingURL=chunk-OWUSKHPI.mjs.map