volleyballsimtypes 0.0.524 → 0.0.525

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 (75) hide show
  1. package/dist/cjs/src/api/index.d.ts +16 -0
  2. package/dist/cjs/src/data/init-models.js +32 -0
  3. package/dist/cjs/src/data/models/competition.d.ts +1 -1
  4. package/dist/cjs/src/data/models/competition.js +1 -1
  5. package/dist/cjs/src/data/models/index.d.ts +5 -0
  6. package/dist/cjs/src/data/models/index.js +5 -0
  7. package/dist/cjs/src/data/models/jersey-badge.d.ts +1 -1
  8. package/dist/cjs/src/data/models/jersey-badge.js +1 -1
  9. package/dist/cjs/src/data/models/national-team-claim.d.ts +21 -0
  10. package/dist/cjs/src/data/models/national-team-claim.js +36 -0
  11. package/dist/cjs/src/data/models/national-team.d.ts +22 -0
  12. package/dist/cjs/src/data/models/national-team.js +31 -0
  13. package/dist/cjs/src/data/models/wnl-callup.d.ts +31 -0
  14. package/dist/cjs/src/data/models/wnl-callup.js +45 -0
  15. package/dist/cjs/src/data/models/wnl-season.d.ts +24 -0
  16. package/dist/cjs/src/data/models/wnl-season.js +34 -0
  17. package/dist/cjs/src/data/models/wnl-squad.d.ts +40 -0
  18. package/dist/cjs/src/data/models/wnl-squad.js +59 -0
  19. package/dist/cjs/src/service/match/index.d.ts +1 -0
  20. package/dist/cjs/src/service/match/index.js +8 -0
  21. package/dist/cjs/src/service/match/match-generator.d.ts +5 -1
  22. package/dist/cjs/src/service/match/match-generator.js +6 -4
  23. package/dist/cjs/src/service/notification/catalog/en.json +29 -0
  24. package/dist/cjs/src/service/notification/catalog/es.json +29 -0
  25. package/dist/cjs/src/service/notification/catalog/fr.json +29 -0
  26. package/dist/cjs/src/service/notification/catalog/it.json +29 -0
  27. package/dist/cjs/src/service/notification/catalog/pl.json +29 -0
  28. package/dist/cjs/src/service/notification/catalog/pt-BR.json +29 -0
  29. package/dist/cjs/src/service/notification/catalog/tr.json +29 -0
  30. package/dist/cjs/src/service/notification/notification-type.d.ts +1 -1
  31. package/dist/cjs/src/service/notification/notification-type.js +8 -1
  32. package/dist/cjs/src/service/notification/notification.test.js +18 -0
  33. package/dist/cjs/src/service/notification/payloads.d.ts +7 -1
  34. package/dist/cjs/src/service/notification/registry.d.ts +5 -1
  35. package/dist/cjs/src/service/notification/registry.js +90 -3
  36. package/dist/cjs/src/service/premium/premium-tier.d.ts +2 -0
  37. package/dist/cjs/src/service/premium/premium-tier.js +8 -1
  38. package/dist/esm/src/api/index.d.ts +16 -0
  39. package/dist/esm/src/data/init-models.js +33 -1
  40. package/dist/esm/src/data/models/competition.d.ts +1 -1
  41. package/dist/esm/src/data/models/competition.js +1 -1
  42. package/dist/esm/src/data/models/index.d.ts +5 -0
  43. package/dist/esm/src/data/models/index.js +5 -0
  44. package/dist/esm/src/data/models/jersey-badge.d.ts +1 -1
  45. package/dist/esm/src/data/models/jersey-badge.js +1 -1
  46. package/dist/esm/src/data/models/national-team-claim.d.ts +21 -0
  47. package/dist/esm/src/data/models/national-team-claim.js +32 -0
  48. package/dist/esm/src/data/models/national-team.d.ts +22 -0
  49. package/dist/esm/src/data/models/national-team.js +27 -0
  50. package/dist/esm/src/data/models/wnl-callup.d.ts +31 -0
  51. package/dist/esm/src/data/models/wnl-callup.js +41 -0
  52. package/dist/esm/src/data/models/wnl-season.d.ts +24 -0
  53. package/dist/esm/src/data/models/wnl-season.js +30 -0
  54. package/dist/esm/src/data/models/wnl-squad.d.ts +40 -0
  55. package/dist/esm/src/data/models/wnl-squad.js +55 -0
  56. package/dist/esm/src/service/match/index.d.ts +1 -0
  57. package/dist/esm/src/service/match/index.js +3 -0
  58. package/dist/esm/src/service/match/match-generator.d.ts +5 -1
  59. package/dist/esm/src/service/match/match-generator.js +6 -4
  60. package/dist/esm/src/service/notification/catalog/en.json +29 -0
  61. package/dist/esm/src/service/notification/catalog/es.json +29 -0
  62. package/dist/esm/src/service/notification/catalog/fr.json +29 -0
  63. package/dist/esm/src/service/notification/catalog/it.json +29 -0
  64. package/dist/esm/src/service/notification/catalog/pl.json +29 -0
  65. package/dist/esm/src/service/notification/catalog/pt-BR.json +29 -0
  66. package/dist/esm/src/service/notification/catalog/tr.json +29 -0
  67. package/dist/esm/src/service/notification/notification-type.d.ts +1 -1
  68. package/dist/esm/src/service/notification/notification-type.js +8 -1
  69. package/dist/esm/src/service/notification/notification.test.js +19 -1
  70. package/dist/esm/src/service/notification/payloads.d.ts +7 -1
  71. package/dist/esm/src/service/notification/registry.d.ts +5 -1
  72. package/dist/esm/src/service/notification/registry.js +88 -3
  73. package/dist/esm/src/service/premium/premium-tier.d.ts +2 -0
  74. package/dist/esm/src/service/premium/premium-tier.js +6 -0
  75. package/package.json +1 -1
@@ -70,6 +70,8 @@ export type ChampionBadgeSpec = {
70
70
  region: ChampionRegion;
71
71
  } | {
72
72
  type: 'wcc';
73
+ } | {
74
+ type: 'wnl';
73
75
  };
74
76
  export type Player = Omit<DataProps<_Player>, 'stats' | 'birthAge' | 'birthIteration' | 'declineProfile' | 'nickname' | 'injuryProneProfile' | 'injury'> & {
75
77
  -readonly [K in 'birthAge' | 'birthIteration']?: DataProps<_Player>[K];
@@ -83,6 +85,7 @@ export type Player = Omit<DataProps<_Player>, 'stats' | 'birthAge' | 'birthItera
83
85
  nickname?: string;
84
86
  jerseyConfig?: JerseyConfig;
85
87
  championBadge?: ChampionBadgeSpec;
88
+ nationalFlagAlpha2?: string;
86
89
  };
87
90
  export interface StartingLineup {
88
91
  [CourtPosition.LEFT_FRONT]: string;
@@ -189,6 +192,12 @@ export type Team = Omit<DataProps<_Team>, 'roster' | '_rating' | 'rating' | 'tac
189
192
  };
190
193
  nationalCountryName?: string;
191
194
  isEvent?: boolean;
195
+ isNational?: boolean;
196
+ nationalManager?: {
197
+ displayName: string;
198
+ teamId: string;
199
+ teamShortName: string;
200
+ };
192
201
  };
193
202
  export type Standing = DataProps<_Standing> & {
194
203
  position: number;
@@ -255,4 +264,11 @@ export type TotalBoxScore = Omit<DataProps<BoxScore>, 'misc' | 'playerId' | 'mat
255
264
  setsPlayed: number;
256
265
  matchesPlayed: number;
257
266
  };
267
+ national?: {
268
+ alpha2: string;
269
+ matchesPlayed: number;
270
+ matchesWon: number;
271
+ pointsPlayed: number;
272
+ pointsWon: number;
273
+ };
258
274
  };
@@ -66,6 +66,11 @@ function initModels(sequelize) {
66
66
  const Friendly = models_1.FriendlyModel.initModel(sequelize);
67
67
  const RegionQualifier = models_1.RegionQualifierModel.initModel(sequelize);
68
68
  const NationalCountry = models_1.NationalCountryModel.initModel(sequelize);
69
+ const NationalTeam = models_1.NationalTeamModel.initModel(sequelize);
70
+ const NationalTeamClaim = models_1.NationalTeamClaimModel.initModel(sequelize);
71
+ const WnlSquad = models_1.WnlSquadModel.initModel(sequelize);
72
+ const WnlCallup = models_1.WnlCallupModel.initModel(sequelize);
73
+ const WnlSeason = models_1.WnlSeasonModel.initModel(sequelize);
69
74
  const Team = models_1.TeamModel.initModel(sequelize);
70
75
  const TeamReplacement = models_1.TeamReplacementModel.initModel(sequelize);
71
76
  const LegacyTeamFlag = models_1.LegacyTeamFlagModel.initModel(sequelize);
@@ -231,6 +236,28 @@ function initModels(sequelize) {
231
236
  Competition.hasOne(NationalCountry, { as: 'NationalCountry', foreignKey: 'competition_id' });
232
237
  Country.hasMany(NationalCountry, { as: 'NationalCountries', foreignKey: 'country_id' });
233
238
  Iteration.hasMany(NationalCountry, { as: 'NationalCountries', foreignKey: 'iteration' });
239
+ // National teams (WNL). The registry maps a country to its permanent active=false national Team; the claim links a
240
+ // Tier-2 manager to it; per-edition squad + callup + season rows hang off the WNL league Competition.
241
+ NationalTeam.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
242
+ NationalTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
243
+ Country.hasOne(NationalTeam, { as: 'NationalTeam', foreignKey: 'country_id' });
244
+ Team.hasOne(NationalTeam, { as: 'NationalTeam', foreignKey: 'team_id' });
245
+ NationalTeam.hasOne(NationalTeamClaim, { as: 'claim', foreignKey: 'country_id' });
246
+ NationalTeamClaim.belongsTo(NationalTeam, { as: 'nationalTeam', foreignKey: 'country_id' });
247
+ NationalTeamClaim.belongsTo(AuthUser, { as: 'user', foreignKey: 'user_id' });
248
+ AuthUser.hasOne(NationalTeamClaim, { as: 'NationalTeamClaim', foreignKey: 'user_id' });
249
+ WnlSquad.belongsTo(Competition, { as: 'competition', foreignKey: 'competition_id' });
250
+ WnlSquad.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
251
+ WnlSquad.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
252
+ WnlSquad.belongsTo(AuthUser, { as: 'manager', foreignKey: 'manager_user_id' });
253
+ Competition.hasMany(WnlSquad, { as: 'WnlSquads', foreignKey: 'competition_id' });
254
+ WnlCallup.belongsTo(Competition, { as: 'competition', foreignKey: 'competition_id' });
255
+ WnlCallup.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
256
+ WnlCallup.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
257
+ Competition.hasMany(WnlCallup, { as: 'WnlCallups', foreignKey: 'competition_id' });
258
+ WnlSeason.belongsTo(Competition, { as: 'competition', foreignKey: 'competition_id' });
259
+ WnlSeason.belongsTo(Competition, { as: 'finalsCompetition', foreignKey: 'finals_competition_id' });
260
+ Competition.hasOne(WnlSeason, { as: 'WnlSeason', foreignKey: 'competition_id' });
234
261
  VPER.belongsTo(Player, { as: 'Player', foreignKey: 'player_id' });
235
262
  VPER.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
236
263
  Team.hasOne(Coach, { as: 'Coach', foreignKey: 'team_id' });
@@ -354,6 +381,11 @@ function initModels(sequelize) {
354
381
  Friendly,
355
382
  RegionQualifier,
356
383
  NationalCountry,
384
+ NationalTeam,
385
+ NationalTeamClaim,
386
+ WnlSquad,
387
+ WnlCallup,
388
+ WnlSeason,
357
389
  Rally,
358
390
  Team,
359
391
  TeamReplacement,
@@ -21,7 +21,7 @@ export interface CompetitionAttributes {
21
21
  LowerPromotionMatches?: PromotionMatchAttributes[];
22
22
  }
23
23
  export type CompetitionPk = 'competition_id';
24
- export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER' | 'NATIONAL' | 'EVENT';
24
+ export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER' | 'NATIONAL' | 'EVENT' | 'WNL' | 'WNLF';
25
25
  export type CompetitionId = CompetitionModel[CompetitionPk];
26
26
  export type CompetitionCreationAttributes = CompetitionAttributes;
27
27
  export declare class CompetitionModel extends Model<CompetitionAttributes, CompetitionCreationAttributes> implements CompetitionAttributes {
@@ -21,7 +21,7 @@ class CompetitionModel extends sequelize_1.Model {
21
21
  }
22
22
  },
23
23
  type: {
24
- type: sequelize_1.DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER', 'NATIONAL', 'EVENT'),
24
+ type: sequelize_1.DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER', 'NATIONAL', 'EVENT', 'WNL', 'WNLF'),
25
25
  allowNull: false
26
26
  },
27
27
  status: {
@@ -32,6 +32,11 @@ export * from './promotion-match';
32
32
  export * from './friendly';
33
33
  export * from './region-qualifier';
34
34
  export * from './national-country';
35
+ export * from './national-team';
36
+ export * from './national-team-claim';
37
+ export * from './wnl-squad';
38
+ export * from './wnl-callup';
39
+ export * from './wnl-season';
35
40
  export * from './coach';
36
41
  export * from './scout';
37
42
  export * from './physician';
@@ -48,6 +48,11 @@ __exportStar(require("./promotion-match"), exports);
48
48
  __exportStar(require("./friendly"), exports);
49
49
  __exportStar(require("./region-qualifier"), exports);
50
50
  __exportStar(require("./national-country"), exports);
51
+ __exportStar(require("./national-team"), exports);
52
+ __exportStar(require("./national-team-claim"), exports);
53
+ __exportStar(require("./wnl-squad"), exports);
54
+ __exportStar(require("./wnl-callup"), exports);
55
+ __exportStar(require("./wnl-season"), exports);
51
56
  __exportStar(require("./coach"), exports);
52
57
  __exportStar(require("./scout"), exports);
53
58
  __exportStar(require("./physician"), exports);
@@ -1,7 +1,7 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { Model } from 'sequelize';
3
3
  import { CompetitionId, CompetitionModel, TeamId, TeamModel } from '.';
4
- export type JerseyBadgeKind = 'LEAGUE' | 'NATIONALS' | 'REGIONALS' | 'WCC';
4
+ export type JerseyBadgeKind = 'LEAGUE' | 'NATIONALS' | 'REGIONALS' | 'WCC' | 'WNL';
5
5
  export interface JerseyBadgeAttributes {
6
6
  competition_id: string;
7
7
  team_id: string;
@@ -23,7 +23,7 @@ class JerseyBadgeModel extends sequelize_1.Model {
23
23
  }
24
24
  },
25
25
  badge: {
26
- type: sequelize_1.DataTypes.ENUM('LEAGUE', 'NATIONALS', 'REGIONALS', 'WCC'),
26
+ type: sequelize_1.DataTypes.ENUM('LEAGUE', 'NATIONALS', 'REGIONALS', 'WCC', 'WNL'),
27
27
  allowNull: false
28
28
  },
29
29
  region: {
@@ -0,0 +1,21 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model, Optional } from 'sequelize';
3
+ import { AuthUserId, AuthUserModel } from '.';
4
+ export interface NationalTeamClaimAttributes {
5
+ country_id: string;
6
+ user_id: string;
7
+ claimed_at: Date;
8
+ }
9
+ export type NationalTeamClaimPk = 'country_id';
10
+ export type NationalTeamClaimId = NationalTeamClaimModel[NationalTeamClaimPk];
11
+ export type NationalTeamClaimOptionalAttributes = 'claimed_at';
12
+ export type NationalTeamClaimCreationAttributes = Optional<NationalTeamClaimAttributes, NationalTeamClaimOptionalAttributes>;
13
+ export declare class NationalTeamClaimModel extends Model<NationalTeamClaimAttributes, NationalTeamClaimCreationAttributes> implements NationalTeamClaimAttributes {
14
+ country_id: string;
15
+ user_id: string;
16
+ claimed_at: Date;
17
+ user: AuthUserModel;
18
+ getUser: Sequelize.BelongsToGetAssociationMixin<AuthUserModel>;
19
+ setUser: Sequelize.BelongsToSetAssociationMixin<AuthUserModel, AuthUserId>;
20
+ static initModel(sequelize: Sequelize.Sequelize): typeof NationalTeamClaimModel;
21
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NationalTeamClaimModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ class NationalTeamClaimModel extends sequelize_1.Model {
6
+ static initModel(sequelize) {
7
+ return NationalTeamClaimModel.init({
8
+ country_id: {
9
+ type: sequelize_1.DataTypes.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ references: { model: 'NationalTeam', key: 'country_id' }
13
+ },
14
+ user_id: {
15
+ type: sequelize_1.DataTypes.UUID,
16
+ allowNull: false,
17
+ references: { model: 'AuthUser', key: 'user_id' }
18
+ },
19
+ claimed_at: {
20
+ type: sequelize_1.DataTypes.DATE,
21
+ allowNull: false,
22
+ defaultValue: sequelize_1.DataTypes.NOW
23
+ }
24
+ }, {
25
+ sequelize,
26
+ tableName: 'NationalTeamClaim',
27
+ schema: 'public',
28
+ timestamps: false,
29
+ indexes: [
30
+ { name: 'NationalTeamClaim_pk', unique: true, fields: [{ name: 'country_id' }] },
31
+ { name: 'NationalTeamClaim_user_id_uq', unique: true, fields: [{ name: 'user_id' }] }
32
+ ]
33
+ });
34
+ }
35
+ }
36
+ exports.NationalTeamClaimModel = NationalTeamClaimModel;
@@ -0,0 +1,22 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { CountryId, CountryModel, TeamAttributes, TeamId, TeamModel } from '.';
4
+ export interface NationalTeamAttributes {
5
+ country_id: string;
6
+ team_id: string;
7
+ team?: TeamAttributes;
8
+ }
9
+ export type NationalTeamPk = 'country_id';
10
+ export type NationalTeamId = NationalTeamModel[NationalTeamPk];
11
+ export type NationalTeamCreationAttributes = NationalTeamAttributes;
12
+ export declare class NationalTeamModel extends Model<NationalTeamAttributes, NationalTeamCreationAttributes> implements NationalTeamAttributes {
13
+ country_id: string;
14
+ team_id: string;
15
+ country: CountryModel;
16
+ getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
17
+ setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
18
+ team: TeamModel;
19
+ getTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
20
+ setTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
21
+ static initModel(sequelize: Sequelize.Sequelize): typeof NationalTeamModel;
22
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NationalTeamModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ class NationalTeamModel extends sequelize_1.Model {
6
+ static initModel(sequelize) {
7
+ return NationalTeamModel.init({
8
+ country_id: {
9
+ type: sequelize_1.DataTypes.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ references: { model: 'Country', key: 'country_id' }
13
+ },
14
+ team_id: {
15
+ type: sequelize_1.DataTypes.UUID,
16
+ allowNull: false,
17
+ references: { model: 'Team', key: 'team_id' }
18
+ }
19
+ }, {
20
+ sequelize,
21
+ tableName: 'NationalTeam',
22
+ schema: 'public',
23
+ timestamps: false,
24
+ indexes: [
25
+ { name: 'NationalTeam_pk', unique: true, fields: [{ name: 'country_id' }] },
26
+ { name: 'NationalTeam_team_id_uq', unique: true, fields: [{ name: 'team_id' }] }
27
+ ]
28
+ });
29
+ }
30
+ }
31
+ exports.NationalTeamModel = NationalTeamModel;
@@ -0,0 +1,31 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { CompetitionId, CompetitionModel, CountryId, CountryModel, PlayerId, PlayerModel } from '.';
4
+ export type WnlCallupRole = 'SELECTION' | 'BACKUP';
5
+ export interface WnlCallupAttributes {
6
+ competition_id: string;
7
+ player_id: string;
8
+ country_id: string;
9
+ role: WnlCallupRole;
10
+ slot_order: number;
11
+ }
12
+ export type WnlCallupPk = 'competition_id' | 'player_id';
13
+ export type WnlCallupId = WnlCallupModel[WnlCallupPk];
14
+ export type WnlCallupCreationAttributes = WnlCallupAttributes;
15
+ export declare class WnlCallupModel extends Model<WnlCallupAttributes, WnlCallupCreationAttributes> implements WnlCallupAttributes {
16
+ competition_id: string;
17
+ player_id: string;
18
+ country_id: string;
19
+ role: WnlCallupRole;
20
+ slot_order: number;
21
+ competition: CompetitionModel;
22
+ getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
23
+ setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
24
+ player: PlayerModel;
25
+ getPlayer: Sequelize.BelongsToGetAssociationMixin<PlayerModel>;
26
+ setPlayer: Sequelize.BelongsToSetAssociationMixin<PlayerModel, PlayerId>;
27
+ country: CountryModel;
28
+ getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
29
+ setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
30
+ static initModel(sequelize: Sequelize.Sequelize): typeof WnlCallupModel;
31
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WnlCallupModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ class WnlCallupModel extends sequelize_1.Model {
6
+ static initModel(sequelize) {
7
+ return WnlCallupModel.init({
8
+ competition_id: {
9
+ type: sequelize_1.DataTypes.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ references: { model: 'Competition', key: 'competition_id' }
13
+ },
14
+ player_id: {
15
+ type: sequelize_1.DataTypes.UUID,
16
+ allowNull: false,
17
+ primaryKey: true,
18
+ references: { model: 'Player', key: 'player_id' }
19
+ },
20
+ country_id: {
21
+ type: sequelize_1.DataTypes.UUID,
22
+ allowNull: false,
23
+ references: { model: 'Country', key: 'country_id' }
24
+ },
25
+ role: {
26
+ type: sequelize_1.DataTypes.ENUM('SELECTION', 'BACKUP'),
27
+ allowNull: false
28
+ },
29
+ slot_order: {
30
+ type: sequelize_1.DataTypes.INTEGER,
31
+ allowNull: false
32
+ }
33
+ }, {
34
+ sequelize,
35
+ tableName: 'WnlCallup',
36
+ schema: 'public',
37
+ timestamps: false,
38
+ indexes: [
39
+ { name: 'WnlCallup_pk', unique: true, fields: [{ name: 'competition_id' }, { name: 'player_id' }] },
40
+ { name: 'WnlCallup_competition_country_idx', fields: [{ name: 'competition_id' }, { name: 'country_id' }] }
41
+ ]
42
+ });
43
+ }
44
+ }
45
+ exports.WnlCallupModel = WnlCallupModel;
@@ -0,0 +1,24 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model, Optional } from 'sequelize';
3
+ import { CompetitionId, CompetitionModel } from '.';
4
+ export interface WnlSeasonAttributes {
5
+ competition_id: string;
6
+ season_index: number;
7
+ finals_competition_id: string | null;
8
+ }
9
+ export type WnlSeasonPk = 'competition_id';
10
+ export type WnlSeasonId = WnlSeasonModel[WnlSeasonPk];
11
+ export type WnlSeasonOptionalAttributes = 'finals_competition_id';
12
+ export type WnlSeasonCreationAttributes = Optional<WnlSeasonAttributes, WnlSeasonOptionalAttributes>;
13
+ export declare class WnlSeasonModel extends Model<WnlSeasonAttributes, WnlSeasonCreationAttributes> implements WnlSeasonAttributes {
14
+ competition_id: string;
15
+ season_index: number;
16
+ finals_competition_id: string | null;
17
+ competition: CompetitionModel;
18
+ getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
19
+ setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
20
+ finalsCompetition: CompetitionModel;
21
+ getFinalsCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
22
+ setFinalsCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
23
+ static initModel(sequelize: Sequelize.Sequelize): typeof WnlSeasonModel;
24
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WnlSeasonModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ class WnlSeasonModel extends sequelize_1.Model {
6
+ static initModel(sequelize) {
7
+ return WnlSeasonModel.init({
8
+ competition_id: {
9
+ type: sequelize_1.DataTypes.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ references: { model: 'Competition', key: 'competition_id' }
13
+ },
14
+ season_index: {
15
+ type: sequelize_1.DataTypes.INTEGER,
16
+ allowNull: false
17
+ },
18
+ finals_competition_id: {
19
+ type: sequelize_1.DataTypes.UUID,
20
+ allowNull: true,
21
+ references: { model: 'Competition', key: 'competition_id' }
22
+ }
23
+ }, {
24
+ sequelize,
25
+ tableName: 'WnlSeason',
26
+ schema: 'public',
27
+ timestamps: false,
28
+ indexes: [
29
+ { name: 'WnlSeason_pk', unique: true, fields: [{ name: 'competition_id' }] }
30
+ ]
31
+ });
32
+ }
33
+ }
34
+ exports.WnlSeasonModel = WnlSeasonModel;
@@ -0,0 +1,40 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model, Optional } from 'sequelize';
3
+ import { AuthUserId, AuthUserModel, CompetitionId, CompetitionModel, CountryId, CountryModel, TeamId, TeamModel } from '.';
4
+ export interface WnlSquadAttributes {
5
+ competition_id: string;
6
+ country_id: string;
7
+ team_id: string;
8
+ manager_user_id: string | null;
9
+ manager_name: string | null;
10
+ auto: boolean;
11
+ finalized: boolean;
12
+ finalized_at: Date | null;
13
+ }
14
+ export type WnlSquadPk = 'competition_id' | 'country_id';
15
+ export type WnlSquadId = WnlSquadModel[WnlSquadPk];
16
+ export type WnlSquadOptionalAttributes = 'manager_user_id' | 'manager_name' | 'auto' | 'finalized' | 'finalized_at';
17
+ export type WnlSquadCreationAttributes = Optional<WnlSquadAttributes, WnlSquadOptionalAttributes>;
18
+ export declare class WnlSquadModel extends Model<WnlSquadAttributes, WnlSquadCreationAttributes> implements WnlSquadAttributes {
19
+ competition_id: string;
20
+ country_id: string;
21
+ team_id: string;
22
+ manager_user_id: string | null;
23
+ manager_name: string | null;
24
+ auto: boolean;
25
+ finalized: boolean;
26
+ finalized_at: Date | null;
27
+ competition: CompetitionModel;
28
+ getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
29
+ setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
30
+ country: CountryModel;
31
+ getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
32
+ setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
33
+ team: TeamModel;
34
+ getTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
35
+ setTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
36
+ manager: AuthUserModel;
37
+ getManager: Sequelize.BelongsToGetAssociationMixin<AuthUserModel>;
38
+ setManager: Sequelize.BelongsToSetAssociationMixin<AuthUserModel, AuthUserId>;
39
+ static initModel(sequelize: Sequelize.Sequelize): typeof WnlSquadModel;
40
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WnlSquadModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ class WnlSquadModel extends sequelize_1.Model {
6
+ static initModel(sequelize) {
7
+ return WnlSquadModel.init({
8
+ competition_id: {
9
+ type: sequelize_1.DataTypes.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ references: { model: 'Competition', key: 'competition_id' }
13
+ },
14
+ country_id: {
15
+ type: sequelize_1.DataTypes.UUID,
16
+ allowNull: false,
17
+ primaryKey: true,
18
+ references: { model: 'Country', key: 'country_id' }
19
+ },
20
+ team_id: {
21
+ type: sequelize_1.DataTypes.UUID,
22
+ allowNull: false,
23
+ references: { model: 'Team', key: 'team_id' }
24
+ },
25
+ manager_user_id: {
26
+ type: sequelize_1.DataTypes.UUID,
27
+ allowNull: true,
28
+ references: { model: 'AuthUser', key: 'user_id' }
29
+ },
30
+ manager_name: {
31
+ type: sequelize_1.DataTypes.TEXT,
32
+ allowNull: true
33
+ },
34
+ auto: {
35
+ type: sequelize_1.DataTypes.BOOLEAN,
36
+ allowNull: false,
37
+ defaultValue: false
38
+ },
39
+ finalized: {
40
+ type: sequelize_1.DataTypes.BOOLEAN,
41
+ allowNull: false,
42
+ defaultValue: false
43
+ },
44
+ finalized_at: {
45
+ type: sequelize_1.DataTypes.DATE,
46
+ allowNull: true
47
+ }
48
+ }, {
49
+ sequelize,
50
+ tableName: 'WnlSquad',
51
+ schema: 'public',
52
+ timestamps: false,
53
+ indexes: [
54
+ { name: 'WnlSquad_pk', unique: true, fields: [{ name: 'competition_id' }, { name: 'country_id' }] }
55
+ ]
56
+ });
57
+ }
58
+ }
59
+ exports.WnlSquadModel = WnlSquadModel;
@@ -1,6 +1,7 @@
1
1
  export * from './box-score';
2
2
  export * from './match';
3
3
  export * from './match-generator';
4
+ export { default as MatchGenerator } from './match-generator';
4
5
  export * from './match-rating';
5
6
  export * from './match-set';
6
7
  export * from './rally';
@@ -13,10 +13,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.MatchGenerator = void 0;
17
21
  __exportStar(require("./box-score"), exports);
18
22
  __exportStar(require("./match"), exports);
19
23
  __exportStar(require("./match-generator"), exports);
24
+ // The default export (the class itself) is not surfaced by `export *`; re-export it by name so consumers (e.g. the
25
+ // engine's WNL scheduler) can call MatchGenerator.generateMatches with custom spacing/start-hour options.
26
+ var match_generator_1 = require("./match-generator");
27
+ Object.defineProperty(exports, "MatchGenerator", { enumerable: true, get: function () { return __importDefault(match_generator_1).default; } });
20
28
  __exportStar(require("./match-rating"), exports);
21
29
  __exportStar(require("./match-set"), exports);
22
30
  __exportStar(require("./rally"), exports);
@@ -1,5 +1,9 @@
1
1
  import { Team } from '../team';
2
2
  import { Match } from './match';
3
+ export interface GenerateMatchesOptions {
4
+ spacingMinutes?: number;
5
+ startHourUTC?: number;
6
+ }
3
7
  export default class MatchGenerator {
4
- static generateMatches(teams: Team[], baseDate: Date): Match[];
8
+ static generateMatches(teams: Team[], baseDate: Date, options?: GenerateMatchesOptions): Match[];
5
9
  }
@@ -16,12 +16,14 @@ dayjs_1.default.extend(utc_1.default);
16
16
  const MATCH_SPACING_MINUTES = 30;
17
17
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
18
18
  class MatchGenerator {
19
- static generateMatches(teams, baseDate) {
19
+ static generateMatches(teams, baseDate, options = {}) {
20
+ const spacingMinutes = options.spacingMinutes ?? MATCH_SPACING_MINUTES;
21
+ const startHourUTC = options.startHourUTC ?? 0;
20
22
  const t = new Set(teams.map(x => x.id));
21
- // Anchor the first match to 00:00 UTC of the iteration's start day (Monday), so league rounds fall on the
23
+ // Anchor the first match to `startHourUTC`:00 UTC of the iteration's start day (Monday), so rounds fall on the
22
24
  // same wall-clock time everywhere regardless of the host timezone. startOf('day') in UTC avoids the
23
25
  // local-timezone roll the old startOf('hour') was exposed to on a fractional-hour-offset host.
24
- let date = dayjs_1.default.utc(baseDate).startOf('day');
26
+ let date = dayjs_1.default.utc(baseDate).startOf('day').add(startHourUTC, 'hour');
25
27
  if (t.size !== teams.length) {
26
28
  throw new Error('DUPLICATE_TEAMS');
27
29
  }
@@ -30,7 +32,7 @@ class MatchGenerator {
30
32
  }
31
33
  const nextDate = () => {
32
34
  const scheduledDate = date.toDate();
33
- date = date.add(MATCH_SPACING_MINUTES, 'minutes');
35
+ date = date.add(spacingMinutes, 'minutes');
34
36
  return scheduledDate;
35
37
  };
36
38
  // First leg: one pass of the round robin, matches laid out back to back in round order.
@@ -62,5 +62,34 @@
62
62
  "regionRelocation": {
63
63
  "title": "Your team is moving",
64
64
  "body": "Your team has been chosen to be moved to the new region: Kyorin. Nothing has changed in terms of the team you manage, your players or anything else."
65
+ },
66
+ "wnlCallupOpen": {
67
+ "title": "National call-up open",
68
+ "body": "The national call-up phase has begun! You have until {{date}} to select your team to participate in the next edition of the WNL."
69
+ },
70
+ "wnlCallupDeadline": {
71
+ "title": "Call-up deadline today",
72
+ "body": "The national call-up deadline is today. Make sure you have selected the players that will participate in the next edition of the WNL."
73
+ },
74
+ "wnlCallupClosed": {
75
+ "title": "National call-up closed",
76
+ "body": "The national call-up phase has ended. You can edit your line-up to prepare for the WNL starting next Monday!"
77
+ },
78
+ "wnlLeagueStart": {
79
+ "title": "WNL league started",
80
+ "body": "The WNL League phase has started!"
81
+ },
82
+ "wnlFinalsStart": {
83
+ "title": "WNL finals started",
84
+ "body": "The WNL finals have started!"
85
+ },
86
+ "wnlChampion": {
87
+ "title": "WNL champions crowned",
88
+ "body": "The WNL edition has ended. {{team}} are the WNL champions!",
89
+ "bodyUnnamed": "The WNL edition has ended. The champions have been crowned!"
90
+ },
91
+ "wnlPlayerCalledUp": {
92
+ "title": "Players called up",
93
+ "body": "One or more of your players have been called-up to their national team!"
65
94
  }
66
95
  }