@senior-gestao-empresarial/angular-components 4.22.1 → 4.22.2-7ecfc706-3270-4664-9d10-a6918ef49acd
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/senior-gestao-empresarial-angular-components.umd.js +176 -100
- package/bundles/senior-gestao-empresarial-angular-components.umd.js.map +1 -1
- package/bundles/senior-gestao-empresarial-angular-components.umd.min.js +2 -2
- package/bundles/senior-gestao-empresarial-angular-components.umd.min.js.map +1 -1
- package/components/websocket/websocket.service.d.ts +26 -16
- package/esm2015/components/websocket/websocket.service.js +110 -78
- package/esm5/components/websocket/websocket.service.js +174 -100
- package/fesm2015/senior-gestao-empresarial-angular-components.js +109 -76
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +173 -98
- package/fesm5/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/senior-gestao-empresarial-angular-components.metadata.json +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'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@seniorsistemas/angular-components'), require('@angular/common/http'), require('primeng/api'), require('@ngx-translate/core'), require('@seniorsistemas/platform-components'), require('@seniorsistemas/senior-platform-data'), require('@angular/forms'), require('js-cookie'), require('@stomp/stompjs'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/angular-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', 'moment', '@seniorsistemas/angular-components', '@angular/common/http', 'primeng/api', '@ngx-translate/core', '@seniorsistemas/platform-components', '@seniorsistemas/senior-platform-data', '@angular/forms', 'js-cookie', '@stomp/stompjs', '
|
|
4
|
-
(global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['angular-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.moment_, global.angularComponents, global.ng.common.http, global.api, global.core$1, global.platformComponents, global.seniorPlatformData, global.ng.forms, global.jsCookie, global.stompjs, global.
|
|
5
|
-
}(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, jsCookie, stompjs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@seniorsistemas/angular-components'), require('@angular/common/http'), require('primeng/api'), require('@ngx-translate/core'), require('@seniorsistemas/platform-components'), require('@seniorsistemas/senior-platform-data'), require('@angular/forms'), require('js-cookie'), require('@stomp/stompjs'), require('sockjs-client')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/angular-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', 'moment', '@seniorsistemas/angular-components', '@angular/common/http', 'primeng/api', '@ngx-translate/core', '@seniorsistemas/platform-components', '@seniorsistemas/senior-platform-data', '@angular/forms', 'js-cookie', '@stomp/stompjs', 'sockjs-client'], factory) :
|
|
4
|
+
(global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['angular-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.moment_, global.angularComponents, global.ng.common.http, global.api, global.core$1, global.platformComponents, global.seniorPlatformData, global.ng.forms, global.jsCookie, global.stompjs, global.SockJS));
|
|
5
|
+
}(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, jsCookie, stompjs, SockJS) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -6609,17 +6609,16 @@
|
|
|
6609
6609
|
}());
|
|
6610
6610
|
|
|
6611
6611
|
var WebsocketService = /** @class */ (function () {
|
|
6612
|
-
function WebsocketService(
|
|
6613
|
-
this.cookieService = cookieService;
|
|
6614
|
-
this.baseUrl = null;
|
|
6615
|
-
this.username = null;
|
|
6612
|
+
function WebsocketService() {
|
|
6616
6613
|
this.focused = true;
|
|
6614
|
+
this.wasConnected = false;
|
|
6617
6615
|
this.connected = false;
|
|
6618
6616
|
this.isConnecting = false;
|
|
6619
|
-
this.stompSubscriptions = new Map();
|
|
6620
6617
|
this.primitiveManagers = new Map();
|
|
6621
|
-
this.disconnectSubject = new rxjs.Subject();
|
|
6622
6618
|
this.connect$ = new rxjs.Subject();
|
|
6619
|
+
this.disconnect$ = new rxjs.Subject();
|
|
6620
|
+
this.reconnect$ = new rxjs.Subject();
|
|
6621
|
+
this.error$ = new rxjs.Subject();
|
|
6623
6622
|
window.onfocus = this.onFocus;
|
|
6624
6623
|
window.onblur = this.onBlur;
|
|
6625
6624
|
this.connect();
|
|
@@ -6627,7 +6626,7 @@
|
|
|
6627
6626
|
WebsocketService_1 = WebsocketService;
|
|
6628
6627
|
/**
|
|
6629
6628
|
* Observable responsável por emitir uma notificação quando a conexão websocket é estabelecida.
|
|
6630
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida
|
|
6629
|
+
* @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida.
|
|
6631
6630
|
*/
|
|
6632
6631
|
WebsocketService.prototype.onConnect = function () {
|
|
6633
6632
|
var _this = this;
|
|
@@ -6639,53 +6638,69 @@
|
|
|
6639
6638
|
return this.connect$.asObservable();
|
|
6640
6639
|
};
|
|
6641
6640
|
/**
|
|
6642
|
-
* Observable responsável por emitir uma notificação quando a conexão é
|
|
6643
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é
|
|
6641
|
+
* Observable responsável por emitir uma notificação quando a conexão é desconectada.
|
|
6642
|
+
* @return Um `Observable<void>` que emite uma notificação quando a conexão é desconectada.
|
|
6644
6643
|
*/
|
|
6645
6644
|
WebsocketService.prototype.onDisconnect = function () {
|
|
6646
|
-
return this.
|
|
6645
|
+
return this.disconnect$.asObservable();
|
|
6646
|
+
};
|
|
6647
|
+
/**
|
|
6648
|
+
* Observable responsável por emitir uma notificação quando a conexão é reconectada.
|
|
6649
|
+
* @return Um `Observable<void>` que emite uma notificação quando a conexão é reconectada.
|
|
6650
|
+
*/
|
|
6651
|
+
WebsocketService.prototype.onReconnect = function () {
|
|
6652
|
+
return this.reconnect$.asObservable();
|
|
6653
|
+
};
|
|
6654
|
+
/**
|
|
6655
|
+
* Observable responsável por emitir uma notificação quando ocorre algum erro.
|
|
6656
|
+
* @return Um `Observable<FrameImpl>` que emite uma notificação quando ocorre algum erro.
|
|
6657
|
+
*/
|
|
6658
|
+
WebsocketService.prototype.onError = function () {
|
|
6659
|
+
return this.error$.asObservable();
|
|
6647
6660
|
};
|
|
6648
6661
|
/**
|
|
6649
6662
|
* Observable responsável por emitir uma notificação quando um evento é publicado.
|
|
6650
6663
|
* @typeParam `<T>` Tipo do objeto que o retorno do `observable` vai devolver.
|
|
6651
|
-
* @param domain Dominio da
|
|
6664
|
+
* @param domain Dominio da primitiva.
|
|
6652
6665
|
* @param service Service da primitiva.
|
|
6653
6666
|
* @param primitive Primitiva que será "observada" pelo client.
|
|
6654
|
-
* @param identifierPath Caminho até a propriedade considerada o
|
|
6667
|
+
* @param identifierPath Caminho até a propriedade considerada o identificador do registro.
|
|
6655
6668
|
* @return Um `observable` que emite notificações toda vez que o respectivo evento é publicado no sistema.
|
|
6656
6669
|
*/
|
|
6657
6670
|
WebsocketService.prototype.onEvent = function (domain, service, primitive, identifierPath) {
|
|
6658
6671
|
var _this = this;
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
return primitiveManager.subject.asObservable();
|
|
6672
|
+
if (this.primitiveManagers.has(primitive)) {
|
|
6673
|
+
return this.primitiveManagers.get(primitive).subject.asObservable();
|
|
6662
6674
|
}
|
|
6663
|
-
primitiveManager = {
|
|
6675
|
+
var primitiveManager = {
|
|
6676
|
+
domain: domain,
|
|
6677
|
+
service: service,
|
|
6678
|
+
primitive: primitive,
|
|
6679
|
+
stompSubscriptions: [],
|
|
6664
6680
|
subject: new rxjs.Subject(),
|
|
6665
6681
|
identifierPath: identifierPath,
|
|
6666
6682
|
publishedEvents: [],
|
|
6667
6683
|
};
|
|
6684
|
+
this.primitiveManagers.set(primitive, primitiveManager);
|
|
6668
6685
|
if (this.isConnected()) {
|
|
6669
|
-
this.createStompSubscriptions(
|
|
6670
|
-
return primitiveManager.subject.
|
|
6686
|
+
this.createStompSubscriptions(primitiveManager);
|
|
6687
|
+
return primitiveManager.subject.pipe(operators.finalize(function () { return _this.disconnectPrimitiveOnFinalize(primitive); }));
|
|
6671
6688
|
}
|
|
6672
6689
|
else {
|
|
6673
6690
|
if (!this.isConnecting) {
|
|
6674
6691
|
this.connect();
|
|
6675
6692
|
}
|
|
6676
|
-
this.
|
|
6677
|
-
.
|
|
6678
|
-
.subscribe(function () {
|
|
6679
|
-
_this.createStompSubscriptions(domain, service, primitive, primitiveManager);
|
|
6693
|
+
this.connect$.pipe(operators.first()).subscribe(function () {
|
|
6694
|
+
_this.createStompSubscriptions(primitiveManager);
|
|
6680
6695
|
});
|
|
6681
|
-
return primitiveManager.subject.
|
|
6696
|
+
return primitiveManager.subject.pipe(operators.finalize(function () { return _this.disconnectPrimitiveOnFinalize(primitive); }));
|
|
6682
6697
|
}
|
|
6683
6698
|
};
|
|
6684
6699
|
/**
|
|
6685
6700
|
* Retorna todos os eventos ouvidos pela primitiva com os respectivos identificadores.
|
|
6686
6701
|
* @typeParam `<T>` Tipo do evento retornado pela primitiva.
|
|
6687
6702
|
* @param primitive Primitiva que será "observada" pelo client.
|
|
6688
|
-
* @param identifiers Array com os
|
|
6703
|
+
* @param identifiers Array com os identificadores interessados.
|
|
6689
6704
|
* @return Array contendo o último evento recebido de cada identificador fornecido.
|
|
6690
6705
|
*/
|
|
6691
6706
|
WebsocketService.prototype.getPublishedEvents = function (primitive, identifiers) {
|
|
@@ -6725,13 +6740,12 @@
|
|
|
6725
6740
|
primitiveManager.publishedEvents.push(event);
|
|
6726
6741
|
}
|
|
6727
6742
|
};
|
|
6728
|
-
WebsocketService.prototype.createStompSubscriptions = function (
|
|
6729
|
-
var withTokenUrl = this.getSubscriptionUrlWithToken(domain, service, primitive);
|
|
6730
|
-
this.primitiveManagers.set(primitive, primitiveManager);
|
|
6743
|
+
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
6744
|
+
var withTokenUrl = this.getSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
6731
6745
|
var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
|
|
6732
|
-
var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(domain, service, primitive);
|
|
6746
|
+
var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
6733
6747
|
var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
|
|
6734
|
-
|
|
6748
|
+
primitiveManager.stompSubscriptions = [stompSubscriptionWithToken, stompSubscriptionWithoutToken];
|
|
6735
6749
|
};
|
|
6736
6750
|
WebsocketService.prototype.getIdentifierFromEvent = function (identifierPath, event) {
|
|
6737
6751
|
var e_2, _a;
|
|
@@ -6756,13 +6770,22 @@
|
|
|
6756
6770
|
var _this = this;
|
|
6757
6771
|
this.createStompClient();
|
|
6758
6772
|
this.isConnecting = true;
|
|
6773
|
+
this._stompClient.activate();
|
|
6759
6774
|
this._stompClient.connect({}, function () {
|
|
6760
|
-
_this.setConnected(true);
|
|
6761
6775
|
_this.isConnecting = false;
|
|
6762
|
-
_this.
|
|
6763
|
-
|
|
6776
|
+
_this.setConnected(true);
|
|
6777
|
+
if (_this.wasConnected) {
|
|
6778
|
+
_this.reconnectPrimitives();
|
|
6779
|
+
_this.reconnect$.next();
|
|
6780
|
+
}
|
|
6781
|
+
else {
|
|
6782
|
+
_this.wasConnected = true;
|
|
6783
|
+
_this.publishOnConnect();
|
|
6784
|
+
}
|
|
6785
|
+
}, function (error) {
|
|
6764
6786
|
_this.setConnected(false);
|
|
6765
|
-
|
|
6787
|
+
_this.error$.next(error);
|
|
6788
|
+
_this.reconnect();
|
|
6766
6789
|
});
|
|
6767
6790
|
};
|
|
6768
6791
|
WebsocketService.prototype.publishOnConnect = function () {
|
|
@@ -6776,59 +6799,54 @@
|
|
|
6776
6799
|
this.focused = false;
|
|
6777
6800
|
};
|
|
6778
6801
|
WebsocketService.prototype.disconnect = function () {
|
|
6779
|
-
var e_3, _a, e_4, _b;
|
|
6780
|
-
var observersCount =
|
|
6802
|
+
var e_3, _a, e_4, _b, e_5, _c;
|
|
6803
|
+
var observersCount = this.getObserversCount();
|
|
6804
|
+
if (observersCount > 0)
|
|
6805
|
+
return;
|
|
6781
6806
|
try {
|
|
6782
|
-
for (var
|
|
6783
|
-
var primitiveManager =
|
|
6784
|
-
observersCount += primitiveManager.subject.observers.length;
|
|
6785
|
-
}
|
|
6786
|
-
}
|
|
6787
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
6788
|
-
finally {
|
|
6789
|
-
try {
|
|
6790
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
6791
|
-
}
|
|
6792
|
-
finally { if (e_3) throw e_3.error; }
|
|
6793
|
-
}
|
|
6794
|
-
if (observersCount === 0) {
|
|
6795
|
-
this.stompSubscriptions.forEach(function (stompSubscriptions) {
|
|
6796
|
-
var e_5, _a;
|
|
6807
|
+
for (var _d = __values(this.primitiveManagers.values()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
6808
|
+
var primitiveManager = _e.value;
|
|
6797
6809
|
try {
|
|
6798
|
-
for (var
|
|
6799
|
-
var stompSubscription =
|
|
6810
|
+
for (var _f = (e_4 = void 0, __values(primitiveManager.stompSubscriptions)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
6811
|
+
var stompSubscription = _g.value;
|
|
6800
6812
|
stompSubscription.unsubscribe();
|
|
6801
6813
|
}
|
|
6802
6814
|
}
|
|
6803
|
-
catch (
|
|
6815
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
6804
6816
|
finally {
|
|
6805
6817
|
try {
|
|
6806
|
-
if (
|
|
6818
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
6807
6819
|
}
|
|
6808
|
-
finally { if (
|
|
6820
|
+
finally { if (e_4) throw e_4.error; }
|
|
6809
6821
|
}
|
|
6810
|
-
}
|
|
6822
|
+
}
|
|
6823
|
+
}
|
|
6824
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
6825
|
+
finally {
|
|
6811
6826
|
try {
|
|
6812
|
-
|
|
6813
|
-
var primitiveManager = _f.value;
|
|
6814
|
-
primitiveManager.subject.complete();
|
|
6815
|
-
}
|
|
6827
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
6816
6828
|
}
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6829
|
+
finally { if (e_3) throw e_3.error; }
|
|
6830
|
+
}
|
|
6831
|
+
try {
|
|
6832
|
+
for (var _h = __values(this.primitiveManagers.values()), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
6833
|
+
var primitiveManager = _j.value;
|
|
6834
|
+
primitiveManager.subject.complete();
|
|
6823
6835
|
}
|
|
6824
|
-
this.stompSubscriptions.clear();
|
|
6825
|
-
this.primitiveManagers.clear();
|
|
6826
|
-
this._stompClient.disconnect();
|
|
6827
|
-
this._stompClient.deactivate();
|
|
6828
|
-
this.setConnected(false);
|
|
6829
|
-
this.isConnecting = false;
|
|
6830
|
-
this.disconnectSubject.next();
|
|
6831
6836
|
}
|
|
6837
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
6838
|
+
finally {
|
|
6839
|
+
try {
|
|
6840
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
6841
|
+
}
|
|
6842
|
+
finally { if (e_5) throw e_5.error; }
|
|
6843
|
+
}
|
|
6844
|
+
this.primitiveManagers.clear();
|
|
6845
|
+
this._stompClient.disconnect();
|
|
6846
|
+
this._stompClient.deactivate();
|
|
6847
|
+
this.setConnected(false);
|
|
6848
|
+
this.isConnecting = false;
|
|
6849
|
+
this.disconnect$.next();
|
|
6832
6850
|
};
|
|
6833
6851
|
WebsocketService.prototype.isConnected = function () {
|
|
6834
6852
|
return this.connected;
|
|
@@ -6856,46 +6874,104 @@
|
|
|
6856
6874
|
WebsocketService.prototype.createStompClient = function () {
|
|
6857
6875
|
var ws = new SockJS(WebsocketService_1.WEBSOCKET_URL + "subscription", null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
|
|
6858
6876
|
this._stompClient = stompjs.Stomp.over(ws);
|
|
6877
|
+
// this._stompClient.debug = (str) => console.log(new Date().toISOString(), str);
|
|
6859
6878
|
this._stompClient.debug = function () { }; // Para remover os logs.
|
|
6860
6879
|
};
|
|
6861
|
-
WebsocketService.prototype.
|
|
6862
|
-
return this.cookieService.get("com.senior.base.url");
|
|
6863
|
-
};
|
|
6864
|
-
WebsocketService.prototype.getUserName = function () {
|
|
6865
|
-
var token = this.cookieService.get("com.senior.token");
|
|
6866
|
-
return token && JSON.parse(token).username;
|
|
6867
|
-
};
|
|
6868
|
-
WebsocketService.prototype.reconnectWebSocket = function () {
|
|
6880
|
+
WebsocketService.prototype.reconnect = function () {
|
|
6869
6881
|
var _this = this;
|
|
6870
|
-
this.
|
|
6871
|
-
|
|
6872
|
-
if (this.baseUrl !== null && baseUrl != this.baseUrl) {
|
|
6873
|
-
return;
|
|
6874
|
-
}
|
|
6875
|
-
var username = this.getUserName();
|
|
6876
|
-
if (this.username !== null && username != this.username) {
|
|
6877
|
-
return;
|
|
6878
|
-
}
|
|
6882
|
+
if (this.connected)
|
|
6883
|
+
this._stompClient.disconnect();
|
|
6879
6884
|
setTimeout(function () {
|
|
6885
|
+
if (_this.getObserversCount() === 0)
|
|
6886
|
+
return;
|
|
6880
6887
|
if (_this.focused) {
|
|
6881
6888
|
_this.connect();
|
|
6882
6889
|
}
|
|
6883
6890
|
else {
|
|
6884
|
-
_this.
|
|
6891
|
+
_this.reconnect();
|
|
6885
6892
|
}
|
|
6886
6893
|
}, WebsocketService_1.RECONNECT_TIMER);
|
|
6887
6894
|
};
|
|
6895
|
+
WebsocketService.prototype.reconnectPrimitives = function () {
|
|
6896
|
+
var e_6, _a, e_7, _b;
|
|
6897
|
+
try {
|
|
6898
|
+
for (var _c = __values(this.primitiveManagers.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
6899
|
+
var primitiveManager = _d.value;
|
|
6900
|
+
try {
|
|
6901
|
+
for (var _e = (e_7 = void 0, __values(primitiveManager.stompSubscriptions)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
6902
|
+
var stompSubscription = _f.value;
|
|
6903
|
+
stompSubscription.unsubscribe();
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
6907
|
+
finally {
|
|
6908
|
+
try {
|
|
6909
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
6910
|
+
}
|
|
6911
|
+
finally { if (e_7) throw e_7.error; }
|
|
6912
|
+
}
|
|
6913
|
+
this.createStompSubscriptions(primitiveManager);
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
6917
|
+
finally {
|
|
6918
|
+
try {
|
|
6919
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
6920
|
+
}
|
|
6921
|
+
finally { if (e_6) throw e_6.error; }
|
|
6922
|
+
}
|
|
6923
|
+
};
|
|
6924
|
+
WebsocketService.prototype.getObserversCount = function () {
|
|
6925
|
+
var e_8, _a;
|
|
6926
|
+
var observersCount = 0;
|
|
6927
|
+
try {
|
|
6928
|
+
for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6929
|
+
var primitiveManager = _c.value;
|
|
6930
|
+
observersCount += primitiveManager.subject.observers.length;
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
6934
|
+
finally {
|
|
6935
|
+
try {
|
|
6936
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6937
|
+
}
|
|
6938
|
+
finally { if (e_8) throw e_8.error; }
|
|
6939
|
+
}
|
|
6940
|
+
return observersCount;
|
|
6941
|
+
};
|
|
6942
|
+
WebsocketService.prototype.disconnectPrimitiveOnFinalize = function (primitive) {
|
|
6943
|
+
var e_9, _a;
|
|
6944
|
+
var primitiveManager = this.primitiveManagers.get(primitive);
|
|
6945
|
+
if (!primitiveManager)
|
|
6946
|
+
return;
|
|
6947
|
+
// @IMPORTANT: Replace .observers.length with .observed in rxjs 7.0+
|
|
6948
|
+
var hasObservers = !(primitiveManager.subject.observers.length === 1);
|
|
6949
|
+
if (hasObservers)
|
|
6950
|
+
return;
|
|
6951
|
+
try {
|
|
6952
|
+
for (var _b = __values(primitiveManager.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6953
|
+
var stompSubscription = _c.value;
|
|
6954
|
+
stompSubscription.unsubscribe();
|
|
6955
|
+
}
|
|
6956
|
+
}
|
|
6957
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
6958
|
+
finally {
|
|
6959
|
+
try {
|
|
6960
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6961
|
+
}
|
|
6962
|
+
finally { if (e_9) throw e_9.error; }
|
|
6963
|
+
}
|
|
6964
|
+
this.primitiveManagers.delete(primitive);
|
|
6965
|
+
this.disconnect();
|
|
6966
|
+
};
|
|
6888
6967
|
var WebsocketService_1;
|
|
6889
6968
|
WebsocketService.RECONNECT_TIMER = 3000;
|
|
6890
|
-
WebsocketService.CONNECTION_TIMEOUT =
|
|
6969
|
+
WebsocketService.CONNECTION_TIMEOUT = 15000;
|
|
6891
6970
|
WebsocketService.BASE_URL_COOKIE = "com.senior.base.url";
|
|
6892
6971
|
WebsocketService.TOKEN_COOKIE = "com.senior.token";
|
|
6893
6972
|
WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) || "{}");
|
|
6894
6973
|
WebsocketService.WEBSOCKET_URL = jsCookie.get(WebsocketService_1.BASE_URL_COOKIE) + "/websocket/";
|
|
6895
|
-
WebsocketService
|
|
6896
|
-
{ type: ngxCookieService.CookieService }
|
|
6897
|
-
]; };
|
|
6898
|
-
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(core.ɵɵinject(ngxCookieService.CookieService)); }, token: WebsocketService, providedIn: "root" });
|
|
6974
|
+
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
|
|
6899
6975
|
WebsocketService = WebsocketService_1 = __decorate([
|
|
6900
6976
|
core.Injectable({
|
|
6901
6977
|
providedIn: "root",
|