@senior-gestao-empresarial/angular-components 6.12.0-bea9aaec-b4b5-4e5b-b8eb-155b7aa8d5aa → 6.12.0-cdee7359-3bca-4813-b06f-c65cc860eea4
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 +150 -54
- 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/utils/async-lock.d.ts +6 -0
- package/components/websocket/index.d.ts +2 -0
- package/components/websocket/models/index.d.ts +1 -0
- package/components/websocket/protocols/index.d.ts +2 -0
- package/components/websocket/websocket.service.d.ts +3 -3
- package/esm2015/components/utils/async-lock.js +34 -0
- package/esm2015/components/websocket/index.js +2 -1
- package/esm2015/components/websocket/models/index.js +2 -0
- package/esm2015/components/websocket/models/primitive-manager.js +2 -2
- package/esm2015/components/websocket/protocols/index.js +1 -0
- package/esm2015/components/websocket/user-information.service.js +2 -2
- package/esm2015/components/websocket/websocket.service.js +76 -53
- package/esm5/components/utils/async-lock.js +43 -0
- package/esm5/components/websocket/index.js +2 -1
- package/esm5/components/websocket/models/index.js +2 -0
- package/esm5/components/websocket/models/primitive-manager.js +2 -2
- package/esm5/components/websocket/protocols/index.js +1 -0
- package/esm5/components/websocket/user-information.service.js +2 -2
- package/esm5/components/websocket/websocket.service.js +109 -54
- package/fesm2015/senior-gestao-empresarial-angular-components.js +109 -54
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +150 -55
- 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
|
@@ -6768,6 +6768,39 @@ NpsService = __decorate([
|
|
|
6768
6768
|
})
|
|
6769
6769
|
], NpsService);
|
|
6770
6770
|
|
|
6771
|
+
class AsyncLock {
|
|
6772
|
+
constructor() {
|
|
6773
|
+
this.queue = [];
|
|
6774
|
+
this.acquired = false;
|
|
6775
|
+
}
|
|
6776
|
+
acquire() {
|
|
6777
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6778
|
+
if (!this.acquired) {
|
|
6779
|
+
this.acquired = true;
|
|
6780
|
+
return Promise.resolve();
|
|
6781
|
+
}
|
|
6782
|
+
else {
|
|
6783
|
+
return new Promise((resolve, _) => {
|
|
6784
|
+
this.queue.push(resolve);
|
|
6785
|
+
});
|
|
6786
|
+
}
|
|
6787
|
+
});
|
|
6788
|
+
}
|
|
6789
|
+
release() {
|
|
6790
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6791
|
+
if (this.queue.length === 0 && this.acquired) {
|
|
6792
|
+
this.acquired = false;
|
|
6793
|
+
return Promise.resolve();
|
|
6794
|
+
}
|
|
6795
|
+
const continuation = this.queue.shift();
|
|
6796
|
+
return new Promise((res) => {
|
|
6797
|
+
continuation();
|
|
6798
|
+
res();
|
|
6799
|
+
});
|
|
6800
|
+
});
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6803
|
+
|
|
6771
6804
|
var UserInformationService_1;
|
|
6772
6805
|
let UserInformationService = UserInformationService_1 = class UserInformationService {
|
|
6773
6806
|
getAuthToken() {
|
|
@@ -6782,7 +6815,7 @@ let UserInformationService = UserInformationService_1 = class UserInformationSer
|
|
|
6782
6815
|
}
|
|
6783
6816
|
getWebSocketUrl() {
|
|
6784
6817
|
let baseUrl = get(UserInformationService_1.BASE_URL_COOKIE_KEY);
|
|
6785
|
-
if (!baseUrl.endsWith('/')) {
|
|
6818
|
+
if (baseUrl && !baseUrl.endsWith('/')) {
|
|
6786
6819
|
baseUrl += '/';
|
|
6787
6820
|
}
|
|
6788
6821
|
return baseUrl + 'websocket';
|
|
@@ -6828,7 +6861,7 @@ class PrimitiveManager {
|
|
|
6828
6861
|
}
|
|
6829
6862
|
hasObservers() {
|
|
6830
6863
|
// @IMPORTANT: Replace .observers.length === 1 with .observed in rxjs 7.0+
|
|
6831
|
-
return this.event$.observers.length
|
|
6864
|
+
return this.event$.observers.length !== 1;
|
|
6832
6865
|
}
|
|
6833
6866
|
getObserversCount() {
|
|
6834
6867
|
return this.event$.observers.length;
|
|
@@ -6846,6 +6879,7 @@ let WebsocketService = class WebsocketService {
|
|
|
6846
6879
|
this.error$ = new Subject();
|
|
6847
6880
|
this.subscribed$ = new Subject();
|
|
6848
6881
|
this.primitiveManagers = new Map();
|
|
6882
|
+
this.connectionLock = new AsyncLock();
|
|
6849
6883
|
this.debugEnable = false;
|
|
6850
6884
|
this.lostConnection = false;
|
|
6851
6885
|
}
|
|
@@ -6859,43 +6893,60 @@ let WebsocketService = class WebsocketService {
|
|
|
6859
6893
|
* Manually starts the connection
|
|
6860
6894
|
*/
|
|
6861
6895
|
connect() {
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6896
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6897
|
+
yield this.connectionLock.acquire();
|
|
6898
|
+
try {
|
|
6899
|
+
if (this.isConnected() || this.isConnecting()) {
|
|
6900
|
+
return;
|
|
6901
|
+
}
|
|
6902
|
+
this.lostConnection = false;
|
|
6903
|
+
const stompConfig = {
|
|
6904
|
+
webSocketFactory: () => {
|
|
6905
|
+
return new SockJS(this.getSubscriptionUrl(), null, {
|
|
6906
|
+
timeout: CONNECTION_TIMEOUT_MILLISECONDS
|
|
6907
|
+
});
|
|
6908
|
+
},
|
|
6909
|
+
connectionTimeout: CONNECTION_TIMEOUT_MILLISECONDS,
|
|
6910
|
+
reconnectDelay: RECONNECT_INTERVAL_MILLISECONDS,
|
|
6911
|
+
debug: this.debug.bind(this),
|
|
6912
|
+
onConnect: this.handleOnConnected.bind(this),
|
|
6913
|
+
onDisconnect: this.handleOnDisconnect.bind(this),
|
|
6914
|
+
onWebSocketClose: this.handleOnWebSocketClose.bind(this),
|
|
6915
|
+
onStompError: this.handleOnStompError.bind(this),
|
|
6916
|
+
onWebSocketError: this.handleOnWebSocketError.bind(this)
|
|
6917
|
+
};
|
|
6918
|
+
this.debug('Connecting the Webscoket');
|
|
6919
|
+
this.stompClient = new Client(stompConfig);
|
|
6920
|
+
this.stompClient.activate();
|
|
6921
|
+
}
|
|
6922
|
+
finally {
|
|
6923
|
+
yield this.connectionLock.release();
|
|
6924
|
+
}
|
|
6925
|
+
});
|
|
6884
6926
|
}
|
|
6885
6927
|
/**
|
|
6886
6928
|
* Manually disconnect the websocket. The reconnect loop will be stopped.
|
|
6887
6929
|
*/
|
|
6888
6930
|
disconnect() {
|
|
6889
6931
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6890
|
-
|
|
6891
|
-
|
|
6932
|
+
if (!this.isConnected()) {
|
|
6933
|
+
return;
|
|
6892
6934
|
}
|
|
6893
|
-
this.
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6935
|
+
yield this.connectionLock.acquire();
|
|
6936
|
+
try {
|
|
6937
|
+
for (const primitiveManager of this.primitiveManagers.values()) {
|
|
6938
|
+
primitiveManager.unsubscribe();
|
|
6939
|
+
}
|
|
6940
|
+
this.primitiveManagers.clear();
|
|
6941
|
+
this.connected$.next(false);
|
|
6942
|
+
if (this.stompClient) {
|
|
6943
|
+
this.stompClient.forceDisconnect();
|
|
6944
|
+
yield this.stompClient.deactivate();
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
finally {
|
|
6948
|
+
yield this.connectionLock.release();
|
|
6897
6949
|
}
|
|
6898
|
-
this.connected$.next(false);
|
|
6899
6950
|
});
|
|
6900
6951
|
}
|
|
6901
6952
|
/**
|
|
@@ -6966,11 +7017,12 @@ let WebsocketService = class WebsocketService {
|
|
|
6966
7017
|
}
|
|
6967
7018
|
const primitiveManager = new PrimitiveManager(domain, service, primitive);
|
|
6968
7019
|
this.primitiveManagers.set(key, primitiveManager);
|
|
6969
|
-
this.connect()
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
7020
|
+
this.connect().then(() => {
|
|
7021
|
+
this.onConnect()
|
|
7022
|
+
.pipe(take(1))
|
|
7023
|
+
.subscribe(() => {
|
|
7024
|
+
this.createStompSubscriptions(primitiveManager);
|
|
7025
|
+
});
|
|
6974
7026
|
});
|
|
6975
7027
|
return primitiveManager
|
|
6976
7028
|
.getEventObservable()
|
|
@@ -6986,7 +7038,6 @@ let WebsocketService = class WebsocketService {
|
|
|
6986
7038
|
onSubscribe(options) {
|
|
6987
7039
|
const { domain, service, primitive } = options;
|
|
6988
7040
|
const key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
6989
|
-
this.connect();
|
|
6990
7041
|
return this.onConnect().pipe(take(1), switchMap(() => {
|
|
6991
7042
|
if (this.primitiveManagers.has(key)) {
|
|
6992
7043
|
return this.primitiveManagers
|
|
@@ -7008,16 +7059,17 @@ let WebsocketService = class WebsocketService {
|
|
|
7008
7059
|
info(message) {
|
|
7009
7060
|
console.info('WS info: ' + message);
|
|
7010
7061
|
}
|
|
7011
|
-
handleOnConnected(
|
|
7012
|
-
this.
|
|
7062
|
+
handleOnConnected() {
|
|
7063
|
+
this.info('Webscoket connected');
|
|
7013
7064
|
this.connected$.next(true);
|
|
7014
7065
|
if (this.lostConnection) {
|
|
7015
7066
|
this.info('Webscoket reconnected, recriating subscriptions');
|
|
7016
7067
|
this.handleReconnection();
|
|
7017
7068
|
}
|
|
7018
7069
|
}
|
|
7019
|
-
handleOnDisconnect(
|
|
7020
|
-
this.
|
|
7070
|
+
handleOnDisconnect() {
|
|
7071
|
+
this.info('Webscoket disconnected');
|
|
7072
|
+
this.connected$.next(false);
|
|
7021
7073
|
this.disconnected$.next();
|
|
7022
7074
|
}
|
|
7023
7075
|
handleOnWebSocketClose(data) {
|
|
@@ -7027,7 +7079,6 @@ let WebsocketService = class WebsocketService {
|
|
|
7027
7079
|
this.lostConnection = true;
|
|
7028
7080
|
}
|
|
7029
7081
|
handleOnStompError(data) {
|
|
7030
|
-
debugger;
|
|
7031
7082
|
this.handleError('StompError', data);
|
|
7032
7083
|
if (this.isAuthenticationError(data)) {
|
|
7033
7084
|
this.info('Authentication error, recriating subscriptions');
|
|
@@ -7072,19 +7123,23 @@ let WebsocketService = class WebsocketService {
|
|
|
7072
7123
|
return `${domain}/${service}/${primitive}`;
|
|
7073
7124
|
}
|
|
7074
7125
|
unsubscribePrimitiveOnFinalize(primitiveManager) {
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7127
|
+
if (primitiveManager.hasObservers()) {
|
|
7128
|
+
return;
|
|
7129
|
+
}
|
|
7130
|
+
primitiveManager.unsubscribe();
|
|
7131
|
+
const key = this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7132
|
+
this.primitiveManagers.delete(key);
|
|
7133
|
+
yield this.disconnectIfNoMoreObservables();
|
|
7134
|
+
});
|
|
7082
7135
|
}
|
|
7083
7136
|
disconnectIfNoMoreObservables() {
|
|
7084
|
-
|
|
7085
|
-
this.
|
|
7086
|
-
|
|
7087
|
-
|
|
7137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7138
|
+
if (this.getObserversCount() === 0) {
|
|
7139
|
+
this.debug('Manually disconnecting because there are no more observers');
|
|
7140
|
+
yield this.disconnect();
|
|
7141
|
+
}
|
|
7142
|
+
});
|
|
7088
7143
|
}
|
|
7089
7144
|
getObserversCount() {
|
|
7090
7145
|
let observersCount = 0;
|
|
@@ -7266,5 +7321,5 @@ var ModulesEnum;
|
|
|
7266
7321
|
* Generated bundle index. Do not edit.
|
|
7267
7322
|
*/
|
|
7268
7323
|
|
|
7269
|
-
export { AgreementLookup, BankLookup, BeneficioFiscalLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ContaInternaFilialLookup, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, DocumentoLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E043MpcLookup, E043PcmLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E069GreLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E081TabLookup, E082TprLookup, E085PesLookup, E089DocLookup, E090HrpComGerLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E099UsuSupCprLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E501TcpLookup, E600CcoLookup, E640LotLookup, EntityPersonProductLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, HTTP_STATUS_CODE, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NotaFiscalEntradaLookup, NpsService, ParametersLookup, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, SegmentoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, VerifyModulePermissions, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, EnumAnaSin as ɵb, EnumNatCtb as ɵc, StorageService as ɵd, UserInformationService as ɵe, VerifyModulePermissionService as ɵf, VerifyModulePermissionsService as ɵg };
|
|
7324
|
+
export { AgreementLookup, BankLookup, BeneficioFiscalLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ContaInternaFilialLookup, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, DocumentoLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E043MpcLookup, E043PcmLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E069GreLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E081TabLookup, E082TprLookup, E085PesLookup, E089DocLookup, E090HrpComGerLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E099UsuSupCprLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E501TcpLookup, E600CcoLookup, E640LotLookup, EntityPersonProductLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, HTTP_STATUS_CODE, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NotaFiscalEntradaLookup, NpsService, ParametersLookup, PrimitiveManager, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, SegmentoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, VerifyModulePermissions, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, EnumAnaSin as ɵb, EnumNatCtb as ɵc, StorageService as ɵd, UserInformationService as ɵe, VerifyModulePermissionService as ɵf, VerifyModulePermissionsService as ɵg };
|
|
7270
7325
|
//# sourceMappingURL=senior-gestao-empresarial-angular-components.js.map
|