@senior-gestao-empresarial/angular-components 4.22.1 → 4.22.2-7c0b6b2c-1273-4faf-bd8a-91d677cec9bd
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 +179 -106
- 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 -17
- package/esm2015/components/websocket/websocket.service.js +113 -84
- package/esm5/components/websocket/websocket.service.js +177 -106
- package/fesm2015/senior-gestao-empresarial-angular-components.js +112 -82
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +176 -104
- 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,65 +6626,81 @@
|
|
|
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;
|
|
6634
6633
|
setTimeout(function () {
|
|
6635
6634
|
if (_this.isConnected()) {
|
|
6636
|
-
_this.
|
|
6635
|
+
_this.connect$.next();
|
|
6637
6636
|
}
|
|
6638
6637
|
}, 0);
|
|
6639
|
-
return this.connect$.
|
|
6638
|
+
return this.connect$.pipe(operators.first());
|
|
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,19 +6770,24 @@
|
|
|
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.connect$.next();
|
|
6784
|
+
}
|
|
6785
|
+
}, function (error) {
|
|
6764
6786
|
_this.setConnected(false);
|
|
6765
|
-
|
|
6787
|
+
_this.error$.next(error);
|
|
6788
|
+
_this.reconnect();
|
|
6766
6789
|
});
|
|
6767
6790
|
};
|
|
6768
|
-
WebsocketService.prototype.publishOnConnect = function () {
|
|
6769
|
-
this.connect$.next();
|
|
6770
|
-
this.connect$.observers = [];
|
|
6771
|
-
};
|
|
6772
6791
|
WebsocketService.prototype.onFocus = function () {
|
|
6773
6792
|
this.focused = true;
|
|
6774
6793
|
};
|
|
@@ -6776,59 +6795,55 @@
|
|
|
6776
6795
|
this.focused = false;
|
|
6777
6796
|
};
|
|
6778
6797
|
WebsocketService.prototype.disconnect = function () {
|
|
6779
|
-
var e_3, _a, e_4, _b;
|
|
6780
|
-
var observersCount =
|
|
6798
|
+
var e_3, _a, e_4, _b, e_5, _c;
|
|
6799
|
+
var observersCount = this.getObserversCount();
|
|
6800
|
+
if (observersCount > 0)
|
|
6801
|
+
return;
|
|
6781
6802
|
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;
|
|
6803
|
+
for (var _d = __values(this.primitiveManagers.values()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
6804
|
+
var primitiveManager = _e.value;
|
|
6797
6805
|
try {
|
|
6798
|
-
for (var
|
|
6799
|
-
var stompSubscription =
|
|
6806
|
+
for (var _f = (e_4 = void 0, __values(primitiveManager.stompSubscriptions)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
6807
|
+
var stompSubscription = _g.value;
|
|
6800
6808
|
stompSubscription.unsubscribe();
|
|
6801
6809
|
}
|
|
6802
6810
|
}
|
|
6803
|
-
catch (
|
|
6811
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
6804
6812
|
finally {
|
|
6805
6813
|
try {
|
|
6806
|
-
if (
|
|
6814
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
6807
6815
|
}
|
|
6808
|
-
finally { if (
|
|
6816
|
+
finally { if (e_4) throw e_4.error; }
|
|
6809
6817
|
}
|
|
6810
|
-
}
|
|
6818
|
+
}
|
|
6819
|
+
}
|
|
6820
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
6821
|
+
finally {
|
|
6811
6822
|
try {
|
|
6812
|
-
|
|
6813
|
-
var primitiveManager = _f.value;
|
|
6814
|
-
primitiveManager.subject.complete();
|
|
6815
|
-
}
|
|
6823
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
6816
6824
|
}
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6825
|
+
finally { if (e_3) throw e_3.error; }
|
|
6826
|
+
}
|
|
6827
|
+
try {
|
|
6828
|
+
for (var _h = __values(this.primitiveManagers.values()), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
6829
|
+
var primitiveManager = _j.value;
|
|
6830
|
+
primitiveManager.subject.complete();
|
|
6823
6831
|
}
|
|
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
6832
|
}
|
|
6833
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
6834
|
+
finally {
|
|
6835
|
+
try {
|
|
6836
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
6837
|
+
}
|
|
6838
|
+
finally { if (e_5) throw e_5.error; }
|
|
6839
|
+
}
|
|
6840
|
+
this.primitiveManagers.clear();
|
|
6841
|
+
this._stompClient.disconnect();
|
|
6842
|
+
this._stompClient.deactivate();
|
|
6843
|
+
this.setConnected(false);
|
|
6844
|
+
this.isConnecting = false;
|
|
6845
|
+
this.wasConnected = false;
|
|
6846
|
+
this.disconnect$.next();
|
|
6832
6847
|
};
|
|
6833
6848
|
WebsocketService.prototype.isConnected = function () {
|
|
6834
6849
|
return this.connected;
|
|
@@ -6856,46 +6871,104 @@
|
|
|
6856
6871
|
WebsocketService.prototype.createStompClient = function () {
|
|
6857
6872
|
var ws = new SockJS(WebsocketService_1.WEBSOCKET_URL + "subscription", null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
|
|
6858
6873
|
this._stompClient = stompjs.Stomp.over(ws);
|
|
6874
|
+
// this._stompClient.debug = (str) => console.log(new Date().toISOString(), str);
|
|
6859
6875
|
this._stompClient.debug = function () { }; // Para remover os logs.
|
|
6860
6876
|
};
|
|
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 () {
|
|
6877
|
+
WebsocketService.prototype.reconnect = function () {
|
|
6869
6878
|
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
|
-
}
|
|
6879
|
+
if (this.connected)
|
|
6880
|
+
this._stompClient.disconnect();
|
|
6879
6881
|
setTimeout(function () {
|
|
6882
|
+
if (_this.getObserversCount() === 0)
|
|
6883
|
+
return;
|
|
6880
6884
|
if (_this.focused) {
|
|
6881
6885
|
_this.connect();
|
|
6882
6886
|
}
|
|
6883
6887
|
else {
|
|
6884
|
-
_this.
|
|
6888
|
+
_this.reconnect();
|
|
6885
6889
|
}
|
|
6886
6890
|
}, WebsocketService_1.RECONNECT_TIMER);
|
|
6887
6891
|
};
|
|
6892
|
+
WebsocketService.prototype.reconnectPrimitives = function () {
|
|
6893
|
+
var e_6, _a, e_7, _b;
|
|
6894
|
+
try {
|
|
6895
|
+
for (var _c = __values(this.primitiveManagers.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
6896
|
+
var primitiveManager = _d.value;
|
|
6897
|
+
try {
|
|
6898
|
+
for (var _e = (e_7 = void 0, __values(primitiveManager.stompSubscriptions)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
6899
|
+
var stompSubscription = _f.value;
|
|
6900
|
+
stompSubscription.unsubscribe();
|
|
6901
|
+
}
|
|
6902
|
+
}
|
|
6903
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
6904
|
+
finally {
|
|
6905
|
+
try {
|
|
6906
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
6907
|
+
}
|
|
6908
|
+
finally { if (e_7) throw e_7.error; }
|
|
6909
|
+
}
|
|
6910
|
+
this.createStompSubscriptions(primitiveManager);
|
|
6911
|
+
}
|
|
6912
|
+
}
|
|
6913
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
6914
|
+
finally {
|
|
6915
|
+
try {
|
|
6916
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
6917
|
+
}
|
|
6918
|
+
finally { if (e_6) throw e_6.error; }
|
|
6919
|
+
}
|
|
6920
|
+
};
|
|
6921
|
+
WebsocketService.prototype.getObserversCount = function () {
|
|
6922
|
+
var e_8, _a;
|
|
6923
|
+
var observersCount = 0;
|
|
6924
|
+
try {
|
|
6925
|
+
for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6926
|
+
var primitiveManager = _c.value;
|
|
6927
|
+
observersCount += primitiveManager.subject.observers.length;
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
6931
|
+
finally {
|
|
6932
|
+
try {
|
|
6933
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6934
|
+
}
|
|
6935
|
+
finally { if (e_8) throw e_8.error; }
|
|
6936
|
+
}
|
|
6937
|
+
return observersCount;
|
|
6938
|
+
};
|
|
6939
|
+
WebsocketService.prototype.disconnectPrimitiveOnFinalize = function (primitive) {
|
|
6940
|
+
var e_9, _a;
|
|
6941
|
+
var primitiveManager = this.primitiveManagers.get(primitive);
|
|
6942
|
+
if (!primitiveManager)
|
|
6943
|
+
return;
|
|
6944
|
+
// @IMPORTANT: Replace .observers.length with .observed in rxjs 7.0+
|
|
6945
|
+
var hasObservers = !(primitiveManager.subject.observers.length === 1);
|
|
6946
|
+
if (hasObservers)
|
|
6947
|
+
return;
|
|
6948
|
+
try {
|
|
6949
|
+
for (var _b = __values(primitiveManager.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6950
|
+
var stompSubscription = _c.value;
|
|
6951
|
+
stompSubscription.unsubscribe();
|
|
6952
|
+
}
|
|
6953
|
+
}
|
|
6954
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
6955
|
+
finally {
|
|
6956
|
+
try {
|
|
6957
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6958
|
+
}
|
|
6959
|
+
finally { if (e_9) throw e_9.error; }
|
|
6960
|
+
}
|
|
6961
|
+
this.primitiveManagers.delete(primitive);
|
|
6962
|
+
this.disconnect();
|
|
6963
|
+
};
|
|
6888
6964
|
var WebsocketService_1;
|
|
6889
6965
|
WebsocketService.RECONNECT_TIMER = 3000;
|
|
6890
|
-
WebsocketService.CONNECTION_TIMEOUT =
|
|
6966
|
+
WebsocketService.CONNECTION_TIMEOUT = 15000;
|
|
6891
6967
|
WebsocketService.BASE_URL_COOKIE = "com.senior.base.url";
|
|
6892
6968
|
WebsocketService.TOKEN_COOKIE = "com.senior.token";
|
|
6893
6969
|
WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) || "{}");
|
|
6894
6970
|
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" });
|
|
6971
|
+
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
|
|
6899
6972
|
WebsocketService = WebsocketService_1 = __decorate([
|
|
6900
6973
|
core.Injectable({
|
|
6901
6974
|
providedIn: "root",
|