@senior-gestao-empresarial/angular-components 6.12.0 → 7.0.0-3e0c74dd-ca06-44ec-8be2-124d3c32bae0
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 +500 -255
- 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/lookups/entities/e-006-pai-lookup.d.ts +8 -0
- package/components/lookups/index.d.ts +1 -0
- 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/models/primitive-manager.d.ts +19 -0
- package/components/websocket/protocols/index.d.ts +2 -0
- package/components/websocket/protocols/on-event-options.d.ts +8 -0
- package/components/websocket/protocols/primitive-event.d.ts +10 -0
- package/components/websocket/user-information.service.d.ts +7 -0
- package/components/websocket/websocket.service.d.ts +78 -74
- package/esm2015/components/lookups/entities/e-006-pai-lookup.js +48 -0
- package/esm2015/components/lookups/erp-lookups.module.js +3 -1
- package/esm2015/components/lookups/index.js +2 -1
- 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 +39 -0
- package/esm2015/components/websocket/protocols/index.js +1 -0
- package/esm2015/components/websocket/protocols/on-event-options.js +1 -0
- package/esm2015/components/websocket/protocols/primitive-event.js +1 -0
- package/esm2015/components/websocket/user-information.service.js +34 -0
- package/esm2015/components/websocket/websocket.service.js +269 -195
- package/esm2015/senior-gestao-empresarial-angular-components.js +4 -3
- package/esm5/components/lookups/entities/e-006-pai-lookup.js +51 -0
- package/esm5/components/lookups/erp-lookups.module.js +3 -1
- package/esm5/components/lookups/index.js +2 -1
- 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 +58 -0
- package/esm5/components/websocket/protocols/index.js +1 -0
- package/esm5/components/websocket/protocols/on-event-options.js +1 -0
- package/esm5/components/websocket/protocols/primitive-event.js +1 -0
- package/esm5/components/websocket/user-information.service.js +38 -0
- package/esm5/components/websocket/websocket.service.js +326 -255
- package/esm5/senior-gestao-empresarial-angular-components.js +4 -3
- package/fesm2015/senior-gestao-empresarial-angular-components.js +406 -193
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +496 -254
- package/fesm5/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/package.json +3 -3
- package/senior-gestao-empresarial-angular-components.d.ts +3 -2
- 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('@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', '@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.stompjs, global.
|
|
5
|
-
}(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, 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('@stomp/stompjs'), require('sockjs-client'), require('js-cookie')) :
|
|
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', '@stomp/stompjs', 'sockjs-client', 'js-cookie'], 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.stompjs, global.SockJS, global.jsCookie));
|
|
5
|
+
}(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, moment_, angularComponents, http, api, core$1, platformComponents, seniorPlatformData, forms, stompjs, SockJS, jsCookie) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -955,6 +955,50 @@
|
|
|
955
955
|
return E007UfsLookup;
|
|
956
956
|
}(ErpLookups));
|
|
957
957
|
|
|
958
|
+
var codPai = "codPai";
|
|
959
|
+
var nomPai = "nomPai";
|
|
960
|
+
var E006PaiLookup = /** @class */ (function (_super) {
|
|
961
|
+
__extends(E006PaiLookup, _super);
|
|
962
|
+
function E006PaiLookup(lookupService, translate) {
|
|
963
|
+
var _this = _super.call(this, lookupService, translate, "e006pai", [
|
|
964
|
+
{
|
|
965
|
+
name: codPai,
|
|
966
|
+
type: angularComponents.FieldType.String
|
|
967
|
+
}, {
|
|
968
|
+
name: nomPai,
|
|
969
|
+
type: angularComponents.FieldType.String
|
|
970
|
+
}
|
|
971
|
+
], [
|
|
972
|
+
{
|
|
973
|
+
name: codPai,
|
|
974
|
+
type: angularComponents.FieldType.String
|
|
975
|
+
}, {
|
|
976
|
+
name: nomPai,
|
|
977
|
+
type: angularComponents.FieldType.String
|
|
978
|
+
}
|
|
979
|
+
], [
|
|
980
|
+
{
|
|
981
|
+
name: codPai,
|
|
982
|
+
type: angularComponents.FieldType.Integer
|
|
983
|
+
}, {
|
|
984
|
+
name: nomPai,
|
|
985
|
+
type: angularComponents.FieldType.String
|
|
986
|
+
}
|
|
987
|
+
], "erpx_fnd", "empresa") || this;
|
|
988
|
+
_this.lookupService = lookupService;
|
|
989
|
+
_this.translate = translate;
|
|
990
|
+
return _this;
|
|
991
|
+
}
|
|
992
|
+
E006PaiLookup.ctorParameters = function () { return [
|
|
993
|
+
{ type: ErpLookupsService },
|
|
994
|
+
{ type: core$1.TranslateService }
|
|
995
|
+
]; };
|
|
996
|
+
E006PaiLookup = __decorate([
|
|
997
|
+
core.Injectable()
|
|
998
|
+
], E006PaiLookup);
|
|
999
|
+
return E006PaiLookup;
|
|
1000
|
+
}(ErpLookups));
|
|
1001
|
+
|
|
958
1002
|
var E008CepLookup = /** @class */ (function (_super) {
|
|
959
1003
|
__extends(E008CepLookup, _super);
|
|
960
1004
|
function E008CepLookup(lookupService, translate) {
|
|
@@ -6562,6 +6606,7 @@
|
|
|
6562
6606
|
ProdutoServicoLookup,
|
|
6563
6607
|
E044CcuFinRatDepLookup,
|
|
6564
6608
|
LigacaoItemFornecedorLookup,
|
|
6609
|
+
E006PaiLookup,
|
|
6565
6610
|
E007UfsLookup,
|
|
6566
6611
|
E008CepLookup,
|
|
6567
6612
|
E008RaiLookup,
|
|
@@ -7412,320 +7457,517 @@
|
|
|
7412
7457
|
return NpsService;
|
|
7413
7458
|
}());
|
|
7414
7459
|
|
|
7460
|
+
var AsyncLock = /** @class */ (function () {
|
|
7461
|
+
function AsyncLock() {
|
|
7462
|
+
this.queue = [];
|
|
7463
|
+
this.acquired = false;
|
|
7464
|
+
}
|
|
7465
|
+
AsyncLock.prototype.acquire = function () {
|
|
7466
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7467
|
+
var _this = this;
|
|
7468
|
+
return __generator(this, function (_a) {
|
|
7469
|
+
if (!this.acquired) {
|
|
7470
|
+
this.acquired = true;
|
|
7471
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7472
|
+
}
|
|
7473
|
+
else {
|
|
7474
|
+
return [2 /*return*/, new Promise(function (resolve, _) {
|
|
7475
|
+
_this.queue.push(resolve);
|
|
7476
|
+
})];
|
|
7477
|
+
}
|
|
7478
|
+
return [2 /*return*/];
|
|
7479
|
+
});
|
|
7480
|
+
});
|
|
7481
|
+
};
|
|
7482
|
+
AsyncLock.prototype.release = function () {
|
|
7483
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7484
|
+
var continuation;
|
|
7485
|
+
return __generator(this, function (_a) {
|
|
7486
|
+
if (this.queue.length === 0 && this.acquired) {
|
|
7487
|
+
this.acquired = false;
|
|
7488
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7489
|
+
}
|
|
7490
|
+
continuation = this.queue.shift();
|
|
7491
|
+
return [2 /*return*/, new Promise(function (res) {
|
|
7492
|
+
continuation();
|
|
7493
|
+
res();
|
|
7494
|
+
})];
|
|
7495
|
+
});
|
|
7496
|
+
});
|
|
7497
|
+
};
|
|
7498
|
+
return AsyncLock;
|
|
7499
|
+
}());
|
|
7500
|
+
|
|
7501
|
+
var UserInformationService = /** @class */ (function () {
|
|
7502
|
+
function UserInformationService() {
|
|
7503
|
+
}
|
|
7504
|
+
UserInformationService_1 = UserInformationService;
|
|
7505
|
+
UserInformationService.prototype.getAuthToken = function () {
|
|
7506
|
+
var cookieValue = jsCookie.get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7507
|
+
var authToken = JSON.parse(cookieValue);
|
|
7508
|
+
return authToken.access_token;
|
|
7509
|
+
};
|
|
7510
|
+
UserInformationService.prototype.getTenantDomain = function () {
|
|
7511
|
+
var cookieValue = jsCookie.get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7512
|
+
var authToken = JSON.parse(cookieValue);
|
|
7513
|
+
return authToken.username.split('@')[1];
|
|
7514
|
+
};
|
|
7515
|
+
UserInformationService.prototype.getWebSocketUrl = function () {
|
|
7516
|
+
var baseUrl = jsCookie.get(UserInformationService_1.BASE_URL_COOKIE_KEY);
|
|
7517
|
+
if (baseUrl && !baseUrl.endsWith('/')) {
|
|
7518
|
+
baseUrl += '/';
|
|
7519
|
+
}
|
|
7520
|
+
return baseUrl + 'websocket';
|
|
7521
|
+
};
|
|
7522
|
+
var UserInformationService_1;
|
|
7523
|
+
UserInformationService.BASE_URL_COOKIE_KEY = 'com.senior.base.url';
|
|
7524
|
+
UserInformationService.TOKEN_COOKIE_KEY = 'com.senior.token';
|
|
7525
|
+
UserInformationService.ɵprov = core.ɵɵdefineInjectable({ factory: function UserInformationService_Factory() { return new UserInformationService(); }, token: UserInformationService, providedIn: "root" });
|
|
7526
|
+
UserInformationService = UserInformationService_1 = __decorate([
|
|
7527
|
+
core.Injectable({
|
|
7528
|
+
providedIn: 'root'
|
|
7529
|
+
})
|
|
7530
|
+
], UserInformationService);
|
|
7531
|
+
return UserInformationService;
|
|
7532
|
+
}());
|
|
7533
|
+
|
|
7534
|
+
var PrimitiveManager = /** @class */ (function () {
|
|
7535
|
+
function PrimitiveManager(domain, service, primitive) {
|
|
7536
|
+
this.domain = domain;
|
|
7537
|
+
this.service = service;
|
|
7538
|
+
this.primitive = primitive;
|
|
7539
|
+
this.stompSubscriptions = [];
|
|
7540
|
+
this.event$ = new rxjs.Subject();
|
|
7541
|
+
this.subscribed$ = new rxjs.BehaviorSubject(false);
|
|
7542
|
+
}
|
|
7543
|
+
PrimitiveManager.prototype.unsubscribe = function () {
|
|
7544
|
+
var e_1, _a;
|
|
7545
|
+
this.event$.complete();
|
|
7546
|
+
try {
|
|
7547
|
+
for (var _b = __values(this.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7548
|
+
var stompSubscription = _c.value;
|
|
7549
|
+
stompSubscription.unsubscribe();
|
|
7550
|
+
}
|
|
7551
|
+
}
|
|
7552
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7553
|
+
finally {
|
|
7554
|
+
try {
|
|
7555
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7556
|
+
}
|
|
7557
|
+
finally { if (e_1) throw e_1.error; }
|
|
7558
|
+
}
|
|
7559
|
+
this.subscribed$.complete();
|
|
7560
|
+
};
|
|
7561
|
+
PrimitiveManager.prototype.fireEvent = function (event) {
|
|
7562
|
+
this.event$.next(event);
|
|
7563
|
+
};
|
|
7564
|
+
PrimitiveManager.prototype.subscribe = function () {
|
|
7565
|
+
var _a;
|
|
7566
|
+
var subscriptions = [];
|
|
7567
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
7568
|
+
subscriptions[_i] = arguments[_i];
|
|
7569
|
+
}
|
|
7570
|
+
(_a = this.stompSubscriptions).push.apply(_a, __spread(subscriptions));
|
|
7571
|
+
this.subscribed$.next(true);
|
|
7572
|
+
};
|
|
7573
|
+
PrimitiveManager.prototype.getEventObservable = function () {
|
|
7574
|
+
return this.event$.asObservable();
|
|
7575
|
+
};
|
|
7576
|
+
PrimitiveManager.prototype.getSubscriptionObservable = function () {
|
|
7577
|
+
return this.subscribed$.asObservable();
|
|
7578
|
+
};
|
|
7579
|
+
PrimitiveManager.prototype.hasObservers = function () {
|
|
7580
|
+
// @IMPORTANT: Replace .observers.length === 1 with .observed in rxjs 7.0+
|
|
7581
|
+
return this.event$.observers.length !== 1;
|
|
7582
|
+
};
|
|
7583
|
+
PrimitiveManager.prototype.getObserversCount = function () {
|
|
7584
|
+
return this.event$.observers.length;
|
|
7585
|
+
};
|
|
7586
|
+
return PrimitiveManager;
|
|
7587
|
+
}());
|
|
7588
|
+
|
|
7589
|
+
var RECONNECT_INTERVAL_MILLISECONDS = 3000;
|
|
7590
|
+
var CONNECTION_TIMEOUT_MILLISECONDS = 5000;
|
|
7415
7591
|
var WebsocketService = /** @class */ (function () {
|
|
7416
|
-
function WebsocketService() {
|
|
7417
|
-
|
|
7418
|
-
this.wasConnected = false;
|
|
7419
|
-
/** @private */
|
|
7420
|
-
this.isConnected = false;
|
|
7421
|
-
/** @private */
|
|
7422
|
-
this.isConnecting = false;
|
|
7423
|
-
/** @private */
|
|
7424
|
-
this.primitiveManagers = new Map();
|
|
7425
|
-
/** @private */
|
|
7592
|
+
function WebsocketService(userInformationService) {
|
|
7593
|
+
this.userInformationService = userInformationService;
|
|
7426
7594
|
this.connected$ = new rxjs.BehaviorSubject(false);
|
|
7427
|
-
|
|
7428
|
-
this.
|
|
7429
|
-
/** @private */
|
|
7430
|
-
this.reconnect$ = new rxjs.Subject();
|
|
7431
|
-
/** @private */
|
|
7595
|
+
this.disconnected$ = new rxjs.Subject();
|
|
7596
|
+
this.reconnected$ = new rxjs.Subject();
|
|
7432
7597
|
this.error$ = new rxjs.Subject();
|
|
7433
7598
|
this.subscribed$ = new rxjs.Subject();
|
|
7599
|
+
this.primitiveManagers = new Map();
|
|
7600
|
+
this.connectionLock = new AsyncLock();
|
|
7601
|
+
this.debugEnable = false;
|
|
7602
|
+
this.lostConnection = false;
|
|
7434
7603
|
}
|
|
7435
|
-
WebsocketService_1 = WebsocketService;
|
|
7436
7604
|
/**
|
|
7437
|
-
*
|
|
7438
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida pela primeira vez.
|
|
7605
|
+
* Enables stompjs debug logs and additional info
|
|
7439
7606
|
*/
|
|
7440
|
-
WebsocketService.prototype.
|
|
7441
|
-
|
|
7607
|
+
WebsocketService.prototype.enableDebugLogs = function () {
|
|
7608
|
+
this.debugEnable = true;
|
|
7442
7609
|
};
|
|
7443
7610
|
/**
|
|
7444
|
-
*
|
|
7445
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é desconectada.
|
|
7611
|
+
* Manually starts the connection
|
|
7446
7612
|
*/
|
|
7447
|
-
WebsocketService.prototype.
|
|
7448
|
-
return this
|
|
7613
|
+
WebsocketService.prototype.connect = function () {
|
|
7614
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7615
|
+
var stompConfig;
|
|
7616
|
+
var _this = this;
|
|
7617
|
+
return __generator(this, function (_a) {
|
|
7618
|
+
switch (_a.label) {
|
|
7619
|
+
case 0: return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7620
|
+
case 1:
|
|
7621
|
+
_a.sent();
|
|
7622
|
+
_a.label = 2;
|
|
7623
|
+
case 2:
|
|
7624
|
+
_a.trys.push([2, , 3, 5]);
|
|
7625
|
+
if (this.isConnected() || this.isConnecting()) {
|
|
7626
|
+
return [2 /*return*/];
|
|
7627
|
+
}
|
|
7628
|
+
this.lostConnection = false;
|
|
7629
|
+
stompConfig = {
|
|
7630
|
+
webSocketFactory: function () {
|
|
7631
|
+
return new SockJS(_this.getSubscriptionUrl(), null, {
|
|
7632
|
+
timeout: CONNECTION_TIMEOUT_MILLISECONDS
|
|
7633
|
+
});
|
|
7634
|
+
},
|
|
7635
|
+
connectionTimeout: CONNECTION_TIMEOUT_MILLISECONDS,
|
|
7636
|
+
reconnectDelay: RECONNECT_INTERVAL_MILLISECONDS,
|
|
7637
|
+
debug: this.debug.bind(this),
|
|
7638
|
+
onConnect: this.handleOnConnected.bind(this),
|
|
7639
|
+
onDisconnect: this.handleOnDisconnect.bind(this),
|
|
7640
|
+
onWebSocketClose: this.handleOnWebSocketClose.bind(this),
|
|
7641
|
+
onStompError: this.handleOnStompError.bind(this),
|
|
7642
|
+
onWebSocketError: this.handleOnWebSocketError.bind(this)
|
|
7643
|
+
};
|
|
7644
|
+
this.debug('Connecting the Webscoket');
|
|
7645
|
+
this.stompClient = new stompjs.Client(stompConfig);
|
|
7646
|
+
this.stompClient.activate();
|
|
7647
|
+
return [3 /*break*/, 5];
|
|
7648
|
+
case 3: return [4 /*yield*/, this.connectionLock.release()];
|
|
7649
|
+
case 4:
|
|
7650
|
+
_a.sent();
|
|
7651
|
+
return [7 /*endfinally*/];
|
|
7652
|
+
case 5: return [2 /*return*/];
|
|
7653
|
+
}
|
|
7654
|
+
});
|
|
7655
|
+
});
|
|
7449
7656
|
};
|
|
7450
7657
|
/**
|
|
7451
|
-
*
|
|
7452
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é reconectada.
|
|
7658
|
+
* Manually disconnect the websocket. The reconnect loop will be stopped.
|
|
7453
7659
|
*/
|
|
7454
|
-
WebsocketService.prototype.
|
|
7455
|
-
return this
|
|
7660
|
+
WebsocketService.prototype.disconnect = function () {
|
|
7661
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7662
|
+
var _a, _b, primitiveManager;
|
|
7663
|
+
var e_1, _c;
|
|
7664
|
+
return __generator(this, function (_d) {
|
|
7665
|
+
switch (_d.label) {
|
|
7666
|
+
case 0:
|
|
7667
|
+
if (!this.isConnected()) {
|
|
7668
|
+
return [2 /*return*/];
|
|
7669
|
+
}
|
|
7670
|
+
return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7671
|
+
case 1:
|
|
7672
|
+
_d.sent();
|
|
7673
|
+
_d.label = 2;
|
|
7674
|
+
case 2:
|
|
7675
|
+
_d.trys.push([2, , 5, 7]);
|
|
7676
|
+
try {
|
|
7677
|
+
for (_a = __values(this.primitiveManagers.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
7678
|
+
primitiveManager = _b.value;
|
|
7679
|
+
primitiveManager.unsubscribe();
|
|
7680
|
+
}
|
|
7681
|
+
}
|
|
7682
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7683
|
+
finally {
|
|
7684
|
+
try {
|
|
7685
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
7686
|
+
}
|
|
7687
|
+
finally { if (e_1) throw e_1.error; }
|
|
7688
|
+
}
|
|
7689
|
+
this.primitiveManagers.clear();
|
|
7690
|
+
this.connected$.next(false);
|
|
7691
|
+
if (!this.stompClient) return [3 /*break*/, 4];
|
|
7692
|
+
return [4 /*yield*/, this.stompClient.deactivate()];
|
|
7693
|
+
case 3:
|
|
7694
|
+
_d.sent();
|
|
7695
|
+
_d.label = 4;
|
|
7696
|
+
case 4: return [3 /*break*/, 7];
|
|
7697
|
+
case 5: return [4 /*yield*/, this.connectionLock.release()];
|
|
7698
|
+
case 6:
|
|
7699
|
+
_d.sent();
|
|
7700
|
+
return [7 /*endfinally*/];
|
|
7701
|
+
case 7: return [2 /*return*/];
|
|
7702
|
+
}
|
|
7703
|
+
});
|
|
7704
|
+
});
|
|
7456
7705
|
};
|
|
7457
7706
|
/**
|
|
7458
|
-
*
|
|
7459
|
-
* @return
|
|
7707
|
+
* Check if the websocket is connected
|
|
7708
|
+
* @return `boolean` representing if the websocket is connected
|
|
7460
7709
|
*/
|
|
7461
|
-
WebsocketService.prototype.
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
return this.
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
}
|
|
7710
|
+
WebsocketService.prototype.isConnected = function () {
|
|
7711
|
+
if (!this.stompClient) {
|
|
7712
|
+
return false;
|
|
7713
|
+
}
|
|
7714
|
+
return this.stompClient.connected;
|
|
7715
|
+
};
|
|
7716
|
+
/**
|
|
7717
|
+
* Check if the websocket is tring to connect
|
|
7718
|
+
* @return `boolean` representing if the websocket status
|
|
7719
|
+
*/
|
|
7720
|
+
WebsocketService.prototype.isConnecting = function () {
|
|
7721
|
+
if (!this.stompClient) {
|
|
7722
|
+
return false;
|
|
7723
|
+
}
|
|
7724
|
+
return !this.stompClient.connected && this.stompClient.active;
|
|
7725
|
+
};
|
|
7726
|
+
/**
|
|
7727
|
+
* Event responsable to emit an event when the connection is established.
|
|
7728
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7729
|
+
* @return `Observable<boolean>`
|
|
7730
|
+
*/
|
|
7731
|
+
WebsocketService.prototype.onConnect = function () {
|
|
7732
|
+
return this.connected$.asObservable()
|
|
7733
|
+
.pipe(operators.filter(function (p) { return p === true; }));
|
|
7475
7734
|
};
|
|
7476
7735
|
/**
|
|
7477
|
-
*
|
|
7478
|
-
*
|
|
7736
|
+
* Event responsable to emit an event when the connection is closed.
|
|
7737
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7738
|
+
* @return `Observable<void>`
|
|
7739
|
+
*/
|
|
7740
|
+
WebsocketService.prototype.onDisconnect = function () {
|
|
7741
|
+
return this.disconnected$.asObservable();
|
|
7742
|
+
};
|
|
7743
|
+
/**
|
|
7744
|
+
* Event responsable to emit an event when the connection is reestablished.
|
|
7745
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7746
|
+
* @return `Observable<void>`
|
|
7747
|
+
*/
|
|
7748
|
+
WebsocketService.prototype.onReconnect = function () {
|
|
7749
|
+
return this.reconnected$.asObservable();
|
|
7750
|
+
};
|
|
7751
|
+
/**
|
|
7752
|
+
* Event responsable to emit an event when an error ocurred.
|
|
7753
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7754
|
+
* @return `Observable<FrameImpl>`
|
|
7479
7755
|
*/
|
|
7480
7756
|
WebsocketService.prototype.onError = function () {
|
|
7481
7757
|
return this.error$.asObservable();
|
|
7482
7758
|
};
|
|
7483
7759
|
/**
|
|
7484
|
-
*
|
|
7485
|
-
*
|
|
7486
|
-
* @
|
|
7487
|
-
* @param {
|
|
7488
|
-
* @
|
|
7489
|
-
* @return Um Observable<T> que emite notificações toda vez que o respectivo evento é publicado.
|
|
7760
|
+
* Event responsible to emit an event when a primitive is called.
|
|
7761
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7762
|
+
* @typeParam `<T>` Object type that will be used in the observable for the `data` property.
|
|
7763
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7764
|
+
* @return `Observable<PrimitiveEvent<T>>` Observable that emits an event when the service calls the primitive.
|
|
7490
7765
|
*/
|
|
7491
7766
|
WebsocketService.prototype.onEvent = function (options) {
|
|
7492
7767
|
var _this = this;
|
|
7493
|
-
this.connect();
|
|
7494
7768
|
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7495
|
-
var key = this.
|
|
7769
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7496
7770
|
if (this.primitiveManagers.has(key)) {
|
|
7497
|
-
return this.primitiveManagers.get(key).
|
|
7771
|
+
return this.primitiveManagers.get(key).getEventObservable();
|
|
7498
7772
|
}
|
|
7499
|
-
var primitiveManager =
|
|
7500
|
-
domain: domain,
|
|
7501
|
-
service: service,
|
|
7502
|
-
primitive: primitive,
|
|
7503
|
-
stompSubscriptions: [],
|
|
7504
|
-
event$: new rxjs.Subject(),
|
|
7505
|
-
subscribed$: new rxjs.BehaviorSubject(false)
|
|
7506
|
-
};
|
|
7773
|
+
var primitiveManager = new PrimitiveManager(domain, service, primitive);
|
|
7507
7774
|
this.primitiveManagers.set(key, primitiveManager);
|
|
7508
|
-
this.
|
|
7509
|
-
.
|
|
7510
|
-
|
|
7511
|
-
|
|
7775
|
+
this.connect().then(function () {
|
|
7776
|
+
_this.onConnect()
|
|
7777
|
+
.pipe(operators.take(1))
|
|
7778
|
+
.subscribe(function () {
|
|
7779
|
+
_this.createStompSubscriptions(primitiveManager);
|
|
7780
|
+
});
|
|
7512
7781
|
});
|
|
7513
|
-
return primitiveManager
|
|
7514
|
-
.
|
|
7515
|
-
.pipe(operators.finalize(function () { return _this.
|
|
7516
|
-
};
|
|
7517
|
-
/** @private */
|
|
7518
|
-
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
7519
|
-
var withTokenUrl = this.getSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7520
|
-
var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
|
|
7521
|
-
var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7522
|
-
var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
|
|
7523
|
-
primitiveManager.stompSubscriptions = [
|
|
7524
|
-
stompSubscriptionWithToken,
|
|
7525
|
-
stompSubscriptionWithoutToken
|
|
7526
|
-
];
|
|
7527
|
-
primitiveManager.subscribed$.next(true);
|
|
7528
|
-
this.subscribed$.next(primitiveManager);
|
|
7782
|
+
return primitiveManager
|
|
7783
|
+
.getEventObservable()
|
|
7784
|
+
.pipe(operators.finalize(function () { return _this.unsubscribePrimitiveOnFinalize(primitiveManager); }));
|
|
7529
7785
|
};
|
|
7530
|
-
/**
|
|
7531
|
-
|
|
7786
|
+
/**
|
|
7787
|
+
* Event responsible to emit an event when a subscription is created for the primitive.
|
|
7788
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7789
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7790
|
+
* Observable responsável por emitir uma notificação após o subscribe do evento pela primeira vez.
|
|
7791
|
+
* @return `Observable<boolean>` Observable that emits an event when the service calls the primitive.
|
|
7792
|
+
*/
|
|
7793
|
+
WebsocketService.prototype.onSubscribe = function (options) {
|
|
7532
7794
|
var _this = this;
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
this.
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
_this.reconnectPrimitives();
|
|
7542
|
-
_this.connected$.next(true);
|
|
7543
|
-
_this.reconnect$.next();
|
|
7795
|
+
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7796
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7797
|
+
return this.onConnect().pipe(operators.take(1), operators.switchMap(function () {
|
|
7798
|
+
if (_this.primitiveManagers.has(key)) {
|
|
7799
|
+
return _this.primitiveManagers
|
|
7800
|
+
.get(key)
|
|
7801
|
+
.getSubscriptionObservable()
|
|
7802
|
+
.pipe(operators.take(1));
|
|
7544
7803
|
}
|
|
7545
|
-
|
|
7546
|
-
_this.
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
}, function (error) {
|
|
7550
|
-
_this.isConnected = false;
|
|
7551
|
-
_this.connected$.next(false);
|
|
7552
|
-
_this.error$.next(error);
|
|
7553
|
-
rxjs.race(_this.disconnect$.pipe(operators.take(1), operators.map(function () { return ({ wasDisconnected: true }); })), rxjs.timer(WebsocketService_1.RECONNECT_INTERVAL).pipe(operators.take(1), operators.switchMap(function () {
|
|
7554
|
-
return rxjs.iif(function () { return document.hidden; }, rxjs.fromEvent(document, 'visibilitychange').pipe(operators.first()), rxjs.of(void 0));
|
|
7555
|
-
}), operators.map(function () { return ({ wasDisconnected: false }); })))
|
|
7556
|
-
.pipe(operators.take(1))
|
|
7557
|
-
.subscribe({
|
|
7558
|
-
next: function (_a) {
|
|
7559
|
-
var wasDisconnected = _a.wasDisconnected;
|
|
7560
|
-
if (!wasDisconnected &&
|
|
7561
|
-
!(_this.isConnected || _this.isConnecting)) {
|
|
7562
|
-
_this.connect();
|
|
7563
|
-
}
|
|
7564
|
-
}
|
|
7565
|
-
});
|
|
7566
|
-
});
|
|
7804
|
+
return _this.subscribed$.asObservable().pipe(operators.filter(function (primitiveManager) {
|
|
7805
|
+
return _this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
|
|
7806
|
+
}), operators.map(function () { return true; }), operators.take(1));
|
|
7807
|
+
}));
|
|
7567
7808
|
};
|
|
7568
|
-
WebsocketService.prototype.
|
|
7569
|
-
var
|
|
7570
|
-
|
|
7809
|
+
WebsocketService.prototype.debug = function (message) {
|
|
7810
|
+
var optionalParams = [];
|
|
7811
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7812
|
+
optionalParams[_i - 1] = arguments[_i];
|
|
7813
|
+
}
|
|
7814
|
+
if (!this.debugEnable) {
|
|
7571
7815
|
return;
|
|
7572
7816
|
}
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
try {
|
|
7585
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
7586
|
-
}
|
|
7587
|
-
finally { if (e_2) throw e_2.error; }
|
|
7588
|
-
}
|
|
7589
|
-
}
|
|
7817
|
+
console.log.apply(console, __spread(['WS debug: ' + message], optionalParams));
|
|
7818
|
+
};
|
|
7819
|
+
WebsocketService.prototype.info = function (message) {
|
|
7820
|
+
console.info('WS info: ' + message);
|
|
7821
|
+
};
|
|
7822
|
+
WebsocketService.prototype.handleOnConnected = function () {
|
|
7823
|
+
this.info('Webscoket connected');
|
|
7824
|
+
this.connected$.next(true);
|
|
7825
|
+
if (this.lostConnection) {
|
|
7826
|
+
this.info('Webscoket reconnected, recriating subscriptions');
|
|
7827
|
+
this.handleReconnection();
|
|
7590
7828
|
}
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7829
|
+
};
|
|
7830
|
+
WebsocketService.prototype.handleOnDisconnect = function () {
|
|
7831
|
+
this.info('Webscoket disconnected');
|
|
7832
|
+
this.connected$.next(false);
|
|
7833
|
+
this.disconnected$.next();
|
|
7834
|
+
};
|
|
7835
|
+
WebsocketService.prototype.handleOnWebSocketClose = function (data) {
|
|
7836
|
+
if (data.reason && data.reason.toLowerCase().indexOf("go away") !== -1) {
|
|
7837
|
+
this.lostConnection = true;
|
|
7838
|
+
this.handleError('AuthenticationError', new stompjs.FrameImpl({
|
|
7839
|
+
command: data.type,
|
|
7840
|
+
headers: {
|
|
7841
|
+
message: data.reason
|
|
7842
|
+
}
|
|
7843
|
+
}));
|
|
7844
|
+
return;
|
|
7597
7845
|
}
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
var primitiveManager = _j.value;
|
|
7601
|
-
primitiveManager.event$.complete();
|
|
7602
|
-
}
|
|
7846
|
+
if (data.wasClean) {
|
|
7847
|
+
return;
|
|
7603
7848
|
}
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7849
|
+
this.lostConnection = true;
|
|
7850
|
+
};
|
|
7851
|
+
WebsocketService.prototype.handleOnStompError = function (data) {
|
|
7852
|
+
this.handleError('StompError', data);
|
|
7853
|
+
if (this.isAuthenticationError(data)) {
|
|
7854
|
+
this.info('Authentication error, recriating subscriptions');
|
|
7855
|
+
this.handleReconnection();
|
|
7610
7856
|
}
|
|
7611
|
-
this.primitiveManagers.clear();
|
|
7612
|
-
this._stompClient.disconnect();
|
|
7613
|
-
this._stompClient.deactivate();
|
|
7614
|
-
this.isConnected = false;
|
|
7615
|
-
this.isConnecting = false;
|
|
7616
|
-
this.wasConnected = false;
|
|
7617
|
-
this.connected$.next(false);
|
|
7618
|
-
this.disconnect$.next();
|
|
7619
7857
|
};
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
var
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
: null;
|
|
7628
|
-
return "/topic/" + tenant + "/" + token + "/" + domain + "/" + service + "/" + primitive;
|
|
7858
|
+
WebsocketService.prototype.isAuthenticationError = function (data) {
|
|
7859
|
+
var _a;
|
|
7860
|
+
var errorMessage = (_a = data === null || data === void 0 ? void 0 : data.headers) === null || _a === void 0 ? void 0 : _a.message;
|
|
7861
|
+
if (!errorMessage) {
|
|
7862
|
+
return false;
|
|
7863
|
+
}
|
|
7864
|
+
return errorMessage.toLowerCase().indexOf('forbiddenexception') !== -1;
|
|
7629
7865
|
};
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
var tenant = WebsocketService_1.TOKEN
|
|
7633
|
-
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7634
|
-
: null;
|
|
7635
|
-
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7866
|
+
WebsocketService.prototype.handleOnWebSocketError = function (data) {
|
|
7867
|
+
this.handleError('WebSocketError', data);
|
|
7636
7868
|
};
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
var event = JSON.parse(message.body || '{}');
|
|
7641
|
-
primitiveManager.event$.next(event);
|
|
7642
|
-
});
|
|
7869
|
+
WebsocketService.prototype.handleError = function (origin, data) {
|
|
7870
|
+
console.error(origin, data);
|
|
7871
|
+
this.error$.next(data);
|
|
7643
7872
|
};
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
this.
|
|
7648
|
-
this._stompClient.debug = function () { return null; };
|
|
7873
|
+
WebsocketService.prototype.handleReconnection = function () {
|
|
7874
|
+
this.lostConnection = false;
|
|
7875
|
+
this.reconnectPrimitives();
|
|
7876
|
+
this.reconnected$.next();
|
|
7649
7877
|
};
|
|
7650
|
-
/** @private */
|
|
7651
7878
|
WebsocketService.prototype.reconnectPrimitives = function () {
|
|
7652
|
-
var
|
|
7879
|
+
var e_2, _a;
|
|
7653
7880
|
try {
|
|
7654
7881
|
for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7655
7882
|
var primitiveManager = _c.value;
|
|
7656
7883
|
this.createStompSubscriptions(primitiveManager);
|
|
7657
7884
|
}
|
|
7658
7885
|
}
|
|
7659
|
-
catch (
|
|
7886
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
7660
7887
|
finally {
|
|
7661
7888
|
try {
|
|
7662
7889
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7663
7890
|
}
|
|
7664
|
-
finally { if (
|
|
7891
|
+
finally { if (e_2) throw e_2.error; }
|
|
7665
7892
|
}
|
|
7666
7893
|
};
|
|
7667
|
-
|
|
7894
|
+
WebsocketService.prototype.buildSubscriptionUrlWithToken = function (domain, service, primitive) {
|
|
7895
|
+
var authToken = this.userInformationService.getAuthToken();
|
|
7896
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7897
|
+
return "/topic/" + tenant + "/" + authToken + "/" + domain + "/" + service + "/" + primitive;
|
|
7898
|
+
};
|
|
7899
|
+
WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
|
|
7900
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7901
|
+
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7902
|
+
};
|
|
7903
|
+
WebsocketService.prototype.buildPrimitiveManagerKey = function (domain, service, primitive) {
|
|
7904
|
+
return domain + "/" + service + "/" + primitive;
|
|
7905
|
+
};
|
|
7906
|
+
WebsocketService.prototype.unsubscribePrimitiveOnFinalize = function (primitiveManager) {
|
|
7907
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7908
|
+
var key;
|
|
7909
|
+
return __generator(this, function (_a) {
|
|
7910
|
+
switch (_a.label) {
|
|
7911
|
+
case 0:
|
|
7912
|
+
if (primitiveManager.hasObservers()) {
|
|
7913
|
+
return [2 /*return*/];
|
|
7914
|
+
}
|
|
7915
|
+
primitiveManager.unsubscribe();
|
|
7916
|
+
key = this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7917
|
+
this.primitiveManagers.delete(key);
|
|
7918
|
+
return [4 /*yield*/, this.disconnectIfNoMoreObservables()];
|
|
7919
|
+
case 1:
|
|
7920
|
+
_a.sent();
|
|
7921
|
+
return [2 /*return*/];
|
|
7922
|
+
}
|
|
7923
|
+
});
|
|
7924
|
+
});
|
|
7925
|
+
};
|
|
7926
|
+
WebsocketService.prototype.disconnectIfNoMoreObservables = function () {
|
|
7927
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7928
|
+
return __generator(this, function (_a) {
|
|
7929
|
+
switch (_a.label) {
|
|
7930
|
+
case 0:
|
|
7931
|
+
if (!(this.getObserversCount() === 0)) return [3 /*break*/, 2];
|
|
7932
|
+
this.debug('Manually disconnecting because there are no more observers');
|
|
7933
|
+
return [4 /*yield*/, this.disconnect()];
|
|
7934
|
+
case 1:
|
|
7935
|
+
_a.sent();
|
|
7936
|
+
_a.label = 2;
|
|
7937
|
+
case 2: return [2 /*return*/];
|
|
7938
|
+
}
|
|
7939
|
+
});
|
|
7940
|
+
});
|
|
7941
|
+
};
|
|
7668
7942
|
WebsocketService.prototype.getObserversCount = function () {
|
|
7669
|
-
var e_5, _a;
|
|
7670
7943
|
var observersCount = 0;
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
observersCount += primitiveManager.event$.observers.length;
|
|
7675
|
-
}
|
|
7676
|
-
}
|
|
7677
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
7678
|
-
finally {
|
|
7679
|
-
try {
|
|
7680
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7681
|
-
}
|
|
7682
|
-
finally { if (e_5) throw e_5.error; }
|
|
7683
|
-
}
|
|
7944
|
+
this.primitiveManagers.forEach(function (primitiveManager) {
|
|
7945
|
+
observersCount += primitiveManager.getObserversCount();
|
|
7946
|
+
});
|
|
7684
7947
|
return observersCount;
|
|
7685
7948
|
};
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
if (hasObservers)
|
|
7692
|
-
return;
|
|
7693
|
-
primitiveManager.event$.complete();
|
|
7694
|
-
try {
|
|
7695
|
-
for (var _b = __values(primitiveManager.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7696
|
-
var stompSubscription = _c.value;
|
|
7697
|
-
stompSubscription.unsubscribe();
|
|
7698
|
-
}
|
|
7699
|
-
}
|
|
7700
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
7701
|
-
finally {
|
|
7702
|
-
try {
|
|
7703
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7704
|
-
}
|
|
7705
|
-
finally { if (e_6) throw e_6.error; }
|
|
7706
|
-
}
|
|
7707
|
-
primitiveManager.subscribed$.complete();
|
|
7708
|
-
var key = this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7709
|
-
this.primitiveManagers.delete(key);
|
|
7710
|
-
this.disconnect();
|
|
7949
|
+
WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
|
|
7950
|
+
return this.stompClient.subscribe(destination, function (message) {
|
|
7951
|
+
var event = JSON.parse(message.body || '{}');
|
|
7952
|
+
primitiveManager.fireEvent(event);
|
|
7953
|
+
});
|
|
7711
7954
|
};
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7955
|
+
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
7956
|
+
var subscriptionUrlWithToken = this.buildSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7957
|
+
var subscriptionUrlWithoutToken = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7958
|
+
var stompSubscriptionWithToken = this.createStompSubscription(subscriptionUrlWithToken, primitiveManager);
|
|
7959
|
+
var stompSubscriptionWithoutToken = this.createStompSubscription(subscriptionUrlWithoutToken, primitiveManager);
|
|
7960
|
+
primitiveManager.subscribe(stompSubscriptionWithToken, stompSubscriptionWithoutToken);
|
|
7961
|
+
this.subscribed$.next(primitiveManager);
|
|
7962
|
+
};
|
|
7963
|
+
WebsocketService.prototype.getSubscriptionUrl = function () {
|
|
7964
|
+
return this.userInformationService.getWebSocketUrl() + "/subscription";
|
|
7715
7965
|
};
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
WebsocketService
|
|
7721
|
-
/** @private */
|
|
7722
|
-
WebsocketService.TOKEN_COOKIE = 'com.senior.token';
|
|
7723
|
-
/** @private */
|
|
7724
|
-
WebsocketService.TOKEN = JSON.parse(jsCookie.get(WebsocketService_1.TOKEN_COOKIE) || '{}');
|
|
7725
|
-
/** @private */
|
|
7726
|
-
WebsocketService.WEBSOCKET_URL = jsCookie.get(WebsocketService_1.BASE_URL_COOKIE) + '/websocket/';
|
|
7727
|
-
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
|
|
7728
|
-
WebsocketService = WebsocketService_1 = __decorate([
|
|
7966
|
+
WebsocketService.ctorParameters = function () { return [
|
|
7967
|
+
{ type: UserInformationService }
|
|
7968
|
+
]; };
|
|
7969
|
+
WebsocketService.ɵprov = core.ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(core.ɵɵinject(UserInformationService)); }, token: WebsocketService, providedIn: "root" });
|
|
7970
|
+
WebsocketService = __decorate([
|
|
7729
7971
|
core.Injectable({
|
|
7730
7972
|
providedIn: 'root'
|
|
7731
7973
|
})
|
|
@@ -7917,6 +8159,7 @@
|
|
|
7917
8159
|
exports.E001TnsLookup = E001TnsLookup;
|
|
7918
8160
|
exports.E001TnsSupEstLookup = E001TnsSupEstLookup;
|
|
7919
8161
|
exports.E002TptLookup = E002TptLookup;
|
|
8162
|
+
exports.E006PaiLookup = E006PaiLookup;
|
|
7920
8163
|
exports.E007UfsLookup = E007UfsLookup;
|
|
7921
8164
|
exports.E008CepLookup = E008CepLookup;
|
|
7922
8165
|
exports.E008RaiLookup = E008RaiLookup;
|
|
@@ -7996,6 +8239,7 @@
|
|
|
7996
8239
|
exports.NotaFiscalEntradaLookup = NotaFiscalEntradaLookup;
|
|
7997
8240
|
exports.NpsService = NpsService;
|
|
7998
8241
|
exports.ParametersLookup = ParametersLookup;
|
|
8242
|
+
exports.PrimitiveManager = PrimitiveManager;
|
|
7999
8243
|
exports.ProdutoServicoLookup = ProdutoServicoLookup;
|
|
8000
8244
|
exports.QuantidadeDisponivelDemandaLookup = QuantidadeDisponivelDemandaLookup;
|
|
8001
8245
|
exports.RequisicaoLookup = RequisicaoLookup;
|
|
@@ -8010,8 +8254,9 @@
|
|
|
8010
8254
|
exports.ɵ0 = ɵ0;
|
|
8011
8255
|
exports.ɵa = ErpLookupsService;
|
|
8012
8256
|
exports.ɵd = StorageService;
|
|
8013
|
-
exports.ɵe =
|
|
8014
|
-
exports.ɵf =
|
|
8257
|
+
exports.ɵe = UserInformationService;
|
|
8258
|
+
exports.ɵf = VerifyModulePermissionService;
|
|
8259
|
+
exports.ɵg = VerifyModulePermissionsService;
|
|
8015
8260
|
|
|
8016
8261
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8017
8262
|
|