UNPKG

wise-eyes-core

Version:

Web server to monitor the status of owlcms

144 lines (143 loc) 4.73 kB
import type { AthleteState, OwlcmsAthleteList } from './athlete'; import type { ClockState } from './clock'; import Athlete from './athlete'; import Clock from './clock'; export type BreakType = 'BEFORE_INTRODUCTION' | 'CEREMONY' | 'CHALLENGE' | 'FIRST_CJ' | 'FIRST_SNATCH' | 'GROUP_DONE' | 'JURY' | 'MARSHAL' | 'SNATCH_DONE' | 'TECHNICAL'; export interface CategoryFederationRecords { federation: string; snatch: number; clean: number; total: number; snatchAttempt: boolean; cleanAttempt: boolean; totalAttempt: boolean; } export interface CategoryRecords { category: string[]; data: CategoryFederationRecords[]; } export type CeremonyType = 'INTRODUCTION' | 'MEDALS' | 'OFFICIALS_INTRODUCTION'; export type Decision = 'bad' | 'good'; export type FopState = 'BREAK' | 'CURRENT_ATHLETE_DISPLAYED' | 'DECISION_VISIBLE' | 'DOWN_SIGNAL_VISIBLE' | 'INACTIVE' | 'TIME_RUNNING' | 'TIME_STOPPED'; export type LiftTypeKey = 'CLEAN_AND_JERK' | 'SNATCH'; export type Mode = 'BEFORE_INTRODUCTION' | 'CEREMONY' | 'CURRENT_ATHLETE' | 'FIRST_CJ' | 'FIRST_SNATCH' | 'INTRO_COUNTDOWN' | 'INTRODUCTION' | 'LIFT_COUNTDOWN' | 'LIFT_COUNTDOWN_CEREMONY' | 'LIFTING' | 'MARSHAL' | 'TECHNICAL' | 'WAIT'; export interface OwlcmsCategoryFederationRecords { cjHighlight: string; CLEANJERK: number; SNATCH: number; snatchHighlight: string; TOTAL: number; totalHighlight: string; } export interface OwlcmsCategoryRecords { cat: string[]; records: OwlcmsCategoryFederationRecords[]; } export type OwlcmsLiftType = 'Clean_and_Jerk' | 'Snatch'; export interface OwlcmsRecords { recordCategories: string[]; recordNames: string[]; recordTable: OwlcmsCategoryRecords[]; } export interface PlatformState { athlete: AthleteState | null; athleteClock: ClockState; breakClock: ClockState; breakType: BreakType | null; centerReferee: Decision | null; ceremonyType: CeremonyType | null; downSignal: boolean; fopState: FopState | null; juryDecision: Decision | null; juryReversal: boolean | null; leftReferee: Decision | null; leaders: AthleteState[]; liftType: string | null; liftTypeKey: LiftTypeKey | null; mode: Mode | null; name: string; recordKind: RecordKind; records: Records | null; rightReferee: Decision | null; sessionDescription: string | null; sessionInfo: string | null; sessionName: string | null; } export type RecordKind = 'attempt' | 'denied' | 'new' | 'none'; export interface Records { federations: string[]; categories: string[]; records: CategoryRecords[]; } export interface Session { description: string; info: string; name: string; } export default class Platform { private static platforms; private athletes; private athleteClock; private breakClock; private breakType; private centerReferee; private ceremonyType; private currentAthlete; private currentSession; private downSignal; private fopState; private juryDecision; private juryReversal; private leaders; private leftReferee; private liftingOrder; private liftType; private liftTypeKey; private mode; private name; private recordKind; private records; private rightReferee; static getPlatform(name: string, { noPersist, }?: { noPersist?: boolean; }): Platform; static getPlatforms(): string[]; constructor({ name, }: { name: string; }); getAthleteClock(): Clock; getBreakClock(): Clock; getCurrentAthlete(): Athlete | null; getLiftingOrder(): Athlete[]; getState(): PlatformState; resetDecisions(): void; setBreakType(breakType: BreakType | null): void; setCeremonyType(ceremonyType: CeremonyType | null): void; setCurrentAthlete(startNumber: number): void; setDecisions({ centerReferee, leftReferee, rightReferee, }: { centerReferee: Decision | null; leftReferee: Decision | null; rightReferee: Decision | null; }): void; setDownSignal(state: boolean): void; setFopState(fopState: FopState): void; setJuryDecision({ decision, reversal, }: { decision: Decision; reversal: boolean; }): void; setLeaders(athletes: OwlcmsAthleteList): void; setLiftType({ key, name, }: { key: OwlcmsLiftType; name: string | null; }): void; setMode(mode: Mode): void; setRecordKind(recordKind: RecordKind): void; setRecords(records: OwlcmsRecords): void; setSession(session: { description: string; info: string; name: string; }): void; private updateAthlete; updateAthletes(athletes: OwlcmsAthleteList): void; }