@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
|
@@ -3,8 +3,8 @@ import { Input, Component, NgModule, Injectable, Inject, ɵɵdefineInjectable,
|
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
|
|
5
5
|
import { NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
6
|
-
import { Subject, throwError, interval, of, BehaviorSubject,
|
|
7
|
-
import { takeUntil, filter, catchError, map, takeWhile, switchMap, take, finalize
|
|
6
|
+
import { Subject, throwError, interval, of, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
7
|
+
import { takeUntil, filter, catchError, map, takeWhile, switchMap, take, finalize } from 'rxjs/operators';
|
|
8
8
|
import * as moment_ from 'moment';
|
|
9
9
|
import { FormField, FieldType } from '@seniorsistemas/angular-components';
|
|
10
10
|
import { HttpParams, HttpClient } from '@angular/common/http';
|
|
@@ -13,9 +13,9 @@ import { TranslateService } from '@ngx-translate/core';
|
|
|
13
13
|
import { HttpInterceptorModule } from '@seniorsistemas/platform-components';
|
|
14
14
|
import { user } from '@seniorsistemas/senior-platform-data';
|
|
15
15
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
16
|
-
import {
|
|
17
|
-
import { get } from 'js-cookie';
|
|
16
|
+
import { Client, FrameImpl } from '@stomp/stompjs';
|
|
18
17
|
import * as SockJS from 'sockjs-client';
|
|
18
|
+
import { get } from 'js-cookie';
|
|
19
19
|
|
|
20
20
|
var BreadcrumbComponent = /** @class */ (function () {
|
|
21
21
|
function BreadcrumbComponent(activatedRoute, router) {
|
|
@@ -749,6 +749,50 @@ var E007UfsLookup = /** @class */ (function (_super) {
|
|
|
749
749
|
return E007UfsLookup;
|
|
750
750
|
}(ErpLookups));
|
|
751
751
|
|
|
752
|
+
var codPai = "codPai";
|
|
753
|
+
var nomPai = "nomPai";
|
|
754
|
+
var E006PaiLookup = /** @class */ (function (_super) {
|
|
755
|
+
__extends(E006PaiLookup, _super);
|
|
756
|
+
function E006PaiLookup(lookupService, translate) {
|
|
757
|
+
var _this = _super.call(this, lookupService, translate, "e006pai", [
|
|
758
|
+
{
|
|
759
|
+
name: codPai,
|
|
760
|
+
type: FieldType.String
|
|
761
|
+
}, {
|
|
762
|
+
name: nomPai,
|
|
763
|
+
type: FieldType.String
|
|
764
|
+
}
|
|
765
|
+
], [
|
|
766
|
+
{
|
|
767
|
+
name: codPai,
|
|
768
|
+
type: FieldType.String
|
|
769
|
+
}, {
|
|
770
|
+
name: nomPai,
|
|
771
|
+
type: FieldType.String
|
|
772
|
+
}
|
|
773
|
+
], [
|
|
774
|
+
{
|
|
775
|
+
name: codPai,
|
|
776
|
+
type: FieldType.Integer
|
|
777
|
+
}, {
|
|
778
|
+
name: nomPai,
|
|
779
|
+
type: FieldType.String
|
|
780
|
+
}
|
|
781
|
+
], "erpx_fnd", "empresa") || this;
|
|
782
|
+
_this.lookupService = lookupService;
|
|
783
|
+
_this.translate = translate;
|
|
784
|
+
return _this;
|
|
785
|
+
}
|
|
786
|
+
E006PaiLookup.ctorParameters = function () { return [
|
|
787
|
+
{ type: ErpLookupsService },
|
|
788
|
+
{ type: TranslateService }
|
|
789
|
+
]; };
|
|
790
|
+
E006PaiLookup = __decorate([
|
|
791
|
+
Injectable()
|
|
792
|
+
], E006PaiLookup);
|
|
793
|
+
return E006PaiLookup;
|
|
794
|
+
}(ErpLookups));
|
|
795
|
+
|
|
752
796
|
var E008CepLookup = /** @class */ (function (_super) {
|
|
753
797
|
__extends(E008CepLookup, _super);
|
|
754
798
|
function E008CepLookup(lookupService, translate) {
|
|
@@ -6356,6 +6400,7 @@ var ErpLookupsModule = /** @class */ (function () {
|
|
|
6356
6400
|
ProdutoServicoLookup,
|
|
6357
6401
|
E044CcuFinRatDepLookup,
|
|
6358
6402
|
LigacaoItemFornecedorLookup,
|
|
6403
|
+
E006PaiLookup,
|
|
6359
6404
|
E007UfsLookup,
|
|
6360
6405
|
E008CepLookup,
|
|
6361
6406
|
E008RaiLookup,
|
|
@@ -7206,320 +7251,517 @@ var NpsService = /** @class */ (function () {
|
|
|
7206
7251
|
return NpsService;
|
|
7207
7252
|
}());
|
|
7208
7253
|
|
|
7254
|
+
var AsyncLock = /** @class */ (function () {
|
|
7255
|
+
function AsyncLock() {
|
|
7256
|
+
this.queue = [];
|
|
7257
|
+
this.acquired = false;
|
|
7258
|
+
}
|
|
7259
|
+
AsyncLock.prototype.acquire = function () {
|
|
7260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7261
|
+
var _this = this;
|
|
7262
|
+
return __generator(this, function (_a) {
|
|
7263
|
+
if (!this.acquired) {
|
|
7264
|
+
this.acquired = true;
|
|
7265
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7266
|
+
}
|
|
7267
|
+
else {
|
|
7268
|
+
return [2 /*return*/, new Promise(function (resolve, _) {
|
|
7269
|
+
_this.queue.push(resolve);
|
|
7270
|
+
})];
|
|
7271
|
+
}
|
|
7272
|
+
return [2 /*return*/];
|
|
7273
|
+
});
|
|
7274
|
+
});
|
|
7275
|
+
};
|
|
7276
|
+
AsyncLock.prototype.release = function () {
|
|
7277
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7278
|
+
var continuation;
|
|
7279
|
+
return __generator(this, function (_a) {
|
|
7280
|
+
if (this.queue.length === 0 && this.acquired) {
|
|
7281
|
+
this.acquired = false;
|
|
7282
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7283
|
+
}
|
|
7284
|
+
continuation = this.queue.shift();
|
|
7285
|
+
return [2 /*return*/, new Promise(function (res) {
|
|
7286
|
+
continuation();
|
|
7287
|
+
res();
|
|
7288
|
+
})];
|
|
7289
|
+
});
|
|
7290
|
+
});
|
|
7291
|
+
};
|
|
7292
|
+
return AsyncLock;
|
|
7293
|
+
}());
|
|
7294
|
+
|
|
7295
|
+
var UserInformationService = /** @class */ (function () {
|
|
7296
|
+
function UserInformationService() {
|
|
7297
|
+
}
|
|
7298
|
+
UserInformationService_1 = UserInformationService;
|
|
7299
|
+
UserInformationService.prototype.getAuthToken = function () {
|
|
7300
|
+
var cookieValue = get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7301
|
+
var authToken = JSON.parse(cookieValue);
|
|
7302
|
+
return authToken.access_token;
|
|
7303
|
+
};
|
|
7304
|
+
UserInformationService.prototype.getTenantDomain = function () {
|
|
7305
|
+
var cookieValue = get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7306
|
+
var authToken = JSON.parse(cookieValue);
|
|
7307
|
+
return authToken.username.split('@')[1];
|
|
7308
|
+
};
|
|
7309
|
+
UserInformationService.prototype.getWebSocketUrl = function () {
|
|
7310
|
+
var baseUrl = get(UserInformationService_1.BASE_URL_COOKIE_KEY);
|
|
7311
|
+
if (baseUrl && !baseUrl.endsWith('/')) {
|
|
7312
|
+
baseUrl += '/';
|
|
7313
|
+
}
|
|
7314
|
+
return baseUrl + 'websocket';
|
|
7315
|
+
};
|
|
7316
|
+
var UserInformationService_1;
|
|
7317
|
+
UserInformationService.BASE_URL_COOKIE_KEY = 'com.senior.base.url';
|
|
7318
|
+
UserInformationService.TOKEN_COOKIE_KEY = 'com.senior.token';
|
|
7319
|
+
UserInformationService.ɵprov = ɵɵdefineInjectable({ factory: function UserInformationService_Factory() { return new UserInformationService(); }, token: UserInformationService, providedIn: "root" });
|
|
7320
|
+
UserInformationService = UserInformationService_1 = __decorate([
|
|
7321
|
+
Injectable({
|
|
7322
|
+
providedIn: 'root'
|
|
7323
|
+
})
|
|
7324
|
+
], UserInformationService);
|
|
7325
|
+
return UserInformationService;
|
|
7326
|
+
}());
|
|
7327
|
+
|
|
7328
|
+
var PrimitiveManager = /** @class */ (function () {
|
|
7329
|
+
function PrimitiveManager(domain, service, primitive) {
|
|
7330
|
+
this.domain = domain;
|
|
7331
|
+
this.service = service;
|
|
7332
|
+
this.primitive = primitive;
|
|
7333
|
+
this.stompSubscriptions = [];
|
|
7334
|
+
this.event$ = new Subject();
|
|
7335
|
+
this.subscribed$ = new BehaviorSubject(false);
|
|
7336
|
+
}
|
|
7337
|
+
PrimitiveManager.prototype.unsubscribe = function () {
|
|
7338
|
+
var e_1, _a;
|
|
7339
|
+
this.event$.complete();
|
|
7340
|
+
try {
|
|
7341
|
+
for (var _b = __values(this.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7342
|
+
var stompSubscription = _c.value;
|
|
7343
|
+
stompSubscription.unsubscribe();
|
|
7344
|
+
}
|
|
7345
|
+
}
|
|
7346
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7347
|
+
finally {
|
|
7348
|
+
try {
|
|
7349
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7350
|
+
}
|
|
7351
|
+
finally { if (e_1) throw e_1.error; }
|
|
7352
|
+
}
|
|
7353
|
+
this.subscribed$.complete();
|
|
7354
|
+
};
|
|
7355
|
+
PrimitiveManager.prototype.fireEvent = function (event) {
|
|
7356
|
+
this.event$.next(event);
|
|
7357
|
+
};
|
|
7358
|
+
PrimitiveManager.prototype.subscribe = function () {
|
|
7359
|
+
var _a;
|
|
7360
|
+
var subscriptions = [];
|
|
7361
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
7362
|
+
subscriptions[_i] = arguments[_i];
|
|
7363
|
+
}
|
|
7364
|
+
(_a = this.stompSubscriptions).push.apply(_a, __spread(subscriptions));
|
|
7365
|
+
this.subscribed$.next(true);
|
|
7366
|
+
};
|
|
7367
|
+
PrimitiveManager.prototype.getEventObservable = function () {
|
|
7368
|
+
return this.event$.asObservable();
|
|
7369
|
+
};
|
|
7370
|
+
PrimitiveManager.prototype.getSubscriptionObservable = function () {
|
|
7371
|
+
return this.subscribed$.asObservable();
|
|
7372
|
+
};
|
|
7373
|
+
PrimitiveManager.prototype.hasObservers = function () {
|
|
7374
|
+
// @IMPORTANT: Replace .observers.length === 1 with .observed in rxjs 7.0+
|
|
7375
|
+
return this.event$.observers.length !== 1;
|
|
7376
|
+
};
|
|
7377
|
+
PrimitiveManager.prototype.getObserversCount = function () {
|
|
7378
|
+
return this.event$.observers.length;
|
|
7379
|
+
};
|
|
7380
|
+
return PrimitiveManager;
|
|
7381
|
+
}());
|
|
7382
|
+
|
|
7383
|
+
var RECONNECT_INTERVAL_MILLISECONDS = 3000;
|
|
7384
|
+
var CONNECTION_TIMEOUT_MILLISECONDS = 5000;
|
|
7209
7385
|
var WebsocketService = /** @class */ (function () {
|
|
7210
|
-
function WebsocketService() {
|
|
7211
|
-
|
|
7212
|
-
this.wasConnected = false;
|
|
7213
|
-
/** @private */
|
|
7214
|
-
this.isConnected = false;
|
|
7215
|
-
/** @private */
|
|
7216
|
-
this.isConnecting = false;
|
|
7217
|
-
/** @private */
|
|
7218
|
-
this.primitiveManagers = new Map();
|
|
7219
|
-
/** @private */
|
|
7386
|
+
function WebsocketService(userInformationService) {
|
|
7387
|
+
this.userInformationService = userInformationService;
|
|
7220
7388
|
this.connected$ = new BehaviorSubject(false);
|
|
7221
|
-
|
|
7222
|
-
this.
|
|
7223
|
-
/** @private */
|
|
7224
|
-
this.reconnect$ = new Subject();
|
|
7225
|
-
/** @private */
|
|
7389
|
+
this.disconnected$ = new Subject();
|
|
7390
|
+
this.reconnected$ = new Subject();
|
|
7226
7391
|
this.error$ = new Subject();
|
|
7227
7392
|
this.subscribed$ = new Subject();
|
|
7393
|
+
this.primitiveManagers = new Map();
|
|
7394
|
+
this.connectionLock = new AsyncLock();
|
|
7395
|
+
this.debugEnable = false;
|
|
7396
|
+
this.lostConnection = false;
|
|
7228
7397
|
}
|
|
7229
|
-
WebsocketService_1 = WebsocketService;
|
|
7230
7398
|
/**
|
|
7231
|
-
*
|
|
7232
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida pela primeira vez.
|
|
7399
|
+
* Enables stompjs debug logs and additional info
|
|
7233
7400
|
*/
|
|
7234
|
-
WebsocketService.prototype.
|
|
7235
|
-
|
|
7401
|
+
WebsocketService.prototype.enableDebugLogs = function () {
|
|
7402
|
+
this.debugEnable = true;
|
|
7236
7403
|
};
|
|
7237
7404
|
/**
|
|
7238
|
-
*
|
|
7239
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é desconectada.
|
|
7405
|
+
* Manually starts the connection
|
|
7240
7406
|
*/
|
|
7241
|
-
WebsocketService.prototype.
|
|
7242
|
-
return this
|
|
7407
|
+
WebsocketService.prototype.connect = function () {
|
|
7408
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7409
|
+
var stompConfig;
|
|
7410
|
+
var _this = this;
|
|
7411
|
+
return __generator(this, function (_a) {
|
|
7412
|
+
switch (_a.label) {
|
|
7413
|
+
case 0: return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7414
|
+
case 1:
|
|
7415
|
+
_a.sent();
|
|
7416
|
+
_a.label = 2;
|
|
7417
|
+
case 2:
|
|
7418
|
+
_a.trys.push([2, , 3, 5]);
|
|
7419
|
+
if (this.isConnected() || this.isConnecting()) {
|
|
7420
|
+
return [2 /*return*/];
|
|
7421
|
+
}
|
|
7422
|
+
this.lostConnection = false;
|
|
7423
|
+
stompConfig = {
|
|
7424
|
+
webSocketFactory: function () {
|
|
7425
|
+
return new SockJS(_this.getSubscriptionUrl(), null, {
|
|
7426
|
+
timeout: CONNECTION_TIMEOUT_MILLISECONDS
|
|
7427
|
+
});
|
|
7428
|
+
},
|
|
7429
|
+
connectionTimeout: CONNECTION_TIMEOUT_MILLISECONDS,
|
|
7430
|
+
reconnectDelay: RECONNECT_INTERVAL_MILLISECONDS,
|
|
7431
|
+
debug: this.debug.bind(this),
|
|
7432
|
+
onConnect: this.handleOnConnected.bind(this),
|
|
7433
|
+
onDisconnect: this.handleOnDisconnect.bind(this),
|
|
7434
|
+
onWebSocketClose: this.handleOnWebSocketClose.bind(this),
|
|
7435
|
+
onStompError: this.handleOnStompError.bind(this),
|
|
7436
|
+
onWebSocketError: this.handleOnWebSocketError.bind(this)
|
|
7437
|
+
};
|
|
7438
|
+
this.debug('Connecting the Webscoket');
|
|
7439
|
+
this.stompClient = new Client(stompConfig);
|
|
7440
|
+
this.stompClient.activate();
|
|
7441
|
+
return [3 /*break*/, 5];
|
|
7442
|
+
case 3: return [4 /*yield*/, this.connectionLock.release()];
|
|
7443
|
+
case 4:
|
|
7444
|
+
_a.sent();
|
|
7445
|
+
return [7 /*endfinally*/];
|
|
7446
|
+
case 5: return [2 /*return*/];
|
|
7447
|
+
}
|
|
7448
|
+
});
|
|
7449
|
+
});
|
|
7243
7450
|
};
|
|
7244
7451
|
/**
|
|
7245
|
-
*
|
|
7246
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é reconectada.
|
|
7452
|
+
* Manually disconnect the websocket. The reconnect loop will be stopped.
|
|
7247
7453
|
*/
|
|
7248
|
-
WebsocketService.prototype.
|
|
7249
|
-
return this
|
|
7454
|
+
WebsocketService.prototype.disconnect = function () {
|
|
7455
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7456
|
+
var _a, _b, primitiveManager;
|
|
7457
|
+
var e_1, _c;
|
|
7458
|
+
return __generator(this, function (_d) {
|
|
7459
|
+
switch (_d.label) {
|
|
7460
|
+
case 0:
|
|
7461
|
+
if (!this.isConnected()) {
|
|
7462
|
+
return [2 /*return*/];
|
|
7463
|
+
}
|
|
7464
|
+
return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7465
|
+
case 1:
|
|
7466
|
+
_d.sent();
|
|
7467
|
+
_d.label = 2;
|
|
7468
|
+
case 2:
|
|
7469
|
+
_d.trys.push([2, , 5, 7]);
|
|
7470
|
+
try {
|
|
7471
|
+
for (_a = __values(this.primitiveManagers.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
7472
|
+
primitiveManager = _b.value;
|
|
7473
|
+
primitiveManager.unsubscribe();
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7477
|
+
finally {
|
|
7478
|
+
try {
|
|
7479
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
7480
|
+
}
|
|
7481
|
+
finally { if (e_1) throw e_1.error; }
|
|
7482
|
+
}
|
|
7483
|
+
this.primitiveManagers.clear();
|
|
7484
|
+
this.connected$.next(false);
|
|
7485
|
+
if (!this.stompClient) return [3 /*break*/, 4];
|
|
7486
|
+
return [4 /*yield*/, this.stompClient.deactivate()];
|
|
7487
|
+
case 3:
|
|
7488
|
+
_d.sent();
|
|
7489
|
+
_d.label = 4;
|
|
7490
|
+
case 4: return [3 /*break*/, 7];
|
|
7491
|
+
case 5: return [4 /*yield*/, this.connectionLock.release()];
|
|
7492
|
+
case 6:
|
|
7493
|
+
_d.sent();
|
|
7494
|
+
return [7 /*endfinally*/];
|
|
7495
|
+
case 7: return [2 /*return*/];
|
|
7496
|
+
}
|
|
7497
|
+
});
|
|
7498
|
+
});
|
|
7250
7499
|
};
|
|
7251
7500
|
/**
|
|
7252
|
-
*
|
|
7253
|
-
* @return
|
|
7501
|
+
* Check if the websocket is connected
|
|
7502
|
+
* @return `boolean` representing if the websocket is connected
|
|
7254
7503
|
*/
|
|
7255
|
-
WebsocketService.prototype.
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
return this.
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
}
|
|
7504
|
+
WebsocketService.prototype.isConnected = function () {
|
|
7505
|
+
if (!this.stompClient) {
|
|
7506
|
+
return false;
|
|
7507
|
+
}
|
|
7508
|
+
return this.stompClient.connected;
|
|
7509
|
+
};
|
|
7510
|
+
/**
|
|
7511
|
+
* Check if the websocket is tring to connect
|
|
7512
|
+
* @return `boolean` representing if the websocket status
|
|
7513
|
+
*/
|
|
7514
|
+
WebsocketService.prototype.isConnecting = function () {
|
|
7515
|
+
if (!this.stompClient) {
|
|
7516
|
+
return false;
|
|
7517
|
+
}
|
|
7518
|
+
return !this.stompClient.connected && this.stompClient.active;
|
|
7519
|
+
};
|
|
7520
|
+
/**
|
|
7521
|
+
* Event responsable to emit an event when the connection is established.
|
|
7522
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7523
|
+
* @return `Observable<boolean>`
|
|
7524
|
+
*/
|
|
7525
|
+
WebsocketService.prototype.onConnect = function () {
|
|
7526
|
+
return this.connected$.asObservable()
|
|
7527
|
+
.pipe(filter(function (p) { return p === true; }));
|
|
7528
|
+
};
|
|
7529
|
+
/**
|
|
7530
|
+
* Event responsable to emit an event when the connection is closed.
|
|
7531
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7532
|
+
* @return `Observable<void>`
|
|
7533
|
+
*/
|
|
7534
|
+
WebsocketService.prototype.onDisconnect = function () {
|
|
7535
|
+
return this.disconnected$.asObservable();
|
|
7536
|
+
};
|
|
7537
|
+
/**
|
|
7538
|
+
* Event responsable to emit an event when the connection is reestablished.
|
|
7539
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7540
|
+
* @return `Observable<void>`
|
|
7541
|
+
*/
|
|
7542
|
+
WebsocketService.prototype.onReconnect = function () {
|
|
7543
|
+
return this.reconnected$.asObservable();
|
|
7269
7544
|
};
|
|
7270
7545
|
/**
|
|
7271
|
-
*
|
|
7272
|
-
*
|
|
7546
|
+
* Event responsable to emit an event when an error ocurred.
|
|
7547
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7548
|
+
* @return `Observable<FrameImpl>`
|
|
7273
7549
|
*/
|
|
7274
7550
|
WebsocketService.prototype.onError = function () {
|
|
7275
7551
|
return this.error$.asObservable();
|
|
7276
7552
|
};
|
|
7277
7553
|
/**
|
|
7278
|
-
*
|
|
7279
|
-
*
|
|
7280
|
-
* @
|
|
7281
|
-
* @param {
|
|
7282
|
-
* @
|
|
7283
|
-
* @return Um Observable<T> que emite notificações toda vez que o respectivo evento é publicado.
|
|
7554
|
+
* Event responsible to emit an event when a primitive is called.
|
|
7555
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7556
|
+
* @typeParam `<T>` Object type that will be used in the observable for the `data` property.
|
|
7557
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7558
|
+
* @return `Observable<PrimitiveEvent<T>>` Observable that emits an event when the service calls the primitive.
|
|
7284
7559
|
*/
|
|
7285
7560
|
WebsocketService.prototype.onEvent = function (options) {
|
|
7286
7561
|
var _this = this;
|
|
7287
|
-
this.connect();
|
|
7288
7562
|
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7289
|
-
var key = this.
|
|
7563
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7290
7564
|
if (this.primitiveManagers.has(key)) {
|
|
7291
|
-
return this.primitiveManagers.get(key).
|
|
7565
|
+
return this.primitiveManagers.get(key).getEventObservable();
|
|
7292
7566
|
}
|
|
7293
|
-
var primitiveManager =
|
|
7294
|
-
domain: domain,
|
|
7295
|
-
service: service,
|
|
7296
|
-
primitive: primitive,
|
|
7297
|
-
stompSubscriptions: [],
|
|
7298
|
-
event$: new Subject(),
|
|
7299
|
-
subscribed$: new BehaviorSubject(false)
|
|
7300
|
-
};
|
|
7567
|
+
var primitiveManager = new PrimitiveManager(domain, service, primitive);
|
|
7301
7568
|
this.primitiveManagers.set(key, primitiveManager);
|
|
7302
|
-
this.
|
|
7303
|
-
.
|
|
7304
|
-
|
|
7305
|
-
|
|
7569
|
+
this.connect().then(function () {
|
|
7570
|
+
_this.onConnect()
|
|
7571
|
+
.pipe(take(1))
|
|
7572
|
+
.subscribe(function () {
|
|
7573
|
+
_this.createStompSubscriptions(primitiveManager);
|
|
7574
|
+
});
|
|
7306
7575
|
});
|
|
7307
|
-
return primitiveManager
|
|
7308
|
-
.
|
|
7309
|
-
.pipe(finalize(function () { return _this.
|
|
7310
|
-
};
|
|
7311
|
-
/** @private */
|
|
7312
|
-
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
7313
|
-
var withTokenUrl = this.getSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7314
|
-
var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
|
|
7315
|
-
var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7316
|
-
var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
|
|
7317
|
-
primitiveManager.stompSubscriptions = [
|
|
7318
|
-
stompSubscriptionWithToken,
|
|
7319
|
-
stompSubscriptionWithoutToken
|
|
7320
|
-
];
|
|
7321
|
-
primitiveManager.subscribed$.next(true);
|
|
7322
|
-
this.subscribed$.next(primitiveManager);
|
|
7576
|
+
return primitiveManager
|
|
7577
|
+
.getEventObservable()
|
|
7578
|
+
.pipe(finalize(function () { return _this.unsubscribePrimitiveOnFinalize(primitiveManager); }));
|
|
7323
7579
|
};
|
|
7324
|
-
/**
|
|
7325
|
-
|
|
7580
|
+
/**
|
|
7581
|
+
* Event responsible to emit an event when a subscription is created for the primitive.
|
|
7582
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7583
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7584
|
+
* Observable responsável por emitir uma notificação após o subscribe do evento pela primeira vez.
|
|
7585
|
+
* @return `Observable<boolean>` Observable that emits an event when the service calls the primitive.
|
|
7586
|
+
*/
|
|
7587
|
+
WebsocketService.prototype.onSubscribe = function (options) {
|
|
7326
7588
|
var _this = this;
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
this.
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
_this.reconnectPrimitives();
|
|
7336
|
-
_this.connected$.next(true);
|
|
7337
|
-
_this.reconnect$.next();
|
|
7589
|
+
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7590
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7591
|
+
return this.onConnect().pipe(take(1), switchMap(function () {
|
|
7592
|
+
if (_this.primitiveManagers.has(key)) {
|
|
7593
|
+
return _this.primitiveManagers
|
|
7594
|
+
.get(key)
|
|
7595
|
+
.getSubscriptionObservable()
|
|
7596
|
+
.pipe(take(1));
|
|
7338
7597
|
}
|
|
7339
|
-
|
|
7340
|
-
_this.
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
}, function (error) {
|
|
7344
|
-
_this.isConnected = false;
|
|
7345
|
-
_this.connected$.next(false);
|
|
7346
|
-
_this.error$.next(error);
|
|
7347
|
-
race(_this.disconnect$.pipe(take(1), map(function () { return ({ wasDisconnected: true }); })), timer(WebsocketService_1.RECONNECT_INTERVAL).pipe(take(1), switchMap(function () {
|
|
7348
|
-
return iif(function () { return document.hidden; }, fromEvent(document, 'visibilitychange').pipe(first()), of(void 0));
|
|
7349
|
-
}), map(function () { return ({ wasDisconnected: false }); })))
|
|
7350
|
-
.pipe(take(1))
|
|
7351
|
-
.subscribe({
|
|
7352
|
-
next: function (_a) {
|
|
7353
|
-
var wasDisconnected = _a.wasDisconnected;
|
|
7354
|
-
if (!wasDisconnected &&
|
|
7355
|
-
!(_this.isConnected || _this.isConnecting)) {
|
|
7356
|
-
_this.connect();
|
|
7357
|
-
}
|
|
7358
|
-
}
|
|
7359
|
-
});
|
|
7360
|
-
});
|
|
7598
|
+
return _this.subscribed$.asObservable().pipe(filter(function (primitiveManager) {
|
|
7599
|
+
return _this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
|
|
7600
|
+
}), map(function () { return true; }), take(1));
|
|
7601
|
+
}));
|
|
7361
7602
|
};
|
|
7362
|
-
WebsocketService.prototype.
|
|
7363
|
-
var
|
|
7364
|
-
|
|
7603
|
+
WebsocketService.prototype.debug = function (message) {
|
|
7604
|
+
var optionalParams = [];
|
|
7605
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7606
|
+
optionalParams[_i - 1] = arguments[_i];
|
|
7607
|
+
}
|
|
7608
|
+
if (!this.debugEnable) {
|
|
7365
7609
|
return;
|
|
7366
7610
|
}
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7611
|
+
console.log.apply(console, __spread(['WS debug: ' + message], optionalParams));
|
|
7612
|
+
};
|
|
7613
|
+
WebsocketService.prototype.info = function (message) {
|
|
7614
|
+
console.info('WS info: ' + message);
|
|
7615
|
+
};
|
|
7616
|
+
WebsocketService.prototype.handleOnConnected = function () {
|
|
7617
|
+
this.info('Webscoket connected');
|
|
7618
|
+
this.connected$.next(true);
|
|
7619
|
+
if (this.lostConnection) {
|
|
7620
|
+
this.info('Webscoket reconnected, recriating subscriptions');
|
|
7621
|
+
this.handleReconnection();
|
|
7622
|
+
}
|
|
7623
|
+
};
|
|
7624
|
+
WebsocketService.prototype.handleOnDisconnect = function () {
|
|
7625
|
+
this.info('Webscoket disconnected');
|
|
7626
|
+
this.connected$.next(false);
|
|
7627
|
+
this.disconnected$.next();
|
|
7628
|
+
};
|
|
7629
|
+
WebsocketService.prototype.handleOnWebSocketClose = function (data) {
|
|
7630
|
+
if (data.reason && data.reason.toLowerCase().indexOf("go away") !== -1) {
|
|
7631
|
+
this.lostConnection = true;
|
|
7632
|
+
this.handleError('AuthenticationError', new FrameImpl({
|
|
7633
|
+
command: data.type,
|
|
7634
|
+
headers: {
|
|
7635
|
+
message: data.reason
|
|
7382
7636
|
}
|
|
7383
|
-
}
|
|
7637
|
+
}));
|
|
7638
|
+
return;
|
|
7384
7639
|
}
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
try {
|
|
7388
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
7389
|
-
}
|
|
7390
|
-
finally { if (e_1) throw e_1.error; }
|
|
7640
|
+
if (data.wasClean) {
|
|
7641
|
+
return;
|
|
7391
7642
|
}
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7643
|
+
this.lostConnection = true;
|
|
7644
|
+
};
|
|
7645
|
+
WebsocketService.prototype.handleOnStompError = function (data) {
|
|
7646
|
+
this.handleError('StompError', data);
|
|
7647
|
+
if (this.isAuthenticationError(data)) {
|
|
7648
|
+
this.info('Authentication error, recriating subscriptions');
|
|
7649
|
+
this.handleReconnection();
|
|
7397
7650
|
}
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7651
|
+
};
|
|
7652
|
+
WebsocketService.prototype.isAuthenticationError = function (data) {
|
|
7653
|
+
var _a;
|
|
7654
|
+
var errorMessage = (_a = data === null || data === void 0 ? void 0 : data.headers) === null || _a === void 0 ? void 0 : _a.message;
|
|
7655
|
+
if (!errorMessage) {
|
|
7656
|
+
return false;
|
|
7404
7657
|
}
|
|
7405
|
-
|
|
7406
|
-
this._stompClient.disconnect();
|
|
7407
|
-
this._stompClient.deactivate();
|
|
7408
|
-
this.isConnected = false;
|
|
7409
|
-
this.isConnecting = false;
|
|
7410
|
-
this.wasConnected = false;
|
|
7411
|
-
this.connected$.next(false);
|
|
7412
|
-
this.disconnect$.next();
|
|
7658
|
+
return errorMessage.toLowerCase().indexOf('forbiddenexception') !== -1;
|
|
7413
7659
|
};
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
var tenant = WebsocketService_1.TOKEN
|
|
7417
|
-
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7418
|
-
: null;
|
|
7419
|
-
var token = WebsocketService_1.TOKEN
|
|
7420
|
-
? WebsocketService_1.TOKEN.access_token
|
|
7421
|
-
: null;
|
|
7422
|
-
return "/topic/" + tenant + "/" + token + "/" + domain + "/" + service + "/" + primitive;
|
|
7660
|
+
WebsocketService.prototype.handleOnWebSocketError = function (data) {
|
|
7661
|
+
this.handleError('WebSocketError', data);
|
|
7423
7662
|
};
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7428
|
-
: null;
|
|
7429
|
-
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7663
|
+
WebsocketService.prototype.handleError = function (origin, data) {
|
|
7664
|
+
console.error(origin, data);
|
|
7665
|
+
this.error$.next(data);
|
|
7430
7666
|
};
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
primitiveManager.event$.next(event);
|
|
7436
|
-
});
|
|
7437
|
-
};
|
|
7438
|
-
/** @private */
|
|
7439
|
-
WebsocketService.prototype.createStompClient = function () {
|
|
7440
|
-
var ws = new SockJS(WebsocketService_1.WEBSOCKET_URL + "subscription", null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
|
|
7441
|
-
this._stompClient = Stomp.over(ws);
|
|
7442
|
-
this._stompClient.debug = function () { return null; };
|
|
7667
|
+
WebsocketService.prototype.handleReconnection = function () {
|
|
7668
|
+
this.lostConnection = false;
|
|
7669
|
+
this.reconnectPrimitives();
|
|
7670
|
+
this.reconnected$.next();
|
|
7443
7671
|
};
|
|
7444
|
-
/** @private */
|
|
7445
7672
|
WebsocketService.prototype.reconnectPrimitives = function () {
|
|
7446
|
-
var
|
|
7673
|
+
var e_2, _a;
|
|
7447
7674
|
try {
|
|
7448
7675
|
for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7449
7676
|
var primitiveManager = _c.value;
|
|
7450
7677
|
this.createStompSubscriptions(primitiveManager);
|
|
7451
7678
|
}
|
|
7452
7679
|
}
|
|
7453
|
-
catch (
|
|
7680
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
7454
7681
|
finally {
|
|
7455
7682
|
try {
|
|
7456
7683
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7457
7684
|
}
|
|
7458
|
-
finally { if (
|
|
7685
|
+
finally { if (e_2) throw e_2.error; }
|
|
7459
7686
|
}
|
|
7460
7687
|
};
|
|
7461
|
-
|
|
7688
|
+
WebsocketService.prototype.buildSubscriptionUrlWithToken = function (domain, service, primitive) {
|
|
7689
|
+
var authToken = this.userInformationService.getAuthToken();
|
|
7690
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7691
|
+
return "/topic/" + tenant + "/" + authToken + "/" + domain + "/" + service + "/" + primitive;
|
|
7692
|
+
};
|
|
7693
|
+
WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
|
|
7694
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7695
|
+
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7696
|
+
};
|
|
7697
|
+
WebsocketService.prototype.buildPrimitiveManagerKey = function (domain, service, primitive) {
|
|
7698
|
+
return domain + "/" + service + "/" + primitive;
|
|
7699
|
+
};
|
|
7700
|
+
WebsocketService.prototype.unsubscribePrimitiveOnFinalize = function (primitiveManager) {
|
|
7701
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7702
|
+
var key;
|
|
7703
|
+
return __generator(this, function (_a) {
|
|
7704
|
+
switch (_a.label) {
|
|
7705
|
+
case 0:
|
|
7706
|
+
if (primitiveManager.hasObservers()) {
|
|
7707
|
+
return [2 /*return*/];
|
|
7708
|
+
}
|
|
7709
|
+
primitiveManager.unsubscribe();
|
|
7710
|
+
key = this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7711
|
+
this.primitiveManagers.delete(key);
|
|
7712
|
+
return [4 /*yield*/, this.disconnectIfNoMoreObservables()];
|
|
7713
|
+
case 1:
|
|
7714
|
+
_a.sent();
|
|
7715
|
+
return [2 /*return*/];
|
|
7716
|
+
}
|
|
7717
|
+
});
|
|
7718
|
+
});
|
|
7719
|
+
};
|
|
7720
|
+
WebsocketService.prototype.disconnectIfNoMoreObservables = function () {
|
|
7721
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7722
|
+
return __generator(this, function (_a) {
|
|
7723
|
+
switch (_a.label) {
|
|
7724
|
+
case 0:
|
|
7725
|
+
if (!(this.getObserversCount() === 0)) return [3 /*break*/, 2];
|
|
7726
|
+
this.debug('Manually disconnecting because there are no more observers');
|
|
7727
|
+
return [4 /*yield*/, this.disconnect()];
|
|
7728
|
+
case 1:
|
|
7729
|
+
_a.sent();
|
|
7730
|
+
_a.label = 2;
|
|
7731
|
+
case 2: return [2 /*return*/];
|
|
7732
|
+
}
|
|
7733
|
+
});
|
|
7734
|
+
});
|
|
7735
|
+
};
|
|
7462
7736
|
WebsocketService.prototype.getObserversCount = function () {
|
|
7463
|
-
var e_5, _a;
|
|
7464
7737
|
var observersCount = 0;
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
observersCount += primitiveManager.event$.observers.length;
|
|
7469
|
-
}
|
|
7470
|
-
}
|
|
7471
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
7472
|
-
finally {
|
|
7473
|
-
try {
|
|
7474
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7475
|
-
}
|
|
7476
|
-
finally { if (e_5) throw e_5.error; }
|
|
7477
|
-
}
|
|
7738
|
+
this.primitiveManagers.forEach(function (primitiveManager) {
|
|
7739
|
+
observersCount += primitiveManager.getObserversCount();
|
|
7740
|
+
});
|
|
7478
7741
|
return observersCount;
|
|
7479
7742
|
};
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
if (hasObservers)
|
|
7486
|
-
return;
|
|
7487
|
-
primitiveManager.event$.complete();
|
|
7488
|
-
try {
|
|
7489
|
-
for (var _b = __values(primitiveManager.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7490
|
-
var stompSubscription = _c.value;
|
|
7491
|
-
stompSubscription.unsubscribe();
|
|
7492
|
-
}
|
|
7493
|
-
}
|
|
7494
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
7495
|
-
finally {
|
|
7496
|
-
try {
|
|
7497
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7498
|
-
}
|
|
7499
|
-
finally { if (e_6) throw e_6.error; }
|
|
7500
|
-
}
|
|
7501
|
-
primitiveManager.subscribed$.complete();
|
|
7502
|
-
var key = this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7503
|
-
this.primitiveManagers.delete(key);
|
|
7504
|
-
this.disconnect();
|
|
7743
|
+
WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
|
|
7744
|
+
return this.stompClient.subscribe(destination, function (message) {
|
|
7745
|
+
var event = JSON.parse(message.body || '{}');
|
|
7746
|
+
primitiveManager.fireEvent(event);
|
|
7747
|
+
});
|
|
7505
7748
|
};
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7749
|
+
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
7750
|
+
var subscriptionUrlWithToken = this.buildSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7751
|
+
var subscriptionUrlWithoutToken = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7752
|
+
var stompSubscriptionWithToken = this.createStompSubscription(subscriptionUrlWithToken, primitiveManager);
|
|
7753
|
+
var stompSubscriptionWithoutToken = this.createStompSubscription(subscriptionUrlWithoutToken, primitiveManager);
|
|
7754
|
+
primitiveManager.subscribe(stompSubscriptionWithToken, stompSubscriptionWithoutToken);
|
|
7755
|
+
this.subscribed$.next(primitiveManager);
|
|
7756
|
+
};
|
|
7757
|
+
WebsocketService.prototype.getSubscriptionUrl = function () {
|
|
7758
|
+
return this.userInformationService.getWebSocketUrl() + "/subscription";
|
|
7509
7759
|
};
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
WebsocketService
|
|
7515
|
-
/** @private */
|
|
7516
|
-
WebsocketService.TOKEN_COOKIE = 'com.senior.token';
|
|
7517
|
-
/** @private */
|
|
7518
|
-
WebsocketService.TOKEN = JSON.parse(get(WebsocketService_1.TOKEN_COOKIE) || '{}');
|
|
7519
|
-
/** @private */
|
|
7520
|
-
WebsocketService.WEBSOCKET_URL = get(WebsocketService_1.BASE_URL_COOKIE) + '/websocket/';
|
|
7521
|
-
WebsocketService.ɵprov = ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(); }, token: WebsocketService, providedIn: "root" });
|
|
7522
|
-
WebsocketService = WebsocketService_1 = __decorate([
|
|
7760
|
+
WebsocketService.ctorParameters = function () { return [
|
|
7761
|
+
{ type: UserInformationService }
|
|
7762
|
+
]; };
|
|
7763
|
+
WebsocketService.ɵprov = ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(ɵɵinject(UserInformationService)); }, token: WebsocketService, providedIn: "root" });
|
|
7764
|
+
WebsocketService = __decorate([
|
|
7523
7765
|
Injectable({
|
|
7524
7766
|
providedIn: 'root'
|
|
7525
7767
|
})
|
|
@@ -7680,5 +7922,5 @@ var ModulesEnum;
|
|
|
7680
7922
|
* Generated bundle index. Do not edit.
|
|
7681
7923
|
*/
|
|
7682
7924
|
|
|
7683
|
-
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,
|
|
7925
|
+
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, E006PaiLookup, 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 };
|
|
7684
7926
|
//# sourceMappingURL=senior-gestao-empresarial-angular-components.js.map
|