@jsynple/core
Version:
All the core modules and types for the Synple application
22 lines (21 loc) • 943 B
TypeScript
import { Repository } from "../../repositories";
import { Identified } from "../../types";
/**
* A list service provides utility methods for handling lists of specific items, a thing we tend to do
* a lot in the applciation, especially on the administration side. It allows the addition, update and
* removal of items on a list, by calling the specific methods on the linked repository for this kind
* of items.
* @author Vincent Courtois <courtois.vincent@outlook.com>
*/
export declare class ListService<Wrapped extends Identified, CreationWrapper = Wrapped> {
private readonly repository;
private items;
private token;
constructor(repository: Repository<Wrapped, CreationWrapper>, token: string);
fetch(): Promise<Wrapped[]>;
get all(): Wrapped[];
create(item: CreationWrapper): Promise<Wrapped>;
update(item: Wrapped): Promise<Wrapped>;
delete(item: Wrapped | string): void;
private append;
}