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