volleyballsimtypes 0.0.139 → 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.
Files changed (185) hide show
  1. package/dist/esm/data/index.d.ts +3 -0
  2. package/dist/esm/data/index.js +3 -0
  3. package/dist/esm/data/init-models.d.ts +2 -0
  4. package/dist/esm/data/init-models.js +194 -0
  5. package/dist/esm/data/models/coach.d.ts +40 -0
  6. package/dist/esm/data/models/coach.js +51 -0
  7. package/dist/esm/data/models/competition-champion.d.ts +23 -0
  8. package/dist/esm/data/models/competition-champion.js +34 -0
  9. package/dist/esm/data/models/competition-match.d.ts +29 -0
  10. package/dist/esm/data/models/competition-match.js +42 -0
  11. package/dist/esm/data/models/competition-teams.d.ts +23 -0
  12. package/dist/esm/data/models/competition-teams.js +38 -0
  13. package/dist/esm/data/models/competition.d.ts +67 -0
  14. package/dist/esm/data/models/competition.js +34 -0
  15. package/dist/esm/data/models/country.d.ts +61 -0
  16. package/dist/esm/data/models/country.js +30 -0
  17. package/dist/esm/data/models/draft-pick.d.ts +31 -0
  18. package/dist/esm/data/models/draft-pick.js +46 -0
  19. package/dist/esm/data/models/draft.d.ts +29 -0
  20. package/dist/esm/data/models/draft.js +30 -0
  21. package/dist/esm/data/models/index.d.ts +24 -0
  22. package/dist/esm/data/models/index.js +24 -0
  23. package/dist/esm/data/models/iteration.d.ts +26 -0
  24. package/dist/esm/data/models/iteration.js +26 -0
  25. package/dist/esm/data/models/league-season.d.ts +23 -0
  26. package/dist/esm/data/models/league-season.js +34 -0
  27. package/dist/esm/data/models/league.d.ts +44 -0
  28. package/dist/esm/data/models/league.js +34 -0
  29. package/dist/esm/data/models/match-rating.d.ts +27 -0
  30. package/dist/esm/data/models/match-rating.js +48 -0
  31. package/dist/esm/data/models/match-set-stats.d.ts +58 -0
  32. package/dist/esm/data/models/match-set-stats.js +123 -0
  33. package/dist/esm/data/models/match-set.d.ts +85 -0
  34. package/dist/esm/data/models/match-set.js +47 -0
  35. package/dist/esm/data/models/match.d.ts +67 -0
  36. package/dist/esm/data/models/match.js +47 -0
  37. package/dist/esm/data/models/performance-stats.d.ts +40 -0
  38. package/dist/esm/data/models/performance-stats.js +81 -0
  39. package/dist/esm/data/models/player-team.d.ts +28 -0
  40. package/dist/esm/data/models/player-team.js +48 -0
  41. package/dist/esm/data/models/player-trait.d.ts +23 -0
  42. package/dist/esm/data/models/player-trait.js +38 -0
  43. package/dist/esm/data/models/player.d.ts +124 -0
  44. package/dist/esm/data/models/player.js +42 -0
  45. package/dist/esm/data/models/rally.d.ts +29 -0
  46. package/dist/esm/data/models/rally.js +46 -0
  47. package/dist/esm/data/models/set-position.d.ts +29 -0
  48. package/dist/esm/data/models/set-position.js +46 -0
  49. package/dist/esm/data/models/team.d.ts +162 -0
  50. package/dist/esm/data/models/team.js +59 -0
  51. package/dist/esm/data/models/trait.d.ts +37 -0
  52. package/dist/esm/data/models/trait.js +26 -0
  53. package/dist/esm/data/models/user.d.ts +22 -0
  54. package/dist/esm/data/models/user.js +53 -0
  55. package/dist/esm/data/transformers/coach.d.ts +5 -0
  56. package/dist/esm/data/transformers/coach.js +25 -0
  57. package/dist/esm/data/transformers/country.d.ts +5 -0
  58. package/dist/esm/data/transformers/country.js +16 -0
  59. package/dist/esm/data/transformers/court-position.d.ts +5 -0
  60. package/dist/esm/data/transformers/court-position.js +27 -0
  61. package/dist/esm/data/transformers/draft-pick.d.ts +5 -0
  62. package/dist/esm/data/transformers/draft-pick.js +18 -0
  63. package/dist/esm/data/transformers/draft.d.ts +5 -0
  64. package/dist/esm/data/transformers/draft.js +20 -0
  65. package/dist/esm/data/transformers/formation.d.ts +5 -0
  66. package/dist/esm/data/transformers/formation.js +8 -0
  67. package/dist/esm/data/transformers/index.d.ts +25 -0
  68. package/dist/esm/data/transformers/index.js +25 -0
  69. package/dist/esm/data/transformers/iteration.d.ts +5 -0
  70. package/dist/esm/data/transformers/iteration.js +14 -0
  71. package/dist/esm/data/transformers/league.d.ts +5 -0
  72. package/dist/esm/data/transformers/league.js +28 -0
  73. package/dist/esm/data/transformers/match-rating.d.ts +4 -0
  74. package/dist/esm/data/transformers/match-rating.js +13 -0
  75. package/dist/esm/data/transformers/match-set-stats.d.ts +5 -0
  76. package/dist/esm/data/transformers/match-set-stats.js +57 -0
  77. package/dist/esm/data/transformers/match-set.d.ts +5 -0
  78. package/dist/esm/data/transformers/match-set.js +44 -0
  79. package/dist/esm/data/transformers/match.d.ts +5 -0
  80. package/dist/esm/data/transformers/match.js +27 -0
  81. package/dist/esm/data/transformers/performance-stats.d.ts +5 -0
  82. package/dist/esm/data/transformers/performance-stats.js +33 -0
  83. package/dist/esm/data/transformers/player-team.d.ts +3 -0
  84. package/dist/esm/data/transformers/player-team.js +9 -0
  85. package/dist/esm/data/transformers/player.d.ts +5 -0
  86. package/dist/esm/data/transformers/player.js +26 -0
  87. package/dist/esm/data/transformers/rally.d.ts +5 -0
  88. package/dist/esm/data/transformers/rally.js +23 -0
  89. package/dist/esm/data/transformers/role.d.ts +5 -0
  90. package/dist/esm/data/transformers/role.js +23 -0
  91. package/dist/esm/data/transformers/season-match.d.ts +4 -0
  92. package/dist/esm/data/transformers/season-match.js +13 -0
  93. package/dist/esm/data/transformers/season.d.ts +5 -0
  94. package/dist/esm/data/transformers/season.js +39 -0
  95. package/dist/esm/data/transformers/set-position.d.ts +5 -0
  96. package/dist/esm/data/transformers/set-position.js +16 -0
  97. package/dist/esm/data/transformers/stage.d.ts +5 -0
  98. package/dist/esm/data/transformers/stage.js +21 -0
  99. package/dist/esm/data/transformers/team.d.ts +5 -0
  100. package/dist/esm/data/transformers/team.js +28 -0
  101. package/dist/esm/data/transformers/tournament-match.d.ts +5 -0
  102. package/dist/esm/data/transformers/tournament-match.js +19 -0
  103. package/dist/esm/data/transformers/tournament.d.ts +5 -0
  104. package/dist/esm/data/transformers/tournament.js +33 -0
  105. package/dist/esm/data/transformers/trait.d.ts +5 -0
  106. package/dist/esm/data/transformers/trait.js +15 -0
  107. package/dist/esm/index.d.ts +2 -0
  108. package/dist/esm/index.js +2 -0
  109. package/dist/esm/service/coach/coach.d.ts +19 -0
  110. package/dist/esm/service/coach/coach.js +11 -0
  111. package/dist/esm/service/coach/formation.d.ts +31 -0
  112. package/dist/esm/service/coach/formation.js +122 -0
  113. package/dist/esm/service/coach/index.d.ts +2 -0
  114. package/dist/esm/service/coach/index.js +2 -0
  115. package/dist/esm/service/competition/index.d.ts +11 -0
  116. package/dist/esm/service/competition/index.js +12 -0
  117. package/dist/esm/service/competition/iteration.d.ts +10 -0
  118. package/dist/esm/service/competition/iteration.js +8 -0
  119. package/dist/esm/service/competition/league.d.ts +16 -0
  120. package/dist/esm/service/competition/league.js +8 -0
  121. package/dist/esm/service/competition/season.d.ts +23 -0
  122. package/dist/esm/service/competition/season.js +27 -0
  123. package/dist/esm/service/competition/stage.d.ts +11 -0
  124. package/dist/esm/service/competition/stage.js +24 -0
  125. package/dist/esm/service/competition/standing.d.ts +28 -0
  126. package/dist/esm/service/competition/standing.js +76 -0
  127. package/dist/esm/service/competition/tournament-match.d.ts +14 -0
  128. package/dist/esm/service/competition/tournament-match.js +9 -0
  129. package/dist/esm/service/competition/tournament.d.ts +20 -0
  130. package/dist/esm/service/competition/tournament.js +18 -0
  131. package/dist/esm/service/country/country.d.ts +17 -0
  132. package/dist/esm/service/country/country.js +18 -0
  133. package/dist/esm/service/country/index.d.ts +1 -0
  134. package/dist/esm/service/country/index.js +1 -0
  135. package/dist/esm/service/draft/draft-pick.d.ts +14 -0
  136. package/dist/esm/service/draft/draft-pick.js +7 -0
  137. package/dist/esm/service/draft/draft.d.ts +15 -0
  138. package/dist/esm/service/draft/draft.js +8 -0
  139. package/dist/esm/service/draft/index.d.ts +2 -0
  140. package/dist/esm/service/draft/index.js +2 -0
  141. package/dist/esm/service/event/index.d.ts +1 -0
  142. package/dist/esm/service/event/index.js +1 -0
  143. package/dist/esm/service/event/rally-event.d.ts +20 -0
  144. package/dist/esm/service/event/rally-event.js +16 -0
  145. package/dist/esm/service/index.d.ts +9 -0
  146. package/dist/esm/service/index.js +9 -0
  147. package/dist/esm/service/match/court-position.d.ts +21 -0
  148. package/dist/esm/service/match/court-position.js +53 -0
  149. package/dist/esm/service/match/court-target-enum.d.ts +21 -0
  150. package/dist/esm/service/match/court-target-enum.js +54 -0
  151. package/dist/esm/service/match/index.d.ts +7 -0
  152. package/dist/esm/service/match/index.js +7 -0
  153. package/dist/esm/service/match/match-rating.d.ts +35 -0
  154. package/dist/esm/service/match/match-rating.js +61 -0
  155. package/dist/esm/service/match/match-set.d.ts +65 -0
  156. package/dist/esm/service/match/match-set.js +56 -0
  157. package/dist/esm/service/match/match-team.d.ts +7 -0
  158. package/dist/esm/service/match/match-team.js +17 -0
  159. package/dist/esm/service/match/match.d.ts +36 -0
  160. package/dist/esm/service/match/match.js +57 -0
  161. package/dist/esm/service/match/rally.d.ts +22 -0
  162. package/dist/esm/service/match/rally.js +13 -0
  163. package/dist/esm/service/player/index.d.ts +5 -0
  164. package/dist/esm/service/player/index.js +5 -0
  165. package/dist/esm/service/player/performance-stats.d.ts +30 -0
  166. package/dist/esm/service/player/performance-stats.js +34 -0
  167. package/dist/esm/service/player/player.d.ts +46 -0
  168. package/dist/esm/service/player/player.js +84 -0
  169. package/dist/esm/service/player/role.d.ts +17 -0
  170. package/dist/esm/service/player/role.js +42 -0
  171. package/dist/esm/service/player/stats.d.ts +11 -0
  172. package/dist/esm/service/player/stats.js +25 -0
  173. package/dist/esm/service/player/trait.d.ts +21 -0
  174. package/dist/esm/service/player/trait.js +108 -0
  175. package/dist/esm/service/team/index.d.ts +1 -0
  176. package/dist/esm/service/team/index.js +1 -0
  177. package/dist/esm/service/team/team.d.ts +31 -0
  178. package/dist/esm/service/team/team.js +32 -0
  179. package/dist/esm/service/utils/index.d.ts +2 -0
  180. package/dist/esm/service/utils/index.js +2 -0
  181. package/dist/esm/service/utils/object-utils.d.ts +1 -0
  182. package/dist/esm/service/utils/object-utils.js +1 -0
  183. package/dist/esm/service/utils/string-utils.d.ts +2 -0
  184. package/dist/esm/service/utils/string-utils.js +11 -0
  185. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { transformToPlayer, transformToTeam } from '.';
2
+ import { DraftPick } from '../../service';
3
+ function transformToAttributes(draftPick, draftId) {
4
+ return {
5
+ draft_id: draftId,
6
+ player_id: draftPick.pick.id,
7
+ team_id: draftPick.team.id,
8
+ priority: draftPick.priority
9
+ };
10
+ }
11
+ function transformToObject(model) {
12
+ return new DraftPick({
13
+ team: transformToTeam(model.team),
14
+ pick: transformToPlayer(model.player),
15
+ priority: model.priority
16
+ });
17
+ }
18
+ export { transformToObject as transformToDraftPick, transformToAttributes as transformFromDraftPick };
@@ -0,0 +1,5 @@
1
+ import { DraftAttributes, DraftModel } from '../models';
2
+ import { Draft } from '../../service';
3
+ declare function transformToAttributes(draft: Draft): DraftAttributes;
4
+ declare function transformToObject(model: DraftModel): Draft;
5
+ export { transformToObject as transformToDraft, transformToAttributes as transformFromDraft };
@@ -0,0 +1,20 @@
1
+ import { Draft } from '../../service';
2
+ import { transformFromDraftPick, transformToDraftPick } from './draft-pick';
3
+ function transformToAttributes(draft) {
4
+ return {
5
+ draft_id: draft.id,
6
+ start_date: draft.start,
7
+ end_date: draft.end,
8
+ DraftPicks: draft.picks.map((pick) => transformFromDraftPick(pick, draft.id))
9
+ };
10
+ }
11
+ function transformToObject(model) {
12
+ const picks = model.DraftPicks != null ? model.DraftPicks.map(transformToDraftPick) : [];
13
+ return new Draft({
14
+ id: model.draft_id,
15
+ start: new Date(model.start_date),
16
+ end: new Date(model.end_date),
17
+ picks
18
+ });
19
+ }
20
+ export { transformToObject as transformToDraft, transformToAttributes as transformFromDraft };
@@ -0,0 +1,5 @@
1
+ import { Formation } from '../../service';
2
+ import { FormationType } from '../models';
3
+ declare function transformToType(_formation: Formation): FormationType;
4
+ declare function transformFromType(_formation: FormationType): Formation;
5
+ export { transformToType as transformFromFormation, transformFromType as transformToFormation };
@@ -0,0 +1,8 @@
1
+ import { Formation } from '../../service';
2
+ function transformToType(_formation) {
3
+ return _formation.name;
4
+ }
5
+ function transformFromType(_formation) {
6
+ return Formation[_formation];
7
+ }
8
+ export { transformToType as transformFromFormation, transformFromType as transformToFormation };
@@ -0,0 +1,25 @@
1
+ export * from './coach';
2
+ export * from './country';
3
+ export * from './court-position';
4
+ export * from './formation';
5
+ export * from './iteration';
6
+ export * from './draft';
7
+ export * from './draft-pick';
8
+ export * from './league';
9
+ export * from './tournament';
10
+ export * from './tournament-match';
11
+ export * from './stage';
12
+ export * from './match';
13
+ export * from './match-set';
14
+ export * from './match-set-stats';
15
+ export * from './performance-stats';
16
+ export * from './player';
17
+ export * from './rally';
18
+ export * from './set-position';
19
+ export * from './role';
20
+ export * from './season';
21
+ export * from './season-match';
22
+ export * from './player-team';
23
+ export * from './match-rating';
24
+ export * from './team';
25
+ export * from './trait';
@@ -0,0 +1,25 @@
1
+ export * from './coach';
2
+ export * from './country';
3
+ export * from './court-position';
4
+ export * from './formation';
5
+ export * from './iteration';
6
+ export * from './draft';
7
+ export * from './draft-pick';
8
+ export * from './league';
9
+ export * from './tournament';
10
+ export * from './tournament-match';
11
+ export * from './stage';
12
+ export * from './match';
13
+ export * from './match-set';
14
+ export * from './match-set-stats';
15
+ export * from './performance-stats';
16
+ export * from './player';
17
+ export * from './rally';
18
+ export * from './set-position';
19
+ export * from './role';
20
+ export * from './season';
21
+ export * from './season-match';
22
+ export * from './player-team';
23
+ export * from './match-rating';
24
+ export * from './team';
25
+ export * from './trait';
@@ -0,0 +1,5 @@
1
+ import { IterationAttributes, IterationModel } from '../models';
2
+ import { Iteration } from '../../service';
3
+ declare function transformToAttributes(iteration: Iteration): IterationAttributes;
4
+ declare function transformToObject(model: IterationModel): Iteration;
5
+ export { transformToObject as transformToIteration, transformToAttributes as transformFromIteration };
@@ -0,0 +1,14 @@
1
+ import { Iteration } from '../../service';
2
+ function transformToAttributes(iteration) {
3
+ return {
4
+ iteration_id: iteration.id,
5
+ start_date: iteration.startDate
6
+ };
7
+ }
8
+ function transformToObject(model) {
9
+ return new Iteration({
10
+ id: model.iteration_id,
11
+ startDate: new Date(model.start_date)
12
+ });
13
+ }
14
+ export { transformToObject as transformToIteration, transformToAttributes as transformFromIteration };
@@ -0,0 +1,5 @@
1
+ import { LeagueAttributes, LeagueModel } from '../models';
2
+ import { League } from '../../service';
3
+ declare function transformToAttributes(league: League): LeagueAttributes;
4
+ declare function transformToObject(model: LeagueModel): League;
5
+ export { transformToObject as transformToLeague, transformToAttributes as transformFromLeague };
@@ -0,0 +1,28 @@
1
+ import { League } from '../../service';
2
+ import { transformToCountry, transformToSeason } from '.';
3
+ function transformToAttributes(league) {
4
+ const LeagueSeasons = league.seasons != null
5
+ ? league.seasons.map(season => ({
6
+ league_id: league.id,
7
+ competition_id: season.id
8
+ }))
9
+ : undefined;
10
+ return {
11
+ league_id: league.id,
12
+ country_id: league.country.id,
13
+ name: league.name,
14
+ LeagueSeasons
15
+ };
16
+ }
17
+ function transformToObject(model) {
18
+ const seasons = model.LeagueSeasons == null
19
+ ? []
20
+ : model.LeagueSeasons.map((ls) => transformToSeason(ls.competition));
21
+ return new League({
22
+ id: model.league_id,
23
+ name: model.name,
24
+ country: transformToCountry(model.country),
25
+ seasons
26
+ });
27
+ }
28
+ export { transformToObject as transformToLeague, transformToAttributes as transformFromLeague };
@@ -0,0 +1,4 @@
1
+ import { MatchRatingAttributes } from '../models';
2
+ import { MatchRating, MatchTeam } from '../../service';
3
+ declare function transformToAttributes(team: MatchTeam, rating: MatchRating): MatchRatingAttributes;
4
+ export { transformToAttributes as transformFromMatchRating };
@@ -0,0 +1,13 @@
1
+ import { MatchTeam } from '../../service';
2
+ function transformToAttributes(team, rating) {
3
+ const teamId = team === MatchTeam.HOME ? rating.match.homeTeam.id : rating.match.awayTeam.id;
4
+ if (team == null)
5
+ throw new Error(`INVALID_TEAM: ${teamId}`);
6
+ return {
7
+ match_id: rating.match.id,
8
+ team_id: teamId,
9
+ p: rating.getExpectedResult(),
10
+ dR: rating.getPoints(team)
11
+ };
12
+ }
13
+ export { transformToAttributes as transformFromMatchRating };
@@ -0,0 +1,5 @@
1
+ import { MatchSetStatsAttributes, MatchSetStatsModel } from '../models';
2
+ import { SetStatistics } from '../../service';
3
+ declare function transformToAttributes(stats: SetStatistics, setId: string): MatchSetStatsAttributes;
4
+ declare function transformToObject(model: MatchSetStatsModel): SetStatistics;
5
+ export { transformToObject as transformToMatchSetStats, transformToAttributes as transformFromMatchSetStats };
@@ -0,0 +1,57 @@
1
+ import { transformToPlayer } from '.';
2
+ function transformToAttributes(stats, setId) {
3
+ return {
4
+ player_id: stats.player.id,
5
+ match_set_id: setId,
6
+ aces: stats.ace,
7
+ assists: stats.assists,
8
+ attempts: stats.attempts,
9
+ attack_error: stats.attack.error,
10
+ attack_success: stats.attack.success,
11
+ serve_error: stats.serve.error,
12
+ serve_success: stats.serve.success,
13
+ reception_error: stats.reception.error,
14
+ reception_success: stats.reception.success,
15
+ set_error: stats.set.error,
16
+ set_success: stats.set.success,
17
+ block_error: stats.block.error,
18
+ block_success: stats.block.success,
19
+ rallies_played: stats.ralliesPlayed,
20
+ kills: stats.kills,
21
+ contacts: stats.contacts,
22
+ kill_blocks: stats.killBlocks
23
+ };
24
+ }
25
+ function transformToObject(model) {
26
+ return {
27
+ set: {
28
+ success: model.set_success,
29
+ error: model.set_error
30
+ },
31
+ attack: {
32
+ success: model.attack_success,
33
+ error: model.attack_error
34
+ },
35
+ serve: {
36
+ success: model.serve_success,
37
+ error: model.serve_error
38
+ },
39
+ reception: {
40
+ success: model.reception_success,
41
+ error: model.reception_error
42
+ },
43
+ block: {
44
+ success: model.block_success,
45
+ error: model.block_error
46
+ },
47
+ contacts: model.contacts,
48
+ kills: model.kills,
49
+ killBlocks: model.kill_blocks,
50
+ ace: model.aces,
51
+ assists: model.assists,
52
+ ralliesPlayed: model.rallies_played,
53
+ attempts: model.attempts,
54
+ player: transformToPlayer(model.player)
55
+ };
56
+ }
57
+ export { transformToObject as transformToMatchSetStats, transformToAttributes as transformFromMatchSetStats };
@@ -0,0 +1,5 @@
1
+ import { MatchSetAttributes, MatchSetModel } from '../models';
2
+ import { MatchSet } from '../../service';
3
+ declare function transformToAttributes(set: MatchSet, matchId: string): MatchSetAttributes;
4
+ declare function transformToObject(model: MatchSetModel): MatchSet;
5
+ export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
@@ -0,0 +1,44 @@
1
+ import { MatchSet } from '../../service';
2
+ import { transformFromMatchSetStats, transformFromPlayerPosition as fromPosition, transformFromRally, transformToMatchSetStats, transformToPlayerPosition as toPosition, transformToRally } from '.';
3
+ function transformToAttributes(set, matchId) {
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
+ return {
7
+ match_set_id: set.id,
8
+ match_id: matchId,
9
+ order: set.order,
10
+ is_tie_break: set.isTieBreak,
11
+ home_score: set.homeScore,
12
+ away_score: set.awayScore,
13
+ SetPositions: [...homeSetPositions, ...awaySetPositions],
14
+ MatchSetStats: set.stats == null
15
+ ? undefined
16
+ : set.stats.map((stats) => transformFromMatchSetStats(stats, set.id)),
17
+ Rallies: set.rallies == null
18
+ ? undefined
19
+ : set.rallies.map((rally) => transformFromRally(rally, set.id))
20
+ };
21
+ }
22
+ function transformToObject(model) {
23
+ const homePlayerPosition = model.SetPositions == null
24
+ ? []
25
+ : model.SetPositions.filter((p) => p.side === 'HOME').map(toPosition);
26
+ const awayPlayerPosition = model.SetPositions == null
27
+ ? []
28
+ : model.SetPositions.filter((p) => p.side === 'AWAY').map(toPosition);
29
+ const stats = model.MatchSetStats != null ? model.MatchSetStats.map(transformToMatchSetStats) : [];
30
+ const rallies = model.Rallies != null ? model.Rallies.map(transformToRally) : [];
31
+ rallies.sort((r1, r2) => r1.order - r2.order);
32
+ return new MatchSet({
33
+ id: model.match_id,
34
+ order: model.order,
35
+ homeScore: model.home_score,
36
+ awayScore: model.away_score,
37
+ isTieBreak: model.is_tie_break,
38
+ homePlayerPosition,
39
+ awayPlayerPosition,
40
+ rallies,
41
+ stats
42
+ });
43
+ }
44
+ export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
@@ -0,0 +1,5 @@
1
+ import { MatchAttributes, MatchModel } from '../models';
2
+ import { Match } from '../../service';
3
+ declare function transformToAttributes(match: Match): MatchAttributes;
4
+ declare function transformToObject(model: MatchModel): Match;
5
+ export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
@@ -0,0 +1,27 @@
1
+ import { Match } from '../../service';
2
+ import { transformToMatchSet } from './match-set';
3
+ import { transformToTeam } from './team';
4
+ function transformToAttributes(match) {
5
+ return {
6
+ match_id: match.id,
7
+ away_team: match.awayTeam.id,
8
+ home_team: match.homeTeam.id,
9
+ scheduled_date: match.scheduledDate,
10
+ is_simulated: match.isSimulated
11
+ };
12
+ }
13
+ function transformToObject(model) {
14
+ const sets = model.MatchSets == null || model.MatchSets.length < 1
15
+ ? []
16
+ : model.MatchSets.map(transformToMatchSet)
17
+ .sort((s1, s2) => s1.order - s2.order);
18
+ return new Match({
19
+ id: model.match_id,
20
+ homeTeam: transformToTeam(model.HomeTeam),
21
+ awayTeam: transformToTeam(model.AwayTeam),
22
+ scheduledDate: new Date(model.scheduled_date),
23
+ sets,
24
+ isSimulated: model.is_simulated
25
+ });
26
+ }
27
+ export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
@@ -0,0 +1,5 @@
1
+ import { PerformanceStatsAttributes, PerformanceStatsModel } from '../models';
2
+ import { PerformanceStats, Player } from '../../service';
3
+ declare function transformToAttributes(player: Player): PerformanceStatsAttributes;
4
+ declare function transformToObject(model: PerformanceStatsModel): PerformanceStats;
5
+ export { transformToObject as transformToPerformanceStats, transformToAttributes as transformFromPerformanceStats };
@@ -0,0 +1,33 @@
1
+ import { PerformanceStats } from '../../service';
2
+ function transformToAttributes(player) {
3
+ return {
4
+ player_id: player.id,
5
+ back_attack: player.stats.backAttack,
6
+ block: player.stats.block,
7
+ awareness: player.stats.awareness,
8
+ defense: player.stats.defense,
9
+ jump: player.stats.jump,
10
+ pass: player.stats.pass,
11
+ serve: player.stats.serve,
12
+ reception: player.stats.reception,
13
+ setting: player.stats.setting,
14
+ spike: player.stats.spike,
15
+ stamina: player.stats.stamina
16
+ };
17
+ }
18
+ function transformToObject(model) {
19
+ return new PerformanceStats({
20
+ awareness: model.awareness,
21
+ defense: model.defense,
22
+ jump: model.jump,
23
+ pass: model.pass,
24
+ serve: model.serve,
25
+ reception: model.reception,
26
+ setting: model.setting,
27
+ spike: model.spike,
28
+ stamina: model.stamina,
29
+ block: model.block,
30
+ backAttack: model.back_attack
31
+ });
32
+ }
33
+ export { transformToObject as transformToPerformanceStats, transformToAttributes as transformFromPerformanceStats };
@@ -0,0 +1,3 @@
1
+ import { PlayerTeamAttributes } from '../models';
2
+ declare function transformToAttributes(playerId: string, teamId: string, jerseyNumber: number, active?: boolean): PlayerTeamAttributes;
3
+ export { transformToAttributes as transformFromPlayerTeam };
@@ -0,0 +1,9 @@
1
+ function transformToAttributes(playerId, teamId, jerseyNumber, active = false) {
2
+ return {
3
+ player_id: playerId,
4
+ team_id: teamId,
5
+ jersey_number: jerseyNumber,
6
+ active
7
+ };
8
+ }
9
+ export { transformToAttributes as transformFromPlayerTeam };
@@ -0,0 +1,5 @@
1
+ import { PlayerAttributes, PlayerModel } from '../models';
2
+ import { Player } from '../../service';
3
+ declare function transformToAttributes(player: Player): PlayerAttributes;
4
+ declare function transformToObject(model: PlayerModel): Player;
5
+ export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
@@ -0,0 +1,26 @@
1
+ import { Player } from '../../service';
2
+ import { transformFromPerformanceStats, transformFromRole, transformToCountry, transformToPerformanceStats, transformToRole, transformToTrait } from '.';
3
+ function transformToAttributes(player) {
4
+ return {
5
+ player_id: player.id,
6
+ country_id: player.country.id,
7
+ first_name: player.name.first,
8
+ last_name: player.name.last,
9
+ roles: player.roles.map(transformFromRole),
10
+ PerformanceStat: transformFromPerformanceStats(player)
11
+ };
12
+ }
13
+ function transformToObject(model) {
14
+ return new Player({
15
+ id: model.player_id,
16
+ name: {
17
+ first: model.first_name,
18
+ last: model.last_name
19
+ },
20
+ country: transformToCountry(model.country),
21
+ roles: model.roles.map(transformToRole),
22
+ traits: model.Traits.map(transformToTrait),
23
+ stats: transformToPerformanceStats(model.PerformanceStat)
24
+ });
25
+ }
26
+ export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
@@ -0,0 +1,5 @@
1
+ import { RallyAttributes, RallyModel } from '../models';
2
+ import { Rally } from '../../service';
3
+ declare function transformToAttributes(rally: Rally, setId: string): RallyAttributes;
4
+ declare function transformToObject(model: RallyModel): Rally;
5
+ export { transformToObject as transformToRally, transformToAttributes as transformFromRally };
@@ -0,0 +1,23 @@
1
+ import { Rally } from '../../service';
2
+ import { compressToBase64, decompressFromBase64 } from 'lz-string';
3
+ import { transformToTeam } from './team';
4
+ function transformToAttributes(rally, setId) {
5
+ const events = `[${rally.events.map((e) => e.toString()).join(',')}]`;
6
+ return {
7
+ rally_id: rally.id,
8
+ match_set_id: setId,
9
+ order: rally.order,
10
+ serving_team: rally.servingTeam.id,
11
+ events: compressToBase64(events)
12
+ };
13
+ }
14
+ function transformToObject(model) {
15
+ const events = JSON.parse(decompressFromBase64(model.events));
16
+ return new Rally({
17
+ id: model.rally_id,
18
+ order: model.order,
19
+ servingTeam: transformToTeam(model.ServingTeam),
20
+ events
21
+ });
22
+ }
23
+ export { transformToObject as transformToRally, transformToAttributes as transformFromRally };
@@ -0,0 +1,5 @@
1
+ import { Role } from '../../service';
2
+ import { RoleType } from '../models';
3
+ declare function transformToType(role: Role): RoleType;
4
+ declare function transformFromType(role: RoleType): Role;
5
+ export { transformToType as transformFromRole, transformFromType as transformToRole };
@@ -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 };