@mtgame/core 0.1.157 → 0.2.1
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/bundles/mtgame-core.umd.js +58 -36
- package/bundles/mtgame-core.umd.js.map +1 -1
- package/esm2015/localization/basketball-game-sub-log-types.js +5 -2
- package/esm2015/models/basketball-game-config.js +4 -2
- package/esm2015/models/basketball-game-log.js +4 -1
- package/esm2015/models/league.js +3 -1
- package/esm2015/models/tournament.js +8 -1
- package/esm2015/services/centrifugo.service.js +27 -34
- package/fesm2015/mtgame-core.js +46 -36
- package/fesm2015/mtgame-core.js.map +1 -1
- package/localization/basketball-game-sub-log-types.d.ts +3 -0
- package/models/basketball-game-config.d.ts +2 -1
- package/models/basketball-game-log.d.ts +4 -1
- package/models/league.d.ts +1 -0
- package/models/tournament.d.ts +5 -0
- package/mtgame-core.metadata.json +1 -1
- package/package.json +4 -4
- package/services/centrifugo.service.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@mtgame/core', ['exports', '@angular/core', '@angular/common/http', 'rxjs/operators', 'rxjs', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.mtgame = global.mtgame || {}, global.mtgame.core = {}), global.ng.core, global.ng.common.http, global.rxjs.operators, global.rxjs, global.
|
|
5
|
-
}(this, (function (exports, i0, i1, operators, rxjs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('centrifuge'), require('rxjs/internal/Subject'), require('@sentry/angular'), require('@angular/forms'), require('@angular/common')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@mtgame/core', ['exports', '@angular/core', '@angular/common/http', 'rxjs/operators', 'rxjs', 'centrifuge', 'rxjs/internal/Subject', '@sentry/angular', '@angular/forms', '@angular/common'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.mtgame = global.mtgame || {}, global.mtgame.core = {}), global.ng.core, global.ng.common.http, global.rxjs.operators, global.rxjs, global.centrifuge, global.rxjs['internal/Subject'], global.angular, global.ng.forms, global.ng.common));
|
|
5
|
+
}(this, (function (exports, i0, i1, operators, rxjs, centrifuge, Subject, angular, forms, common) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
-
var Centrifuge__namespace = /*#__PURE__*/_interopNamespace(Centrifuge);
|
|
30
29
|
|
|
31
30
|
/*! *****************************************************************************
|
|
32
31
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1506,12 +1505,14 @@
|
|
|
1506
1505
|
documents_count: 'documentsCount',
|
|
1507
1506
|
closest_game_datetime: 'closestGameDatetime',
|
|
1508
1507
|
cover: 'cover',
|
|
1508
|
+
cover_mobile: 'coverMobile',
|
|
1509
1509
|
about: 'about',
|
|
1510
1510
|
},
|
|
1511
1511
|
relation: {
|
|
1512
1512
|
organization: exports.Organization,
|
|
1513
1513
|
logo: exports.File,
|
|
1514
1514
|
cover: exports.File,
|
|
1515
|
+
coverMobile: exports.File,
|
|
1515
1516
|
sport: exports.Sport,
|
|
1516
1517
|
}
|
|
1517
1518
|
})
|
|
@@ -1615,6 +1616,11 @@
|
|
|
1615
1616
|
OvertimeTypes[OvertimeTypes["penalties"] = 8] = "penalties";
|
|
1616
1617
|
OvertimeTypes[OvertimeTypes["time_and_penalties"] = 9] = "time_and_penalties";
|
|
1617
1618
|
})(exports.OvertimeTypes || (exports.OvertimeTypes = {}));
|
|
1619
|
+
exports.TimerTypes = void 0;
|
|
1620
|
+
(function (TimerTypes) {
|
|
1621
|
+
TimerTypes[TimerTypes["backward"] = 1] = "backward";
|
|
1622
|
+
TimerTypes[TimerTypes["forward"] = 2] = "forward";
|
|
1623
|
+
})(exports.TimerTypes || (exports.TimerTypes = {}));
|
|
1618
1624
|
exports.TournamentSettings = /** @class */ (function (_super) {
|
|
1619
1625
|
__extends(TournamentSettings, _super);
|
|
1620
1626
|
function TournamentSettings() {
|
|
@@ -1695,6 +1701,7 @@
|
|
|
1695
1701
|
major_penalty_time: 'majorPenaltyTime',
|
|
1696
1702
|
misconduct_penalty_time: 'misconductPenaltyTime',
|
|
1697
1703
|
game_misconduct_penalty_time: 'gameMisconductPenaltyTime',
|
|
1704
|
+
timer_type: 'timerType',
|
|
1698
1705
|
},
|
|
1699
1706
|
relation: {
|
|
1700
1707
|
type: enumField(exports.TournamentTypes),
|
|
@@ -1704,6 +1711,7 @@
|
|
|
1704
1711
|
rugbyStatisticType: enumField(exports.RugbyStatisticTypes),
|
|
1705
1712
|
gameTimeType: enumField(exports.GameTimeTypes),
|
|
1706
1713
|
overtimeType: enumField(exports.OvertimeTypes),
|
|
1714
|
+
timerType: enumField(exports.TimerTypes),
|
|
1707
1715
|
}
|
|
1708
1716
|
})
|
|
1709
1717
|
], exports.TournamentSettings);
|
|
@@ -1858,11 +1866,13 @@
|
|
|
1858
1866
|
statistic_type: 'statisticType',
|
|
1859
1867
|
shot_clock_enabled: 'shotClockEnabled',
|
|
1860
1868
|
game_time_type: 'gameTimeType',
|
|
1869
|
+
timer_type: 'timerType',
|
|
1861
1870
|
},
|
|
1862
1871
|
relation: {
|
|
1863
1872
|
overtimeType: enumField(exports.OvertimeTypes),
|
|
1864
1873
|
statisticType: enumField(exports.BasketballStatisticTypes),
|
|
1865
1874
|
gameTimeType: enumField(exports.GameTimeTypes),
|
|
1875
|
+
timerType: enumField(exports.TimerTypes),
|
|
1866
1876
|
}
|
|
1867
1877
|
})
|
|
1868
1878
|
], exports.BasketballGameConfig);
|
|
@@ -3624,6 +3634,9 @@
|
|
|
3624
3634
|
BasketballSubLogTypes[BasketballSubLogTypes["five_seconds"] = 21] = "five_seconds";
|
|
3625
3635
|
BasketballSubLogTypes[BasketballSubLogTypes["eight_seconds"] = 22] = "eight_seconds";
|
|
3626
3636
|
BasketballSubLogTypes[BasketballSubLogTypes["twenty_four_seconds"] = 23] = "twenty_four_seconds";
|
|
3637
|
+
BasketballSubLogTypes[BasketballSubLogTypes["back_court"] = 24] = "back_court";
|
|
3638
|
+
BasketballSubLogTypes[BasketballSubLogTypes["offensive_goal_tending"] = 25] = "offensive_goal_tending";
|
|
3639
|
+
BasketballSubLogTypes[BasketballSubLogTypes["other_turnover"] = 26] = "other_turnover";
|
|
3627
3640
|
})(exports.BasketballSubLogTypes || (exports.BasketballSubLogTypes = {}));
|
|
3628
3641
|
exports.BasketballCourtZones = void 0;
|
|
3629
3642
|
(function (BasketballCourtZones) {
|
|
@@ -12548,12 +12561,15 @@
|
|
|
12548
12561
|
_a$e[exports.BasketballSubLogTypes.bad_pass] = 'Плохой пас',
|
|
12549
12562
|
_a$e[exports.BasketballSubLogTypes.ball_handling] = 'На ведении',
|
|
12550
12563
|
_a$e[exports.BasketballSubLogTypes.travel] = 'Пробежка',
|
|
12551
|
-
_a$e[exports.BasketballSubLogTypes.double_dribble] = '
|
|
12564
|
+
_a$e[exports.BasketballSubLogTypes.double_dribble] = 'Двойное ведение',
|
|
12552
12565
|
_a$e[exports.BasketballSubLogTypes.out_of_bounds] = 'Заступ в аут',
|
|
12553
12566
|
_a$e[exports.BasketballSubLogTypes.three_seconds] = '3 секунды',
|
|
12554
12567
|
_a$e[exports.BasketballSubLogTypes.five_seconds] = '5 секунд',
|
|
12555
12568
|
_a$e[exports.BasketballSubLogTypes.eight_seconds] = '8 секунд',
|
|
12556
12569
|
_a$e[exports.BasketballSubLogTypes.twenty_four_seconds] = '24 секунды',
|
|
12570
|
+
_a$e[exports.BasketballSubLogTypes.back_court] = 'Зона',
|
|
12571
|
+
_a$e[exports.BasketballSubLogTypes.offensive_goal_tending] = 'Гоалтендинг',
|
|
12572
|
+
_a$e[exports.BasketballSubLogTypes.other_turnover] = 'Другое',
|
|
12557
12573
|
_a$e);
|
|
12558
12574
|
|
|
12559
12575
|
var _a$d;
|
|
@@ -13151,12 +13167,9 @@
|
|
|
13151
13167
|
if (channel in this.channels$) {
|
|
13152
13168
|
return this.channels$[channel];
|
|
13153
13169
|
}
|
|
13154
|
-
this.channels$[channel] = new
|
|
13155
|
-
|
|
13170
|
+
this.channels$[channel] = new rxjs.Subject();
|
|
13171
|
+
this.connect().subscribe(function (connected) {
|
|
13156
13172
|
_this.subscriptions[channel] = _this.addEngineSubscription(channel);
|
|
13157
|
-
setTimeout(function () {
|
|
13158
|
-
subscription.unsubscribe();
|
|
13159
|
-
});
|
|
13160
13173
|
});
|
|
13161
13174
|
return this.channels$[channel];
|
|
13162
13175
|
};
|
|
@@ -13173,62 +13186,71 @@
|
|
|
13173
13186
|
CentrifugoService.prototype.connect = function () {
|
|
13174
13187
|
var _this = this;
|
|
13175
13188
|
if (!this.initializeEngineSubject) {
|
|
13176
|
-
this.initializeEngineSubject = new
|
|
13177
|
-
this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/
|
|
13189
|
+
this.initializeEngineSubject = new rxjs.ReplaySubject(1);
|
|
13190
|
+
this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/centrifugo_v2/")
|
|
13178
13191
|
.subscribe(function (config) {
|
|
13179
13192
|
_this.initializeEngine({
|
|
13180
13193
|
url: _this.configService.get('centrifugoUrl'),
|
|
13181
|
-
user: config.user,
|
|
13182
|
-
timestamp: config.timestamp,
|
|
13183
13194
|
token: config.token,
|
|
13184
13195
|
transports: ['websocket']
|
|
13185
13196
|
});
|
|
13186
|
-
_this.centrifuge.
|
|
13187
|
-
_this.centrifuge.on('connect', function () {
|
|
13197
|
+
_this.centrifuge.on('connected', function () {
|
|
13188
13198
|
_this.initializeEngineSubject.next(true);
|
|
13189
13199
|
_this.connectedSubject.next(true);
|
|
13190
13200
|
});
|
|
13191
|
-
_this.centrifuge.on('
|
|
13201
|
+
_this.centrifuge.on('disconnected', function () {
|
|
13192
13202
|
_this.connectedSubject.next(false);
|
|
13203
|
+
_this.initializeEngineSubject.next(false);
|
|
13193
13204
|
});
|
|
13205
|
+
_this.centrifuge.connect();
|
|
13194
13206
|
});
|
|
13195
13207
|
}
|
|
13196
13208
|
return this.initializeEngineSubject.pipe(operators.filter(function (item) { return Boolean(item); }), operators.take(1));
|
|
13197
13209
|
};
|
|
13198
13210
|
CentrifugoService.prototype.publish = function (channel, message) {
|
|
13199
13211
|
var _this = this;
|
|
13200
|
-
return
|
|
13201
|
-
_this.connect().subscribe(function () {
|
|
13202
|
-
if (!_this.subscriptions[channel]) {
|
|
13203
|
-
_this.subscriptions[channel] = _this.addEngineSubscription(channel);
|
|
13204
|
-
}
|
|
13205
|
-
_this.subscriptions[channel].publish(message).then(function (res) {
|
|
13206
|
-
observer.next(res);
|
|
13207
|
-
observer.complete();
|
|
13208
|
-
}, function (error) {
|
|
13209
|
-
throw error;
|
|
13210
|
-
});
|
|
13211
|
-
});
|
|
13212
|
-
});
|
|
13212
|
+
return this.connect().pipe(operators.tap(function () { return _this.centrifuge.publish(channel, message); }));
|
|
13213
13213
|
};
|
|
13214
13214
|
CentrifugoService.prototype.disconnect = function () {
|
|
13215
|
+
var e_1, _a;
|
|
13215
13216
|
this.centrifuge.disconnect();
|
|
13216
13217
|
this.initializeEngineSubject = undefined;
|
|
13218
|
+
try {
|
|
13219
|
+
for (var _b = __values(Object.keys(this.channels$)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13220
|
+
var channel = _c.value;
|
|
13221
|
+
this.unsubscribe(channel);
|
|
13222
|
+
}
|
|
13223
|
+
}
|
|
13224
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
13225
|
+
finally {
|
|
13226
|
+
try {
|
|
13227
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13228
|
+
}
|
|
13229
|
+
finally { if (e_1) throw e_1.error; }
|
|
13230
|
+
}
|
|
13217
13231
|
this.channels$ = {};
|
|
13218
13232
|
this.subscriptions = {};
|
|
13219
13233
|
};
|
|
13220
13234
|
CentrifugoService.prototype.initializeEngine = function (config) {
|
|
13221
|
-
this.centrifuge = new
|
|
13235
|
+
this.centrifuge = new centrifuge.Centrifuge(config.url, {
|
|
13236
|
+
token: config.token,
|
|
13237
|
+
});
|
|
13222
13238
|
};
|
|
13223
13239
|
CentrifugoService.prototype.addEngineSubscription = function (channel) {
|
|
13224
|
-
|
|
13240
|
+
var _this = this;
|
|
13241
|
+
var sub = this.centrifuge.newSubscription(channel);
|
|
13242
|
+
sub.on('publication', function (ctx) {
|
|
13243
|
+
_this.resolveMessage(channel, ctx.data);
|
|
13244
|
+
});
|
|
13245
|
+
sub.subscribe();
|
|
13246
|
+
return sub;
|
|
13225
13247
|
};
|
|
13226
|
-
CentrifugoService.prototype.resolveMessage = function (
|
|
13227
|
-
var channel = response.channel;
|
|
13248
|
+
CentrifugoService.prototype.resolveMessage = function (channel, message) {
|
|
13228
13249
|
if (!this.channels$[channel]) {
|
|
13229
13250
|
return;
|
|
13230
13251
|
}
|
|
13231
|
-
|
|
13252
|
+
console.log(message);
|
|
13253
|
+
this.channels$[channel].next(message);
|
|
13232
13254
|
};
|
|
13233
13255
|
return CentrifugoService;
|
|
13234
13256
|
}());
|