import { Group, Match, MatchGame, Participant, Round, SeedOrdering, Stage, InputStage } from 'brackets-model'; /** * Type of an object implementing every ordering method. */ export declare type OrderingMap = Record(array: T[], ...args: number[]) => T[]>; /** * Omits the `id` property of a type. */ export declare type OmitId = Omit; /** * Defines a T which can be null. */ export declare type Nullable = T | null; /** * An object which maps an ID to another ID. */ export declare type IdMapping = Record; /** * Custom participant model to allow extra fields. */ export declare type CustomParticipant = Participant & Record; export declare type CustomSeeding = (CustomParticipant | string | number | null)[]; export declare type CustomInputStage = Omit & { seeding?: CustomSeeding; }; /** * Used by the library to handle placements. Is `null` if is a BYE. Has a `null` name if it's yet to be determined. */ export declare type ParticipantSlot = { id: number | null; position?: number; } | null; /** * The library only handles duels. It's one participant versus another participant. */ export declare type Duel = [ParticipantSlot, ParticipantSlot]; /** * The side of an opponent. */ export declare type Side = 'opponent1' | 'opponent2'; /** * The cumulated scores of the opponents in a match's child games. */ export declare type Scores = { opponent1: number; opponent2: number; }; /** * The possible levels of data to which we can update the child games count. */ export declare type ChildCountLevel = 'stage' | 'group' | 'round' | 'match'; /** * All the possible kinds of bracket (group level) in an elimination stage. * * - `single_bracket` for single elimination. * - `winner_bracket` and `loser_bracket` for double elimination. * - `final_group` for both single and double elimination. */ export declare type BracketKind = 'single_bracket' | 'winner_bracket' | 'loser_bracket' | 'final_group'; /** * Positional information about a round. */ export declare type RoundPositionalInfo = { roundNumber: number; roundCount: number; }; /** * The result of an array which was split by parity. */ export interface ParitySplit { even: T[]; odd: T[]; } /** * Converts all value types to array types. */ declare type ValueToArray = { [K in keyof T]: Array; }; /** * Data type associated to each database table. */ export interface DataTypes { stage: Stage; group: Group; round: Round; match: Match; match_game: MatchGame; participant: Participant | CustomParticipant; } /** * The types of table in the storage. */ export declare type Table = keyof DataTypes; /** * Format of the data in a database. */ export declare type Database = ValueToArray; /** * An item in the final standings of an elimination stage. */ export interface FinalStandingsItem { id: number; name: string; rank: number; } /** * Contains the losers and the winner of the bracket. */ export interface StandardBracketResults { /** * The list of losers for each round of the bracket. */ losers: ParticipantSlot[][]; /** * The winner of the bracket. */ winner: ParticipantSlot; } /** * This CRUD interface is used by the manager to abstract storage. */ export interface CrudInterface { /** * Inserts a value in the database and returns its id. * * @param table Where to insert. * @param value What to insert. */ insert(table: T, value: OmitId): Promise; /** * Inserts multiple values in the database. * * @param table Where to insert. * @param values What to insert. */ insert(table: T, values: OmitId[]): Promise; /** * Gets all data from a table in the database. * * @param table Where to get from. */ select(table: T): Promise | null>; /** * Gets specific data from a table in the database. * * @param table Where to get from. * @param id What to get. */ select(table: T, id: number): Promise; /** * Gets data from a table in the database with a filter. * * @param table Where to get from. * @param filter An object to filter data. */ select(table: T, filter: Partial): Promise | null>; /** * Updates data in a table. * * @param table Where to update. * @param id What to update. * @param value How to update. */ update(table: T, id: number, value: DataTypes[T]): Promise; /** * Updates data in a table. * * @param table Where to update. * @param filter An object to filter data. * @param value How to update. */ update(table: T, filter: Partial, value: Partial): Promise; /** * Empties a table completely. * * @param table Where to delete everything. */ delete(table: T): Promise; /** * Delete data in a table, based on a filter. * * @param table Where to delete in. * @param filter An object to filter data. */ delete(table: T, filter: Partial): Promise; } export interface Storage extends CrudInterface { selectFirst(table: T, filter: Partial): Promise; selectLast(table: T, filter: Partial): Promise; } export {}; //# sourceMappingURL=types.d.ts.map