volleyballsimtypes 0.0.208 → 0.0.210
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/init-models.js +1 -0
- package/dist/cjs/src/data/models/player.d.ts +5 -1
- package/dist/cjs/src/data/transformers/player.js +46 -1
- package/dist/cjs/src/data/transformers/team.js +4 -1
- package/dist/cjs/src/service/match/box-score.d.ts +9 -0
- package/dist/cjs/src/service/player/player.d.ts +4 -2
- package/dist/cjs/src/service/player/player.js +2 -1
- package/dist/esm/src/data/init-models.js +1 -0
- package/dist/esm/src/data/models/player.d.ts +5 -1
- package/dist/esm/src/data/transformers/player.js +46 -1
- package/dist/esm/src/data/transformers/team.js +4 -1
- package/dist/esm/src/service/match/box-score.d.ts +9 -0
- package/dist/esm/src/service/player/player.d.ts +4 -2
- package/dist/esm/src/service/player/player.js +2 -1
- package/package.json +1 -1
|
@@ -113,6 +113,7 @@ function initModels(sequelize) {
|
|
|
113
113
|
Player.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'player_id' });
|
|
114
114
|
Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
|
|
115
115
|
Player.hasOne(PerformanceStats, { as: 'PerformanceStat', foreignKey: 'player_id' });
|
|
116
|
+
Player.hasOne(BoxScoreTotals, { as: 'BoxScoreTotals', foreignKey: 'player_id' });
|
|
116
117
|
PlayerTeam.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
117
118
|
PlayerTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
118
119
|
Rally.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel, VPERId, VPERModel } from '.';
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, BoxScoreTotalsId, BoxScoreTotalsModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel, VPERId, VPERModel } from '.';
|
|
4
4
|
import { Rarity, Role, Trait } from '../../service';
|
|
5
5
|
export interface PlayerAttributes {
|
|
6
6
|
player_id: string;
|
|
@@ -58,6 +58,10 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
58
58
|
getPerformanceStat: Sequelize.HasOneGetAssociationMixin<PerformanceStatsModel>;
|
|
59
59
|
setPerformanceStat: Sequelize.HasOneSetAssociationMixin<PerformanceStatsModel, PerformanceStatsId>;
|
|
60
60
|
createPerformanceStat: Sequelize.HasOneCreateAssociationMixin<PerformanceStatsModel>;
|
|
61
|
+
BoxScoreTotals: BoxScoreTotalsModel;
|
|
62
|
+
getBoxScoreTotals: Sequelize.HasOneGetAssociationMixin<BoxScoreTotalsModel>;
|
|
63
|
+
setBoxScoreTotals: Sequelize.HasOneSetAssociationMixin<BoxScoreTotalsModel, BoxScoreTotalsId>;
|
|
64
|
+
createBoxScoreTotals: Sequelize.HasOneCreateAssociationMixin<BoxScoreTotalsModel>;
|
|
61
65
|
VPERs: VPERModel[];
|
|
62
66
|
getVPERs: Sequelize.HasManyGetAssociationsMixin<VPERModel>;
|
|
63
67
|
setVPERs: Sequelize.HasManySetAssociationsMixin<VPERModel, VPERId>;
|
|
@@ -16,7 +16,51 @@ function transformToAttributes(player) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
exports.transformFromPlayer = transformToAttributes;
|
|
19
|
+
function transformToBoxScoreTotals(model) {
|
|
20
|
+
return {
|
|
21
|
+
attack: {
|
|
22
|
+
attempts: model.attack_attempts,
|
|
23
|
+
kills: model.attack_kills,
|
|
24
|
+
errors: model.attack_errors
|
|
25
|
+
},
|
|
26
|
+
serve: {
|
|
27
|
+
attempts: model.serve_attempts,
|
|
28
|
+
aces: model.serve_aces,
|
|
29
|
+
errors: model.serve_errors
|
|
30
|
+
},
|
|
31
|
+
reception: {
|
|
32
|
+
attempts: model.reception_attempts,
|
|
33
|
+
perfect: model.reception_perfect,
|
|
34
|
+
positive: model.reception_positive,
|
|
35
|
+
overpasses: model.reception_overpasses,
|
|
36
|
+
errors: model.reception_errors
|
|
37
|
+
},
|
|
38
|
+
block: {
|
|
39
|
+
solo: model.block_solo,
|
|
40
|
+
assists: model.block_assists,
|
|
41
|
+
errors: model.block_errors,
|
|
42
|
+
touches: model.block_touches
|
|
43
|
+
},
|
|
44
|
+
setting: {
|
|
45
|
+
assists: model.setting_assists,
|
|
46
|
+
pass: model.setting_pass,
|
|
47
|
+
errors: model.setting_errors
|
|
48
|
+
},
|
|
49
|
+
defense: {
|
|
50
|
+
digs: model.defense_digs,
|
|
51
|
+
errors: model.defense_errors
|
|
52
|
+
},
|
|
53
|
+
misc: {
|
|
54
|
+
pointsPlayed: model.misc_points_played,
|
|
55
|
+
pointsWonOnCourt: model.misc_points_won_on_court,
|
|
56
|
+
serveTurns: model.misc_serve_turns,
|
|
57
|
+
sideoutOpportunities: model.misc_sideout_opportunities,
|
|
58
|
+
successfulSideouts: model.misc_successful_sideouts
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
19
62
|
function transformToObject(model) {
|
|
63
|
+
const boxScoreTotals = model.BoxScoreTotals != null ? transformToBoxScoreTotals(model.BoxScoreTotals) : undefined;
|
|
20
64
|
return new service_1.Player({
|
|
21
65
|
id: model.player_id,
|
|
22
66
|
name: {
|
|
@@ -28,7 +72,8 @@ function transformToObject(model) {
|
|
|
28
72
|
traits: model.traits,
|
|
29
73
|
stats: (0, _1.transformToPerformanceStats)(model.PerformanceStat),
|
|
30
74
|
rarity: model.rarity,
|
|
31
|
-
boxScores: (model.BoxScores ?? []).map(_1.transformToBoxScore)
|
|
75
|
+
boxScores: (model.BoxScores ?? []).map(_1.transformToBoxScore),
|
|
76
|
+
boxScoreTotals
|
|
32
77
|
});
|
|
33
78
|
}
|
|
34
79
|
exports.transformToPlayer = transformToObject;
|
|
@@ -17,13 +17,16 @@ function transformToAttributes(team) {
|
|
|
17
17
|
exports.transformFromTeam = transformToAttributes;
|
|
18
18
|
function transformToObject(model) {
|
|
19
19
|
const roster = (model.PlayerTeams ?? []).map((pt) => (0, _1.transformToPlayer)(pt.player));
|
|
20
|
+
const tactics = model.tactics != null && roster != null && roster.length > 0
|
|
21
|
+
? (0, _1.transformToTactics)(model.tactics, roster)
|
|
22
|
+
: undefined;
|
|
20
23
|
return new service_1.Team({
|
|
21
24
|
id: model.team_id,
|
|
22
25
|
name: model.name,
|
|
23
26
|
shortName: model.short_name,
|
|
24
27
|
country: (0, _1.transformToCountry)(model.country),
|
|
25
28
|
rating: model.rating,
|
|
26
|
-
tactics
|
|
29
|
+
tactics,
|
|
27
30
|
roster,
|
|
28
31
|
divisionId: model.division_id
|
|
29
32
|
});
|
|
@@ -62,6 +62,15 @@ export interface BoxScore {
|
|
|
62
62
|
defense: DefenseStats;
|
|
63
63
|
misc: MiscStats;
|
|
64
64
|
}
|
|
65
|
+
export interface BoxScoreTotals {
|
|
66
|
+
attack: AttackStats;
|
|
67
|
+
serve: ServeStats;
|
|
68
|
+
reception: ReceptionStats;
|
|
69
|
+
block: BlockStats;
|
|
70
|
+
setting: SettingStats;
|
|
71
|
+
defense: DefenseStats;
|
|
72
|
+
misc: MiscStats;
|
|
73
|
+
}
|
|
65
74
|
/**
|
|
66
75
|
* Utility: zeroed-out stat factories
|
|
67
76
|
* ==================================
|
|
@@ -4,7 +4,7 @@ import { Country } from '../country';
|
|
|
4
4
|
import { Rarity } from './rarity';
|
|
5
5
|
import { Stats } from './stats';
|
|
6
6
|
import { Role } from './role';
|
|
7
|
-
import { BoxScore } from '../match';
|
|
7
|
+
import { BoxScore, BoxScoreTotals } from '../match';
|
|
8
8
|
export declare class Stat {
|
|
9
9
|
readonly name: Stats;
|
|
10
10
|
readonly value: number;
|
|
@@ -23,6 +23,7 @@ interface PlayerParams {
|
|
|
23
23
|
readonly traits: Trait[];
|
|
24
24
|
readonly rarity: Rarity;
|
|
25
25
|
readonly boxScores?: BoxScore[];
|
|
26
|
+
readonly boxScoreTotals?: BoxScoreTotals;
|
|
26
27
|
}
|
|
27
28
|
export declare class Name {
|
|
28
29
|
readonly first: string;
|
|
@@ -43,7 +44,8 @@ export declare class Player {
|
|
|
43
44
|
readonly generalStats: Stat[];
|
|
44
45
|
readonly rarity: Rarity;
|
|
45
46
|
readonly boxScores?: BoxScore[];
|
|
46
|
-
|
|
47
|
+
readonly boxScoreTotals?: BoxScoreTotals;
|
|
48
|
+
constructor({ id, name, country, stats, roles, traits, rarity, boxScores, boxScoreTotals }: PlayerParams);
|
|
47
49
|
static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
|
|
48
50
|
static compareStats(p1: Player, p2: Player): number;
|
|
49
51
|
toString(): string;
|
|
@@ -25,7 +25,7 @@ class Name {
|
|
|
25
25
|
}
|
|
26
26
|
exports.Name = Name;
|
|
27
27
|
class Player {
|
|
28
|
-
constructor({ id, name, country, stats, roles, traits, rarity, boxScores }) {
|
|
28
|
+
constructor({ id, name, country, stats, roles, traits, rarity, boxScores, boxScoreTotals }) {
|
|
29
29
|
(0, utils_1.validateUUID)(id);
|
|
30
30
|
this.id = id;
|
|
31
31
|
this.name = name;
|
|
@@ -35,6 +35,7 @@ class Player {
|
|
|
35
35
|
this.traits = traits;
|
|
36
36
|
this.rarity = rarity;
|
|
37
37
|
this.boxScores = boxScores;
|
|
38
|
+
this.boxScoreTotals = boxScoreTotals;
|
|
38
39
|
this.generalStats = Object.values(stats_1.StatsEnum).map((stat) => ({
|
|
39
40
|
name: stat,
|
|
40
41
|
value: (0, stats_1.calculateStatScore)(stats, stat)
|
|
@@ -110,6 +110,7 @@ export function initModels(sequelize) {
|
|
|
110
110
|
Player.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'player_id' });
|
|
111
111
|
Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
|
|
112
112
|
Player.hasOne(PerformanceStats, { as: 'PerformanceStat', foreignKey: 'player_id' });
|
|
113
|
+
Player.hasOne(BoxScoreTotals, { as: 'BoxScoreTotals', foreignKey: 'player_id' });
|
|
113
114
|
PlayerTeam.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
114
115
|
PlayerTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
115
116
|
Rally.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel, VPERId, VPERModel } from '.';
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, BoxScoreTotalsId, BoxScoreTotalsModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel, VPERId, VPERModel } from '.';
|
|
4
4
|
import { Rarity, Role, Trait } from '../../service';
|
|
5
5
|
export interface PlayerAttributes {
|
|
6
6
|
player_id: string;
|
|
@@ -58,6 +58,10 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
58
58
|
getPerformanceStat: Sequelize.HasOneGetAssociationMixin<PerformanceStatsModel>;
|
|
59
59
|
setPerformanceStat: Sequelize.HasOneSetAssociationMixin<PerformanceStatsModel, PerformanceStatsId>;
|
|
60
60
|
createPerformanceStat: Sequelize.HasOneCreateAssociationMixin<PerformanceStatsModel>;
|
|
61
|
+
BoxScoreTotals: BoxScoreTotalsModel;
|
|
62
|
+
getBoxScoreTotals: Sequelize.HasOneGetAssociationMixin<BoxScoreTotalsModel>;
|
|
63
|
+
setBoxScoreTotals: Sequelize.HasOneSetAssociationMixin<BoxScoreTotalsModel, BoxScoreTotalsId>;
|
|
64
|
+
createBoxScoreTotals: Sequelize.HasOneCreateAssociationMixin<BoxScoreTotalsModel>;
|
|
61
65
|
VPERs: VPERModel[];
|
|
62
66
|
getVPERs: Sequelize.HasManyGetAssociationsMixin<VPERModel>;
|
|
63
67
|
setVPERs: Sequelize.HasManySetAssociationsMixin<VPERModel, VPERId>;
|
|
@@ -12,7 +12,51 @@ function transformToAttributes(player) {
|
|
|
12
12
|
rarity: player.rarity
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
function transformToBoxScoreTotals(model) {
|
|
16
|
+
return {
|
|
17
|
+
attack: {
|
|
18
|
+
attempts: model.attack_attempts,
|
|
19
|
+
kills: model.attack_kills,
|
|
20
|
+
errors: model.attack_errors
|
|
21
|
+
},
|
|
22
|
+
serve: {
|
|
23
|
+
attempts: model.serve_attempts,
|
|
24
|
+
aces: model.serve_aces,
|
|
25
|
+
errors: model.serve_errors
|
|
26
|
+
},
|
|
27
|
+
reception: {
|
|
28
|
+
attempts: model.reception_attempts,
|
|
29
|
+
perfect: model.reception_perfect,
|
|
30
|
+
positive: model.reception_positive,
|
|
31
|
+
overpasses: model.reception_overpasses,
|
|
32
|
+
errors: model.reception_errors
|
|
33
|
+
},
|
|
34
|
+
block: {
|
|
35
|
+
solo: model.block_solo,
|
|
36
|
+
assists: model.block_assists,
|
|
37
|
+
errors: model.block_errors,
|
|
38
|
+
touches: model.block_touches
|
|
39
|
+
},
|
|
40
|
+
setting: {
|
|
41
|
+
assists: model.setting_assists,
|
|
42
|
+
pass: model.setting_pass,
|
|
43
|
+
errors: model.setting_errors
|
|
44
|
+
},
|
|
45
|
+
defense: {
|
|
46
|
+
digs: model.defense_digs,
|
|
47
|
+
errors: model.defense_errors
|
|
48
|
+
},
|
|
49
|
+
misc: {
|
|
50
|
+
pointsPlayed: model.misc_points_played,
|
|
51
|
+
pointsWonOnCourt: model.misc_points_won_on_court,
|
|
52
|
+
serveTurns: model.misc_serve_turns,
|
|
53
|
+
sideoutOpportunities: model.misc_sideout_opportunities,
|
|
54
|
+
successfulSideouts: model.misc_successful_sideouts
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
15
58
|
function transformToObject(model) {
|
|
59
|
+
const boxScoreTotals = model.BoxScoreTotals != null ? transformToBoxScoreTotals(model.BoxScoreTotals) : undefined;
|
|
16
60
|
return new Player({
|
|
17
61
|
id: model.player_id,
|
|
18
62
|
name: {
|
|
@@ -24,7 +68,8 @@ function transformToObject(model) {
|
|
|
24
68
|
traits: model.traits,
|
|
25
69
|
stats: transformToPerformanceStats(model.PerformanceStat),
|
|
26
70
|
rarity: model.rarity,
|
|
27
|
-
boxScores: (model.BoxScores ?? []).map(transformToBoxScore)
|
|
71
|
+
boxScores: (model.BoxScores ?? []).map(transformToBoxScore),
|
|
72
|
+
boxScoreTotals
|
|
28
73
|
});
|
|
29
74
|
}
|
|
30
75
|
export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
|
|
@@ -13,13 +13,16 @@ function transformToAttributes(team) {
|
|
|
13
13
|
}
|
|
14
14
|
function transformToObject(model) {
|
|
15
15
|
const roster = (model.PlayerTeams ?? []).map((pt) => transformToPlayer(pt.player));
|
|
16
|
+
const tactics = model.tactics != null && roster != null && roster.length > 0
|
|
17
|
+
? transformToTactics(model.tactics, roster)
|
|
18
|
+
: undefined;
|
|
16
19
|
return new Team({
|
|
17
20
|
id: model.team_id,
|
|
18
21
|
name: model.name,
|
|
19
22
|
shortName: model.short_name,
|
|
20
23
|
country: transformToCountry(model.country),
|
|
21
24
|
rating: model.rating,
|
|
22
|
-
tactics
|
|
25
|
+
tactics,
|
|
23
26
|
roster,
|
|
24
27
|
divisionId: model.division_id
|
|
25
28
|
});
|
|
@@ -62,6 +62,15 @@ export interface BoxScore {
|
|
|
62
62
|
defense: DefenseStats;
|
|
63
63
|
misc: MiscStats;
|
|
64
64
|
}
|
|
65
|
+
export interface BoxScoreTotals {
|
|
66
|
+
attack: AttackStats;
|
|
67
|
+
serve: ServeStats;
|
|
68
|
+
reception: ReceptionStats;
|
|
69
|
+
block: BlockStats;
|
|
70
|
+
setting: SettingStats;
|
|
71
|
+
defense: DefenseStats;
|
|
72
|
+
misc: MiscStats;
|
|
73
|
+
}
|
|
65
74
|
/**
|
|
66
75
|
* Utility: zeroed-out stat factories
|
|
67
76
|
* ==================================
|
|
@@ -4,7 +4,7 @@ import { Country } from '../country';
|
|
|
4
4
|
import { Rarity } from './rarity';
|
|
5
5
|
import { Stats } from './stats';
|
|
6
6
|
import { Role } from './role';
|
|
7
|
-
import { BoxScore } from '../match';
|
|
7
|
+
import { BoxScore, BoxScoreTotals } from '../match';
|
|
8
8
|
export declare class Stat {
|
|
9
9
|
readonly name: Stats;
|
|
10
10
|
readonly value: number;
|
|
@@ -23,6 +23,7 @@ interface PlayerParams {
|
|
|
23
23
|
readonly traits: Trait[];
|
|
24
24
|
readonly rarity: Rarity;
|
|
25
25
|
readonly boxScores?: BoxScore[];
|
|
26
|
+
readonly boxScoreTotals?: BoxScoreTotals;
|
|
26
27
|
}
|
|
27
28
|
export declare class Name {
|
|
28
29
|
readonly first: string;
|
|
@@ -43,7 +44,8 @@ export declare class Player {
|
|
|
43
44
|
readonly generalStats: Stat[];
|
|
44
45
|
readonly rarity: Rarity;
|
|
45
46
|
readonly boxScores?: BoxScore[];
|
|
46
|
-
|
|
47
|
+
readonly boxScoreTotals?: BoxScoreTotals;
|
|
48
|
+
constructor({ id, name, country, stats, roles, traits, rarity, boxScores, boxScoreTotals }: PlayerParams);
|
|
47
49
|
static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
|
|
48
50
|
static compareStats(p1: Player, p2: Player): number;
|
|
49
51
|
toString(): string;
|
|
@@ -20,7 +20,7 @@ export class Name {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export class Player {
|
|
23
|
-
constructor({ id, name, country, stats, roles, traits, rarity, boxScores }) {
|
|
23
|
+
constructor({ id, name, country, stats, roles, traits, rarity, boxScores, boxScoreTotals }) {
|
|
24
24
|
validateUUID(id);
|
|
25
25
|
this.id = id;
|
|
26
26
|
this.name = name;
|
|
@@ -30,6 +30,7 @@ export class Player {
|
|
|
30
30
|
this.traits = traits;
|
|
31
31
|
this.rarity = rarity;
|
|
32
32
|
this.boxScores = boxScores;
|
|
33
|
+
this.boxScoreTotals = boxScoreTotals;
|
|
33
34
|
this.generalStats = Object.values(StatsEnum).map((stat) => ({
|
|
34
35
|
name: stat,
|
|
35
36
|
value: calculateStatScore(stats, stat)
|