volleyballsimtypes 0.0.132 → 0.0.134
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/data/transformers/coach.d.ts +1 -3
- package/dist/cjs/src/data/transformers/coach.js +2 -13
- package/dist/cjs/src/data/transformers/draft.js +1 -3
- package/dist/cjs/src/data/transformers/index.d.ts +0 -7
- package/dist/cjs/src/data/transformers/index.js +0 -7
- package/dist/cjs/src/data/transformers/league.d.ts +1 -3
- package/dist/cjs/src/data/transformers/league.js +1 -9
- package/dist/cjs/src/data/transformers/match-set-stats.d.ts +1 -3
- package/dist/cjs/src/data/transformers/match-set-stats.js +1 -35
- package/dist/cjs/src/data/transformers/match-set.d.ts +1 -3
- package/dist/cjs/src/data/transformers/match-set.js +5 -34
- package/dist/cjs/src/data/transformers/match.d.ts +2 -4
- package/dist/cjs/src/data/transformers/match.js +6 -21
- package/dist/cjs/src/data/transformers/player.d.ts +1 -4
- package/dist/cjs/src/data/transformers/player.js +1 -68
- package/dist/cjs/src/data/transformers/rally.d.ts +1 -3
- package/dist/cjs/src/data/transformers/rally.js +3 -42
- package/dist/cjs/src/data/transformers/role.d.ts +1 -3
- package/dist/cjs/src/data/transformers/role.js +1 -6
- package/dist/cjs/src/data/transformers/season.d.ts +1 -3
- package/dist/cjs/src/data/transformers/season.js +1 -43
- package/dist/cjs/src/data/transformers/team.d.ts +1 -3
- package/dist/cjs/src/data/transformers/team.js +1 -13
- package/dist/cjs/src/data/transformers/tournament-match.d.ts +1 -3
- package/dist/cjs/src/data/transformers/tournament-match.js +1 -9
- package/dist/cjs/src/data/transformers/tournament.d.ts +1 -3
- package/dist/cjs/src/data/transformers/tournament.js +1 -11
- package/dist/cjs/src/data/transformers/trait.d.ts +1 -3
- package/dist/cjs/src/data/transformers/trait.js +1 -23
- package/dist/cjs/src/index.d.ts +0 -1
- package/dist/cjs/src/index.js +0 -1
- package/dist/cjs/src/service/country/country.d.ts +1 -0
- package/dist/cjs/src/service/country/country.js +9 -0
- package/dist/cjs/src/service/match/match-rating.d.ts +2 -2
- package/dist/cjs/src/service/match/match-set.d.ts +12 -8
- package/dist/cjs/src/service/match/match-set.js +8 -8
- package/dist/cjs/src/service/match/match.d.ts +3 -3
- package/dist/cjs/src/service/match/rally.d.ts +3 -3
- package/dist/cjs/src/service/player/performance-stats.d.ts +4 -3
- package/dist/cjs/src/service/player/performance-stats.js +15 -0
- package/dist/cjs/src/service/player/player.d.ts +20 -9
- package/dist/cjs/src/service/player/player.js +32 -1
- package/dist/cjs/src/service/player/role.d.ts +3 -1
- package/dist/cjs/src/service/player/role.js +9 -6
- package/dist/cjs/src/service/player/stats.d.ts +4 -4
- package/dist/cjs/src/service/player/stats.js +4 -4
- package/dist/cjs/src/service/player/trait.d.ts +1 -0
- package/dist/cjs/src/service/player/trait.js +10 -0
- package/dist/cjs/src/service/team/team.d.ts +3 -3
- package/dist/esm/src/data/transformers/coach.d.ts +1 -3
- package/dist/esm/src/data/transformers/coach.js +2 -12
- package/dist/esm/src/data/transformers/draft.js +1 -3
- package/dist/esm/src/data/transformers/index.d.ts +0 -7
- package/dist/esm/src/data/transformers/index.js +0 -7
- package/dist/esm/src/data/transformers/league.d.ts +1 -3
- package/dist/esm/src/data/transformers/league.js +1 -8
- package/dist/esm/src/data/transformers/match-set-stats.d.ts +1 -3
- package/dist/esm/src/data/transformers/match-set-stats.js +1 -34
- package/dist/esm/src/data/transformers/match-set.d.ts +1 -3
- package/dist/esm/src/data/transformers/match-set.js +8 -36
- package/dist/esm/src/data/transformers/match.d.ts +2 -4
- package/dist/esm/src/data/transformers/match.js +3 -17
- package/dist/esm/src/data/transformers/player.d.ts +1 -4
- package/dist/esm/src/data/transformers/player.js +3 -68
- package/dist/esm/src/data/transformers/rally.d.ts +1 -3
- package/dist/esm/src/data/transformers/rally.js +2 -40
- package/dist/esm/src/data/transformers/role.d.ts +1 -3
- package/dist/esm/src/data/transformers/role.js +1 -5
- package/dist/esm/src/data/transformers/season.d.ts +1 -3
- package/dist/esm/src/data/transformers/season.js +2 -43
- package/dist/esm/src/data/transformers/team.d.ts +1 -3
- package/dist/esm/src/data/transformers/team.js +2 -13
- package/dist/esm/src/data/transformers/tournament-match.d.ts +1 -3
- package/dist/esm/src/data/transformers/tournament-match.js +2 -9
- package/dist/esm/src/data/transformers/tournament.d.ts +1 -3
- package/dist/esm/src/data/transformers/tournament.js +2 -11
- package/dist/esm/src/data/transformers/trait.d.ts +1 -3
- package/dist/esm/src/data/transformers/trait.js +1 -22
- package/dist/esm/src/index.d.ts +0 -1
- package/dist/esm/src/index.js +0 -1
- package/dist/esm/src/service/country/country.d.ts +1 -0
- package/dist/esm/src/service/country/country.js +9 -0
- package/dist/esm/src/service/match/match-rating.d.ts +2 -2
- package/dist/esm/src/service/match/match-set.d.ts +12 -8
- package/dist/esm/src/service/match/match-set.js +8 -8
- package/dist/esm/src/service/match/match.d.ts +3 -3
- package/dist/esm/src/service/match/rally.d.ts +3 -3
- package/dist/esm/src/service/player/performance-stats.d.ts +4 -3
- package/dist/esm/src/service/player/performance-stats.js +15 -0
- package/dist/esm/src/service/player/player.d.ts +20 -9
- package/dist/esm/src/service/player/player.js +29 -0
- package/dist/esm/src/service/player/role.d.ts +3 -1
- package/dist/esm/src/service/player/role.js +9 -6
- package/dist/esm/src/service/player/stats.d.ts +4 -4
- package/dist/esm/src/service/player/stats.js +4 -4
- package/dist/esm/src/service/player/trait.d.ts +1 -0
- package/dist/esm/src/service/player/trait.js +10 -0
- package/dist/esm/src/service/team/team.d.ts +3 -3
- package/package.json +3 -2
|
@@ -23,11 +23,4 @@ function transformToObject(model) {
|
|
|
23
23
|
seasons
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
id: model.league_id,
|
|
29
|
-
name: model.name,
|
|
30
|
-
country: transformToCountry(model.country)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export { transformToObject as transformToLeague, transformToAPIObject as transformToAPILeague, transformToAttributes as transformFromLeague };
|
|
26
|
+
export { transformToObject as transformToLeague, transformToAttributes as transformFromLeague };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { MatchSetStatsAttributes, MatchSetStatsModel } from '../models';
|
|
2
2
|
import { SetStatistics } from '../../service';
|
|
3
|
-
import { APISetStatistics } from '../../api';
|
|
4
3
|
declare function transformToAttributes(stats: SetStatistics, setId: string): MatchSetStatsAttributes;
|
|
5
4
|
declare function transformToObject(model: MatchSetStatsModel): SetStatistics;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToMatchSetStats, transformToAPIObject as transformToAPIMatchSetStats, transformToAttributes as transformFromMatchSetStats };
|
|
5
|
+
export { transformToObject as transformToMatchSetStats, transformToAttributes as transformFromMatchSetStats };
|
|
@@ -54,37 +54,4 @@ function transformToObject(model) {
|
|
|
54
54
|
player: transformToPlayer(model.player)
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
set: {
|
|
60
|
-
success: model.set_success,
|
|
61
|
-
error: model.set_error
|
|
62
|
-
},
|
|
63
|
-
attack: {
|
|
64
|
-
success: model.attack_success,
|
|
65
|
-
error: model.attack_error
|
|
66
|
-
},
|
|
67
|
-
serve: {
|
|
68
|
-
success: model.serve_success,
|
|
69
|
-
error: model.serve_error
|
|
70
|
-
},
|
|
71
|
-
reception: {
|
|
72
|
-
success: model.reception_success,
|
|
73
|
-
error: model.reception_error
|
|
74
|
-
},
|
|
75
|
-
block: {
|
|
76
|
-
success: model.block_success,
|
|
77
|
-
error: model.block_error
|
|
78
|
-
},
|
|
79
|
-
contacts: model.contacts,
|
|
80
|
-
kills: model.kills,
|
|
81
|
-
killBlocks: model.kill_blocks,
|
|
82
|
-
ace: model.aces,
|
|
83
|
-
assists: model.assists,
|
|
84
|
-
ralliesPlayed: model.rallies_played,
|
|
85
|
-
attempts: model.attempts,
|
|
86
|
-
playerId: model.player_id,
|
|
87
|
-
order
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export { transformToObject as transformToMatchSetStats, transformToAPIObject as transformToAPIMatchSetStats, transformToAttributes as transformFromMatchSetStats };
|
|
57
|
+
export { transformToObject as transformToMatchSetStats, transformToAttributes as transformFromMatchSetStats };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { MatchSetAttributes, MatchSetModel } from '../models';
|
|
2
2
|
import { MatchSet } from '../../service';
|
|
3
|
-
import { APIMatchSet } from '../../api';
|
|
4
3
|
declare function transformToAttributes(set: MatchSet, matchId: string): MatchSetAttributes;
|
|
5
4
|
declare function transformToObject(model: MatchSetModel): MatchSet;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToMatchSet, transformToAPIObject as transformToAPIMatchSet, transformToAttributes as transformFromMatchSet };
|
|
5
|
+
export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MatchSet } from '../../service';
|
|
2
|
-
import { transformFromMatchSetStats, transformFromPlayerPosition
|
|
2
|
+
import { transformFromMatchSetStats, transformFromPlayerPosition as fromPosition, transformFromRally, transformToMatchSetStats, transformToPlayerPosition as toPosition, transformToRally } from '.';
|
|
3
3
|
function transformToAttributes(set, matchId) {
|
|
4
|
-
const homeSetPositions = set.homePlayerPosition.map(position =>
|
|
5
|
-
const awaySetPositions = set.awayPlayerPosition.map(position =>
|
|
4
|
+
const homeSetPositions = set.homePlayerPosition.map(position => fromPosition(position, 'Home', set.id));
|
|
5
|
+
const awaySetPositions = set.awayPlayerPosition.map(position => fromPosition(position, 'Away', set.id));
|
|
6
6
|
return {
|
|
7
7
|
match_set_id: set.id,
|
|
8
8
|
match_id: matchId,
|
|
9
9
|
order: set.order,
|
|
10
10
|
is_tie_break: set.isTieBreak,
|
|
11
|
-
home_score: set.
|
|
12
|
-
away_score: set.
|
|
11
|
+
home_score: set.homeScore,
|
|
12
|
+
away_score: set.awayScore,
|
|
13
13
|
SetPositions: [...homeSetPositions, ...awaySetPositions],
|
|
14
14
|
MatchSetStats: set.stats != null ? set.stats.map(stats => transformFromMatchSetStats(stats, set.id)) : undefined,
|
|
15
15
|
Rallies: set.rallies != null ? set.rallies.map(rally => transformFromRally(rally, set.id)) : undefined
|
|
@@ -17,12 +17,10 @@ function transformToAttributes(set, matchId) {
|
|
|
17
17
|
}
|
|
18
18
|
function transformToObject(model) {
|
|
19
19
|
const homePlayerPosition = model.SetPositions != null
|
|
20
|
-
? model.SetPositions.filter(p => p.side === 'Home')
|
|
21
|
-
.map(transformToPlayerPosition)
|
|
20
|
+
? model.SetPositions.filter(p => p.side === 'Home').map(toPosition)
|
|
22
21
|
: [];
|
|
23
22
|
const awayPlayerPosition = model.SetPositions != null
|
|
24
|
-
? model.SetPositions.filter(p => p.side === 'Away')
|
|
25
|
-
.map(transformToPlayerPosition)
|
|
23
|
+
? model.SetPositions.filter(p => p.side === 'Away').map(toPosition)
|
|
26
24
|
: [];
|
|
27
25
|
const stats = model.MatchSetStats != null ? model.MatchSetStats.map(transformToMatchSetStats) : [];
|
|
28
26
|
const rallies = model.Rallies != null ? model.Rallies.map(transformToRally) : [];
|
|
@@ -39,30 +37,4 @@ function transformToObject(model) {
|
|
|
39
37
|
stats
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
const rallies = model.Rallies != null ? model.Rallies.map(transformToAPIRally) : [];
|
|
44
|
-
rallies.sort((r1, r2) => r1.order - r2.order);
|
|
45
|
-
const homePlayerPosition = model.SetPositions != null
|
|
46
|
-
? model.SetPositions.filter(p => p.side === 'Home')
|
|
47
|
-
.map(transformToPlayerPosition)
|
|
48
|
-
: [];
|
|
49
|
-
const awayPlayerPosition = model.SetPositions != null
|
|
50
|
-
? model.SetPositions.filter(p => p.side === 'Away')
|
|
51
|
-
.map(transformToPlayerPosition)
|
|
52
|
-
: [];
|
|
53
|
-
const stats = model.MatchSetStats != null
|
|
54
|
-
? model.MatchSetStats.map(stats => transformToAPIMatchSetStats(stats, model.order))
|
|
55
|
-
: [];
|
|
56
|
-
return {
|
|
57
|
-
id: model.match_id,
|
|
58
|
-
order: model.order,
|
|
59
|
-
homeScore: model.home_score,
|
|
60
|
-
awayScore: model.away_score,
|
|
61
|
-
isTieBreak: model.is_tie_break,
|
|
62
|
-
rallies,
|
|
63
|
-
homePlayerPosition,
|
|
64
|
-
awayPlayerPosition,
|
|
65
|
-
stats
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export { transformToObject as transformToMatchSet, transformToAPIObject as transformToAPIMatchSet, transformToAttributes as transformFromMatchSet };
|
|
40
|
+
export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MatchAttributes, MatchModel } from '../models';
|
|
2
2
|
import { Match } from '../../service';
|
|
3
|
-
import { APIMatch } from '../../api';
|
|
4
3
|
declare function transformToAttributes(match: Match): MatchAttributes;
|
|
5
4
|
declare function transformToObject(model: MatchModel): Match;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToMatch, transformToAPIObject as transformToAPIMatch, transformToAttributes as transformFromMatch };
|
|
5
|
+
export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Match } from '../../service';
|
|
2
|
-
import {
|
|
2
|
+
import { transformToMatchSet } from './match-set';
|
|
3
|
+
import { transformToTeam } from './team';
|
|
3
4
|
function transformToAttributes(match) {
|
|
4
5
|
return {
|
|
5
6
|
match_id: match.id,
|
|
@@ -23,19 +24,4 @@ function transformToObject(model) {
|
|
|
23
24
|
isSimulated: model.is_simulated
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
const sets = match.MatchSets == null || match.MatchSets.length < 1
|
|
28
|
-
? []
|
|
29
|
-
: match.MatchSets.map(transformToAPIMatchSet)
|
|
30
|
-
.sort((s1, s2) => s1.order - s2.order);
|
|
31
|
-
return {
|
|
32
|
-
id: match.match_id,
|
|
33
|
-
homeTeam: transformToAPITeam(match.HomeTeam),
|
|
34
|
-
awayTeam: transformToAPITeam(match.AwayTeam),
|
|
35
|
-
scheduledDate: new Date(match.scheduled_date),
|
|
36
|
-
sets,
|
|
37
|
-
season: competition != null && competition.type === 'LEAGUE' ? transformToAPISeason(competition) : undefined,
|
|
38
|
-
tournament: competition != null && competition.type === 'TOURNAMENT' ? transformToAPITournament(competition) : undefined
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export { transformToObject as transformToMatch, transformToAPIObject as transformToAPIMatch, transformToAttributes as transformFromMatch };
|
|
27
|
+
export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { PlayerAttributes, PlayerModel } from '../models';
|
|
2
2
|
import { Player } from '../../service';
|
|
3
|
-
import { APIPlayer, APISetStatistics } from '../../api';
|
|
4
3
|
declare function transformToAttributes(player: Player): PlayerAttributes;
|
|
5
4
|
declare function transformToObject(model: PlayerModel): Player;
|
|
6
|
-
|
|
7
|
-
declare function reduceStatsFn(acc: APISetStatistics, current: APISetStatistics): APISetStatistics;
|
|
8
|
-
export { transformToObject as transformToPlayer, transformToAPIObject as transformToAPIPlayer, transformToAttributes as transformFromPlayer, reduceStatsFn };
|
|
5
|
+
export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { transformFromPerformanceStats, transformFromRole,
|
|
1
|
+
import { Player } from '../../service';
|
|
2
|
+
import { transformFromPerformanceStats, transformFromRole, transformToCountry, transformToPerformanceStats, transformToRole, transformToTrait } from '.';
|
|
3
3
|
function transformToAttributes(player) {
|
|
4
4
|
return {
|
|
5
5
|
player_id: player.id,
|
|
@@ -23,69 +23,4 @@ function transformToObject(model) {
|
|
|
23
23
|
stats: transformToPerformanceStats(model.PerformanceStat)
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
const generalStats = model.PerformanceStat != null
|
|
28
|
-
? GeneralStat.getStats().map(stat => ({
|
|
29
|
-
name: stat,
|
|
30
|
-
value: GeneralStat.calculateScore(transformToPerformanceStats(model.PerformanceStat), stat)
|
|
31
|
-
}))
|
|
32
|
-
: [];
|
|
33
|
-
const gameStats = model.MatchSetStats != null ? model.MatchSetStats.map(transformToAPIMatchSetStats) : [];
|
|
34
|
-
if (gameStats.length > 0) {
|
|
35
|
-
gameStats.push(calculateMatchStats(gameStats));
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
id: model.player_id,
|
|
39
|
-
name: {
|
|
40
|
-
first: model.first_name,
|
|
41
|
-
last: model.last_name
|
|
42
|
-
},
|
|
43
|
-
country: model.country != null ? transformToCountry(model.country) : undefined,
|
|
44
|
-
roles: model.roles.map(transformToAPIRole),
|
|
45
|
-
traits: model.Traits != null ? model.Traits.map(transformToAPITrait) : [],
|
|
46
|
-
generalStats,
|
|
47
|
-
gameStats,
|
|
48
|
-
team,
|
|
49
|
-
jerseyNumber
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function calculateMatchStats(gameStats) {
|
|
53
|
-
const emptyStats = {
|
|
54
|
-
playerId: gameStats[0].playerId,
|
|
55
|
-
attempts: 0,
|
|
56
|
-
contacts: 0,
|
|
57
|
-
ralliesPlayed: 0,
|
|
58
|
-
serve: { success: 0, error: 0 },
|
|
59
|
-
reception: { success: 0, error: 0 },
|
|
60
|
-
set: { success: 0, error: 0 },
|
|
61
|
-
attack: { success: 0, error: 0 },
|
|
62
|
-
block: { success: 0, error: 0 },
|
|
63
|
-
kills: 0,
|
|
64
|
-
killBlocks: 0,
|
|
65
|
-
ace: 0,
|
|
66
|
-
assists: 0,
|
|
67
|
-
order: gameStats.length
|
|
68
|
-
};
|
|
69
|
-
return gameStats.reduce(reduceStatsFn, emptyStats);
|
|
70
|
-
}
|
|
71
|
-
function reduceStatsFn(acc, current) {
|
|
72
|
-
acc.attempts += current.attempts;
|
|
73
|
-
acc.contacts += current.contacts;
|
|
74
|
-
acc.ralliesPlayed += current.ralliesPlayed;
|
|
75
|
-
acc.kills += current.kills;
|
|
76
|
-
acc.killBlocks += current.killBlocks;
|
|
77
|
-
acc.ace += current.ace;
|
|
78
|
-
acc.assists += current.assists;
|
|
79
|
-
acc.serve.success += current.serve.success;
|
|
80
|
-
acc.serve.error += current.serve.error;
|
|
81
|
-
acc.reception.success += current.reception.success;
|
|
82
|
-
acc.reception.error += current.reception.error;
|
|
83
|
-
acc.set.success += current.set.success;
|
|
84
|
-
acc.set.error += current.set.error;
|
|
85
|
-
acc.attack.success += current.attack.success;
|
|
86
|
-
acc.attack.error += current.attack.error;
|
|
87
|
-
acc.block.success += current.block.success;
|
|
88
|
-
acc.block.error += current.block.error;
|
|
89
|
-
return acc;
|
|
90
|
-
}
|
|
91
|
-
export { transformToObject as transformToPlayer, transformToAPIObject as transformToAPIPlayer, transformToAttributes as transformFromPlayer, reduceStatsFn };
|
|
26
|
+
export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { RallyAttributes, RallyModel } from '../models';
|
|
2
2
|
import { Rally } from '../../service';
|
|
3
|
-
import { APIRally } from '../../api';
|
|
4
3
|
declare function transformToAttributes(rally: Rally, setId: string): RallyAttributes;
|
|
5
4
|
declare function transformToObject(model: RallyModel): Rally;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToRally, transformToAPIObject as transformToAPIRally, transformToAttributes as transformFromRally };
|
|
5
|
+
export { transformToObject as transformToRally, transformToAttributes as transformFromRally };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventTypeEnum, Rally } from '../../service';
|
|
2
|
-
import { transformToAPIBlock, transformToAPILiberoReplacement, transformToAPIReception, transformToAPIServe, transformToAPISet, transformToAPISpike, transformToAPISubstitution, transformToTeam } from '.';
|
|
3
2
|
import { compressToBase64, decompressFromBase64 } from 'lz-string';
|
|
3
|
+
import { transformToTeam } from './team';
|
|
4
4
|
function transformToAttributes(rally, setId) {
|
|
5
5
|
const events = `[${rally.events.map(e => {
|
|
6
6
|
switch (e.eventType) {
|
|
@@ -68,42 +68,4 @@ function transformToObject(model) {
|
|
|
68
68
|
events
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
const decompressed = decompressFromBase64(model.events);
|
|
73
|
-
const parsed = JSON.parse(decompressed);
|
|
74
|
-
const events = [];
|
|
75
|
-
parsed.forEach(event => {
|
|
76
|
-
switch (event.eventType) {
|
|
77
|
-
case 0:
|
|
78
|
-
events.push(transformToAPILiberoReplacement(event));
|
|
79
|
-
break;
|
|
80
|
-
case 1:
|
|
81
|
-
events.push(transformToAPISubstitution(event));
|
|
82
|
-
break;
|
|
83
|
-
case 2:
|
|
84
|
-
events.push(transformToAPIServe(event));
|
|
85
|
-
break;
|
|
86
|
-
case 3:
|
|
87
|
-
events.push(transformToAPIReception(event));
|
|
88
|
-
break;
|
|
89
|
-
case 4:
|
|
90
|
-
events.push(transformToAPISet(event));
|
|
91
|
-
break;
|
|
92
|
-
case 5:
|
|
93
|
-
events.push(transformToAPISpike(event));
|
|
94
|
-
break;
|
|
95
|
-
case 6:
|
|
96
|
-
events.push(transformToAPIBlock(event));
|
|
97
|
-
break;
|
|
98
|
-
default:
|
|
99
|
-
throw new Error('UNKNOWN_EVENT');
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
id: model.rally_id,
|
|
104
|
-
order: model.order,
|
|
105
|
-
servingTeamId: model.serving_team,
|
|
106
|
-
events
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export { transformToObject as transformToRally, transformToAPIObject as transformToAPIRally, transformToAttributes as transformFromRally };
|
|
71
|
+
export { transformToObject as transformToRally, transformToAttributes as transformFromRally };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Role } from '../../service';
|
|
2
2
|
import { RoleType } from '../models';
|
|
3
|
-
import { APIRole } from '../../api';
|
|
4
3
|
declare function transformToType(role: Role): RoleType;
|
|
5
4
|
declare function transformFromType(role: RoleType): Role;
|
|
6
|
-
|
|
7
|
-
export { transformToType as transformFromRole, transformToAPIType as transformToAPIRole, transformFromType as transformToRole };
|
|
5
|
+
export { transformToType as transformFromRole, transformFromType as transformToRole };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Role } from '../../service';
|
|
2
|
-
import { APIRole } from '../../api';
|
|
3
2
|
function transformToType(role) {
|
|
4
3
|
switch (role) {
|
|
5
4
|
case Role.SETTER:
|
|
@@ -21,7 +20,4 @@ function transformToType(role) {
|
|
|
21
20
|
function transformFromType(role) {
|
|
22
21
|
return Role[role];
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
return APIRole[role];
|
|
26
|
-
}
|
|
27
|
-
export { transformToType as transformFromRole, transformToAPIType as transformToAPIRole, transformFromType as transformToRole };
|
|
23
|
+
export { transformToType as transformFromRole, transformFromType as transformToRole };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CompetitionAttributes, CompetitionModel } from '../models';
|
|
2
2
|
import { Season } from '../../service';
|
|
3
|
-
import { APISeason } from '../../api';
|
|
4
3
|
declare function transformToAttributes(season: Season, leagueId: string): CompetitionAttributes;
|
|
5
4
|
declare function transformToObject(model: CompetitionModel): Season;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToSeason, transformToAPIObject as transformToAPISeason, transformToAttributes as transformFromSeason };
|
|
5
|
+
export { transformToObject as transformToSeason, transformToAttributes as transformFromSeason };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformFromSeasonMatch,
|
|
1
|
+
import { transformFromSeasonMatch, transformToIteration, transformToMatch, transformToTeam } from '.';
|
|
2
2
|
import { Season } from '../../service';
|
|
3
3
|
function transformToAttributes(season, leagueId) {
|
|
4
4
|
const matches = season.matches != null
|
|
@@ -36,45 +36,4 @@ function transformToObject(model) {
|
|
|
36
36
|
champion: model.CompetitionChampion != null ? transformToTeam(model.CompetitionChampion.team) : undefined
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
const season = transformToObject(model);
|
|
41
|
-
const matches = model.CompetitionMatches != null
|
|
42
|
-
? model.CompetitionMatches.map(matches => transformToAPIMatch(matches.Match))
|
|
43
|
-
: [];
|
|
44
|
-
const teams = model.Teams != null ? model.Teams.map(transformToAPITeam) : [];
|
|
45
|
-
const standings = season.standings.map(standing => {
|
|
46
|
-
const team = teams.find(t => standing.team.id === t.id);
|
|
47
|
-
if (team == null) {
|
|
48
|
-
throw new Error('TEAM_NOT_FOUND');
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
team,
|
|
52
|
-
lost03: standing.lost03,
|
|
53
|
-
lost13: standing.lost13,
|
|
54
|
-
lost23: standing.lost23,
|
|
55
|
-
matchesLost: standing.matchesLost,
|
|
56
|
-
matchesWon: standing.matchesWon,
|
|
57
|
-
points: standing.points,
|
|
58
|
-
pointsLost: standing.pointsLost,
|
|
59
|
-
pointsRatio: standing.pointsRatio,
|
|
60
|
-
pointsWon: standing.pointsWon,
|
|
61
|
-
setsLost: standing.setsLost,
|
|
62
|
-
setsRatio: standing.setsRatio,
|
|
63
|
-
setsWon: standing.setsWon,
|
|
64
|
-
won30: standing.won30,
|
|
65
|
-
won31: standing.won31,
|
|
66
|
-
won32: standing.won32,
|
|
67
|
-
totalMatches: standing.totalMatches
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
id: model.competition_id,
|
|
72
|
-
matches,
|
|
73
|
-
iteration: model.iteration,
|
|
74
|
-
league: model.LeagueSeason?.league != null ? transformToAPILeague(model.LeagueSeason.league) : undefined,
|
|
75
|
-
champion: model.CompetitionChampion != null ? transformToAPITeam(model.CompetitionChampion.team) : undefined,
|
|
76
|
-
teams,
|
|
77
|
-
standings
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
export { transformToObject as transformToSeason, transformToAPIObject as transformToAPISeason, transformToAttributes as transformFromSeason };
|
|
39
|
+
export { transformToObject as transformToSeason, transformToAttributes as transformFromSeason };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Team } from '../../service';
|
|
2
2
|
import { TeamAttributes, TeamModel } from '../models';
|
|
3
|
-
import { APITeam } from '../../api';
|
|
4
3
|
declare function transformToAttributes(team: Team): TeamAttributes;
|
|
5
4
|
declare function transformToObject(team: TeamModel): Team;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToTeam, transformToAPIObject as transformToAPITeam, transformToAttributes as transformFromTeam };
|
|
5
|
+
export { transformToObject as transformToTeam, transformToAttributes as transformFromTeam };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Team } from '../../service';
|
|
2
|
-
import { transformFromCoach,
|
|
2
|
+
import { transformFromCoach, transformToCoach, transformToCountry, transformToPlayer } from '.';
|
|
3
3
|
function transformToAttributes(team) {
|
|
4
4
|
return {
|
|
5
5
|
team_id: team.id,
|
|
@@ -23,15 +23,4 @@ function transformToObject(team) {
|
|
|
23
23
|
rating: team.rating
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
id: model.team_id,
|
|
29
|
-
name: model.name,
|
|
30
|
-
shortName: model.short_name,
|
|
31
|
-
country: model.country != null ? transformToCountry(model.country) : undefined,
|
|
32
|
-
coach: model.coach != null ? transformToAPICoach(model.coach) : undefined,
|
|
33
|
-
roster: model.PlayerTeams != null ? model.PlayerTeams.map(pt => transformToAPIPlayer(pt.player, model.team_id, pt.jersey_number)) : [],
|
|
34
|
-
league: model.league != null ? model.league.name : undefined
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export { transformToObject as transformToTeam, transformToAPIObject as transformToAPITeam, transformToAttributes as transformFromTeam };
|
|
26
|
+
export { transformToObject as transformToTeam, transformToAttributes as transformFromTeam };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { TournamentMatch } from '../../service';
|
|
2
|
-
import { APITournamentMatch } from '../../api';
|
|
3
2
|
import { CompetitionMatchAttributes, CompetitionMatchModel } from '../models';
|
|
4
3
|
declare function transformToAttributes(tournamentMatch: TournamentMatch, tournamentId: string): CompetitionMatchAttributes;
|
|
5
4
|
declare function transformToObject(model: CompetitionMatchModel): TournamentMatch;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToTournamentMatch, transformToAPIObject as transformToAPITournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
5
|
+
export { transformToObject as transformToTournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TournamentMatch } from '../../service';
|
|
2
|
-
import { transformFromMatch, transformFromStage,
|
|
2
|
+
import { transformFromMatch, transformFromStage, transformToMatch, transformToStage } from '.';
|
|
3
3
|
function transformToAttributes(tournamentMatch, tournamentId) {
|
|
4
4
|
return {
|
|
5
5
|
competition_id: tournamentId,
|
|
@@ -16,11 +16,4 @@ function transformToObject(model) {
|
|
|
16
16
|
index: model.index
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
index: model.index,
|
|
22
|
-
stage: transformToStage(model.stage),
|
|
23
|
-
match: transformToAPIMatch(model.Match, model.Competition)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export { transformToObject as transformToTournamentMatch, transformToAPIObject as transformToAPITournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
19
|
+
export { transformToObject as transformToTournamentMatch, transformToAttributes as transformFromTournamentMatch };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CompetitionAttributes, CompetitionModel } from '../models';
|
|
2
2
|
import { Tournament } from '../../service';
|
|
3
|
-
import { APITournament } from '../../api';
|
|
4
3
|
declare function transformToAttributes(tournament: Tournament): CompetitionAttributes;
|
|
5
4
|
declare function transformToObject(model: CompetitionModel): Tournament;
|
|
6
|
-
|
|
7
|
-
export { transformToObject as transformToTournament, transformToAPIObject as transformToAPITournament, transformToAttributes as transformFromTournament };
|
|
5
|
+
export { transformToObject as transformToTournament, transformToAttributes as transformFromTournament };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformFromTournamentMatch,
|
|
1
|
+
import { transformFromTournamentMatch, transformToIteration, transformToTeam, transformToTournamentMatch } from '.';
|
|
2
2
|
import { Tournament } from '../../service';
|
|
3
3
|
function transformToAttributes(tournament) {
|
|
4
4
|
const matches = tournament.matches.map(match => transformFromTournamentMatch(match, tournament.id));
|
|
@@ -30,13 +30,4 @@ function transformToObject(model) {
|
|
|
30
30
|
champion: model.CompetitionChampion != null ? transformToTeam(model.CompetitionChampion.team) : undefined
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
id: model.competition_id,
|
|
36
|
-
iteration: model.iteration,
|
|
37
|
-
champion: model.CompetitionChampion != null ? transformToAPITeam(model.CompetitionChampion.team) : undefined,
|
|
38
|
-
matches: model.CompetitionMatches != null ? model.CompetitionMatches.map(transformToAPITournamentMatch) : [],
|
|
39
|
-
teams: model.Teams != null ? model.Teams.map(transformToAPITeam) : []
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export { transformToObject as transformToTournament, transformToAPIObject as transformToAPITournament, transformToAttributes as transformFromTournament };
|
|
33
|
+
export { transformToObject as transformToTournament, transformToAttributes as transformFromTournament };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Trait } from '../../service';
|
|
2
2
|
import { TraitAttributes, TraitModel } from '../models';
|
|
3
|
-
import { APITrait } from '../../api';
|
|
4
3
|
declare function transformToAttributes(trait: Trait): TraitAttributes;
|
|
5
|
-
declare function transformToAPIObject(model: TraitModel): APITrait;
|
|
6
4
|
declare function transformToObject(model: TraitModel): Trait;
|
|
7
|
-
export { transformToObject as transformToTrait,
|
|
5
|
+
export { transformToObject as transformToTrait, transformToAttributes as transformFromTrait };
|
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
import { Trait } from '../../service';
|
|
2
|
-
import { APITrait } from '../../api';
|
|
3
2
|
function transformToAttributes(trait) {
|
|
4
3
|
return {
|
|
5
4
|
trait_id: trait.id,
|
|
6
5
|
name: trait.name
|
|
7
6
|
};
|
|
8
7
|
}
|
|
9
|
-
function transformToAPIObject(model) {
|
|
10
|
-
switch (model.name) {
|
|
11
|
-
case 'Master Mind':
|
|
12
|
-
return APITrait.MASTER_MIND;
|
|
13
|
-
case 'Moving Wall':
|
|
14
|
-
return APITrait.MOVING_WALL;
|
|
15
|
-
case 'Marksman':
|
|
16
|
-
return APITrait.MARKSMAN;
|
|
17
|
-
case 'Meteor Serve':
|
|
18
|
-
return APITrait.METEOR_SERVE;
|
|
19
|
-
case 'Squad Leader':
|
|
20
|
-
return APITrait.SQUAD_LEADER;
|
|
21
|
-
case 'Vigorous':
|
|
22
|
-
return APITrait.VIGOROUS;
|
|
23
|
-
case 'Guardian':
|
|
24
|
-
return APITrait.GUARDIAN;
|
|
25
|
-
default:
|
|
26
|
-
throw new Error('TRAIT_ERROR');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
8
|
function transformToObject(model) {
|
|
30
9
|
const trait = Trait.getTraits().find(trait => trait.id === model.trait_id);
|
|
31
10
|
if (trait == null) {
|
|
@@ -33,4 +12,4 @@ function transformToObject(model) {
|
|
|
33
12
|
}
|
|
34
13
|
return trait;
|
|
35
14
|
}
|
|
36
|
-
export { transformToObject as transformToTrait,
|
|
15
|
+
export { transformToObject as transformToTrait, transformToAttributes as transformFromTrait };
|
package/dist/esm/src/index.d.ts
CHANGED
package/dist/esm/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Match, MatchTeam } from '.';
|
|
2
2
|
import { CompetitionType } from '../../data';
|
|
3
|
-
interface
|
|
3
|
+
interface MatchRatingParams {
|
|
4
4
|
readonly match: Match;
|
|
5
5
|
readonly competitionType: CompetitionType;
|
|
6
6
|
}
|
|
@@ -27,7 +27,7 @@ export declare class MatchRating {
|
|
|
27
27
|
static MWF: MatchWeightFactor;
|
|
28
28
|
readonly match: Match;
|
|
29
29
|
readonly weight: number;
|
|
30
|
-
constructor({ match, competitionType }:
|
|
30
|
+
constructor({ match, competitionType }: MatchRatingParams);
|
|
31
31
|
getPoints(team: MatchTeam): number;
|
|
32
32
|
static calculateProbability(z: number): number;
|
|
33
33
|
getExpectedResult(): number;
|