UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

20 lines (19 loc) 868 B
import { FetchOptions } from './Gateway'; import { PageList } from './PageList'; import { Id, Key } from './Id'; import { List } from './List'; import { Json, JsonValue } from './Json'; export declare class Repository<T, Options = FetchOptions> { all(options?: Options): Promise<PageList<T>>; byId(id: Id): Promise<T>; byIds(...ids: Id[]): Promise<List<T>>; byKey(key: Key, options?: Options): Promise<PageList<T>>; by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>>; search(q: JsonValue, options?: Options): Promise<PageList<T>>; filter(options?: Options): Promise<PageList<T>>; exists(id: Id): Promise<boolean>; add(t: Partial<T> | Json): Promise<T>; update(id: Id, json: Partial<T> | Json): Promise<T>; remove(id: Id): Promise<boolean>; upsert(id: Id, item: Partial<T> | Json): Promise<T>; }