volleyballsimtypes 0.0.134 → 0.0.136

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 (31) hide show
  1. package/dist/cjs/data/role.formula.json +6 -6
  2. package/dist/cjs/data/stat.formula.json +4 -4
  3. package/dist/cjs/src/data/models/set-position.d.ts +1 -1
  4. package/dist/cjs/src/data/models/set-position.js +1 -1
  5. package/dist/cjs/src/data/transformers/draft.js +1 -1
  6. package/dist/cjs/src/data/transformers/league.js +3 -1
  7. package/dist/cjs/src/data/transformers/match-set.js +14 -10
  8. package/dist/cjs/src/data/transformers/rally.js +1 -1
  9. package/dist/cjs/src/data/transformers/season.js +3 -3
  10. package/dist/cjs/src/data/transformers/set-position.d.ts +1 -1
  11. package/dist/cjs/src/data/transformers/team.js +3 -1
  12. package/dist/cjs/src/data/transformers/tournament.js +6 -6
  13. package/dist/cjs/src/data/transformers/trait.js +1 -1
  14. package/dist/cjs/src/service/coach/formation.d.ts +6 -6
  15. package/dist/cjs/src/service/coach/formation.js +18 -18
  16. package/dist/esm/data/role.formula.json +6 -6
  17. package/dist/esm/data/stat.formula.json +4 -4
  18. package/dist/esm/src/data/models/set-position.d.ts +1 -1
  19. package/dist/esm/src/data/models/set-position.js +1 -1
  20. package/dist/esm/src/data/transformers/draft.js +1 -1
  21. package/dist/esm/src/data/transformers/league.js +3 -1
  22. package/dist/esm/src/data/transformers/match-set.js +14 -10
  23. package/dist/esm/src/data/transformers/rally.js +1 -1
  24. package/dist/esm/src/data/transformers/season.js +3 -3
  25. package/dist/esm/src/data/transformers/set-position.d.ts +1 -1
  26. package/dist/esm/src/data/transformers/team.js +3 -1
  27. package/dist/esm/src/data/transformers/tournament.js +6 -6
  28. package/dist/esm/src/data/transformers/trait.js +1 -1
  29. package/dist/esm/src/service/coach/formation.d.ts +6 -6
  30. package/dist/esm/src/service/coach/formation.js +18 -18
  31. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "role": "Setter",
3
+ "role": "SETTER",
4
4
  "weight": {
5
5
  "serve": 0.2,
6
6
  "setting": 0.2475,
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  {
19
- "role": "Libero",
19
+ "role": "LIBERO",
20
20
  "weight": {
21
21
  "serve": 0.02,
22
22
  "setting": 0.045,
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  {
35
- "role": "Outside Hitter",
35
+ "role": "OUTSIDE_HITTER",
36
36
  "weight": {
37
37
  "serve": 0.2,
38
38
  "setting": 0,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  {
51
- "role": "Opposite Hitter",
51
+ "role": "OPPOSITE_HITTER",
52
52
  "weight": {
53
53
  "serve": 0.2,
54
54
  "setting": 0,
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  {
67
- "role": "Middle Blocker",
67
+ "role": "MIDDLE_BLOCKER",
68
68
  "weight": {
69
69
  "serve": 0.2,
70
70
  "setting": 0,
@@ -80,7 +80,7 @@
80
80
  }
81
81
  },
82
82
  {
83
- "role": "Defensive Specialist",
83
+ "role": "DEFENSIVE_SPECIALIST",
84
84
  "weight": {
85
85
  "serve": 0.005,
86
86
  "setting": 0.025,
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "statName": "Attack",
3
+ "statName": "ATTACK",
4
4
  "weight": {
5
5
  "serve": 0,
6
6
  "setting": 0.2,
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  {
19
- "statName": "Defense",
19
+ "statName": "DEFENSE",
20
20
  "weight": {
21
21
  "serve": 0,
22
22
  "setting": 0.02,
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  {
35
- "statName": "Physical",
35
+ "statName": "PHYSICAL",
36
36
  "weight": {
37
37
  "serve": 0,
38
38
  "setting": 0,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  {
51
- "statName": "Serve",
51
+ "statName": "SERVE",
52
52
  "weight": {
53
53
  "serve": 0.9,
54
54
  "setting": 0,
@@ -8,7 +8,7 @@ export interface SetPositionAttributes {
8
8
  court_position: CourtPositionType;
9
9
  }
10
10
  export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
11
- export type Side = 'Home' | 'Away';
11
+ export type Side = 'HOME' | 'AWAY';
12
12
  export type SetPositionPk = 'player_id' | 'match_set_id';
13
13
  export type SetPositionId = SetPositionModel[SetPositionPk];
14
14
  export type SetPositionCreationAttributes = SetPositionAttributes;
@@ -24,7 +24,7 @@ class SetPositionModel extends sequelize_1.Model {
24
24
  }
25
25
  },
26
26
  side: {
27
- type: sequelize_1.DataTypes.ENUM('Away', 'Home'),
27
+ type: sequelize_1.DataTypes.ENUM('AWAY', 'HOME'),
28
28
  allowNull: false
29
29
  },
30
30
  court_position: {
@@ -8,7 +8,7 @@ function transformToAttributes(draft) {
8
8
  draft_id: draft.id,
9
9
  start_date: draft.start,
10
10
  end_date: draft.end,
11
- DraftPicks: draft.picks.map(pick => (0, draft_pick_1.transformFromDraftPick)(pick, draft.id))
11
+ DraftPicks: draft.picks.map((pick) => (0, draft_pick_1.transformFromDraftPick)(pick, draft.id))
12
12
  };
13
13
  }
14
14
  exports.transformFromDraft = transformToAttributes;
@@ -19,7 +19,9 @@ function transformToAttributes(league) {
19
19
  }
20
20
  exports.transformFromLeague = transformToAttributes;
21
21
  function transformToObject(model) {
22
- const seasons = model.LeagueSeasons != null ? model.LeagueSeasons.map(ls => (0, _1.transformToSeason)(ls.competition)) : [];
22
+ const seasons = model.LeagueSeasons == null
23
+ ? []
24
+ : model.LeagueSeasons.map((ls) => (0, _1.transformToSeason)(ls.competition));
23
25
  return new service_1.League({
24
26
  id: model.league_id,
25
27
  name: model.name,
@@ -4,8 +4,8 @@ exports.transformFromMatchSet = exports.transformToMatchSet = void 0;
4
4
  const service_1 = require("../../service");
5
5
  const _1 = require(".");
6
6
  function transformToAttributes(set, matchId) {
7
- const homeSetPositions = set.homePlayerPosition.map(position => (0, _1.transformFromPlayerPosition)(position, 'Home', set.id));
8
- const awaySetPositions = set.awayPlayerPosition.map(position => (0, _1.transformFromPlayerPosition)(position, 'Away', set.id));
7
+ const homeSetPositions = set.homePlayerPosition.map(position => (0, _1.transformFromPlayerPosition)(position, 'HOME', set.id));
8
+ const awaySetPositions = set.awayPlayerPosition.map(position => (0, _1.transformFromPlayerPosition)(position, 'AWAY', set.id));
9
9
  return {
10
10
  match_set_id: set.id,
11
11
  match_id: matchId,
@@ -14,18 +14,22 @@ function transformToAttributes(set, matchId) {
14
14
  home_score: set.homeScore,
15
15
  away_score: set.awayScore,
16
16
  SetPositions: [...homeSetPositions, ...awaySetPositions],
17
- MatchSetStats: set.stats != null ? set.stats.map(stats => (0, _1.transformFromMatchSetStats)(stats, set.id)) : undefined,
18
- Rallies: set.rallies != null ? set.rallies.map(rally => (0, _1.transformFromRally)(rally, set.id)) : undefined
17
+ MatchSetStats: set.stats == null
18
+ ? undefined
19
+ : set.stats.map((stats) => (0, _1.transformFromMatchSetStats)(stats, set.id)),
20
+ Rallies: set.rallies == null
21
+ ? undefined
22
+ : set.rallies.map((rally) => (0, _1.transformFromRally)(rally, set.id))
19
23
  };
20
24
  }
21
25
  exports.transformFromMatchSet = transformToAttributes;
22
26
  function transformToObject(model) {
23
- const homePlayerPosition = model.SetPositions != null
24
- ? model.SetPositions.filter(p => p.side === 'Home').map(_1.transformToPlayerPosition)
25
- : [];
26
- const awayPlayerPosition = model.SetPositions != null
27
- ? model.SetPositions.filter(p => p.side === 'Away').map(_1.transformToPlayerPosition)
28
- : [];
27
+ const homePlayerPosition = model.SetPositions == null
28
+ ? []
29
+ : model.SetPositions.filter((p) => p.side === 'HOME').map(_1.transformToPlayerPosition);
30
+ const awayPlayerPosition = model.SetPositions == null
31
+ ? []
32
+ : model.SetPositions.filter((p) => p.side === 'AWAY').map(_1.transformToPlayerPosition);
29
33
  const stats = model.MatchSetStats != null ? model.MatchSetStats.map(_1.transformToMatchSetStats) : [];
30
34
  const rallies = model.Rallies != null ? model.Rallies.map(_1.transformToRally) : [];
31
35
  rallies.sort((r1, r2) => r1.order - r2.order);
@@ -5,7 +5,7 @@ const service_1 = require("../../service");
5
5
  const lz_string_1 = require("lz-string");
6
6
  const team_1 = require("./team");
7
7
  function transformToAttributes(rally, setId) {
8
- const events = `[${rally.events.map(e => {
8
+ const events = `[${rally.events.map((e) => {
9
9
  switch (e.eventType) {
10
10
  case service_1.EventTypeEnum.BLOCK:
11
11
  return e.toString();
@@ -29,9 +29,9 @@ function transformToAttributes(season, leagueId) {
29
29
  }
30
30
  exports.transformFromSeason = transformToAttributes;
31
31
  function transformToObject(model) {
32
- const matches = model.CompetitionMatches != null
33
- ? model.CompetitionMatches.map(matches => (0, _1.transformToMatch)(matches.Match))
34
- : [];
32
+ const matches = model.CompetitionMatches == null
33
+ ? []
34
+ : model.CompetitionMatches.map((matches) => (0, _1.transformToMatch)(matches.Match));
35
35
  return new service_1.Season({
36
36
  id: model.competition_id,
37
37
  matches,
@@ -1,5 +1,5 @@
1
1
  import { PlayerPosition } from '../../service';
2
2
  import { SetPositionAttributes, SetPositionModel } from '../models';
3
- declare function transformToAttributes(playerPosition: PlayerPosition, side: 'Home' | 'Away', setId: string): SetPositionAttributes;
3
+ declare function transformToAttributes(playerPosition: PlayerPosition, side: 'HOME' | 'AWAY', setId: string): SetPositionAttributes;
4
4
  declare function transformToObject(model: SetPositionModel): PlayerPosition;
5
5
  export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
@@ -23,7 +23,9 @@ function transformToObject(team) {
23
23
  shortName: team.short_name,
24
24
  country: team.country != null ? (0, _1.transformToCountry)(team.country) : undefined,
25
25
  coach: team.coach != null ? (0, _1.transformToCoach)(team.coach) : undefined,
26
- roster: team.PlayerTeams != null ? team.PlayerTeams.map(pt => (0, _1.transformToPlayer)(pt.player)) : [],
26
+ roster: team.PlayerTeams == null
27
+ ? []
28
+ : team.PlayerTeams.map((pt) => (0, _1.transformToPlayer)(pt.player)),
27
29
  rating: team.rating
28
30
  });
29
31
  }
@@ -4,17 +4,17 @@ exports.transformFromTournament = exports.transformToTournament = void 0;
4
4
  const _1 = require(".");
5
5
  const service_1 = require("../../service");
6
6
  function transformToAttributes(tournament) {
7
- const matches = tournament.matches.map(match => (0, _1.transformFromTournamentMatch)(match, tournament.id));
8
- const teams = tournament.teams.map(team => ({
7
+ const matches = tournament.matches.map((match) => (0, _1.transformFromTournamentMatch)(match, tournament.id));
8
+ const teams = tournament.teams.map((team) => ({
9
9
  competition_id: tournament.id,
10
10
  team_id: team.id
11
11
  }));
12
- const champion = tournament.champion != null
13
- ? {
12
+ const champion = tournament.champion == null
13
+ ? undefined
14
+ : {
14
15
  competition_id: tournament.id,
15
16
  team_id: tournament.champion?.id
16
- }
17
- : undefined;
17
+ };
18
18
  return {
19
19
  competition_id: tournament.id,
20
20
  type: 'TOURNAMENT',
@@ -10,7 +10,7 @@ function transformToAttributes(trait) {
10
10
  }
11
11
  exports.transformFromTrait = transformToAttributes;
12
12
  function transformToObject(model) {
13
- const trait = service_1.Trait.getTraits().find(trait => trait.id === model.trait_id);
13
+ const trait = service_1.Trait.getTraits().find((trait) => trait.id === model.trait_id);
14
14
  if (trait == null) {
15
15
  throw new Error('TRAIT_NOT_FOUND');
16
16
  }
@@ -9,12 +9,12 @@ interface PositionRole {
9
9
  readonly [CourtPosition.RIGHT_BACK]: Role[];
10
10
  }
11
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;
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
18
  }
19
19
  export declare class Formation {
20
20
  static readonly '5-1': Formation;
@@ -44,12 +44,12 @@ Formation['5-1'] = new Formation({
44
44
  [player_1.Role.LIBERO]
45
45
  ],
46
46
  liberoSubPriority: {
47
- 'Middle Blocker': 1,
48
- 'Outside Hitter': 10,
49
- 'Opposite Hitter': 100,
50
- 'Defensive Specialist': 1000,
51
- Setter: 10000,
52
- Libero: 100000
47
+ MIDDLE_BLOCKER: 1,
48
+ OUTSIDE_HITTER: 10,
49
+ OPPOSITE_HITTER: 100,
50
+ DEFENSIVE_SPECIALIST: 1000,
51
+ SETTER: 10000,
52
+ LIBERO: 100000
53
53
  }
54
54
  });
55
55
  Formation['4-2'] = new Formation({
@@ -80,12 +80,12 @@ Formation['4-2'] = new Formation({
80
80
  [player_1.Role.LIBERO]
81
81
  ],
82
82
  liberoSubPriority: {
83
- 'Middle Blocker': 1,
84
- 'Outside Hitter': 10,
85
- 'Opposite Hitter': 100,
86
- 'Defensive Specialist': 1000,
87
- Setter: 10000,
88
- Libero: 100000
83
+ MIDDLE_BLOCKER: 1,
84
+ OUTSIDE_HITTER: 10,
85
+ OPPOSITE_HITTER: 100,
86
+ DEFENSIVE_SPECIALIST: 1000,
87
+ SETTER: 10000,
88
+ LIBERO: 100000
89
89
  }
90
90
  });
91
91
  Formation['6-2'] = new Formation({
@@ -116,11 +116,11 @@ Formation['6-2'] = new Formation({
116
116
  [player_1.Role.LIBERO]
117
117
  ],
118
118
  liberoSubPriority: {
119
- 'Middle Blocker': 1,
120
- 'Outside Hitter': 10,
121
- 'Opposite Hitter': 100,
122
- 'Defensive Specialist': 1000,
123
- Setter: 10000,
124
- Libero: 100000
119
+ MIDDLE_BLOCKER: 1,
120
+ OUTSIDE_HITTER: 10,
121
+ OPPOSITE_HITTER: 100,
122
+ DEFENSIVE_SPECIALIST: 1000,
123
+ SETTER: 10000,
124
+ LIBERO: 100000
125
125
  }
126
126
  });
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "role": "Setter",
3
+ "role": "SETTER",
4
4
  "weight": {
5
5
  "serve": 0.2,
6
6
  "setting": 0.2475,
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  {
19
- "role": "Libero",
19
+ "role": "LIBERO",
20
20
  "weight": {
21
21
  "serve": 0.02,
22
22
  "setting": 0.045,
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  {
35
- "role": "Outside Hitter",
35
+ "role": "OUTSIDE_HITTER",
36
36
  "weight": {
37
37
  "serve": 0.2,
38
38
  "setting": 0,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  {
51
- "role": "Opposite Hitter",
51
+ "role": "OPPOSITE_HITTER",
52
52
  "weight": {
53
53
  "serve": 0.2,
54
54
  "setting": 0,
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  {
67
- "role": "Middle Blocker",
67
+ "role": "MIDDLE_BLOCKER",
68
68
  "weight": {
69
69
  "serve": 0.2,
70
70
  "setting": 0,
@@ -80,7 +80,7 @@
80
80
  }
81
81
  },
82
82
  {
83
- "role": "Defensive Specialist",
83
+ "role": "DEFENSIVE_SPECIALIST",
84
84
  "weight": {
85
85
  "serve": 0.005,
86
86
  "setting": 0.025,
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "statName": "Attack",
3
+ "statName": "ATTACK",
4
4
  "weight": {
5
5
  "serve": 0,
6
6
  "setting": 0.2,
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  {
19
- "statName": "Defense",
19
+ "statName": "DEFENSE",
20
20
  "weight": {
21
21
  "serve": 0,
22
22
  "setting": 0.02,
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  {
35
- "statName": "Physical",
35
+ "statName": "PHYSICAL",
36
36
  "weight": {
37
37
  "serve": 0,
38
38
  "setting": 0,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  {
51
- "statName": "Serve",
51
+ "statName": "SERVE",
52
52
  "weight": {
53
53
  "serve": 0.9,
54
54
  "setting": 0,
@@ -8,7 +8,7 @@ export interface SetPositionAttributes {
8
8
  court_position: CourtPositionType;
9
9
  }
10
10
  export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
11
- export type Side = 'Home' | 'Away';
11
+ export type Side = 'HOME' | 'AWAY';
12
12
  export type SetPositionPk = 'player_id' | 'match_set_id';
13
13
  export type SetPositionId = SetPositionModel[SetPositionPk];
14
14
  export type SetPositionCreationAttributes = SetPositionAttributes;
@@ -21,7 +21,7 @@ export class SetPositionModel extends Model {
21
21
  }
22
22
  },
23
23
  side: {
24
- type: DataTypes.ENUM('Away', 'Home'),
24
+ type: DataTypes.ENUM('AWAY', 'HOME'),
25
25
  allowNull: false
26
26
  },
27
27
  court_position: {
@@ -5,7 +5,7 @@ function transformToAttributes(draft) {
5
5
  draft_id: draft.id,
6
6
  start_date: draft.start,
7
7
  end_date: draft.end,
8
- DraftPicks: draft.picks.map(pick => transformFromDraftPick(pick, draft.id))
8
+ DraftPicks: draft.picks.map((pick) => transformFromDraftPick(pick, draft.id))
9
9
  };
10
10
  }
11
11
  function transformToObject(model) {
@@ -15,7 +15,9 @@ function transformToAttributes(league) {
15
15
  };
16
16
  }
17
17
  function transformToObject(model) {
18
- const seasons = model.LeagueSeasons != null ? model.LeagueSeasons.map(ls => transformToSeason(ls.competition)) : [];
18
+ const seasons = model.LeagueSeasons == null
19
+ ? []
20
+ : model.LeagueSeasons.map((ls) => transformToSeason(ls.competition));
19
21
  return new League({
20
22
  id: model.league_id,
21
23
  name: model.name,
@@ -1,8 +1,8 @@
1
1
  import { MatchSet } from '../../service';
2
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 => fromPosition(position, 'Home', set.id));
5
- const awaySetPositions = set.awayPlayerPosition.map(position => fromPosition(position, 'Away', set.id));
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,
@@ -11,17 +11,21 @@ function transformToAttributes(set, matchId) {
11
11
  home_score: set.homeScore,
12
12
  away_score: set.awayScore,
13
13
  SetPositions: [...homeSetPositions, ...awaySetPositions],
14
- MatchSetStats: set.stats != null ? set.stats.map(stats => transformFromMatchSetStats(stats, set.id)) : undefined,
15
- Rallies: set.rallies != null ? set.rallies.map(rally => transformFromRally(rally, set.id)) : undefined
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))
16
20
  };
17
21
  }
18
22
  function transformToObject(model) {
19
- const homePlayerPosition = model.SetPositions != null
20
- ? model.SetPositions.filter(p => p.side === 'Home').map(toPosition)
21
- : [];
22
- const awayPlayerPosition = model.SetPositions != null
23
- ? model.SetPositions.filter(p => p.side === 'Away').map(toPosition)
24
- : [];
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);
25
29
  const stats = model.MatchSetStats != null ? model.MatchSetStats.map(transformToMatchSetStats) : [];
26
30
  const rallies = model.Rallies != null ? model.Rallies.map(transformToRally) : [];
27
31
  rallies.sort((r1, r2) => r1.order - r2.order);
@@ -2,7 +2,7 @@ import { EventTypeEnum, Rally } from '../../service';
2
2
  import { compressToBase64, decompressFromBase64 } from 'lz-string';
3
3
  import { transformToTeam } from './team';
4
4
  function transformToAttributes(rally, setId) {
5
- const events = `[${rally.events.map(e => {
5
+ const events = `[${rally.events.map((e) => {
6
6
  switch (e.eventType) {
7
7
  case EventTypeEnum.BLOCK:
8
8
  return e.toString();
@@ -25,9 +25,9 @@ function transformToAttributes(season, leagueId) {
25
25
  };
26
26
  }
27
27
  function transformToObject(model) {
28
- const matches = model.CompetitionMatches != null
29
- ? model.CompetitionMatches.map(matches => transformToMatch(matches.Match))
30
- : [];
28
+ const matches = model.CompetitionMatches == null
29
+ ? []
30
+ : model.CompetitionMatches.map((matches) => transformToMatch(matches.Match));
31
31
  return new Season({
32
32
  id: model.competition_id,
33
33
  matches,
@@ -1,5 +1,5 @@
1
1
  import { PlayerPosition } from '../../service';
2
2
  import { SetPositionAttributes, SetPositionModel } from '../models';
3
- declare function transformToAttributes(playerPosition: PlayerPosition, side: 'Home' | 'Away', setId: string): SetPositionAttributes;
3
+ declare function transformToAttributes(playerPosition: PlayerPosition, side: 'HOME' | 'AWAY', setId: string): SetPositionAttributes;
4
4
  declare function transformToObject(model: SetPositionModel): PlayerPosition;
5
5
  export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
@@ -19,7 +19,9 @@ function transformToObject(team) {
19
19
  shortName: team.short_name,
20
20
  country: team.country != null ? transformToCountry(team.country) : undefined,
21
21
  coach: team.coach != null ? transformToCoach(team.coach) : undefined,
22
- roster: team.PlayerTeams != null ? team.PlayerTeams.map(pt => transformToPlayer(pt.player)) : [],
22
+ roster: team.PlayerTeams == null
23
+ ? []
24
+ : team.PlayerTeams.map((pt) => transformToPlayer(pt.player)),
23
25
  rating: team.rating
24
26
  });
25
27
  }
@@ -1,17 +1,17 @@
1
1
  import { transformFromTournamentMatch, transformToIteration, transformToTeam, transformToTournamentMatch } from '.';
2
2
  import { Tournament } from '../../service';
3
3
  function transformToAttributes(tournament) {
4
- const matches = tournament.matches.map(match => transformFromTournamentMatch(match, tournament.id));
5
- const teams = tournament.teams.map(team => ({
4
+ const matches = tournament.matches.map((match) => transformFromTournamentMatch(match, tournament.id));
5
+ const teams = tournament.teams.map((team) => ({
6
6
  competition_id: tournament.id,
7
7
  team_id: team.id
8
8
  }));
9
- const champion = tournament.champion != null
10
- ? {
9
+ const champion = tournament.champion == null
10
+ ? undefined
11
+ : {
11
12
  competition_id: tournament.id,
12
13
  team_id: tournament.champion?.id
13
- }
14
- : undefined;
14
+ };
15
15
  return {
16
16
  competition_id: tournament.id,
17
17
  type: 'TOURNAMENT',
@@ -6,7 +6,7 @@ function transformToAttributes(trait) {
6
6
  };
7
7
  }
8
8
  function transformToObject(model) {
9
- const trait = Trait.getTraits().find(trait => trait.id === model.trait_id);
9
+ const trait = Trait.getTraits().find((trait) => trait.id === model.trait_id);
10
10
  if (trait == null) {
11
11
  throw new Error('TRAIT_NOT_FOUND');
12
12
  }
@@ -9,12 +9,12 @@ interface PositionRole {
9
9
  readonly [CourtPosition.RIGHT_BACK]: Role[];
10
10
  }
11
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;
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
18
  }
19
19
  export declare class Formation {
20
20
  static readonly '5-1': Formation;
@@ -40,12 +40,12 @@ Formation['5-1'] = new Formation({
40
40
  [Role.LIBERO]
41
41
  ],
42
42
  liberoSubPriority: {
43
- 'Middle Blocker': 1,
44
- 'Outside Hitter': 10,
45
- 'Opposite Hitter': 100,
46
- 'Defensive Specialist': 1000,
47
- Setter: 10000,
48
- Libero: 100000
43
+ MIDDLE_BLOCKER: 1,
44
+ OUTSIDE_HITTER: 10,
45
+ OPPOSITE_HITTER: 100,
46
+ DEFENSIVE_SPECIALIST: 1000,
47
+ SETTER: 10000,
48
+ LIBERO: 100000
49
49
  }
50
50
  });
51
51
  Formation['4-2'] = new Formation({
@@ -76,12 +76,12 @@ Formation['4-2'] = new Formation({
76
76
  [Role.LIBERO]
77
77
  ],
78
78
  liberoSubPriority: {
79
- 'Middle Blocker': 1,
80
- 'Outside Hitter': 10,
81
- 'Opposite Hitter': 100,
82
- 'Defensive Specialist': 1000,
83
- Setter: 10000,
84
- Libero: 100000
79
+ MIDDLE_BLOCKER: 1,
80
+ OUTSIDE_HITTER: 10,
81
+ OPPOSITE_HITTER: 100,
82
+ DEFENSIVE_SPECIALIST: 1000,
83
+ SETTER: 10000,
84
+ LIBERO: 100000
85
85
  }
86
86
  });
87
87
  Formation['6-2'] = new Formation({
@@ -112,11 +112,11 @@ Formation['6-2'] = new Formation({
112
112
  [Role.LIBERO]
113
113
  ],
114
114
  liberoSubPriority: {
115
- 'Middle Blocker': 1,
116
- 'Outside Hitter': 10,
117
- 'Opposite Hitter': 100,
118
- 'Defensive Specialist': 1000,
119
- Setter: 10000,
120
- Libero: 100000
115
+ MIDDLE_BLOCKER: 1,
116
+ OUTSIDE_HITTER: 10,
117
+ OPPOSITE_HITTER: 100,
118
+ DEFENSIVE_SPECIALIST: 1000,
119
+ SETTER: 10000,
120
+ LIBERO: 100000
121
121
  }
122
122
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.134",
3
+ "version": "0.0.136",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",