volleyballsimtypes 0.0.13 → 0.0.14
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/models/match.d.ts +2 -0
- package/dist/cjs/src/data/models/match.js +4 -0
- package/dist/cjs/src/data/transformers/league.d.ts +1 -1
- package/dist/cjs/src/data/transformers/league.js +2 -2
- package/dist/cjs/src/data/transformers/match.d.ts +1 -2
- package/dist/cjs/src/data/transformers/match.js +4 -2
- package/dist/cjs/src/data/transformers/player.js +3 -3
- package/dist/cjs/src/data/transformers/season.d.ts +1 -1
- package/dist/cjs/src/data/transformers/season.js +4 -4
- package/dist/cjs/src/data/transformers/trait.d.ts +1 -1
- package/dist/cjs/src/data/transformers/trait.js +2 -2
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/src/routing/events.d.ts +1 -8
- package/dist/cjs/src/routing/league.d.ts +1 -1
- package/dist/cjs/src/routing/match.d.ts +1 -1
- package/dist/cjs/src/routing/player.d.ts +1 -2
- package/dist/cjs/src/routing/team.d.ts +1 -2
- package/dist/cjs/src/service/match/__stubs__/index.js +4 -2
- package/dist/cjs/src/service/match/match-set.d.ts +4 -4
- package/dist/cjs/src/service/match/match-set.js +3 -3
- package/dist/cjs/src/service/match/match.d.ts +3 -1
- package/dist/cjs/src/service/match/match.js +2 -1
- package/dist/cjs/src/service/match/match.test.js +2 -1
- package/dist/esm/src/data/models/match.d.ts +2 -0
- package/dist/esm/src/data/models/match.js +4 -0
- package/dist/esm/src/data/transformers/league.d.ts +1 -1
- package/dist/esm/src/data/transformers/league.js +1 -1
- package/dist/esm/src/data/transformers/match.d.ts +1 -2
- package/dist/esm/src/data/transformers/match.js +4 -2
- package/dist/esm/src/data/transformers/player.js +1 -1
- package/dist/esm/src/data/transformers/season.d.ts +1 -1
- package/dist/esm/src/data/transformers/season.js +1 -1
- package/dist/esm/src/data/transformers/trait.d.ts +1 -1
- package/dist/esm/src/data/transformers/trait.js +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/routing/events.d.ts +1 -8
- package/dist/esm/src/routing/league.d.ts +1 -1
- package/dist/esm/src/routing/match.d.ts +1 -1
- package/dist/esm/src/routing/player.d.ts +1 -2
- package/dist/esm/src/routing/team.d.ts +1 -2
- package/dist/esm/src/service/match/__stubs__/index.js +4 -2
- package/dist/esm/src/service/match/match-set.d.ts +4 -4
- package/dist/esm/src/service/match/match-set.js +3 -3
- package/dist/esm/src/service/match/match.d.ts +3 -1
- package/dist/esm/src/service/match/match.js +2 -1
- package/dist/esm/src/service/match/match.test.js +2 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ export interface MatchAttributes {
|
|
|
9
9
|
away_team: string;
|
|
10
10
|
scheduled_date: string;
|
|
11
11
|
season_id: string;
|
|
12
|
+
is_simulated: boolean;
|
|
12
13
|
MatchSets?: MatchSetAttributes[];
|
|
13
14
|
}
|
|
14
15
|
export type MatchPk = 'match_id';
|
|
@@ -20,6 +21,7 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
|
|
|
20
21
|
away_team: string;
|
|
21
22
|
scheduled_date: string;
|
|
22
23
|
season_id: string;
|
|
24
|
+
is_simulated: boolean;
|
|
23
25
|
MatchSets: MatchSetModel[];
|
|
24
26
|
getMatchSets: Sequelize.HasManyGetAssociationsMixin<MatchSetModel>;
|
|
25
27
|
setMatchSets: Sequelize.HasManySetAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LeagueAttributes, LeagueModel } from '../models';
|
|
2
|
-
import { League } from '../../service
|
|
2
|
+
import { League } from '../../service';
|
|
3
3
|
declare function transformToAttributes(league: League): LeagueAttributes;
|
|
4
4
|
declare function transformToObject(model: LeagueModel): League;
|
|
5
5
|
export { transformToObject as transformToLeague, transformToAttributes as transformFromLeague };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformFromLeague = exports.transformToLeague = void 0;
|
|
4
|
-
const
|
|
4
|
+
const service_1 = require("../../service");
|
|
5
5
|
const country_1 = require("./country");
|
|
6
6
|
const season_1 = require("./season");
|
|
7
7
|
function transformToAttributes(league) {
|
|
@@ -13,7 +13,7 @@ function transformToAttributes(league) {
|
|
|
13
13
|
}
|
|
14
14
|
exports.transformFromLeague = transformToAttributes;
|
|
15
15
|
function transformToObject(model) {
|
|
16
|
-
return new
|
|
16
|
+
return new service_1.League({
|
|
17
17
|
id: model.league_id,
|
|
18
18
|
name: model.name,
|
|
19
19
|
country: (0, country_1.transformToCountry)(model.country),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MatchAttributes, MatchModel } from '../models';
|
|
2
|
-
import { Match } from '../../service';
|
|
3
|
-
import { Season } from '../../service/league';
|
|
2
|
+
import { Match, Season } from '../../service';
|
|
4
3
|
import { APIMatch } from '../../routing';
|
|
5
4
|
declare function transformToAttributes(match: Match, season: Season): MatchAttributes;
|
|
6
5
|
declare function transformToObject(model: MatchModel): Match;
|
|
@@ -10,7 +10,8 @@ function transformToAttributes(match, season) {
|
|
|
10
10
|
season_id: season.id,
|
|
11
11
|
away_team: match.awayTeam.id,
|
|
12
12
|
home_team: match.homeTeam.id,
|
|
13
|
-
scheduled_date: match.scheduledDate.toISOString()
|
|
13
|
+
scheduled_date: match.scheduledDate.toISOString(),
|
|
14
|
+
is_simulated: match.isSimulated
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
exports.transformFromMatch = transformToAttributes;
|
|
@@ -22,7 +23,8 @@ function transformToObject(model) {
|
|
|
22
23
|
homeTeam: (0, team_1.transformToTeam)(model.homeTeam),
|
|
23
24
|
awayTeam: (0, team_1.transformToTeam)(model.awayTeam),
|
|
24
25
|
scheduledDate: new Date(model.scheduled_date),
|
|
25
|
-
sets: sets
|
|
26
|
+
sets: sets,
|
|
27
|
+
isSimulated: model.is_simulated
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
exports.transformToMatch = transformToObject;
|
|
@@ -6,7 +6,7 @@ const trait_1 = require("./trait");
|
|
|
6
6
|
const role_1 = require("./role");
|
|
7
7
|
const performance_stats_1 = require("./performance-stats");
|
|
8
8
|
const country_1 = require("./country");
|
|
9
|
-
const
|
|
9
|
+
const service_2 = require("../../service");
|
|
10
10
|
const match_set_stats_1 = require("./match-set-stats");
|
|
11
11
|
function transformToAttributes(player, team) {
|
|
12
12
|
return {
|
|
@@ -38,9 +38,9 @@ function transformToObject(model) {
|
|
|
38
38
|
}
|
|
39
39
|
exports.transformToPlayer = transformToObject;
|
|
40
40
|
function transformToAPIObject(model) {
|
|
41
|
-
const generalStats =
|
|
41
|
+
const generalStats = service_2.GeneralStat.getStats().map(stat => ({
|
|
42
42
|
name: stat,
|
|
43
|
-
value:
|
|
43
|
+
value: service_2.GeneralStat.calculateScore((0, performance_stats_1.transformToPerformanceStats)(model.PerformanceStat), stat)
|
|
44
44
|
}));
|
|
45
45
|
const gameStats = model.MatchSetStats.map(match_set_stats_1.transformToAPIMatchSetStats);
|
|
46
46
|
gameStats.push(calculateMatchStats(gameStats));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SeasonAttributes, SeasonModel } from '../models';
|
|
2
|
-
import { League, Season } from '../../service
|
|
2
|
+
import { League, Season } from '../../service';
|
|
3
3
|
import { APISeason } from '../../routing';
|
|
4
4
|
declare function transformToAttributes(season: Season, league: League): SeasonAttributes;
|
|
5
5
|
declare function transformToObject(model: SeasonModel): Season;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformFromSeason = exports.transformToAPISeason = exports.transformToSeason = void 0;
|
|
4
4
|
const team_1 = require("./team");
|
|
5
|
-
const
|
|
5
|
+
const service_1 = require("../../service");
|
|
6
6
|
const match_1 = require("./match");
|
|
7
|
-
const
|
|
7
|
+
const league_1 = require("./league");
|
|
8
8
|
function transformToAttributes(season, league) {
|
|
9
9
|
return {
|
|
10
10
|
season_id: season.id,
|
|
@@ -14,7 +14,7 @@ function transformToAttributes(season, league) {
|
|
|
14
14
|
}
|
|
15
15
|
exports.transformFromSeason = transformToAttributes;
|
|
16
16
|
function transformToObject(model) {
|
|
17
|
-
return new
|
|
17
|
+
return new service_1.Season({
|
|
18
18
|
id: model.season_id,
|
|
19
19
|
matches: model.Matches != null ? model.Matches.map(match_1.transformToMatch) : [],
|
|
20
20
|
iteration: model.iteration,
|
|
@@ -29,7 +29,7 @@ function transformToAPIObject(model) {
|
|
|
29
29
|
matches: model.Matches != null ? model.Matches.map(match_1.transformToAPIMatch) : [],
|
|
30
30
|
iteration: model.iteration,
|
|
31
31
|
teams: model.seasonTeams != null ? model.seasonTeams.map(team_1.transformToAPITeam) : [],
|
|
32
|
-
league: (0,
|
|
32
|
+
league: (0, league_1.transformToLeague)(model.league),
|
|
33
33
|
standings: season.standings
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Trait } from '../../service
|
|
1
|
+
import { Trait } from '../../service';
|
|
2
2
|
import { APITrait } from '../../routing';
|
|
3
3
|
type trait = 'MARKSMAN' | 'MOVING_WALL' | 'MASTER_MIND' | 'METEOR_SERVE' | 'VIGOROUS' | 'GUARDIAN';
|
|
4
4
|
declare function transformToType(trait: Trait): trait;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformToAPITrait = exports.transformToTrait = exports.transformFromTrait = void 0;
|
|
4
|
-
const
|
|
4
|
+
const service_1 = require("../../service");
|
|
5
5
|
const routing_1 = require("../../routing");
|
|
6
6
|
function transformToType(trait) {
|
|
7
7
|
switch (trait.name) {
|
|
@@ -23,7 +23,7 @@ function transformToType(trait) {
|
|
|
23
23
|
}
|
|
24
24
|
exports.transformFromTrait = transformToType;
|
|
25
25
|
function transformFromType(trait) {
|
|
26
|
-
return
|
|
26
|
+
return service_1.Trait[trait];
|
|
27
27
|
}
|
|
28
28
|
exports.transformToTrait = transformFromType;
|
|
29
29
|
function transformToEnum(trait) {
|
package/dist/cjs/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Block, BlockFailure, BlockType, Coach, CoachOpts, Country, CountryOpts, CourtPosition, CourtRow, CourtTarget, EventStat, EventType, Formation, formatNumber, GeneralStat, generateModifier, getKeys, getRandomEnumValue, InPlayEvent, InPlayEventOpts, League, LeagueOpts, LiberoReplacement, LiberoReplacementOpts, LiberoReplacementType, Match, MatchSet, MatchSetOpts, MatchSetState, MatchTeam, Name, PerformanceStats, PerformanceStatsOpts, Player, PlayerOpts, PlayerPosition, Rally, RallyEvent, RallyEventOpts, RallyState, randomNumber, Reception, ReceptionFailure, ReceptionType, Role, Score, Season, SeasonOpts, Serve, ServeFailure, ServeType, Set, SetFailure, SetStatistics, SetType, shuffle, Spike, SpikeFailure, SpikeType, Standing, StandingOpts, Stat, SubPriority, Substitution, SubstitutionOpts, Team, TeamOpts, Trait, validateUUID } from './service';
|
|
2
2
|
import { APIBlock, APIEvent, APIInPlayEvent, APILeague, APILiberoReplacement, APIMatch, APIMatchSet, APIPlayer, APIRally, APIReception, APIScore, APISeason, APIServe, APISet, APISetStatistics, APISpike, APISubstitution, APITeam, APITrait } from './routing';
|
|
3
|
-
import {
|
|
3
|
+
import { BlockAttributes, BlockCreationAttributes, BlockId, BlockModel, BlockOptionalAttributes, BlockPk, CoachAttributes, CoachCreationAttributes, CoachId, CoachModel, CoachOptionalAttributes, CoachPk, CountryAttributes, CountryCreationAttributes, CountryId, CountryModel, CountryPk, EventAttributes, EventCreationAttributes, EventId, EventModel, EventPk, initModels, LeagueAttributes, LeagueCreationAttributes, LeagueId, LeagueModel, LeaguePk, LiberoReplacementAttributes, LiberoReplacementCreationAttributes, LiberoReplacementId, LiberoReplacementModel, LiberoReplacementPk, MatchAttributes, MatchCreationAttributes, MatchId, MatchModel, MatchPk, MatchSetAttributes, MatchSetCreationAttributes, MatchSetId, MatchSetModel, MatchSetOptionalAttributes, MatchSetPk, MatchSetStatsAttributes, MatchSetStatsCreationAttributes, MatchSetStatsId, MatchSetStatsModel, MatchSetStatsOptionalAttributes, MatchSetStatsPk, PerformanceStatsAttributes, PerformanceStatsCreationAttributes, PerformanceStatsId, PerformanceStatsModel, PerformanceStatsOptionalAttributes, PerformanceStatsPk, PlayerAttributes, PlayerCreationAttributes, PlayerId, PlayerModel, PlayerPk, RallyAttributes, RallyCreationAttributes, RallyId, RallyModel, RallyPk, RallyPositionAttributes, RallyPositionCreationAttributes, RallyPositionId, RallyPositionModel, RallyPositionPk, ReceptionAttributes, ReceptionCreationAttributes, ReceptionId, ReceptionModel, ReceptionPk, RoleType, ScoreAttributes, ScoreCreationAttributes, ScoreId, ScoreModel, ScorePk, SeasonAttributes, SeasonCreationAttributes, SeasonId, SeasonModel, SeasonPk, SeasonTeamsAttributes, SeasonTeamsCreationAttributes, SeasonTeamsId, SeasonTeamsModel, SeasonTeamsPk, ServeAttributes, ServeCreationAttributes, ServeId, ServeModel, ServePk, SetAttributes, SetCreationAttributes, SetId, SetModel, SetPk, SpikeAttributes, SpikeCreationAttributes, SpikeId, SpikeModel, SpikePk, SubstitutionAttributes, SubstitutionCreationAttributes, SubstitutionId, SubstitutionModel, SubstitutionPk, TeamAttributes, TeamCreationAttributes, TeamId, TeamModel, TeamPk, TraitType, transformFromBlock, transformFromCoach, transformFromCountry, transformFromCourtPosition, transformFromCourtTarget, transformFromEventType, transformFromFormation, transformFromLeague, transformFromLiberoReplacement, transformFromMatch, transformFromMatchSet, transformFromMatchSetStats, transformFromPerformanceStats, transformFromPlayer, transformFromPlayerPosition, transformFromRally, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromServe, transformFromSet, transformFromSpike, transformFromSubstitution, transformFromTeam, transformFromTrait, transformToAPIBlock, transformToAPILiberoReplacement, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPIReception, transformToAPIScore, transformToAPISeason, transformToAPIServe, transformToAPISet, transformToAPISpike, transformToAPISubstitution, transformToAPITeam, transformToAPITrait, transformToBlock, transformToCoach, transformToCountry, transformToCourtPosition, transformToCourtTarget, transformToEventType, transformToFormation, transformToLeague, transformToLiberoReplacement, transformToMatch, transformToMatchSet, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToPlayerPosition, transformToRally, transformToReception, transformToRole, transformToScore, transformToSeason, transformToServe, transformToSet, transformToSpike, transformToSubstitution, transformToTeam, transformToTrait } from './data';
|
|
4
4
|
export { League, Standing, LeagueOpts, CountryOpts, SeasonOpts, Season, StandingOpts, Country, CoachOpts, Coach, Role, SubPriority, GeneralStat, PerformanceStats, Formation, Stat, PerformanceStatsOpts, Block, EventType, LiberoReplacement, MatchSet, Rally, RallyEvent, Reception, Score, Serve, Set, Spike, Substitution, BlockType, LiberoReplacementType, BlockFailure, MatchSetState, MatchSetOpts, LiberoReplacementOpts, RallyEventOpts, InPlayEventOpts, EventStat, Match, InPlayEvent, CourtRow, CourtPosition, CourtTarget, formatNumber, generateModifier, getKeys, MatchTeam, Name, PlayerOpts, Player, RallyState, PlayerPosition, randomNumber, ReceptionType, ServeFailure, ServeType, SetFailure, SetStatistics, SetType, ReceptionFailure, SpikeFailure, SpikeType, SubstitutionOpts, Team, shuffle, TeamOpts, Trait, getRandomEnumValue, validateUUID, APIBlock, APIEvent, APILiberoReplacement, APIRally, APIReception, APIScore, APIServe, APISet, APISpike, APISubstitution, APILeague, APIMatch, APIInPlayEvent, APIMatchSet, APIPlayer, APISeason, APITeam, APITrait, APISetStatistics, initModels, BlockId, BlockModel, RallyModel, RallyId, EventId, EventModel, MatchSetId, MatchSetModel, PerformanceStatsModel, PerformanceStatsId, BlockAttributes, LiberoReplacementId, LiberoReplacementModel, BlockPk, MatchSetStatsId, MatchSetStatsModel, BlockCreationAttributes, ReceptionId, ReceptionModel, BlockOptionalAttributes, CoachAttributes, CoachId, CountryId, CountryModel, CoachCreationAttributes, CoachPk, ScoreId, ScoreModel, CoachModel, RallyPositionId, RallyPositionModel, CoachOptionalAttributes, CountryAttributes, CountryCreationAttributes, CountryPk, EventAttributes, EventPk, EventCreationAttributes, LeagueAttributes, LeagueId, LeagueCreationAttributes, LeagueModel, LeaguePk, LiberoReplacementAttributes, LiberoReplacementCreationAttributes, LiberoReplacementPk, MatchAttributes, MatchId, MatchPk, MatchCreationAttributes, MatchModel, MatchSetAttributes, MatchSetCreationAttributes, MatchSetOptionalAttributes, MatchSetPk, MatchSetStatsAttributes, MatchSetStatsCreationAttributes, MatchSetStatsOptionalAttributes, MatchSetStatsPk, PerformanceStatsAttributes, PerformanceStatsCreationAttributes, PerformanceStatsOptionalAttributes, PerformanceStatsPk, PlayerCreationAttributes, PlayerAttributes, PlayerId, PlayerPk, RallyCreationAttributes, RallyAttributes, RallyPositionAttributes, RallyPositionCreationAttributes, RallyPk, RallyPositionPk, ReceptionCreationAttributes, ReceptionAttributes, ReceptionPk, ScoreCreationAttributes, ScoreAttributes, ScorePk, SeasonCreationAttributes, SeasonAttributes, SeasonId, SeasonTeamsAttributes, PlayerModel, SeasonPk, SeasonTeamsCreationAttributes, SeasonTeamsId, SeasonTeamsModel, SeasonModel, SeasonTeamsPk, ServeCreationAttributes, ServeAttributes, ServeId, ServeModel, SetAttributes, ServePk, SetId, SetModel, SetPk, SetCreationAttributes, SpikeCreationAttributes, SpikeAttributes, SpikeId, SpikeModel, SpikePk, SubstitutionCreationAttributes, SubstitutionAttributes, TeamAttributes, TeamId, TeamModel, TeamPk, SubstitutionId, SubstitutionModel, TeamCreationAttributes, SubstitutionPk, RoleType, TraitType, transformFromBlock, transformToAPIBlock, transformToBlock, transformFromCoach, transformFromCountry, transformFromRally, transformToAPIReception, transformToReception, transformToAPIScore, transformToScore, transformFromFormation, transformFromMatch, transformToAPISet, transformToSet, transformFromMatchSet, transformFromMatchSetStats, transformFromLeague, transformFromPlayer, transformFromPlayerPosition, transformToPlayerPosition, transformFromCourtPosition, transformFromCourtTarget, transformFromPerformanceStats, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromEventType, transformFromServe, transformToAPIServe, transformToServe, transformFromSet, transformFromSpike, transformToAPISpike, transformToSpike, transformFromSubstitution, transformToAPISubstitution, transformToSubstitution, transformFromTeam, transformFromTrait, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPISeason, transformToAPITeam, transformToAPITrait, transformFromLiberoReplacement, transformToAPILiberoReplacement, transformToLiberoReplacement, transformToCoach, transformToCountry, transformToEventType, transformToMatchSet, transformToCourtPosition, transformToCourtTarget, transformToFormation, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToRally, transformToMatch, transformToSeason, transformToTeam, transformToTrait, transformToLeague, transformToRole };
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -57,11 +57,11 @@ Object.defineProperty(exports, "validateUUID", { enumerable: true, get: function
|
|
|
57
57
|
const routing_1 = require("./routing");
|
|
58
58
|
Object.defineProperty(exports, "APITrait", { enumerable: true, get: function () { return routing_1.APITrait; } });
|
|
59
59
|
const data_1 = require("./data");
|
|
60
|
-
Object.defineProperty(exports, "initModels", { enumerable: true, get: function () { return data_1.initModels; } });
|
|
61
60
|
Object.defineProperty(exports, "BlockModel", { enumerable: true, get: function () { return data_1.BlockModel; } });
|
|
62
61
|
Object.defineProperty(exports, "CoachModel", { enumerable: true, get: function () { return data_1.CoachModel; } });
|
|
63
62
|
Object.defineProperty(exports, "CountryModel", { enumerable: true, get: function () { return data_1.CountryModel; } });
|
|
64
63
|
Object.defineProperty(exports, "EventModel", { enumerable: true, get: function () { return data_1.EventModel; } });
|
|
64
|
+
Object.defineProperty(exports, "initModels", { enumerable: true, get: function () { return data_1.initModels; } });
|
|
65
65
|
Object.defineProperty(exports, "LeagueModel", { enumerable: true, get: function () { return data_1.LeagueModel; } });
|
|
66
66
|
Object.defineProperty(exports, "LiberoReplacementModel", { enumerable: true, get: function () { return data_1.LiberoReplacementModel; } });
|
|
67
67
|
Object.defineProperty(exports, "MatchModel", { enumerable: true, get: function () { return data_1.MatchModel; } });
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { EventType } from '../service
|
|
2
|
-
import { LiberoReplacementType } from '../service/event/libero-replacement';
|
|
3
|
-
import { CourtTarget } from '../service/match';
|
|
4
|
-
import { SpikeFailure, SpikeType } from '../service/event/spike';
|
|
5
|
-
import { SetFailure, SetType } from '../service/event/set';
|
|
6
|
-
import { ServeFailure, ServeType } from '../service/event/serve';
|
|
7
|
-
import { BlockFailure, BlockType } from '../service/event/block';
|
|
8
|
-
import { ReceptionFailure, ReceptionType } from '../service/event/reception';
|
|
1
|
+
import { BlockFailure, BlockType, CourtTarget, EventType, LiberoReplacementType, ReceptionFailure, ReceptionType, ServeFailure, ServeType, SetFailure, SetType, SpikeFailure, SpikeType } from '../service';
|
|
9
2
|
export interface APIEvent {
|
|
10
3
|
id: string;
|
|
11
4
|
order: number;
|
|
@@ -105,12 +105,14 @@ exports.match = new match_1.Match({
|
|
|
105
105
|
homeTeam: exports.teams[0],
|
|
106
106
|
awayTeam: exports.teams[1],
|
|
107
107
|
sets: [],
|
|
108
|
-
scheduledDate: new Date('2023-07-26T21:48:12.273Z')
|
|
108
|
+
scheduledDate: new Date('2023-07-26T21:48:12.273Z'),
|
|
109
|
+
isSimulated: false
|
|
109
110
|
});
|
|
110
111
|
exports.match2 = new match_1.Match({
|
|
111
112
|
id: 'dfd87bdc-20c2-4383-92ea-b5c36a8ba7aa',
|
|
112
113
|
homeTeam: exports.teams[2],
|
|
113
114
|
awayTeam: exports.teams[3],
|
|
114
115
|
sets: [],
|
|
115
|
-
scheduledDate: new Date('2023-07-26T21:48:12.273Z')
|
|
116
|
+
scheduledDate: new Date('2023-07-26T21:48:12.273Z'),
|
|
117
|
+
isSimulated: false
|
|
116
118
|
});
|
|
@@ -45,16 +45,16 @@ export declare class MatchSet {
|
|
|
45
45
|
readonly isTieBreak: boolean;
|
|
46
46
|
readonly homeLibero: Player | undefined;
|
|
47
47
|
readonly awayLibero: Player | undefined;
|
|
48
|
+
readonly stats: SetStatistics[];
|
|
49
|
+
readonly rallies: Rally[];
|
|
48
50
|
private readonly scoreThreshold;
|
|
49
51
|
private homeScore;
|
|
50
52
|
private awayScore;
|
|
51
|
-
readonly stats: SetStatistics[];
|
|
52
|
-
readonly rallies: Rally[];
|
|
53
53
|
constructor({ id, order, isTieBreak, homeLibero, awayLibero, stats, rallies, homeScore, awayScore }: MatchSetOpts);
|
|
54
|
-
getHomeScore(): number;
|
|
55
|
-
getAwayScore(): number;
|
|
56
54
|
private _state;
|
|
57
55
|
get state(): MatchSetState;
|
|
56
|
+
getHomeScore(): number;
|
|
57
|
+
getAwayScore(): number;
|
|
58
58
|
increaseScore(team: MatchTeam): void;
|
|
59
59
|
addRally(rally: Rally): void;
|
|
60
60
|
/**
|
|
@@ -40,15 +40,15 @@ class MatchSet {
|
|
|
40
40
|
this.scoreThreshold = isTieBreak ? ScoreThreshold.TIE_BREAK : ScoreThreshold.SET;
|
|
41
41
|
this._state = MatchSetState.NEW;
|
|
42
42
|
}
|
|
43
|
+
get state() {
|
|
44
|
+
return this._state;
|
|
45
|
+
}
|
|
43
46
|
getHomeScore() {
|
|
44
47
|
return this.homeScore;
|
|
45
48
|
}
|
|
46
49
|
getAwayScore() {
|
|
47
50
|
return this.awayScore;
|
|
48
51
|
}
|
|
49
|
-
get state() {
|
|
50
|
-
return this._state;
|
|
51
|
-
}
|
|
52
52
|
increaseScore(team) {
|
|
53
53
|
if (this._state !== MatchSetState.IN_PLAY || this.isOver())
|
|
54
54
|
throw new Error('CANNOT_INCREASE_SCORE_OF_SET');
|
|
@@ -7,6 +7,7 @@ interface MatchOpts {
|
|
|
7
7
|
readonly awayTeam: Team;
|
|
8
8
|
readonly scheduledDate: Date;
|
|
9
9
|
readonly sets: MatchSet[];
|
|
10
|
+
readonly isSimulated: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class Match {
|
|
12
13
|
static readonly BEST_OF = 5;
|
|
@@ -15,7 +16,8 @@ export declare class Match {
|
|
|
15
16
|
readonly awayTeam: Team;
|
|
16
17
|
readonly sets: MatchSet[];
|
|
17
18
|
readonly scheduledDate: Date;
|
|
18
|
-
|
|
19
|
+
isSimulated: boolean;
|
|
20
|
+
constructor({ id, homeTeam, awayTeam, scheduledDate, sets, isSimulated }: MatchOpts);
|
|
19
21
|
addSet(set: MatchSet): void;
|
|
20
22
|
getTeamSets(team: MatchTeam): number;
|
|
21
23
|
isOver(): boolean;
|
|
@@ -4,13 +4,14 @@ exports.Match = void 0;
|
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const match_team_1 = require("./match-team");
|
|
6
6
|
class Match {
|
|
7
|
-
constructor({ id, homeTeam, awayTeam, scheduledDate, sets }) {
|
|
7
|
+
constructor({ id, homeTeam, awayTeam, scheduledDate, sets, isSimulated }) {
|
|
8
8
|
(0, utils_1.validateUUID)(id);
|
|
9
9
|
this.id = id;
|
|
10
10
|
this.homeTeam = homeTeam;
|
|
11
11
|
this.awayTeam = awayTeam;
|
|
12
12
|
this.scheduledDate = scheduledDate;
|
|
13
13
|
this.sets = sets;
|
|
14
|
+
this.isSimulated = isSimulated;
|
|
14
15
|
}
|
|
15
16
|
addSet(set) {
|
|
16
17
|
if (this.sets.length >= Match.BEST_OF)
|
|
@@ -13,7 +13,8 @@ const match_team_1 = require("./match-team");
|
|
|
13
13
|
sets: [],
|
|
14
14
|
homeTeam: __stubs__1.team,
|
|
15
15
|
awayTeam: __stubs__1.noLiberoTeam,
|
|
16
|
-
scheduledDate: new Date('2020-01-01')
|
|
16
|
+
scheduledDate: new Date('2020-01-01'),
|
|
17
|
+
isSimulated: false
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
20
|
(0, globals_1.test)('Should instantiate object properly', () => {
|
|
@@ -9,6 +9,7 @@ export interface MatchAttributes {
|
|
|
9
9
|
away_team: string;
|
|
10
10
|
scheduled_date: string;
|
|
11
11
|
season_id: string;
|
|
12
|
+
is_simulated: boolean;
|
|
12
13
|
MatchSets?: MatchSetAttributes[];
|
|
13
14
|
}
|
|
14
15
|
export type MatchPk = 'match_id';
|
|
@@ -20,6 +21,7 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
|
|
|
20
21
|
away_team: string;
|
|
21
22
|
scheduled_date: string;
|
|
22
23
|
season_id: string;
|
|
24
|
+
is_simulated: boolean;
|
|
23
25
|
MatchSets: MatchSetModel[];
|
|
24
26
|
getMatchSets: Sequelize.HasManyGetAssociationsMixin<MatchSetModel>;
|
|
25
27
|
setMatchSets: Sequelize.HasManySetAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LeagueAttributes, LeagueModel } from '../models';
|
|
2
|
-
import { League } from '../../service
|
|
2
|
+
import { League } from '../../service';
|
|
3
3
|
declare function transformToAttributes(league: League): LeagueAttributes;
|
|
4
4
|
declare function transformToObject(model: LeagueModel): League;
|
|
5
5
|
export { transformToObject as transformToLeague, transformToAttributes as transformFromLeague };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MatchAttributes, MatchModel } from '../models';
|
|
2
|
-
import { Match } from '../../service';
|
|
3
|
-
import { Season } from '../../service/league';
|
|
2
|
+
import { Match, Season } from '../../service';
|
|
4
3
|
import { APIMatch } from '../../routing';
|
|
5
4
|
declare function transformToAttributes(match: Match, season: Season): MatchAttributes;
|
|
6
5
|
declare function transformToObject(model: MatchModel): Match;
|
|
@@ -7,7 +7,8 @@ function transformToAttributes(match, season) {
|
|
|
7
7
|
season_id: season.id,
|
|
8
8
|
away_team: match.awayTeam.id,
|
|
9
9
|
home_team: match.homeTeam.id,
|
|
10
|
-
scheduled_date: match.scheduledDate.toISOString()
|
|
10
|
+
scheduled_date: match.scheduledDate.toISOString(),
|
|
11
|
+
is_simulated: match.isSimulated
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
function transformToObject(model) {
|
|
@@ -18,7 +19,8 @@ function transformToObject(model) {
|
|
|
18
19
|
homeTeam: transformToTeam(model.homeTeam),
|
|
19
20
|
awayTeam: transformToTeam(model.awayTeam),
|
|
20
21
|
scheduledDate: new Date(model.scheduled_date),
|
|
21
|
-
sets: sets
|
|
22
|
+
sets: sets,
|
|
23
|
+
isSimulated: model.is_simulated
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
function transformToAPIObject(model) {
|
|
@@ -3,7 +3,7 @@ import { transformFromTrait, transformToAPITrait, transformToTrait } from './tra
|
|
|
3
3
|
import { transformFromRole, transformToRole } from './role';
|
|
4
4
|
import { transformToPerformanceStats } from './performance-stats';
|
|
5
5
|
import { transformToCountry } from './country';
|
|
6
|
-
import { GeneralStat } from '../../service
|
|
6
|
+
import { GeneralStat } from '../../service';
|
|
7
7
|
import { transformToAPIMatchSetStats } from './match-set-stats';
|
|
8
8
|
function transformToAttributes(player, team) {
|
|
9
9
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SeasonAttributes, SeasonModel } from '../models';
|
|
2
|
-
import { League, Season } from '../../service
|
|
2
|
+
import { League, Season } from '../../service';
|
|
3
3
|
import { APISeason } from '../../routing';
|
|
4
4
|
declare function transformToAttributes(season: Season, league: League): SeasonAttributes;
|
|
5
5
|
declare function transformToObject(model: SeasonModel): Season;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { transformToAPITeam, transformToTeam } from './team';
|
|
2
|
-
import { Season } from '../../service
|
|
2
|
+
import { Season } from '../../service';
|
|
3
3
|
import { transformToAPIMatch, transformToMatch } from './match';
|
|
4
4
|
import { transformToLeague } from './league';
|
|
5
5
|
function transformToAttributes(season, league) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Trait } from '../../service
|
|
1
|
+
import { Trait } from '../../service';
|
|
2
2
|
import { APITrait } from '../../routing';
|
|
3
3
|
type trait = 'MARKSMAN' | 'MOVING_WALL' | 'MASTER_MIND' | 'METEOR_SERVE' | 'VIGOROUS' | 'GUARDIAN';
|
|
4
4
|
declare function transformToType(trait: Trait): trait;
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Block, BlockFailure, BlockType, Coach, CoachOpts, Country, CountryOpts, CourtPosition, CourtRow, CourtTarget, EventStat, EventType, Formation, formatNumber, GeneralStat, generateModifier, getKeys, getRandomEnumValue, InPlayEvent, InPlayEventOpts, League, LeagueOpts, LiberoReplacement, LiberoReplacementOpts, LiberoReplacementType, Match, MatchSet, MatchSetOpts, MatchSetState, MatchTeam, Name, PerformanceStats, PerformanceStatsOpts, Player, PlayerOpts, PlayerPosition, Rally, RallyEvent, RallyEventOpts, RallyState, randomNumber, Reception, ReceptionFailure, ReceptionType, Role, Score, Season, SeasonOpts, Serve, ServeFailure, ServeType, Set, SetFailure, SetStatistics, SetType, shuffle, Spike, SpikeFailure, SpikeType, Standing, StandingOpts, Stat, SubPriority, Substitution, SubstitutionOpts, Team, TeamOpts, Trait, validateUUID } from './service';
|
|
2
2
|
import { APIBlock, APIEvent, APIInPlayEvent, APILeague, APILiberoReplacement, APIMatch, APIMatchSet, APIPlayer, APIRally, APIReception, APIScore, APISeason, APIServe, APISet, APISetStatistics, APISpike, APISubstitution, APITeam, APITrait } from './routing';
|
|
3
|
-
import {
|
|
3
|
+
import { BlockAttributes, BlockCreationAttributes, BlockId, BlockModel, BlockOptionalAttributes, BlockPk, CoachAttributes, CoachCreationAttributes, CoachId, CoachModel, CoachOptionalAttributes, CoachPk, CountryAttributes, CountryCreationAttributes, CountryId, CountryModel, CountryPk, EventAttributes, EventCreationAttributes, EventId, EventModel, EventPk, initModels, LeagueAttributes, LeagueCreationAttributes, LeagueId, LeagueModel, LeaguePk, LiberoReplacementAttributes, LiberoReplacementCreationAttributes, LiberoReplacementId, LiberoReplacementModel, LiberoReplacementPk, MatchAttributes, MatchCreationAttributes, MatchId, MatchModel, MatchPk, MatchSetAttributes, MatchSetCreationAttributes, MatchSetId, MatchSetModel, MatchSetOptionalAttributes, MatchSetPk, MatchSetStatsAttributes, MatchSetStatsCreationAttributes, MatchSetStatsId, MatchSetStatsModel, MatchSetStatsOptionalAttributes, MatchSetStatsPk, PerformanceStatsAttributes, PerformanceStatsCreationAttributes, PerformanceStatsId, PerformanceStatsModel, PerformanceStatsOptionalAttributes, PerformanceStatsPk, PlayerAttributes, PlayerCreationAttributes, PlayerId, PlayerModel, PlayerPk, RallyAttributes, RallyCreationAttributes, RallyId, RallyModel, RallyPk, RallyPositionAttributes, RallyPositionCreationAttributes, RallyPositionId, RallyPositionModel, RallyPositionPk, ReceptionAttributes, ReceptionCreationAttributes, ReceptionId, ReceptionModel, ReceptionPk, RoleType, ScoreAttributes, ScoreCreationAttributes, ScoreId, ScoreModel, ScorePk, SeasonAttributes, SeasonCreationAttributes, SeasonId, SeasonModel, SeasonPk, SeasonTeamsAttributes, SeasonTeamsCreationAttributes, SeasonTeamsId, SeasonTeamsModel, SeasonTeamsPk, ServeAttributes, ServeCreationAttributes, ServeId, ServeModel, ServePk, SetAttributes, SetCreationAttributes, SetId, SetModel, SetPk, SpikeAttributes, SpikeCreationAttributes, SpikeId, SpikeModel, SpikePk, SubstitutionAttributes, SubstitutionCreationAttributes, SubstitutionId, SubstitutionModel, SubstitutionPk, TeamAttributes, TeamCreationAttributes, TeamId, TeamModel, TeamPk, TraitType, transformFromBlock, transformFromCoach, transformFromCountry, transformFromCourtPosition, transformFromCourtTarget, transformFromEventType, transformFromFormation, transformFromLeague, transformFromLiberoReplacement, transformFromMatch, transformFromMatchSet, transformFromMatchSetStats, transformFromPerformanceStats, transformFromPlayer, transformFromPlayerPosition, transformFromRally, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromServe, transformFromSet, transformFromSpike, transformFromSubstitution, transformFromTeam, transformFromTrait, transformToAPIBlock, transformToAPILiberoReplacement, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPIReception, transformToAPIScore, transformToAPISeason, transformToAPIServe, transformToAPISet, transformToAPISpike, transformToAPISubstitution, transformToAPITeam, transformToAPITrait, transformToBlock, transformToCoach, transformToCountry, transformToCourtPosition, transformToCourtTarget, transformToEventType, transformToFormation, transformToLeague, transformToLiberoReplacement, transformToMatch, transformToMatchSet, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToPlayerPosition, transformToRally, transformToReception, transformToRole, transformToScore, transformToSeason, transformToServe, transformToSet, transformToSpike, transformToSubstitution, transformToTeam, transformToTrait } from './data';
|
|
4
4
|
export { League, Standing, LeagueOpts, CountryOpts, SeasonOpts, Season, StandingOpts, Country, CoachOpts, Coach, Role, SubPriority, GeneralStat, PerformanceStats, Formation, Stat, PerformanceStatsOpts, Block, EventType, LiberoReplacement, MatchSet, Rally, RallyEvent, Reception, Score, Serve, Set, Spike, Substitution, BlockType, LiberoReplacementType, BlockFailure, MatchSetState, MatchSetOpts, LiberoReplacementOpts, RallyEventOpts, InPlayEventOpts, EventStat, Match, InPlayEvent, CourtRow, CourtPosition, CourtTarget, formatNumber, generateModifier, getKeys, MatchTeam, Name, PlayerOpts, Player, RallyState, PlayerPosition, randomNumber, ReceptionType, ServeFailure, ServeType, SetFailure, SetStatistics, SetType, ReceptionFailure, SpikeFailure, SpikeType, SubstitutionOpts, Team, shuffle, TeamOpts, Trait, getRandomEnumValue, validateUUID, APIBlock, APIEvent, APILiberoReplacement, APIRally, APIReception, APIScore, APIServe, APISet, APISpike, APISubstitution, APILeague, APIMatch, APIInPlayEvent, APIMatchSet, APIPlayer, APISeason, APITeam, APITrait, APISetStatistics, initModels, BlockId, BlockModel, RallyModel, RallyId, EventId, EventModel, MatchSetId, MatchSetModel, PerformanceStatsModel, PerformanceStatsId, BlockAttributes, LiberoReplacementId, LiberoReplacementModel, BlockPk, MatchSetStatsId, MatchSetStatsModel, BlockCreationAttributes, ReceptionId, ReceptionModel, BlockOptionalAttributes, CoachAttributes, CoachId, CountryId, CountryModel, CoachCreationAttributes, CoachPk, ScoreId, ScoreModel, CoachModel, RallyPositionId, RallyPositionModel, CoachOptionalAttributes, CountryAttributes, CountryCreationAttributes, CountryPk, EventAttributes, EventPk, EventCreationAttributes, LeagueAttributes, LeagueId, LeagueCreationAttributes, LeagueModel, LeaguePk, LiberoReplacementAttributes, LiberoReplacementCreationAttributes, LiberoReplacementPk, MatchAttributes, MatchId, MatchPk, MatchCreationAttributes, MatchModel, MatchSetAttributes, MatchSetCreationAttributes, MatchSetOptionalAttributes, MatchSetPk, MatchSetStatsAttributes, MatchSetStatsCreationAttributes, MatchSetStatsOptionalAttributes, MatchSetStatsPk, PerformanceStatsAttributes, PerformanceStatsCreationAttributes, PerformanceStatsOptionalAttributes, PerformanceStatsPk, PlayerCreationAttributes, PlayerAttributes, PlayerId, PlayerPk, RallyCreationAttributes, RallyAttributes, RallyPositionAttributes, RallyPositionCreationAttributes, RallyPk, RallyPositionPk, ReceptionCreationAttributes, ReceptionAttributes, ReceptionPk, ScoreCreationAttributes, ScoreAttributes, ScorePk, SeasonCreationAttributes, SeasonAttributes, SeasonId, SeasonTeamsAttributes, PlayerModel, SeasonPk, SeasonTeamsCreationAttributes, SeasonTeamsId, SeasonTeamsModel, SeasonModel, SeasonTeamsPk, ServeCreationAttributes, ServeAttributes, ServeId, ServeModel, SetAttributes, ServePk, SetId, SetModel, SetPk, SetCreationAttributes, SpikeCreationAttributes, SpikeAttributes, SpikeId, SpikeModel, SpikePk, SubstitutionCreationAttributes, SubstitutionAttributes, TeamAttributes, TeamId, TeamModel, TeamPk, SubstitutionId, SubstitutionModel, TeamCreationAttributes, SubstitutionPk, RoleType, TraitType, transformFromBlock, transformToAPIBlock, transformToBlock, transformFromCoach, transformFromCountry, transformFromRally, transformToAPIReception, transformToReception, transformToAPIScore, transformToScore, transformFromFormation, transformFromMatch, transformToAPISet, transformToSet, transformFromMatchSet, transformFromMatchSetStats, transformFromLeague, transformFromPlayer, transformFromPlayerPosition, transformToPlayerPosition, transformFromCourtPosition, transformFromCourtTarget, transformFromPerformanceStats, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromEventType, transformFromServe, transformToAPIServe, transformToServe, transformFromSet, transformFromSpike, transformToAPISpike, transformToSpike, transformFromSubstitution, transformToAPISubstitution, transformToSubstitution, transformFromTeam, transformFromTrait, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPISeason, transformToAPITeam, transformToAPITrait, transformFromLiberoReplacement, transformToAPILiberoReplacement, transformToLiberoReplacement, transformToCoach, transformToCountry, transformToEventType, transformToMatchSet, transformToCourtPosition, transformToCourtTarget, transformToFormation, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToRally, transformToMatch, transformToSeason, transformToTeam, transformToTrait, transformToLeague, transformToRole };
|
package/dist/esm/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Block, BlockFailure, BlockType, Coach, Country, CourtPosition, CourtRow, CourtTarget, EventType, Formation, formatNumber, GeneralStat, generateModifier, getKeys, getRandomEnumValue, InPlayEvent, League, LiberoReplacement, LiberoReplacementType, Match, MatchSet, MatchSetState, MatchTeam, PerformanceStats, Player, Rally, RallyEvent, RallyState, randomNumber, Reception, ReceptionFailure, ReceptionType, Role, Score, Season, Serve, ServeFailure, ServeType, Set, SetFailure, SetType, shuffle, Spike, SpikeFailure, SpikeType, Standing, Substitution, Team, Trait, validateUUID } from './service';
|
|
2
2
|
import { APITrait } from './routing';
|
|
3
|
-
import {
|
|
3
|
+
import { BlockModel, CoachModel, CountryModel, EventModel, initModels, LeagueModel, LiberoReplacementModel, MatchModel, MatchSetModel, MatchSetStatsModel, PerformanceStatsModel, PlayerModel, RallyModel, RallyPositionModel, ReceptionModel, ScoreModel, SeasonModel, SeasonTeamsModel, ServeModel, SetModel, SpikeModel, SubstitutionModel, TeamModel, transformFromBlock, transformFromCoach, transformFromCountry, transformFromCourtPosition, transformFromCourtTarget, transformFromEventType, transformFromFormation, transformFromLeague, transformFromLiberoReplacement, transformFromMatch, transformFromMatchSet, transformFromMatchSetStats, transformFromPerformanceStats, transformFromPlayer, transformFromPlayerPosition, transformFromRally, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromServe, transformFromSet, transformFromSpike, transformFromSubstitution, transformFromTeam, transformFromTrait, transformToAPIBlock, transformToAPILiberoReplacement, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPIReception, transformToAPIScore, transformToAPISeason, transformToAPIServe, transformToAPISet, transformToAPISpike, transformToAPISubstitution, transformToAPITeam, transformToAPITrait, transformToBlock, transformToCoach, transformToCountry, transformToCourtPosition, transformToCourtTarget, transformToEventType, transformToFormation, transformToLeague, transformToLiberoReplacement, transformToMatch, transformToMatchSet, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToPlayerPosition, transformToRally, transformToReception, transformToRole, transformToScore, transformToSeason, transformToServe, transformToSet, transformToSpike, transformToSubstitution, transformToTeam, transformToTrait } from './data';
|
|
4
4
|
export { League, Standing, Season, Country, Coach, Role, GeneralStat, PerformanceStats, Formation, Block, EventType, LiberoReplacement, MatchSet, Rally, RallyEvent, Reception, Score, Serve, Set, Spike, Substitution, BlockType, LiberoReplacementType, BlockFailure, MatchSetState, Match, InPlayEvent, CourtRow, CourtPosition, CourtTarget, formatNumber, generateModifier, getKeys, MatchTeam, Player, RallyState, randomNumber, ReceptionType, ServeFailure, ServeType, SetFailure, SetType, ReceptionFailure, SpikeFailure, SpikeType, Team, shuffle, Trait, getRandomEnumValue, validateUUID, APITrait, initModels, BlockModel, RallyModel, EventModel, MatchSetModel, PerformanceStatsModel, LiberoReplacementModel, MatchSetStatsModel, ReceptionModel, CountryModel, ScoreModel, CoachModel, RallyPositionModel, LeagueModel, MatchModel, PlayerModel, SeasonTeamsModel, SeasonModel, ServeModel, SetModel, SpikeModel, TeamModel, SubstitutionModel, transformFromBlock, transformToAPIBlock, transformToBlock, transformFromCoach, transformFromCountry, transformFromRally, transformToAPIReception, transformToReception, transformToAPIScore, transformToScore, transformFromFormation, transformFromMatch, transformToAPISet, transformToSet, transformFromMatchSet, transformFromMatchSetStats, transformFromLeague, transformFromPlayer, transformFromPlayerPosition, transformToPlayerPosition, transformFromCourtPosition, transformFromCourtTarget, transformFromPerformanceStats, transformFromReception, transformFromRole, transformFromScore, transformFromSeason, transformFromEventType, transformFromServe, transformToAPIServe, transformToServe, transformFromSet, transformFromSpike, transformToAPISpike, transformToSpike, transformFromSubstitution, transformToAPISubstitution, transformToSubstitution, transformFromTeam, transformFromTrait, transformToAPIMatch, transformToAPIMatchSet, transformToAPIMatchSetStats, transformToAPIPlayer, transformToAPIRally, transformToAPISeason, transformToAPITeam, transformToAPITrait, transformFromLiberoReplacement, transformToAPILiberoReplacement, transformToLiberoReplacement, transformToCoach, transformToCountry, transformToEventType, transformToMatchSet, transformToCourtPosition, transformToCourtTarget, transformToFormation, transformToMatchSetStats, transformToPerformanceStats, transformToPlayer, transformToRally, transformToMatch, transformToSeason, transformToTeam, transformToTrait, transformToLeague, transformToRole };
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { EventType } from '../service
|
|
2
|
-
import { LiberoReplacementType } from '../service/event/libero-replacement';
|
|
3
|
-
import { CourtTarget } from '../service/match';
|
|
4
|
-
import { SpikeFailure, SpikeType } from '../service/event/spike';
|
|
5
|
-
import { SetFailure, SetType } from '../service/event/set';
|
|
6
|
-
import { ServeFailure, ServeType } from '../service/event/serve';
|
|
7
|
-
import { BlockFailure, BlockType } from '../service/event/block';
|
|
8
|
-
import { ReceptionFailure, ReceptionType } from '../service/event/reception';
|
|
1
|
+
import { BlockFailure, BlockType, CourtTarget, EventType, LiberoReplacementType, ReceptionFailure, ReceptionType, ServeFailure, ServeType, SetFailure, SetType, SpikeFailure, SpikeType } from '../service';
|
|
9
2
|
export interface APIEvent {
|
|
10
3
|
id: string;
|
|
11
4
|
order: number;
|
|
@@ -102,12 +102,14 @@ export const match = new Match({
|
|
|
102
102
|
homeTeam: teams[0],
|
|
103
103
|
awayTeam: teams[1],
|
|
104
104
|
sets: [],
|
|
105
|
-
scheduledDate: new Date('2023-07-26T21:48:12.273Z')
|
|
105
|
+
scheduledDate: new Date('2023-07-26T21:48:12.273Z'),
|
|
106
|
+
isSimulated: false
|
|
106
107
|
});
|
|
107
108
|
export const match2 = new Match({
|
|
108
109
|
id: 'dfd87bdc-20c2-4383-92ea-b5c36a8ba7aa',
|
|
109
110
|
homeTeam: teams[2],
|
|
110
111
|
awayTeam: teams[3],
|
|
111
112
|
sets: [],
|
|
112
|
-
scheduledDate: new Date('2023-07-26T21:48:12.273Z')
|
|
113
|
+
scheduledDate: new Date('2023-07-26T21:48:12.273Z'),
|
|
114
|
+
isSimulated: false
|
|
113
115
|
});
|
|
@@ -45,16 +45,16 @@ export declare class MatchSet {
|
|
|
45
45
|
readonly isTieBreak: boolean;
|
|
46
46
|
readonly homeLibero: Player | undefined;
|
|
47
47
|
readonly awayLibero: Player | undefined;
|
|
48
|
+
readonly stats: SetStatistics[];
|
|
49
|
+
readonly rallies: Rally[];
|
|
48
50
|
private readonly scoreThreshold;
|
|
49
51
|
private homeScore;
|
|
50
52
|
private awayScore;
|
|
51
|
-
readonly stats: SetStatistics[];
|
|
52
|
-
readonly rallies: Rally[];
|
|
53
53
|
constructor({ id, order, isTieBreak, homeLibero, awayLibero, stats, rallies, homeScore, awayScore }: MatchSetOpts);
|
|
54
|
-
getHomeScore(): number;
|
|
55
|
-
getAwayScore(): number;
|
|
56
54
|
private _state;
|
|
57
55
|
get state(): MatchSetState;
|
|
56
|
+
getHomeScore(): number;
|
|
57
|
+
getAwayScore(): number;
|
|
58
58
|
increaseScore(team: MatchTeam): void;
|
|
59
59
|
addRally(rally: Rally): void;
|
|
60
60
|
/**
|
|
@@ -37,15 +37,15 @@ export class MatchSet {
|
|
|
37
37
|
this.scoreThreshold = isTieBreak ? ScoreThreshold.TIE_BREAK : ScoreThreshold.SET;
|
|
38
38
|
this._state = MatchSetState.NEW;
|
|
39
39
|
}
|
|
40
|
+
get state() {
|
|
41
|
+
return this._state;
|
|
42
|
+
}
|
|
40
43
|
getHomeScore() {
|
|
41
44
|
return this.homeScore;
|
|
42
45
|
}
|
|
43
46
|
getAwayScore() {
|
|
44
47
|
return this.awayScore;
|
|
45
48
|
}
|
|
46
|
-
get state() {
|
|
47
|
-
return this._state;
|
|
48
|
-
}
|
|
49
49
|
increaseScore(team) {
|
|
50
50
|
if (this._state !== MatchSetState.IN_PLAY || this.isOver())
|
|
51
51
|
throw new Error('CANNOT_INCREASE_SCORE_OF_SET');
|
|
@@ -7,6 +7,7 @@ interface MatchOpts {
|
|
|
7
7
|
readonly awayTeam: Team;
|
|
8
8
|
readonly scheduledDate: Date;
|
|
9
9
|
readonly sets: MatchSet[];
|
|
10
|
+
readonly isSimulated: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class Match {
|
|
12
13
|
static readonly BEST_OF = 5;
|
|
@@ -15,7 +16,8 @@ export declare class Match {
|
|
|
15
16
|
readonly awayTeam: Team;
|
|
16
17
|
readonly sets: MatchSet[];
|
|
17
18
|
readonly scheduledDate: Date;
|
|
18
|
-
|
|
19
|
+
isSimulated: boolean;
|
|
20
|
+
constructor({ id, homeTeam, awayTeam, scheduledDate, sets, isSimulated }: MatchOpts);
|
|
19
21
|
addSet(set: MatchSet): void;
|
|
20
22
|
getTeamSets(team: MatchTeam): number;
|
|
21
23
|
isOver(): boolean;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { validateUUID } from '../utils';
|
|
2
2
|
import { MatchTeam } from './match-team';
|
|
3
3
|
export class Match {
|
|
4
|
-
constructor({ id, homeTeam, awayTeam, scheduledDate, sets }) {
|
|
4
|
+
constructor({ id, homeTeam, awayTeam, scheduledDate, sets, isSimulated }) {
|
|
5
5
|
validateUUID(id);
|
|
6
6
|
this.id = id;
|
|
7
7
|
this.homeTeam = homeTeam;
|
|
8
8
|
this.awayTeam = awayTeam;
|
|
9
9
|
this.scheduledDate = scheduledDate;
|
|
10
10
|
this.sets = sets;
|
|
11
|
+
this.isSimulated = isSimulated;
|
|
11
12
|
}
|
|
12
13
|
addSet(set) {
|
|
13
14
|
if (this.sets.length >= Match.BEST_OF)
|
|
@@ -11,7 +11,8 @@ describe('Match Test Module', () => {
|
|
|
11
11
|
sets: [],
|
|
12
12
|
homeTeam: team,
|
|
13
13
|
awayTeam: noLiberoTeam,
|
|
14
|
-
scheduledDate: new Date('2020-01-01')
|
|
14
|
+
scheduledDate: new Date('2020-01-01'),
|
|
15
|
+
isSimulated: false
|
|
15
16
|
});
|
|
16
17
|
});
|
|
17
18
|
test('Should instantiate object properly', () => {
|