brackets-manager
Version:
A simple library to manage tournament brackets (round-robin, single elimination, double elimination)
111 lines • 3.9 kB
TypeScript
import { Id, IdSeeding, Match, MatchGame, Seeding, SeedOrdering } from 'brackets-model';
import { BaseUpdater } from './base/updater';
import { ChildCountLevel, DeepPartial } from './types';
export declare class Update extends BaseUpdater {
/**
* Updates partial information of a match. Its id must be given.
*
* This will update related matches accordingly.
*
* @param match Values to change in a match.
*/
match<M extends Match = Match>(match: DeepPartial<M>): Promise<void>;
/**
* Updates partial information of a match game. Its id must be given.
*
* This will update the parent match accordingly.
*
* @param game Values to change in a match game.
*/
matchGame<G extends MatchGame = MatchGame>(game: DeepPartial<G>): Promise<void>;
/**
* Updates the seed ordering of every ordered round in a stage.
*
* @param stageId ID of the stage.
* @param seedOrdering A list of ordering methods.
*/
ordering(stageId: Id, seedOrdering: SeedOrdering[]): Promise<void>;
/**
* Updates the seed ordering of a round.
*
* @param roundId ID of the round.
* @param method Seed ordering method.
*/
roundOrdering(roundId: Id, method: SeedOrdering): Promise<void>;
/**
* Updates child count of all matches of a given level.
*
* @param level The level at which to act.
* @param id ID of the chosen level.
* @param childCount The target child count.
*/
matchChildCount(level: ChildCountLevel, id: Id, childCount: number): Promise<void>;
/**
* Updates the seeding of a stage.
*
* @param stageId ID of the stage.
* @param seeding The new seeding.
* @param keepSameSize Whether to keep the same size as before for the stage. **Default:** false.
*/
seeding(stageId: Id, seeding: Seeding, keepSameSize?: boolean): Promise<void>;
/**
* Updates the seeding of a stage (with a list of IDs).
*
* @param stageId ID of the stage.
* @param seedingIds The new seeding, containing only IDs.
* @param keepSameSize Whether to keep the same size as before for the stage. **Default:** false.
*/
seedingIds(stageId: Id, seedingIds: IdSeeding, keepSameSize?: boolean): Promise<void>;
/**
* Confirms the seeding of a stage.
*
* This will convert TBDs to BYEs and propagate them.
*
* @param stageId ID of the stage.
*/
confirmSeeding(stageId: Id): Promise<void>;
/**
* Update the seed ordering of a round.
*
* @param round The round of which to update the ordering.
* @param method The new ordering method.
*/
private updateRoundOrdering;
/**
* Updates child count of all matches of a stage.
*
* @param stageId ID of the stage.
* @param childCount The target child count.
*/
private updateStageMatchChildCount;
/**
* Updates child count of all matches of a group.
*
* @param groupId ID of the group.
* @param childCount The target child count.
*/
private updateGroupMatchChildCount;
/**
* Updates child count of all matches of a round.
*
* @param roundId ID of the round.
* @param childCount The target child count.
*/
private updateRoundMatchChildCount;
/**
* Updates the ordering of participants in a round's matches.
*
* @param roundNumber The number of the round.
* @param matches The matches of the round.
* @param positions The new positions.
*/
private applyRoundOrdering;
/**
* Adds or deletes match games of a match based on a target child count.
*
* @param match The match of which child games need to be adjusted.
* @param targetChildCount The target child count.
*/
private adjustMatchChildGames;
}
//# sourceMappingURL=update.d.ts.map