@mtgame/core 0.1.5 → 0.1.7

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 (37) hide show
  1. package/api/game-base-api.d.ts +2 -0
  2. package/bundles/mtgame-core.umd.js +195 -118
  3. package/bundles/mtgame-core.umd.js.map +1 -1
  4. package/bundles/mtgame-core.umd.min.js +1 -1
  5. package/bundles/mtgame-core.umd.min.js.map +1 -1
  6. package/esm2015/api/game-base-api.js +7 -1
  7. package/esm2015/localization/game-user-limitation-types.js +6 -0
  8. package/esm2015/localization/public-api.js +2 -1
  9. package/esm2015/models/game-user-limitation.js +32 -0
  10. package/esm2015/models/game.js +4 -1
  11. package/esm2015/models/league.js +14 -4
  12. package/esm2015/models/playoff.js +3 -1
  13. package/esm2015/models/public-api.js +2 -1
  14. package/esm2015/models/util.js +3 -3
  15. package/esm5/api/game-base-api.js +9 -1
  16. package/esm5/localization/game-user-limitation-types.js +7 -0
  17. package/esm5/localization/public-api.js +2 -1
  18. package/esm5/models/game-user-limitation.js +37 -0
  19. package/esm5/models/game.js +4 -1
  20. package/esm5/models/league.js +28 -4
  21. package/esm5/models/playoff.js +3 -1
  22. package/esm5/models/public-api.js +2 -1
  23. package/esm5/models/util.js +3 -3
  24. package/fesm2015/mtgame-core.js +159 -106
  25. package/fesm2015/mtgame-core.js.map +1 -1
  26. package/fesm5/mtgame-core.js +194 -119
  27. package/fesm5/mtgame-core.js.map +1 -1
  28. package/localization/game-user-limitation-types.d.ts +5 -0
  29. package/localization/public-api.d.ts +1 -0
  30. package/models/game-user-limitation.d.ts +11 -0
  31. package/models/game.d.ts +2 -0
  32. package/models/league.d.ts +3 -0
  33. package/models/playoff.d.ts +2 -0
  34. package/models/public-api.d.ts +1 -0
  35. package/models/util.d.ts +2 -2
  36. package/mtgame-core.metadata.json +1 -1
  37. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { GameUser } from '../models/game-user';
3
3
  import { ConfigService } from '../services/config.service';
4
+ import { GameUserLimitations } from '../models/game-user-limitation';
4
5
  export declare class GameBaseApi {
5
6
  protected httpClient: HttpClient;
6
7
  protected configService: ConfigService;
7
8
  constructor(httpClient: HttpClient, configService: ConfigService);
8
9
  getUsers(gameId: number): Promise<GameUser[]>;
9
10
  getMvp(gameId: number): Promise<GameUser[]>;
11
+ getUsersLimitation(gameId: number): Promise<GameUserLimitations[]>;
10
12
  }
@@ -352,13 +352,13 @@
352
352
  if (!Array.isArray(value)) {
353
353
  return [];
354
354
  }
355
- return modelClass.toFront(value);
355
+ return value.map(function (item) { return modelClass.toFront(item); });
356
356
  },
357
357
  toBack: function (value) {
358
358
  if (!Array.isArray(value)) {
359
359
  return [];
360
360
  }
361
- return modelClass.toBack(value);
361
+ return value.map(function (item) { return modelClass.toBack(item); });
362
362
  }
363
363
  };
364
364
  }
@@ -1176,21 +1176,45 @@
1176
1176
  League.toBack = function (data) { };
1177
1177
  Object.defineProperty(League.prototype, "vkLink", {
1178
1178
  get: function () {
1179
- return this.socialLinks.find(function (link) { return link.substr(0, 15) === 'https://vk.com/'; });
1179
+ return this.socialLinks.find(function (link) { return link.indexOf('vk.com/') > -1; });
1180
1180
  },
1181
1181
  enumerable: true,
1182
1182
  configurable: true
1183
1183
  });
1184
1184
  Object.defineProperty(League.prototype, "fbLink", {
1185
1185
  get: function () {
1186
- return this.socialLinks.find(function (link) { return link.substr(0, 25) === 'https://www.facebook.com/'; });
1186
+ return this.socialLinks.find(function (link) { return link.indexOf('facebook.com/') > -1; });
1187
1187
  },
1188
1188
  enumerable: true,
1189
1189
  configurable: true
1190
1190
  });
1191
1191
  Object.defineProperty(League.prototype, "instaLink", {
1192
1192
  get: function () {
1193
- return this.socialLinks.find(function (link) { return link.substr(0, 25) === 'https://www.instagram.com'; });
1193
+ return this.socialLinks.find(function (link) { return link.indexOf('instagram.com/') > -1; });
1194
+ },
1195
+ enumerable: true,
1196
+ configurable: true
1197
+ });
1198
+ Object.defineProperty(League.prototype, "youtubeLink", {
1199
+ get: function () {
1200
+ return this.socialLinks.find(function (link) { return link.indexOf('youtube.com/') > -1; });
1201
+ },
1202
+ enumerable: true,
1203
+ configurable: true
1204
+ });
1205
+ Object.defineProperty(League.prototype, "telegramLink", {
1206
+ get: function () {
1207
+ return this.socialLinks.find(function (link) {
1208
+ return link.substr(0, 13) === 'https://t.me/' ||
1209
+ link.substr(0, 17) === 'https://www.t.me/';
1210
+ });
1211
+ },
1212
+ enumerable: true,
1213
+ configurable: true
1214
+ });
1215
+ Object.defineProperty(League.prototype, "tiktokLink", {
1216
+ get: function () {
1217
+ return this.socialLinks.find(function (link) { return link.indexOf('tiktok.com/') > -1; });
1194
1218
  },
1195
1219
  enumerable: true,
1196
1220
  configurable: true
@@ -1753,6 +1777,121 @@
1753
1777
  return HandballGameConfig;
1754
1778
  }(BaseModel));
1755
1779
 
1780
+ function generateArray(length) {
1781
+ if (length <= 0) {
1782
+ return [];
1783
+ }
1784
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
1785
+ }
1786
+ function getArrayChunks(array, length) {
1787
+ var chunks = [];
1788
+ var chunkLength = Math.ceil(array.length / length);
1789
+ if (chunkLength === 0) {
1790
+ return [array];
1791
+ }
1792
+ for (var i = 0; i < chunkLength; i++) {
1793
+ chunks.push(array.slice(i * length, (i + 1) * length));
1794
+ }
1795
+ return chunks;
1796
+ }
1797
+
1798
+
1799
+ (function (PlayoffTypes) {
1800
+ PlayoffTypes["double_elimination"] = "double_elimination";
1801
+ PlayoffTypes["elimination"] = "elimination";
1802
+ })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
1803
+ var PlayoffSettings = /** @class */ (function (_super) {
1804
+ __extends(PlayoffSettings, _super);
1805
+ function PlayoffSettings() {
1806
+ return _super !== null && _super.apply(this, arguments) || this;
1807
+ }
1808
+ PlayoffSettings.toFront = function (data) { };
1809
+ PlayoffSettings.toBack = function (data) { };
1810
+ __decorate([
1811
+ ToFrontHook
1812
+ ], PlayoffSettings, "toFront", null);
1813
+ __decorate([
1814
+ ToBackHook
1815
+ ], PlayoffSettings, "toBack", null);
1816
+ PlayoffSettings = __decorate([
1817
+ ModelInstance({
1818
+ mappingFields: {
1819
+ rounds: 'rounds',
1820
+ final_rounds: 'finalRounds',
1821
+ third_place_rounds: 'thirdPlaceRounds',
1822
+ teams_count: 'teamsCount',
1823
+ type: 'type',
1824
+ min_player_games_count: 'minPlayerGamesCount',
1825
+ min_player_time: 'minPlayerTime',
1826
+ },
1827
+ relation: {
1828
+ type: enumField(exports.PlayoffTypes)
1829
+ }
1830
+ })
1831
+ ], PlayoffSettings);
1832
+ return PlayoffSettings;
1833
+ }(BaseModel));
1834
+ var Playoff = /** @class */ (function (_super) {
1835
+ __extends(Playoff, _super);
1836
+ function Playoff() {
1837
+ var _this = _super !== null && _super.apply(this, arguments) || this;
1838
+ _this.stages = [];
1839
+ return _this;
1840
+ }
1841
+ Playoff.toFront = function (data) { };
1842
+ Playoff.toBack = function (data) { };
1843
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
1844
+ get: function () {
1845
+ return Math.log(this.settings.teamsCount) / Math.log(2);
1846
+ },
1847
+ enumerable: true,
1848
+ configurable: true
1849
+ });
1850
+ Playoff.prototype.getPlayoffStages = function () {
1851
+ var _this = this;
1852
+ if (this.stages.length === 0 && this.settings.teamsCount) {
1853
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
1854
+ this.stages = generateArray(stagesCount).map(function (stage) {
1855
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
1856
+ var title = '';
1857
+ if (playoffStage === 1) {
1858
+ title = 'Финал';
1859
+ }
1860
+ else {
1861
+ title = "1 / " + playoffStage;
1862
+ }
1863
+ return {
1864
+ value: stage,
1865
+ title: title
1866
+ };
1867
+ });
1868
+ }
1869
+ return this.stages;
1870
+ };
1871
+ __decorate([
1872
+ ToFrontHook
1873
+ ], Playoff, "toFront", null);
1874
+ __decorate([
1875
+ ToBackHook
1876
+ ], Playoff, "toBack", null);
1877
+ Playoff = __decorate([
1878
+ ModelInstance({
1879
+ mappingFields: {
1880
+ id: 'id',
1881
+ name: 'name',
1882
+ settings: 'settings',
1883
+ tournament_id: 'tournamentId',
1884
+ tournament_stage_id: 'tournamentStageId',
1885
+ is_official: 'isOfficial'
1886
+ },
1887
+ relation: {
1888
+ settings: PlayoffSettings
1889
+ }
1890
+ })
1891
+ ], Playoff);
1892
+ return Playoff;
1893
+ }(BaseModel));
1894
+
1756
1895
 
1757
1896
  (function (GameStatuses) {
1758
1897
  GameStatuses[GameStatuses["open"] = 1] = "open";
@@ -1864,6 +2003,7 @@
1864
2003
  playoff_stage: 'playoffStage',
1865
2004
  tournament_stage_id: 'tournamentStageId',
1866
2005
  tournament_playoff_id: 'tournamentPlayoffId',
2006
+ tournament_playoff: 'tournamentPlayoff',
1867
2007
  tournament_court: 'tournamentCourt',
1868
2008
  media_count: 'mediaCount',
1869
2009
  media_live_count: 'mediaLiveCount',
@@ -1881,6 +2021,7 @@
1881
2021
  hockeyGameConfig: HockeyGameConfig,
1882
2022
  footballGameConfig: FootballGameConfig,
1883
2023
  handballGameConfig: HandballGameConfig,
2024
+ tournamentPlayoff: Playoff,
1884
2025
  tournamentCourt: LeagueCourt,
1885
2026
  media: listField(MediaItem),
1886
2027
  tournament: Tournament,
@@ -2675,6 +2816,40 @@
2675
2816
  return GameUser;
2676
2817
  }(BaseModel));
2677
2818
 
2819
+
2820
+ (function (GameUserLimitationTypes) {
2821
+ GameUserLimitationTypes["min_user_games_count"] = "min_user_games_count";
2822
+ GameUserLimitationTypes["min_user_time"] = "min_user_time";
2823
+ })(exports.GameUserLimitationTypes || (exports.GameUserLimitationTypes = {}));
2824
+ var GameUserLimitations = /** @class */ (function (_super) {
2825
+ __extends(GameUserLimitations, _super);
2826
+ function GameUserLimitations() {
2827
+ return _super !== null && _super.apply(this, arguments) || this;
2828
+ }
2829
+ GameUserLimitations.toFront = function (data) {
2830
+ };
2831
+ GameUserLimitations.toBack = function (data) {
2832
+ };
2833
+ __decorate([
2834
+ ToFrontHook
2835
+ ], GameUserLimitations, "toFront", null);
2836
+ __decorate([
2837
+ ToBackHook
2838
+ ], GameUserLimitations, "toBack", null);
2839
+ GameUserLimitations = __decorate([
2840
+ ModelInstance({
2841
+ mappingFields: {
2842
+ tournament_team_user_id: 'tournamentTeamUserId',
2843
+ limitations: 'limitations'
2844
+ },
2845
+ relation: {
2846
+ limitations: listField(enumField(exports.GameUserLimitationTypes))
2847
+ }
2848
+ })
2849
+ ], GameUserLimitations);
2850
+ return GameUserLimitations;
2851
+ }(BaseModel));
2852
+
2678
2853
  var GameBaseApi = /** @class */ (function () {
2679
2854
  function GameBaseApi(httpClient, configService) {
2680
2855
  this.httpClient = httpClient;
@@ -2694,6 +2869,13 @@
2694
2869
  });
2695
2870
  });
2696
2871
  };
2872
+ GameBaseApi.prototype.getUsersLimitation = function (gameId) {
2873
+ return __awaiter(this, void 0, void 0, function () {
2874
+ return __generator(this, function (_a) {
2875
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users_limitation/").pipe(operators.map(function (result) { return GameUserLimitations.toFront(result); })).toPromise()];
2876
+ });
2877
+ });
2878
+ };
2697
2879
  GameBaseApi.ctorParameters = function () { return [
2698
2880
  { type: http.HttpClient },
2699
2881
  { type: ConfigService }
@@ -4444,119 +4626,6 @@
4444
4626
  return TournamentStage;
4445
4627
  }(BaseModel));
4446
4628
 
4447
- function generateArray(length) {
4448
- if (length <= 0) {
4449
- return [];
4450
- }
4451
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
4452
- }
4453
- function getArrayChunks(array, length) {
4454
- var chunks = [];
4455
- var chunkLength = Math.ceil(array.length / length);
4456
- if (chunkLength === 0) {
4457
- return [array];
4458
- }
4459
- for (var i = 0; i < chunkLength; i++) {
4460
- chunks.push(array.slice(i * length, (i + 1) * length));
4461
- }
4462
- return chunks;
4463
- }
4464
-
4465
-
4466
- (function (PlayoffTypes) {
4467
- PlayoffTypes["double_elimination"] = "double_elimination";
4468
- PlayoffTypes["elimination"] = "elimination";
4469
- })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
4470
- var PlayoffSettings = /** @class */ (function (_super) {
4471
- __extends(PlayoffSettings, _super);
4472
- function PlayoffSettings() {
4473
- return _super !== null && _super.apply(this, arguments) || this;
4474
- }
4475
- PlayoffSettings.toFront = function (data) { };
4476
- PlayoffSettings.toBack = function (data) { };
4477
- __decorate([
4478
- ToFrontHook
4479
- ], PlayoffSettings, "toFront", null);
4480
- __decorate([
4481
- ToBackHook
4482
- ], PlayoffSettings, "toBack", null);
4483
- PlayoffSettings = __decorate([
4484
- ModelInstance({
4485
- mappingFields: {
4486
- rounds: 'rounds',
4487
- final_rounds: 'finalRounds',
4488
- third_place_rounds: 'thirdPlaceRounds',
4489
- teams_count: 'teamsCount',
4490
- type: 'type',
4491
- },
4492
- relation: {
4493
- type: enumField(exports.PlayoffTypes)
4494
- }
4495
- })
4496
- ], PlayoffSettings);
4497
- return PlayoffSettings;
4498
- }(BaseModel));
4499
- var Playoff = /** @class */ (function (_super) {
4500
- __extends(Playoff, _super);
4501
- function Playoff() {
4502
- var _this = _super !== null && _super.apply(this, arguments) || this;
4503
- _this.stages = [];
4504
- return _this;
4505
- }
4506
- Playoff.toFront = function (data) { };
4507
- Playoff.toBack = function (data) { };
4508
- Object.defineProperty(Playoff.prototype, "stagesCount", {
4509
- get: function () {
4510
- return Math.log(this.settings.teamsCount) / Math.log(2);
4511
- },
4512
- enumerable: true,
4513
- configurable: true
4514
- });
4515
- Playoff.prototype.getPlayoffStages = function () {
4516
- var _this = this;
4517
- if (this.stages.length === 0 && this.settings.teamsCount) {
4518
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
4519
- this.stages = generateArray(stagesCount).map(function (stage) {
4520
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
4521
- var title = '';
4522
- if (playoffStage === 1) {
4523
- title = 'Финал';
4524
- }
4525
- else {
4526
- title = "1 / " + playoffStage;
4527
- }
4528
- return {
4529
- value: stage,
4530
- title: title
4531
- };
4532
- });
4533
- }
4534
- return this.stages;
4535
- };
4536
- __decorate([
4537
- ToFrontHook
4538
- ], Playoff, "toFront", null);
4539
- __decorate([
4540
- ToBackHook
4541
- ], Playoff, "toBack", null);
4542
- Playoff = __decorate([
4543
- ModelInstance({
4544
- mappingFields: {
4545
- id: 'id',
4546
- name: 'name',
4547
- settings: 'settings',
4548
- tournament_id: 'tournamentId',
4549
- tournament_stage_id: 'tournamentStageId',
4550
- is_official: 'isOfficial'
4551
- },
4552
- relation: {
4553
- settings: PlayoffSettings
4554
- }
4555
- })
4556
- ], Playoff);
4557
- return Playoff;
4558
- }(BaseModel));
4559
-
4560
4629
  var VolleyballStatistic = /** @class */ (function (_super) {
4561
4630
  __extends(VolleyballStatistic, _super);
4562
4631
  function VolleyballStatistic() {
@@ -8473,6 +8542,12 @@
8473
8542
  _a$8[exports.VolleyballGameLogType.yellow_card] = 'Предупреждение',
8474
8543
  _a$8);
8475
8544
 
8545
+ var _a$9;
8546
+ var GameUserLimitationTypeLocalization = (_a$9 = {},
8547
+ _a$9[exports.GameUserLimitationTypes.min_user_games_count] = 'Минимальное количество матчей для допуска до плей-офф',
8548
+ _a$9[exports.GameUserLimitationTypes.min_user_time] = 'Минимальное количество минут для допуска до плей-офф',
8549
+ _a$9);
8550
+
8476
8551
  var LeaguePlaylist = /** @class */ (function (_super) {
8477
8552
  __extends(LeaguePlaylist, _super);
8478
8553
  function LeaguePlaylist() {
@@ -8959,6 +9034,8 @@
8959
9034
  exports.GameTimelineStageItem = GameTimelineStageItem;
8960
9035
  exports.GameTimelineStages = GameTimelineStages;
8961
9036
  exports.GameUser = GameUser;
9037
+ exports.GameUserLimitationTypeLocalization = GameUserLimitationTypeLocalization;
9038
+ exports.GameUserLimitations = GameUserLimitations;
8962
9039
  exports.GameVolleyballPositionLocalization = GameVolleyballPositionLocalization;
8963
9040
  exports.GameVolleyballPositionShortLocalization = GameVolleyballPositionShortLocalization;
8964
9041
  exports.GameVolleyballPositionShortRuLocalization = GameVolleyballPositionShortRuLocalization;