UNPKG

brackets-manager

Version:

A simple library to manage tournament brackets (round-robin, single elimination, double elimination)

53 lines 1.77 kB
import { CrudInterface, Database, Storage } from './types'; import { InputStage, Stage } from 'brackets-model'; import { Create } from './create'; import { Get } from './get'; import { Update } from './update'; import { Delete } from './delete'; import { Find } from './find'; import { Reset } from './reset'; export interface CallableCreate extends Create { /** * Creates a stage for an existing tournament. The tournament won't be created. * * @param stage A stage to create. * @deprecated Please use `manager.create.stage()` instead. */ (stage: InputStage): Promise<Stage>; } /** * A class to handle tournament management at those levels: `stage`, `group`, `round`, `match` and `match_game`. */ export declare class BracketsManager { verbose: boolean; storage: Storage; get: Get; update: Update; delete: Delete; find: Find; reset: Reset; create: CallableCreate; /** * Creates an instance of BracketsManager, which will handle all the stuff from the library. * * @param storageInterface An implementation of CrudInterface. * @param verbose Whether to log CRUD operations. */ constructor(storageInterface: CrudInterface, verbose?: boolean); /** * Imports data in the database. * * @param data Data to import. * @param normalizeIds Enable ID normalization: all IDs (and references to them) are remapped to consecutive IDs starting from 0. */ import(data: Database, normalizeIds?: boolean): Promise<void>; /** * Exports data from the database. */ export(): Promise<Database>; /** * Add `console.log()` to storage methods in verbose mode. */ private instrumentStorage; } //# sourceMappingURL=manager.d.ts.map