@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
48 lines (46 loc) • 914 B
JavaScript
import {
toPageList
} from "./chunk-TORB7XB3.mjs";
import {
choose
} from "./chunk-XAIHCZT4.mjs";
import {
resolve
} from "./chunk-5HENJTR6.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-PRVFFLHU.mjs.map