volleyballsimtypes 0.0.138 → 0.0.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/service/player/trait.js +2 -2
- package/dist/esm/data/index.d.ts +3 -0
- package/dist/esm/data/index.js +3 -0
- package/dist/esm/data/init-models.d.ts +2 -0
- package/dist/esm/data/init-models.js +194 -0
- package/dist/esm/data/models/coach.d.ts +40 -0
- package/dist/esm/data/models/coach.js +51 -0
- package/dist/esm/data/models/competition-champion.d.ts +23 -0
- package/dist/esm/data/models/competition-champion.js +34 -0
- package/dist/esm/data/models/competition-match.d.ts +29 -0
- package/dist/esm/data/models/competition-match.js +42 -0
- package/dist/esm/data/models/competition-teams.d.ts +23 -0
- package/dist/esm/data/models/competition-teams.js +38 -0
- package/dist/esm/data/models/competition.d.ts +67 -0
- package/dist/esm/data/models/competition.js +34 -0
- package/dist/esm/data/models/country.d.ts +61 -0
- package/dist/esm/data/models/country.js +30 -0
- package/dist/esm/data/models/draft-pick.d.ts +31 -0
- package/dist/esm/data/models/draft-pick.js +46 -0
- package/dist/esm/data/models/draft.d.ts +29 -0
- package/dist/esm/data/models/draft.js +30 -0
- package/dist/esm/data/models/index.d.ts +24 -0
- package/dist/esm/data/models/index.js +24 -0
- package/dist/esm/data/models/iteration.d.ts +26 -0
- package/dist/esm/data/models/iteration.js +26 -0
- package/dist/esm/data/models/league-season.d.ts +23 -0
- package/dist/esm/data/models/league-season.js +34 -0
- package/dist/esm/data/models/league.d.ts +44 -0
- package/dist/esm/data/models/league.js +34 -0
- package/dist/esm/data/models/match-rating.d.ts +27 -0
- package/dist/esm/data/models/match-rating.js +48 -0
- package/dist/esm/data/models/match-set-stats.d.ts +58 -0
- package/dist/esm/data/models/match-set-stats.js +123 -0
- package/dist/esm/data/models/match-set.d.ts +85 -0
- package/dist/esm/data/models/match-set.js +47 -0
- package/dist/esm/data/models/match.d.ts +67 -0
- package/dist/esm/data/models/match.js +47 -0
- package/dist/esm/data/models/performance-stats.d.ts +40 -0
- package/dist/esm/data/models/performance-stats.js +81 -0
- package/dist/esm/data/models/player-team.d.ts +28 -0
- package/dist/esm/data/models/player-team.js +48 -0
- package/dist/esm/data/models/player-trait.d.ts +23 -0
- package/dist/esm/data/models/player-trait.js +38 -0
- package/dist/esm/data/models/player.d.ts +124 -0
- package/dist/esm/data/models/player.js +42 -0
- package/dist/esm/data/models/rally.d.ts +29 -0
- package/dist/esm/data/models/rally.js +46 -0
- package/dist/esm/data/models/set-position.d.ts +29 -0
- package/dist/esm/data/models/set-position.js +46 -0
- package/dist/esm/data/models/team.d.ts +162 -0
- package/dist/esm/data/models/team.js +59 -0
- package/dist/esm/data/models/trait.d.ts +37 -0
- package/dist/esm/data/models/trait.js +26 -0
- package/dist/esm/data/models/user.d.ts +22 -0
- package/dist/esm/data/models/user.js +53 -0
- package/dist/esm/data/transformers/coach.d.ts +5 -0
- package/dist/esm/data/transformers/coach.js +25 -0
- package/dist/esm/data/transformers/country.d.ts +5 -0
- package/dist/esm/data/transformers/country.js +16 -0
- package/dist/esm/data/transformers/court-position.d.ts +5 -0
- package/dist/esm/data/transformers/court-position.js +27 -0
- package/dist/esm/data/transformers/draft-pick.d.ts +5 -0
- package/dist/esm/data/transformers/draft-pick.js +18 -0
- package/dist/esm/data/transformers/draft.d.ts +5 -0
- package/dist/esm/data/transformers/draft.js +20 -0
- package/dist/esm/data/transformers/formation.d.ts +5 -0
- package/dist/esm/data/transformers/formation.js +8 -0
- package/dist/esm/data/transformers/index.d.ts +25 -0
- package/dist/esm/data/transformers/index.js +25 -0
- package/dist/esm/data/transformers/iteration.d.ts +5 -0
- package/dist/esm/data/transformers/iteration.js +14 -0
- package/dist/esm/data/transformers/league.d.ts +5 -0
- package/dist/esm/data/transformers/league.js +28 -0
- package/dist/esm/data/transformers/match-rating.d.ts +4 -0
- package/dist/esm/data/transformers/match-rating.js +13 -0
- package/dist/esm/data/transformers/match-set-stats.d.ts +5 -0
- package/dist/esm/data/transformers/match-set-stats.js +57 -0
- package/dist/esm/data/transformers/match-set.d.ts +5 -0
- package/dist/esm/data/transformers/match-set.js +44 -0
- package/dist/esm/data/transformers/match.d.ts +5 -0
- package/dist/esm/data/transformers/match.js +27 -0
- package/dist/esm/data/transformers/performance-stats.d.ts +5 -0
- package/dist/esm/data/transformers/performance-stats.js +33 -0
- package/dist/esm/data/transformers/player-team.d.ts +3 -0
- package/dist/esm/data/transformers/player-team.js +9 -0
- package/dist/esm/data/transformers/player.d.ts +5 -0
- package/dist/esm/data/transformers/player.js +26 -0
- package/dist/esm/data/transformers/rally.d.ts +5 -0
- package/dist/esm/data/transformers/rally.js +23 -0
- package/dist/esm/data/transformers/role.d.ts +5 -0
- package/dist/esm/data/transformers/role.js +23 -0
- package/dist/esm/data/transformers/season-match.d.ts +4 -0
- package/dist/esm/data/transformers/season-match.js +13 -0
- package/dist/esm/data/transformers/season.d.ts +5 -0
- package/dist/esm/data/transformers/season.js +39 -0
- package/dist/esm/data/transformers/set-position.d.ts +5 -0
- package/dist/esm/data/transformers/set-position.js +16 -0
- package/dist/esm/data/transformers/stage.d.ts +5 -0
- package/dist/esm/data/transformers/stage.js +21 -0
- package/dist/esm/data/transformers/team.d.ts +5 -0
- package/dist/esm/data/transformers/team.js +28 -0
- package/dist/esm/data/transformers/tournament-match.d.ts +5 -0
- package/dist/esm/data/transformers/tournament-match.js +19 -0
- package/dist/esm/data/transformers/tournament.d.ts +5 -0
- package/dist/esm/data/transformers/tournament.js +33 -0
- package/dist/esm/data/transformers/trait.d.ts +5 -0
- package/dist/esm/data/transformers/trait.js +15 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/service/coach/coach.d.ts +19 -0
- package/dist/esm/service/coach/coach.js +11 -0
- package/dist/esm/service/coach/formation.d.ts +31 -0
- package/dist/esm/service/coach/formation.js +122 -0
- package/dist/esm/service/coach/index.d.ts +2 -0
- package/dist/esm/service/coach/index.js +2 -0
- package/dist/esm/service/competition/index.d.ts +11 -0
- package/dist/esm/service/competition/index.js +12 -0
- package/dist/esm/service/competition/iteration.d.ts +10 -0
- package/dist/esm/service/competition/iteration.js +8 -0
- package/dist/esm/service/competition/league.d.ts +16 -0
- package/dist/esm/service/competition/league.js +8 -0
- package/dist/esm/service/competition/season.d.ts +23 -0
- package/dist/esm/service/competition/season.js +27 -0
- package/dist/esm/service/competition/stage.d.ts +11 -0
- package/dist/esm/service/competition/stage.js +24 -0
- package/dist/esm/service/competition/standing.d.ts +28 -0
- package/dist/esm/service/competition/standing.js +76 -0
- package/dist/esm/service/competition/tournament-match.d.ts +14 -0
- package/dist/esm/service/competition/tournament-match.js +9 -0
- package/dist/esm/service/competition/tournament.d.ts +20 -0
- package/dist/esm/service/competition/tournament.js +18 -0
- package/dist/esm/service/country/country.d.ts +17 -0
- package/dist/esm/service/country/country.js +18 -0
- package/dist/esm/service/country/index.d.ts +1 -0
- package/dist/esm/service/country/index.js +1 -0
- package/dist/esm/service/draft/draft-pick.d.ts +14 -0
- package/dist/esm/service/draft/draft-pick.js +7 -0
- package/dist/esm/service/draft/draft.d.ts +15 -0
- package/dist/esm/service/draft/draft.js +8 -0
- package/dist/esm/service/draft/index.d.ts +2 -0
- package/dist/esm/service/draft/index.js +2 -0
- package/dist/esm/service/event/index.d.ts +1 -0
- package/dist/esm/service/event/index.js +1 -0
- package/dist/esm/service/event/rally-event.d.ts +20 -0
- package/dist/esm/service/event/rally-event.js +16 -0
- package/dist/esm/service/index.d.ts +9 -0
- package/dist/esm/service/index.js +9 -0
- package/dist/esm/service/match/court-position.d.ts +21 -0
- package/dist/esm/service/match/court-position.js +53 -0
- package/dist/esm/service/match/court-target-enum.d.ts +21 -0
- package/dist/esm/service/match/court-target-enum.js +54 -0
- package/dist/esm/service/match/index.d.ts +7 -0
- package/dist/esm/service/match/index.js +7 -0
- package/dist/esm/service/match/match-rating.d.ts +35 -0
- package/dist/esm/service/match/match-rating.js +61 -0
- package/dist/esm/service/match/match-set.d.ts +65 -0
- package/dist/esm/service/match/match-set.js +56 -0
- package/dist/esm/service/match/match-team.d.ts +7 -0
- package/dist/esm/service/match/match-team.js +17 -0
- package/dist/esm/service/match/match.d.ts +36 -0
- package/dist/esm/service/match/match.js +57 -0
- package/dist/esm/service/match/rally.d.ts +22 -0
- package/dist/esm/service/match/rally.js +13 -0
- package/dist/esm/service/player/index.d.ts +5 -0
- package/dist/esm/service/player/index.js +5 -0
- package/dist/esm/service/player/performance-stats.d.ts +30 -0
- package/dist/esm/service/player/performance-stats.js +34 -0
- package/dist/esm/service/player/player.d.ts +46 -0
- package/dist/esm/service/player/player.js +84 -0
- package/dist/esm/service/player/role.d.ts +17 -0
- package/dist/esm/service/player/role.js +42 -0
- package/dist/esm/service/player/stats.d.ts +11 -0
- package/dist/esm/service/player/stats.js +25 -0
- package/dist/esm/service/player/trait.d.ts +21 -0
- package/dist/esm/service/player/trait.js +108 -0
- package/dist/esm/service/team/index.d.ts +1 -0
- package/dist/esm/service/team/index.js +1 -0
- package/dist/esm/service/team/team.d.ts +31 -0
- package/dist/esm/service/team/team.js +32 -0
- package/dist/esm/service/utils/index.d.ts +2 -0
- package/dist/esm/service/utils/index.js +2 -0
- package/dist/esm/service/utils/object-utils.d.ts +1 -0
- package/dist/esm/service/utils/object-utils.js +1 -0
- package/dist/esm/service/utils/string-utils.d.ts +2 -0
- package/dist/esm/service/utils/string-utils.js +11 -0
- package/dist/esm/src/service/player/trait.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Role } from '../../service';
|
|
2
|
+
function transformToType(role) {
|
|
3
|
+
switch (role) {
|
|
4
|
+
case Role.SETTER:
|
|
5
|
+
return 'SETTER';
|
|
6
|
+
case Role.DEFENSIVE_SPECIALIST:
|
|
7
|
+
return 'DEFENSIVE_SPECIALIST';
|
|
8
|
+
case Role.LIBERO:
|
|
9
|
+
return 'LIBERO';
|
|
10
|
+
case Role.MIDDLE_BLOCKER:
|
|
11
|
+
return 'MIDDLE_BLOCKER';
|
|
12
|
+
case Role.OUTSIDE_HITTER:
|
|
13
|
+
return 'OUTSIDE_HITTER';
|
|
14
|
+
case Role.OPPOSITE_HITTER:
|
|
15
|
+
return 'OPPOSITE_HITTER';
|
|
16
|
+
default:
|
|
17
|
+
throw new Error('UNKNOWN_ROLE');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function transformFromType(role) {
|
|
21
|
+
return Role[role];
|
|
22
|
+
}
|
|
23
|
+
export { transformToType as transformFromRole, transformFromType as transformToRole };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CompetitionMatchAttributes } from '../models';
|
|
2
|
+
import { Match } from '../../service';
|
|
3
|
+
declare function transformToAttributes(seasonId: string, match: Match, index: number): CompetitionMatchAttributes;
|
|
4
|
+
export { transformToAttributes as transformFromSeasonMatch };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Stage } from '../../service';
|
|
2
|
+
import { transformFromMatch } from './match';
|
|
3
|
+
import { transformFromStage } from './stage';
|
|
4
|
+
function transformToAttributes(seasonId, match, index) {
|
|
5
|
+
return {
|
|
6
|
+
competition_id: seasonId,
|
|
7
|
+
match_id: match.id,
|
|
8
|
+
index,
|
|
9
|
+
stage: transformFromStage(Stage.LEAGUE),
|
|
10
|
+
Match: transformFromMatch(match)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { transformToAttributes as transformFromSeasonMatch };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CompetitionAttributes, CompetitionModel } from '../models';
|
|
2
|
+
import { Season } from '../../service';
|
|
3
|
+
declare function transformToAttributes(season: Season, leagueId: string): CompetitionAttributes;
|
|
4
|
+
declare function transformToObject(model: CompetitionModel): Season;
|
|
5
|
+
export { transformToObject as transformToSeason, transformToAttributes as transformFromSeason };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { transformFromSeasonMatch, transformToIteration, transformToMatch, transformToTeam } from '.';
|
|
2
|
+
import { Season } from '../../service';
|
|
3
|
+
function transformToAttributes(season, leagueId) {
|
|
4
|
+
const matches = season.matches != null
|
|
5
|
+
? season.matches.map((match, index) => transformFromSeasonMatch(season.id, match, index))
|
|
6
|
+
: [];
|
|
7
|
+
const teams = season.teams.map(team => ({
|
|
8
|
+
competition_id: season.id,
|
|
9
|
+
team_id: team.id
|
|
10
|
+
}));
|
|
11
|
+
const champion = season.champion != null
|
|
12
|
+
? {
|
|
13
|
+
competition_id: season.id,
|
|
14
|
+
team_id: season.champion?.id
|
|
15
|
+
}
|
|
16
|
+
: undefined;
|
|
17
|
+
return {
|
|
18
|
+
competition_id: season.id,
|
|
19
|
+
type: 'LEAGUE',
|
|
20
|
+
iteration: season.iteration.id,
|
|
21
|
+
LeagueSeason: { league_id: leagueId, competition_id: season.id },
|
|
22
|
+
CompetitionChampion: champion,
|
|
23
|
+
CompetitionMatches: matches,
|
|
24
|
+
CompetitionTeams: teams
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function transformToObject(model) {
|
|
28
|
+
const matches = model.CompetitionMatches == null
|
|
29
|
+
? []
|
|
30
|
+
: model.CompetitionMatches.map((matches) => transformToMatch(matches.Match));
|
|
31
|
+
return new Season({
|
|
32
|
+
id: model.competition_id,
|
|
33
|
+
matches,
|
|
34
|
+
iteration: transformToIteration(model.Iteration),
|
|
35
|
+
teams: model.Teams != null ? model.Teams.map(transformToTeam) : [],
|
|
36
|
+
champion: model.CompetitionChampion != null ? transformToTeam(model.CompetitionChampion.team) : undefined
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { transformToObject as transformToSeason, transformToAttributes as transformFromSeason };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PlayerPosition } from '../../service';
|
|
2
|
+
import { SetPositionAttributes, SetPositionModel } from '../models';
|
|
3
|
+
declare function transformToAttributes(playerPosition: PlayerPosition, side: 'HOME' | 'AWAY', setId: string): SetPositionAttributes;
|
|
4
|
+
declare function transformToObject(model: SetPositionModel): PlayerPosition;
|
|
5
|
+
export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { transformFromCourtPosition, transformToCourtPosition } from '.';
|
|
2
|
+
function transformToAttributes(playerPosition, side, setId) {
|
|
3
|
+
return {
|
|
4
|
+
match_set_id: setId,
|
|
5
|
+
side,
|
|
6
|
+
court_position: transformFromCourtPosition(playerPosition.position),
|
|
7
|
+
player_id: playerPosition.playerId
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function transformToObject(model) {
|
|
11
|
+
return {
|
|
12
|
+
playerId: model.player_id,
|
|
13
|
+
position: transformToCourtPosition(model.court_position)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Stage } from '../../service';
|
|
2
|
+
import { CompetitionStage } from '../models';
|
|
3
|
+
declare function transformToType(stage: Stage): CompetitionStage;
|
|
4
|
+
declare function transformFromType(s: CompetitionStage): Stage;
|
|
5
|
+
export { transformToType as transformFromStage, transformFromType as transformToStage };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Stage } from '../../service';
|
|
2
|
+
function transformToType(stage) {
|
|
3
|
+
switch (stage) {
|
|
4
|
+
case Stage.ROUND_OF_8:
|
|
5
|
+
return 'ROUND_OF_8';
|
|
6
|
+
case Stage.QUARTERFINALS:
|
|
7
|
+
return 'QUARTERFINALS';
|
|
8
|
+
case Stage.SEMIFINALS:
|
|
9
|
+
return 'SEMIFINALS';
|
|
10
|
+
case Stage.FINAL:
|
|
11
|
+
return 'FINAL';
|
|
12
|
+
case Stage.LEAGUE:
|
|
13
|
+
return 'LEAGUE';
|
|
14
|
+
default:
|
|
15
|
+
throw new Error('UNKNOWN_ROLE');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function transformFromType(s) {
|
|
19
|
+
return Stage[s];
|
|
20
|
+
}
|
|
21
|
+
export { transformToType as transformFromStage, transformFromType as transformToStage };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Team } from '../../service';
|
|
2
|
+
import { TeamAttributes, TeamModel } from '../models';
|
|
3
|
+
declare function transformToAttributes(team: Team): TeamAttributes;
|
|
4
|
+
declare function transformToObject(team: TeamModel): Team;
|
|
5
|
+
export { transformToObject as transformToTeam, transformToAttributes as transformFromTeam };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Team } from '../../service';
|
|
2
|
+
import { transformFromCoach, transformToCoach, transformToCountry, transformToPlayer } from '.';
|
|
3
|
+
function transformToAttributes(team) {
|
|
4
|
+
return {
|
|
5
|
+
team_id: team.id,
|
|
6
|
+
name: team.name,
|
|
7
|
+
short_name: team.shortName,
|
|
8
|
+
coach_id: team.coach != null ? team.coach.id : undefined,
|
|
9
|
+
country_id: team.country != null ? team.country.id : undefined,
|
|
10
|
+
league_id: team.league != null ? team.league.id : undefined,
|
|
11
|
+
coach: team.coach != null ? transformFromCoach(team.coach) : undefined,
|
|
12
|
+
rating: team.rating
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function transformToObject(team) {
|
|
16
|
+
return new Team({
|
|
17
|
+
id: team.team_id,
|
|
18
|
+
name: team.name,
|
|
19
|
+
shortName: team.short_name,
|
|
20
|
+
country: team.country != null ? transformToCountry(team.country) : undefined,
|
|
21
|
+
coach: team.coach != null ? transformToCoach(team.coach) : undefined,
|
|
22
|
+
roster: team.PlayerTeams == null
|
|
23
|
+
? []
|
|
24
|
+
: team.PlayerTeams.map((pt) => transformToPlayer(pt.player)),
|
|
25
|
+
rating: team.rating
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { transformToObject as transformToTeam, transformToAttributes as transformFromTeam };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TournamentMatch } from '../../service';
|
|
2
|
+
import { CompetitionMatchAttributes, CompetitionMatchModel } from '../models';
|
|
3
|
+
declare function transformToAttributes(tournamentMatch: TournamentMatch, tournamentId: string): CompetitionMatchAttributes;
|
|
4
|
+
declare function transformToObject(model: CompetitionMatchModel): TournamentMatch;
|
|
5
|
+
export { transformToObject as transformToTournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TournamentMatch } from '../../service';
|
|
2
|
+
import { transformFromMatch, transformFromStage, transformToMatch, transformToStage } from '.';
|
|
3
|
+
function transformToAttributes(tournamentMatch, tournamentId) {
|
|
4
|
+
return {
|
|
5
|
+
competition_id: tournamentId,
|
|
6
|
+
match_id: tournamentMatch.match.id,
|
|
7
|
+
index: tournamentMatch.index,
|
|
8
|
+
stage: transformFromStage(tournamentMatch.stage),
|
|
9
|
+
Match: transformFromMatch(tournamentMatch.match)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function transformToObject(model) {
|
|
13
|
+
return new TournamentMatch({
|
|
14
|
+
stage: transformToStage(model.stage),
|
|
15
|
+
match: transformToMatch(model.Match),
|
|
16
|
+
index: model.index
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { transformToObject as transformToTournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CompetitionAttributes, CompetitionModel } from '../models';
|
|
2
|
+
import { Tournament } from '../../service';
|
|
3
|
+
declare function transformToAttributes(tournament: Tournament): CompetitionAttributes;
|
|
4
|
+
declare function transformToObject(model: CompetitionModel): Tournament;
|
|
5
|
+
export { transformToObject as transformToTournament, transformToAttributes as transformFromTournament };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { transformFromTournamentMatch, transformToIteration, transformToTeam, transformToTournamentMatch } from '.';
|
|
2
|
+
import { Tournament } from '../../service';
|
|
3
|
+
function transformToAttributes(tournament) {
|
|
4
|
+
const matches = tournament.matches.map((match) => transformFromTournamentMatch(match, tournament.id));
|
|
5
|
+
const teams = tournament.teams.map((team) => ({
|
|
6
|
+
competition_id: tournament.id,
|
|
7
|
+
team_id: team.id
|
|
8
|
+
}));
|
|
9
|
+
const champion = tournament.champion == null
|
|
10
|
+
? undefined
|
|
11
|
+
: {
|
|
12
|
+
competition_id: tournament.id,
|
|
13
|
+
team_id: tournament.champion?.id
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
competition_id: tournament.id,
|
|
17
|
+
type: 'TOURNAMENT',
|
|
18
|
+
iteration: tournament.iteration.id,
|
|
19
|
+
CompetitionChampion: champion,
|
|
20
|
+
CompetitionMatches: matches,
|
|
21
|
+
CompetitionTeams: teams
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function transformToObject(model) {
|
|
25
|
+
return new Tournament({
|
|
26
|
+
id: model.competition_id,
|
|
27
|
+
iteration: transformToIteration(model.Iteration),
|
|
28
|
+
matches: model.CompetitionMatches != null ? model.CompetitionMatches.map(transformToTournamentMatch) : [],
|
|
29
|
+
teams: model.Teams != null ? model.Teams.map(transformToTeam) : [],
|
|
30
|
+
champion: model.CompetitionChampion != null ? transformToTeam(model.CompetitionChampion.team) : undefined
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { transformToObject as transformToTournament, transformToAttributes as transformFromTournament };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Trait } from '../../service';
|
|
2
|
+
import { TraitAttributes, TraitModel } from '../models';
|
|
3
|
+
declare function transformToAttributes(trait: Trait): TraitAttributes;
|
|
4
|
+
declare function transformToObject(model: TraitModel): Trait;
|
|
5
|
+
export { transformToObject as transformToTrait, transformToAttributes as transformFromTrait };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Trait } from '../../service';
|
|
2
|
+
function transformToAttributes(trait) {
|
|
3
|
+
return {
|
|
4
|
+
trait_id: trait.id,
|
|
5
|
+
name: trait.name
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function transformToObject(model) {
|
|
9
|
+
const trait = Trait.getTraits().find((trait) => trait.id === model.trait_id);
|
|
10
|
+
if (trait == null) {
|
|
11
|
+
throw new Error('TRAIT_NOT_FOUND');
|
|
12
|
+
}
|
|
13
|
+
return trait;
|
|
14
|
+
}
|
|
15
|
+
export { transformToObject as transformToTrait, transformToAttributes as transformFromTrait };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Formation } from './formation';
|
|
2
|
+
import { Name } from '../player';
|
|
3
|
+
import { Country } from '../country';
|
|
4
|
+
interface CoachOpts {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: Name;
|
|
7
|
+
readonly country: Country;
|
|
8
|
+
readonly formation: Formation;
|
|
9
|
+
readonly substitutionTolerance: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class Coach {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: Name;
|
|
14
|
+
readonly country: Country;
|
|
15
|
+
readonly formation: Formation;
|
|
16
|
+
readonly substitutionTolerance: number;
|
|
17
|
+
constructor({ id, name, country, formation, substitutionTolerance }: CoachOpts);
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { validateUUID } from '../utils';
|
|
2
|
+
export class Coach {
|
|
3
|
+
constructor({ id, name, country, formation, substitutionTolerance }) {
|
|
4
|
+
validateUUID(id);
|
|
5
|
+
this.id = id;
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.country = country;
|
|
8
|
+
this.formation = formation;
|
|
9
|
+
this.substitutionTolerance = substitutionTolerance;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Role } from '../player';
|
|
2
|
+
import { CourtPosition } from '../match';
|
|
3
|
+
interface PositionRole {
|
|
4
|
+
readonly [CourtPosition.LEFT_FRONT]: Role[];
|
|
5
|
+
readonly [CourtPosition.MIDDLE_FRONT]: Role[];
|
|
6
|
+
readonly [CourtPosition.RIGHT_FRONT]: Role[];
|
|
7
|
+
readonly [CourtPosition.LEFT_BACK]: Role[];
|
|
8
|
+
readonly [CourtPosition.MIDDLE_BACK]: Role[];
|
|
9
|
+
readonly [CourtPosition.RIGHT_BACK]: Role[];
|
|
10
|
+
}
|
|
11
|
+
export interface SubPriority {
|
|
12
|
+
readonly MIDDLE_BLOCKER: number;
|
|
13
|
+
readonly OUTSIDE_HITTER: number;
|
|
14
|
+
readonly OPPOSITE_HITTER: number;
|
|
15
|
+
readonly DEFENSIVE_SPECIALIST: number;
|
|
16
|
+
readonly SETTER: number;
|
|
17
|
+
readonly LIBERO: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class Formation {
|
|
20
|
+
static readonly '5-1': Formation;
|
|
21
|
+
static readonly '4-2': Formation;
|
|
22
|
+
static readonly '6-2': Formation;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly initialRotation: PositionRole;
|
|
25
|
+
readonly base: PositionRole;
|
|
26
|
+
readonly draftingPriorities: Role[][];
|
|
27
|
+
readonly liberoSubPriority: SubPriority;
|
|
28
|
+
private constructor();
|
|
29
|
+
static getFormations(): Formation[];
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Role } from '../player';
|
|
2
|
+
import { CourtPosition } from '../match';
|
|
3
|
+
export class Formation {
|
|
4
|
+
constructor({ name, initialRotation, base, draftingPriorities, liberoSubPriority }) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.initialRotation = initialRotation;
|
|
7
|
+
this.base = base;
|
|
8
|
+
this.draftingPriorities = draftingPriorities;
|
|
9
|
+
this.liberoSubPriority = liberoSubPriority;
|
|
10
|
+
}
|
|
11
|
+
static getFormations() {
|
|
12
|
+
return [this['4-2'], this['5-1'], this['6-2']];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
Formation['5-1'] = new Formation({
|
|
16
|
+
name: '5-1',
|
|
17
|
+
initialRotation: {
|
|
18
|
+
1: [Role.SETTER],
|
|
19
|
+
2: [Role.OUTSIDE_HITTER],
|
|
20
|
+
3: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
21
|
+
4: [Role.OPPOSITE_HITTER],
|
|
22
|
+
5: [Role.OUTSIDE_HITTER],
|
|
23
|
+
6: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST]
|
|
24
|
+
},
|
|
25
|
+
base: {
|
|
26
|
+
1: [Role.OPPOSITE_HITTER, Role.SETTER],
|
|
27
|
+
2: [Role.OPPOSITE_HITTER],
|
|
28
|
+
3: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
29
|
+
4: [Role.OUTSIDE_HITTER],
|
|
30
|
+
5: [Role.OUTSIDE_HITTER],
|
|
31
|
+
6: [Role.LIBERO, Role.DEFENSIVE_SPECIALIST]
|
|
32
|
+
},
|
|
33
|
+
draftingPriorities: [
|
|
34
|
+
[Role.SETTER, Role.OPPOSITE_HITTER],
|
|
35
|
+
[Role.OPPOSITE_HITTER],
|
|
36
|
+
[Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
37
|
+
[Role.MIDDLE_BLOCKER],
|
|
38
|
+
[Role.OUTSIDE_HITTER],
|
|
39
|
+
[Role.OUTSIDE_HITTER],
|
|
40
|
+
[Role.LIBERO]
|
|
41
|
+
],
|
|
42
|
+
liberoSubPriority: {
|
|
43
|
+
MIDDLE_BLOCKER: 1,
|
|
44
|
+
OUTSIDE_HITTER: 10,
|
|
45
|
+
OPPOSITE_HITTER: 100,
|
|
46
|
+
DEFENSIVE_SPECIALIST: 1000,
|
|
47
|
+
SETTER: 10000,
|
|
48
|
+
LIBERO: 100000
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Formation['4-2'] = new Formation({
|
|
52
|
+
name: '4-2',
|
|
53
|
+
initialRotation: {
|
|
54
|
+
1: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
55
|
+
2: [Role.SETTER],
|
|
56
|
+
3: [Role.OUTSIDE_HITTER],
|
|
57
|
+
4: [Role.MIDDLE_BLOCKER],
|
|
58
|
+
5: [Role.SETTER],
|
|
59
|
+
6: [Role.OPPOSITE_HITTER]
|
|
60
|
+
},
|
|
61
|
+
base: {
|
|
62
|
+
1: [Role.SETTER],
|
|
63
|
+
2: [Role.OPPOSITE_HITTER, Role.SETTER],
|
|
64
|
+
3: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
65
|
+
4: [Role.OUTSIDE_HITTER],
|
|
66
|
+
5: [Role.OUTSIDE_HITTER],
|
|
67
|
+
6: [Role.LIBERO, Role.DEFENSIVE_SPECIALIST]
|
|
68
|
+
},
|
|
69
|
+
draftingPriorities: [
|
|
70
|
+
[Role.SETTER, Role.OPPOSITE_HITTER],
|
|
71
|
+
[Role.SETTER],
|
|
72
|
+
[Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
73
|
+
[Role.MIDDLE_BLOCKER],
|
|
74
|
+
[Role.OUTSIDE_HITTER],
|
|
75
|
+
[Role.OUTSIDE_HITTER],
|
|
76
|
+
[Role.LIBERO]
|
|
77
|
+
],
|
|
78
|
+
liberoSubPriority: {
|
|
79
|
+
MIDDLE_BLOCKER: 1,
|
|
80
|
+
OUTSIDE_HITTER: 10,
|
|
81
|
+
OPPOSITE_HITTER: 100,
|
|
82
|
+
DEFENSIVE_SPECIALIST: 1000,
|
|
83
|
+
SETTER: 10000,
|
|
84
|
+
LIBERO: 100000
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Formation['6-2'] = new Formation({
|
|
88
|
+
name: '6-2',
|
|
89
|
+
initialRotation: {
|
|
90
|
+
1: [Role.OPPOSITE_HITTER, Role.SETTER],
|
|
91
|
+
2: [Role.OUTSIDE_HITTER],
|
|
92
|
+
3: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
93
|
+
4: [Role.OPPOSITE_HITTER, Role.SETTER],
|
|
94
|
+
5: [Role.OUTSIDE_HITTER],
|
|
95
|
+
6: [Role.MIDDLE_BLOCKER]
|
|
96
|
+
},
|
|
97
|
+
base: {
|
|
98
|
+
1: [Role.SETTER],
|
|
99
|
+
2: [Role.OPPOSITE_HITTER, Role.SETTER],
|
|
100
|
+
3: [Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
101
|
+
4: [Role.OUTSIDE_HITTER],
|
|
102
|
+
5: [Role.OUTSIDE_HITTER],
|
|
103
|
+
6: [Role.LIBERO, Role.DEFENSIVE_SPECIALIST]
|
|
104
|
+
},
|
|
105
|
+
draftingPriorities: [
|
|
106
|
+
[Role.SETTER, Role.OPPOSITE_HITTER],
|
|
107
|
+
[Role.OPPOSITE_HITTER, Role.SETTER],
|
|
108
|
+
[Role.MIDDLE_BLOCKER, Role.DEFENSIVE_SPECIALIST],
|
|
109
|
+
[Role.DEFENSIVE_SPECIALIST, Role.MIDDLE_BLOCKER],
|
|
110
|
+
[Role.OUTSIDE_HITTER],
|
|
111
|
+
[Role.OUTSIDE_HITTER],
|
|
112
|
+
[Role.LIBERO]
|
|
113
|
+
],
|
|
114
|
+
liberoSubPriority: {
|
|
115
|
+
MIDDLE_BLOCKER: 1,
|
|
116
|
+
OUTSIDE_HITTER: 10,
|
|
117
|
+
OPPOSITE_HITTER: 100,
|
|
118
|
+
DEFENSIVE_SPECIALIST: 1000,
|
|
119
|
+
SETTER: 10000,
|
|
120
|
+
LIBERO: 100000
|
|
121
|
+
}
|
|
122
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './standing';
|
|
2
|
+
export * from './season';
|
|
3
|
+
export * from './league';
|
|
4
|
+
export * from './iteration';
|
|
5
|
+
export * from './tournament';
|
|
6
|
+
export * from './tournament-match';
|
|
7
|
+
export * from './stage';
|
|
8
|
+
export declare enum _CompetitionType {
|
|
9
|
+
TOURNAMENT = "TOURNAMENT",
|
|
10
|
+
LEAGUE = "LEAGUE"
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './standing';
|
|
2
|
+
export * from './season';
|
|
3
|
+
export * from './league';
|
|
4
|
+
export * from './iteration';
|
|
5
|
+
export * from './tournament';
|
|
6
|
+
export * from './tournament-match';
|
|
7
|
+
export * from './stage';
|
|
8
|
+
export var _CompetitionType;
|
|
9
|
+
(function (_CompetitionType) {
|
|
10
|
+
_CompetitionType["TOURNAMENT"] = "TOURNAMENT";
|
|
11
|
+
_CompetitionType["LEAGUE"] = "LEAGUE";
|
|
12
|
+
})(_CompetitionType || (_CompetitionType = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Season } from './season';
|
|
2
|
+
import { Country } from '../country';
|
|
3
|
+
interface LeagueOpts {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly country: Country;
|
|
7
|
+
readonly seasons: Season[];
|
|
8
|
+
}
|
|
9
|
+
export declare class League {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly seasons: Season[];
|
|
13
|
+
readonly country: Country;
|
|
14
|
+
constructor({ id, name, country, seasons }: LeagueOpts);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Team } from '../team';
|
|
2
|
+
import { Match } from '../match';
|
|
3
|
+
import { Standing } from './standing';
|
|
4
|
+
import { Iteration } from './iteration';
|
|
5
|
+
interface SeasonOpts {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly teams: Team[];
|
|
8
|
+
readonly matches: Match[];
|
|
9
|
+
readonly iteration: Iteration;
|
|
10
|
+
readonly champion?: Team;
|
|
11
|
+
}
|
|
12
|
+
export declare class Season {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly teams: Team[];
|
|
15
|
+
readonly matches: Match[];
|
|
16
|
+
readonly iteration: Iteration;
|
|
17
|
+
readonly standings: Standing[];
|
|
18
|
+
champion?: Team;
|
|
19
|
+
constructor({ id, iteration, teams, matches, champion }: SeasonOpts);
|
|
20
|
+
calculateStandings(): Standing[];
|
|
21
|
+
updateStandings(): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Standing } from './standing';
|
|
2
|
+
export class Season {
|
|
3
|
+
constructor({ id, iteration, teams, matches, champion }) {
|
|
4
|
+
this.id = id;
|
|
5
|
+
this.teams = teams;
|
|
6
|
+
this.matches = matches;
|
|
7
|
+
this.iteration = iteration;
|
|
8
|
+
this.champion = champion;
|
|
9
|
+
this.standings = this.calculateStandings();
|
|
10
|
+
}
|
|
11
|
+
calculateStandings() {
|
|
12
|
+
return this.teams.map(team => {
|
|
13
|
+
const standing = new Standing({ team });
|
|
14
|
+
standing.calculateStanding(this.matches);
|
|
15
|
+
return standing;
|
|
16
|
+
}).sort(Standing.sortFn);
|
|
17
|
+
}
|
|
18
|
+
updateStandings() {
|
|
19
|
+
if (this.matches == null || this.matches.length < 1)
|
|
20
|
+
throw new Error('NO_MATCHES');
|
|
21
|
+
this.standings.length = 0;
|
|
22
|
+
this.standings.push(...this.calculateStandings());
|
|
23
|
+
if (this.matches.every((match) => match.isOver())) {
|
|
24
|
+
this.champion = this.standings[0].team;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var Stage;
|
|
2
|
+
(function (Stage) {
|
|
3
|
+
Stage[Stage["ROUND_OF_8"] = 8] = "ROUND_OF_8";
|
|
4
|
+
Stage[Stage["QUARTERFINALS"] = 4] = "QUARTERFINALS";
|
|
5
|
+
Stage[Stage["SEMIFINALS"] = 2] = "SEMIFINALS";
|
|
6
|
+
Stage[Stage["FINAL"] = 1] = "FINAL";
|
|
7
|
+
Stage[Stage["LEAGUE"] = 0] = "LEAGUE";
|
|
8
|
+
})(Stage || (Stage = {}));
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
10
|
+
(function (Stage) {
|
|
11
|
+
const STAGES = [Stage.ROUND_OF_8, Stage.QUARTERFINALS, Stage.SEMIFINALS, Stage.FINAL, Stage.LEAGUE];
|
|
12
|
+
function getStages() {
|
|
13
|
+
return [...STAGES];
|
|
14
|
+
}
|
|
15
|
+
Stage.getStages = getStages;
|
|
16
|
+
function getNextStage(stage) {
|
|
17
|
+
if (stage < 1)
|
|
18
|
+
throw new Error(`INVALID_STAGE ${stage}`);
|
|
19
|
+
if (stage === 1)
|
|
20
|
+
throw new Error('ALREADY_IN_FINAL_STAGE');
|
|
21
|
+
return stage / 2;
|
|
22
|
+
}
|
|
23
|
+
Stage.getNextStage = getNextStage;
|
|
24
|
+
})(Stage || (Stage = {}));
|