@senior-gestao-empresarial/angular-components 6.11.5 → 6.12.0-67d9099d-c888-4b61-a14e-4c7c373707d6
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 +513 -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/permissions/index.d.ts +1 -0
- package/components/permissions/verify-module-permissions-service.d.ts +18 -0
- package/components/permissions/verify-module-permissions.d.ts +16 -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/permissions/index.js +2 -1
- package/esm2015/components/permissions/verify-module-permissions-service.js +26 -0
- package/esm2015/components/permissions/verify-module-permissions.js +51 -0
- 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 +259 -195
- package/esm2015/senior-gestao-empresarial-angular-components.js +4 -2
- package/esm5/components/permissions/index.js +2 -1
- package/esm5/components/permissions/verify-module-permissions-service.js +28 -0
- package/esm5/components/permissions/verify-module-permissions.js +53 -0
- 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 +317 -256
- package/esm5/senior-gestao-empresarial-angular-components.js +4 -2
- package/fesm2015/senior-gestao-empresarial-angular-components.js +417 -193
- package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-angular-components.js +509 -255
- 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 -1
- 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 } 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) {
|
|
@@ -7206,320 +7206,507 @@ var NpsService = /** @class */ (function () {
|
|
|
7206
7206
|
return NpsService;
|
|
7207
7207
|
}());
|
|
7208
7208
|
|
|
7209
|
+
var AsyncLock = /** @class */ (function () {
|
|
7210
|
+
function AsyncLock() {
|
|
7211
|
+
this.queue = [];
|
|
7212
|
+
this.acquired = false;
|
|
7213
|
+
}
|
|
7214
|
+
AsyncLock.prototype.acquire = function () {
|
|
7215
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7216
|
+
var _this = this;
|
|
7217
|
+
return __generator(this, function (_a) {
|
|
7218
|
+
if (!this.acquired) {
|
|
7219
|
+
this.acquired = true;
|
|
7220
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7221
|
+
}
|
|
7222
|
+
else {
|
|
7223
|
+
return [2 /*return*/, new Promise(function (resolve, _) {
|
|
7224
|
+
_this.queue.push(resolve);
|
|
7225
|
+
})];
|
|
7226
|
+
}
|
|
7227
|
+
return [2 /*return*/];
|
|
7228
|
+
});
|
|
7229
|
+
});
|
|
7230
|
+
};
|
|
7231
|
+
AsyncLock.prototype.release = function () {
|
|
7232
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7233
|
+
var continuation;
|
|
7234
|
+
return __generator(this, function (_a) {
|
|
7235
|
+
if (this.queue.length === 0 && this.acquired) {
|
|
7236
|
+
this.acquired = false;
|
|
7237
|
+
return [2 /*return*/, Promise.resolve()];
|
|
7238
|
+
}
|
|
7239
|
+
continuation = this.queue.shift();
|
|
7240
|
+
return [2 /*return*/, new Promise(function (res) {
|
|
7241
|
+
continuation();
|
|
7242
|
+
res();
|
|
7243
|
+
})];
|
|
7244
|
+
});
|
|
7245
|
+
});
|
|
7246
|
+
};
|
|
7247
|
+
return AsyncLock;
|
|
7248
|
+
}());
|
|
7249
|
+
|
|
7250
|
+
var UserInformationService = /** @class */ (function () {
|
|
7251
|
+
function UserInformationService() {
|
|
7252
|
+
}
|
|
7253
|
+
UserInformationService_1 = UserInformationService;
|
|
7254
|
+
UserInformationService.prototype.getAuthToken = function () {
|
|
7255
|
+
var cookieValue = get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7256
|
+
var authToken = JSON.parse(cookieValue);
|
|
7257
|
+
return authToken.access_token;
|
|
7258
|
+
};
|
|
7259
|
+
UserInformationService.prototype.getTenantDomain = function () {
|
|
7260
|
+
var cookieValue = get(UserInformationService_1.TOKEN_COOKIE_KEY) || '{}';
|
|
7261
|
+
var authToken = JSON.parse(cookieValue);
|
|
7262
|
+
return authToken.username.split('@')[1];
|
|
7263
|
+
};
|
|
7264
|
+
UserInformationService.prototype.getWebSocketUrl = function () {
|
|
7265
|
+
var baseUrl = get(UserInformationService_1.BASE_URL_COOKIE_KEY);
|
|
7266
|
+
if (baseUrl && !baseUrl.endsWith('/')) {
|
|
7267
|
+
baseUrl += '/';
|
|
7268
|
+
}
|
|
7269
|
+
return baseUrl + 'websocket';
|
|
7270
|
+
};
|
|
7271
|
+
var UserInformationService_1;
|
|
7272
|
+
UserInformationService.BASE_URL_COOKIE_KEY = 'com.senior.base.url';
|
|
7273
|
+
UserInformationService.TOKEN_COOKIE_KEY = 'com.senior.token';
|
|
7274
|
+
UserInformationService.ɵprov = ɵɵdefineInjectable({ factory: function UserInformationService_Factory() { return new UserInformationService(); }, token: UserInformationService, providedIn: "root" });
|
|
7275
|
+
UserInformationService = UserInformationService_1 = __decorate([
|
|
7276
|
+
Injectable({
|
|
7277
|
+
providedIn: 'root'
|
|
7278
|
+
})
|
|
7279
|
+
], UserInformationService);
|
|
7280
|
+
return UserInformationService;
|
|
7281
|
+
}());
|
|
7282
|
+
|
|
7283
|
+
var PrimitiveManager = /** @class */ (function () {
|
|
7284
|
+
function PrimitiveManager(domain, service, primitive) {
|
|
7285
|
+
this.domain = domain;
|
|
7286
|
+
this.service = service;
|
|
7287
|
+
this.primitive = primitive;
|
|
7288
|
+
this.stompSubscriptions = [];
|
|
7289
|
+
this.event$ = new Subject();
|
|
7290
|
+
this.subscribed$ = new BehaviorSubject(false);
|
|
7291
|
+
}
|
|
7292
|
+
PrimitiveManager.prototype.unsubscribe = function () {
|
|
7293
|
+
var e_1, _a;
|
|
7294
|
+
this.event$.complete();
|
|
7295
|
+
try {
|
|
7296
|
+
for (var _b = __values(this.stompSubscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7297
|
+
var stompSubscription = _c.value;
|
|
7298
|
+
stompSubscription.unsubscribe();
|
|
7299
|
+
}
|
|
7300
|
+
}
|
|
7301
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7302
|
+
finally {
|
|
7303
|
+
try {
|
|
7304
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7305
|
+
}
|
|
7306
|
+
finally { if (e_1) throw e_1.error; }
|
|
7307
|
+
}
|
|
7308
|
+
this.subscribed$.complete();
|
|
7309
|
+
};
|
|
7310
|
+
PrimitiveManager.prototype.fireEvent = function (event) {
|
|
7311
|
+
this.event$.next(event);
|
|
7312
|
+
};
|
|
7313
|
+
PrimitiveManager.prototype.subscribe = function () {
|
|
7314
|
+
var _a;
|
|
7315
|
+
var subscriptions = [];
|
|
7316
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
7317
|
+
subscriptions[_i] = arguments[_i];
|
|
7318
|
+
}
|
|
7319
|
+
(_a = this.stompSubscriptions).push.apply(_a, __spread(subscriptions));
|
|
7320
|
+
this.subscribed$.next(true);
|
|
7321
|
+
};
|
|
7322
|
+
PrimitiveManager.prototype.getEventObservable = function () {
|
|
7323
|
+
return this.event$.asObservable();
|
|
7324
|
+
};
|
|
7325
|
+
PrimitiveManager.prototype.getSubscriptionObservable = function () {
|
|
7326
|
+
return this.subscribed$.asObservable();
|
|
7327
|
+
};
|
|
7328
|
+
PrimitiveManager.prototype.hasObservers = function () {
|
|
7329
|
+
// @IMPORTANT: Replace .observers.length === 1 with .observed in rxjs 7.0+
|
|
7330
|
+
return this.event$.observers.length !== 1;
|
|
7331
|
+
};
|
|
7332
|
+
PrimitiveManager.prototype.getObserversCount = function () {
|
|
7333
|
+
return this.event$.observers.length;
|
|
7334
|
+
};
|
|
7335
|
+
return PrimitiveManager;
|
|
7336
|
+
}());
|
|
7337
|
+
|
|
7338
|
+
var RECONNECT_INTERVAL_MILLISECONDS = 3000;
|
|
7339
|
+
var CONNECTION_TIMEOUT_MILLISECONDS = 5000;
|
|
7209
7340
|
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 */
|
|
7341
|
+
function WebsocketService(userInformationService) {
|
|
7342
|
+
this.userInformationService = userInformationService;
|
|
7220
7343
|
this.connected$ = new BehaviorSubject(false);
|
|
7221
|
-
|
|
7222
|
-
this.
|
|
7223
|
-
/** @private */
|
|
7224
|
-
this.reconnect$ = new Subject();
|
|
7225
|
-
/** @private */
|
|
7344
|
+
this.disconnected$ = new Subject();
|
|
7345
|
+
this.reconnected$ = new Subject();
|
|
7226
7346
|
this.error$ = new Subject();
|
|
7227
7347
|
this.subscribed$ = new Subject();
|
|
7348
|
+
this.primitiveManagers = new Map();
|
|
7349
|
+
this.connectionLock = new AsyncLock();
|
|
7350
|
+
this.debugEnable = false;
|
|
7351
|
+
this.lostConnection = false;
|
|
7228
7352
|
}
|
|
7229
|
-
WebsocketService_1 = WebsocketService;
|
|
7230
7353
|
/**
|
|
7231
|
-
*
|
|
7232
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida pela primeira vez.
|
|
7354
|
+
* Enables stompjs debug logs and additional info
|
|
7233
7355
|
*/
|
|
7234
|
-
WebsocketService.prototype.
|
|
7235
|
-
|
|
7356
|
+
WebsocketService.prototype.enableDebugLogs = function () {
|
|
7357
|
+
this.debugEnable = true;
|
|
7236
7358
|
};
|
|
7237
7359
|
/**
|
|
7238
|
-
*
|
|
7239
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é desconectada.
|
|
7360
|
+
* Manually starts the connection
|
|
7240
7361
|
*/
|
|
7241
|
-
WebsocketService.prototype.
|
|
7242
|
-
return this
|
|
7362
|
+
WebsocketService.prototype.connect = function () {
|
|
7363
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7364
|
+
var stompConfig;
|
|
7365
|
+
var _this = this;
|
|
7366
|
+
return __generator(this, function (_a) {
|
|
7367
|
+
switch (_a.label) {
|
|
7368
|
+
case 0: return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7369
|
+
case 1:
|
|
7370
|
+
_a.sent();
|
|
7371
|
+
_a.label = 2;
|
|
7372
|
+
case 2:
|
|
7373
|
+
_a.trys.push([2, , 3, 5]);
|
|
7374
|
+
if (this.isConnected() || this.isConnecting()) {
|
|
7375
|
+
return [2 /*return*/];
|
|
7376
|
+
}
|
|
7377
|
+
this.lostConnection = false;
|
|
7378
|
+
stompConfig = {
|
|
7379
|
+
webSocketFactory: function () {
|
|
7380
|
+
return new SockJS(_this.getSubscriptionUrl(), null, {
|
|
7381
|
+
timeout: CONNECTION_TIMEOUT_MILLISECONDS
|
|
7382
|
+
});
|
|
7383
|
+
},
|
|
7384
|
+
connectionTimeout: CONNECTION_TIMEOUT_MILLISECONDS,
|
|
7385
|
+
reconnectDelay: RECONNECT_INTERVAL_MILLISECONDS,
|
|
7386
|
+
debug: this.debug.bind(this),
|
|
7387
|
+
onConnect: this.handleOnConnected.bind(this),
|
|
7388
|
+
onDisconnect: this.handleOnDisconnect.bind(this),
|
|
7389
|
+
onWebSocketClose: this.handleOnWebSocketClose.bind(this),
|
|
7390
|
+
onStompError: this.handleOnStompError.bind(this),
|
|
7391
|
+
onWebSocketError: this.handleOnWebSocketError.bind(this)
|
|
7392
|
+
};
|
|
7393
|
+
this.debug('Connecting the Webscoket');
|
|
7394
|
+
this.stompClient = new Client(stompConfig);
|
|
7395
|
+
this.stompClient.activate();
|
|
7396
|
+
return [3 /*break*/, 5];
|
|
7397
|
+
case 3: return [4 /*yield*/, this.connectionLock.release()];
|
|
7398
|
+
case 4:
|
|
7399
|
+
_a.sent();
|
|
7400
|
+
return [7 /*endfinally*/];
|
|
7401
|
+
case 5: return [2 /*return*/];
|
|
7402
|
+
}
|
|
7403
|
+
});
|
|
7404
|
+
});
|
|
7243
7405
|
};
|
|
7244
7406
|
/**
|
|
7245
|
-
*
|
|
7246
|
-
* @return Um `Observable<void>` que emite uma notificação quando a conexão é reconectada.
|
|
7407
|
+
* Manually disconnect the websocket. The reconnect loop will be stopped.
|
|
7247
7408
|
*/
|
|
7248
|
-
WebsocketService.prototype.
|
|
7249
|
-
return this
|
|
7409
|
+
WebsocketService.prototype.disconnect = function () {
|
|
7410
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7411
|
+
var _a, _b, primitiveManager;
|
|
7412
|
+
var e_1, _c;
|
|
7413
|
+
return __generator(this, function (_d) {
|
|
7414
|
+
switch (_d.label) {
|
|
7415
|
+
case 0:
|
|
7416
|
+
if (!this.isConnected()) {
|
|
7417
|
+
return [2 /*return*/];
|
|
7418
|
+
}
|
|
7419
|
+
return [4 /*yield*/, this.connectionLock.acquire()];
|
|
7420
|
+
case 1:
|
|
7421
|
+
_d.sent();
|
|
7422
|
+
_d.label = 2;
|
|
7423
|
+
case 2:
|
|
7424
|
+
_d.trys.push([2, , 5, 7]);
|
|
7425
|
+
try {
|
|
7426
|
+
for (_a = __values(this.primitiveManagers.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
7427
|
+
primitiveManager = _b.value;
|
|
7428
|
+
primitiveManager.unsubscribe();
|
|
7429
|
+
}
|
|
7430
|
+
}
|
|
7431
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7432
|
+
finally {
|
|
7433
|
+
try {
|
|
7434
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
7435
|
+
}
|
|
7436
|
+
finally { if (e_1) throw e_1.error; }
|
|
7437
|
+
}
|
|
7438
|
+
this.primitiveManagers.clear();
|
|
7439
|
+
this.connected$.next(false);
|
|
7440
|
+
if (!this.stompClient) return [3 /*break*/, 4];
|
|
7441
|
+
return [4 /*yield*/, this.stompClient.deactivate()];
|
|
7442
|
+
case 3:
|
|
7443
|
+
_d.sent();
|
|
7444
|
+
_d.label = 4;
|
|
7445
|
+
case 4: return [3 /*break*/, 7];
|
|
7446
|
+
case 5: return [4 /*yield*/, this.connectionLock.release()];
|
|
7447
|
+
case 6:
|
|
7448
|
+
_d.sent();
|
|
7449
|
+
return [7 /*endfinally*/];
|
|
7450
|
+
case 7: return [2 /*return*/];
|
|
7451
|
+
}
|
|
7452
|
+
});
|
|
7453
|
+
});
|
|
7250
7454
|
};
|
|
7251
7455
|
/**
|
|
7252
|
-
*
|
|
7253
|
-
* @return
|
|
7456
|
+
* Check if the websocket is connected
|
|
7457
|
+
* @return `boolean` representing if the websocket is connected
|
|
7254
7458
|
*/
|
|
7255
|
-
WebsocketService.prototype.
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
return this.
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
}
|
|
7459
|
+
WebsocketService.prototype.isConnected = function () {
|
|
7460
|
+
if (!this.stompClient) {
|
|
7461
|
+
return false;
|
|
7462
|
+
}
|
|
7463
|
+
return this.stompClient.connected;
|
|
7464
|
+
};
|
|
7465
|
+
/**
|
|
7466
|
+
* Check if the websocket is tring to connect
|
|
7467
|
+
* @return `boolean` representing if the websocket status
|
|
7468
|
+
*/
|
|
7469
|
+
WebsocketService.prototype.isConnecting = function () {
|
|
7470
|
+
if (!this.stompClient) {
|
|
7471
|
+
return false;
|
|
7472
|
+
}
|
|
7473
|
+
return !this.stompClient.connected && this.stompClient.active;
|
|
7269
7474
|
};
|
|
7270
7475
|
/**
|
|
7271
|
-
*
|
|
7272
|
-
*
|
|
7476
|
+
* Event responsable to emit an event when the connection is established.
|
|
7477
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7478
|
+
* @return `Observable<boolean>`
|
|
7479
|
+
*/
|
|
7480
|
+
WebsocketService.prototype.onConnect = function () {
|
|
7481
|
+
return this.connected$.asObservable()
|
|
7482
|
+
.pipe(filter(function (p) { return p === true; }));
|
|
7483
|
+
};
|
|
7484
|
+
/**
|
|
7485
|
+
* Event responsable to emit an event when the connection is closed.
|
|
7486
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7487
|
+
* @return `Observable<void>`
|
|
7488
|
+
*/
|
|
7489
|
+
WebsocketService.prototype.onDisconnect = function () {
|
|
7490
|
+
return this.disconnected$.asObservable();
|
|
7491
|
+
};
|
|
7492
|
+
/**
|
|
7493
|
+
* Event responsable to emit an event when the connection is reestablished.
|
|
7494
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7495
|
+
* @return `Observable<void>`
|
|
7496
|
+
*/
|
|
7497
|
+
WebsocketService.prototype.onReconnect = function () {
|
|
7498
|
+
return this.reconnected$.asObservable();
|
|
7499
|
+
};
|
|
7500
|
+
/**
|
|
7501
|
+
* Event responsable to emit an event when an error ocurred.
|
|
7502
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7503
|
+
* @return `Observable<FrameImpl>`
|
|
7273
7504
|
*/
|
|
7274
7505
|
WebsocketService.prototype.onError = function () {
|
|
7275
7506
|
return this.error$.asObservable();
|
|
7276
7507
|
};
|
|
7277
7508
|
/**
|
|
7278
|
-
*
|
|
7279
|
-
*
|
|
7280
|
-
* @
|
|
7281
|
-
* @param {
|
|
7282
|
-
* @
|
|
7283
|
-
* @return Um Observable<T> que emite notificações toda vez que o respectivo evento é publicado.
|
|
7509
|
+
* Event responsible to emit an event when a primitive is called.
|
|
7510
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7511
|
+
* @typeParam `<T>` Object type that will be used in the observable for the `data` property.
|
|
7512
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7513
|
+
* @return `Observable<PrimitiveEvent<T>>` Observable that emits an event when the service calls the primitive.
|
|
7284
7514
|
*/
|
|
7285
7515
|
WebsocketService.prototype.onEvent = function (options) {
|
|
7286
7516
|
var _this = this;
|
|
7287
|
-
this.connect();
|
|
7288
7517
|
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7289
|
-
var key = this.
|
|
7518
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7290
7519
|
if (this.primitiveManagers.has(key)) {
|
|
7291
|
-
return this.primitiveManagers.get(key).
|
|
7520
|
+
return this.primitiveManagers.get(key).getEventObservable();
|
|
7292
7521
|
}
|
|
7293
|
-
var primitiveManager =
|
|
7294
|
-
domain: domain,
|
|
7295
|
-
service: service,
|
|
7296
|
-
primitive: primitive,
|
|
7297
|
-
stompSubscriptions: [],
|
|
7298
|
-
event$: new Subject(),
|
|
7299
|
-
subscribed$: new BehaviorSubject(false)
|
|
7300
|
-
};
|
|
7522
|
+
var primitiveManager = new PrimitiveManager(domain, service, primitive);
|
|
7301
7523
|
this.primitiveManagers.set(key, primitiveManager);
|
|
7302
|
-
this.
|
|
7303
|
-
.
|
|
7304
|
-
|
|
7305
|
-
|
|
7524
|
+
this.connect().then(function () {
|
|
7525
|
+
_this.onConnect()
|
|
7526
|
+
.pipe(take(1))
|
|
7527
|
+
.subscribe(function () {
|
|
7528
|
+
_this.createStompSubscriptions(primitiveManager);
|
|
7529
|
+
});
|
|
7306
7530
|
});
|
|
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);
|
|
7531
|
+
return primitiveManager
|
|
7532
|
+
.getEventObservable()
|
|
7533
|
+
.pipe(finalize(function () { return _this.unsubscribePrimitiveOnFinalize(primitiveManager); }));
|
|
7323
7534
|
};
|
|
7324
|
-
/**
|
|
7325
|
-
|
|
7535
|
+
/**
|
|
7536
|
+
* Event responsible to emit an event when a subscription is created for the primitive.
|
|
7537
|
+
* Do not forget to unsubscribe the observable when you don't need it anymore.
|
|
7538
|
+
* @param {OnEventOptions} options Configurations for the event.
|
|
7539
|
+
* Observable responsável por emitir uma notificação após o subscribe do evento pela primeira vez.
|
|
7540
|
+
* @return `Observable<boolean>` Observable that emits an event when the service calls the primitive.
|
|
7541
|
+
*/
|
|
7542
|
+
WebsocketService.prototype.onSubscribe = function (options) {
|
|
7326
7543
|
var _this = this;
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
this.
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
_this.reconnectPrimitives();
|
|
7336
|
-
_this.connected$.next(true);
|
|
7337
|
-
_this.reconnect$.next();
|
|
7544
|
+
var domain = options.domain, service = options.service, primitive = options.primitive;
|
|
7545
|
+
var key = this.buildPrimitiveManagerKey(domain, service, primitive);
|
|
7546
|
+
return this.onConnect().pipe(take(1), switchMap(function () {
|
|
7547
|
+
if (_this.primitiveManagers.has(key)) {
|
|
7548
|
+
return _this.primitiveManagers
|
|
7549
|
+
.get(key)
|
|
7550
|
+
.getSubscriptionObservable()
|
|
7551
|
+
.pipe(take(1));
|
|
7338
7552
|
}
|
|
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
|
-
});
|
|
7553
|
+
return _this.subscribed$.asObservable().pipe(filter(function (primitiveManager) {
|
|
7554
|
+
return _this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
|
|
7555
|
+
}), map(function () { return true; }), take(1));
|
|
7556
|
+
}));
|
|
7361
7557
|
};
|
|
7362
|
-
WebsocketService.prototype.
|
|
7363
|
-
var
|
|
7364
|
-
|
|
7558
|
+
WebsocketService.prototype.debug = function (message) {
|
|
7559
|
+
var optionalParams = [];
|
|
7560
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7561
|
+
optionalParams[_i - 1] = arguments[_i];
|
|
7562
|
+
}
|
|
7563
|
+
if (!this.debugEnable) {
|
|
7365
7564
|
return;
|
|
7366
7565
|
}
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
try {
|
|
7379
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
7380
|
-
}
|
|
7381
|
-
finally { if (e_2) throw e_2.error; }
|
|
7382
|
-
}
|
|
7383
|
-
}
|
|
7566
|
+
console.log.apply(console, __spread(['WS debug: ' + message], optionalParams));
|
|
7567
|
+
};
|
|
7568
|
+
WebsocketService.prototype.info = function (message) {
|
|
7569
|
+
console.info('WS info: ' + message);
|
|
7570
|
+
};
|
|
7571
|
+
WebsocketService.prototype.handleOnConnected = function () {
|
|
7572
|
+
this.info('Webscoket connected');
|
|
7573
|
+
this.connected$.next(true);
|
|
7574
|
+
if (this.lostConnection) {
|
|
7575
|
+
this.info('Webscoket reconnected, recriating subscriptions');
|
|
7576
|
+
this.handleReconnection();
|
|
7384
7577
|
}
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7578
|
+
};
|
|
7579
|
+
WebsocketService.prototype.handleOnDisconnect = function () {
|
|
7580
|
+
this.info('Webscoket disconnected');
|
|
7581
|
+
this.connected$.next(false);
|
|
7582
|
+
this.disconnected$.next();
|
|
7583
|
+
};
|
|
7584
|
+
WebsocketService.prototype.handleOnWebSocketClose = function (data) {
|
|
7585
|
+
if (data.wasClean) {
|
|
7586
|
+
return;
|
|
7391
7587
|
}
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7588
|
+
this.lostConnection = true;
|
|
7589
|
+
};
|
|
7590
|
+
WebsocketService.prototype.handleOnStompError = function (data) {
|
|
7591
|
+
this.handleError('StompError', data);
|
|
7592
|
+
if (this.isAuthenticationError(data)) {
|
|
7593
|
+
this.info('Authentication error, recriating subscriptions');
|
|
7594
|
+
this.handleReconnection();
|
|
7397
7595
|
}
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7596
|
+
};
|
|
7597
|
+
WebsocketService.prototype.isAuthenticationError = function (data) {
|
|
7598
|
+
var _a;
|
|
7599
|
+
var errorMessage = (_a = data === null || data === void 0 ? void 0 : data.headers) === null || _a === void 0 ? void 0 : _a.message;
|
|
7600
|
+
if (!errorMessage) {
|
|
7601
|
+
return false;
|
|
7404
7602
|
}
|
|
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();
|
|
7603
|
+
return errorMessage.toLowerCase().indexOf('forbiddenexception') !== -1;
|
|
7413
7604
|
};
|
|
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;
|
|
7605
|
+
WebsocketService.prototype.handleOnWebSocketError = function (data) {
|
|
7606
|
+
this.handleError('WebSocketError', data);
|
|
7423
7607
|
};
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
? WebsocketService_1.TOKEN.username.split('@')[1]
|
|
7428
|
-
: null;
|
|
7429
|
-
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7608
|
+
WebsocketService.prototype.handleError = function (origin, data) {
|
|
7609
|
+
console.error(origin, data);
|
|
7610
|
+
this.error$.next(data);
|
|
7430
7611
|
};
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
primitiveManager.event$.next(event);
|
|
7436
|
-
});
|
|
7612
|
+
WebsocketService.prototype.handleReconnection = function () {
|
|
7613
|
+
this.lostConnection = false;
|
|
7614
|
+
this.reconnectPrimitives();
|
|
7615
|
+
this.reconnected$.next();
|
|
7437
7616
|
};
|
|
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; };
|
|
7443
|
-
};
|
|
7444
|
-
/** @private */
|
|
7445
7617
|
WebsocketService.prototype.reconnectPrimitives = function () {
|
|
7446
|
-
var
|
|
7618
|
+
var e_2, _a;
|
|
7447
7619
|
try {
|
|
7448
7620
|
for (var _b = __values(this.primitiveManagers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7449
7621
|
var primitiveManager = _c.value;
|
|
7450
7622
|
this.createStompSubscriptions(primitiveManager);
|
|
7451
7623
|
}
|
|
7452
7624
|
}
|
|
7453
|
-
catch (
|
|
7625
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
7454
7626
|
finally {
|
|
7455
7627
|
try {
|
|
7456
7628
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7457
7629
|
}
|
|
7458
|
-
finally { if (
|
|
7630
|
+
finally { if (e_2) throw e_2.error; }
|
|
7459
7631
|
}
|
|
7460
7632
|
};
|
|
7461
|
-
|
|
7633
|
+
WebsocketService.prototype.buildSubscriptionUrlWithToken = function (domain, service, primitive) {
|
|
7634
|
+
var authToken = this.userInformationService.getAuthToken();
|
|
7635
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7636
|
+
return "/topic/" + tenant + "/" + authToken + "/" + domain + "/" + service + "/" + primitive;
|
|
7637
|
+
};
|
|
7638
|
+
WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
|
|
7639
|
+
var tenant = this.userInformationService.getTenantDomain();
|
|
7640
|
+
return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
|
|
7641
|
+
};
|
|
7642
|
+
WebsocketService.prototype.buildPrimitiveManagerKey = function (domain, service, primitive) {
|
|
7643
|
+
return domain + "/" + service + "/" + primitive;
|
|
7644
|
+
};
|
|
7645
|
+
WebsocketService.prototype.unsubscribePrimitiveOnFinalize = function (primitiveManager) {
|
|
7646
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7647
|
+
var key;
|
|
7648
|
+
return __generator(this, function (_a) {
|
|
7649
|
+
switch (_a.label) {
|
|
7650
|
+
case 0:
|
|
7651
|
+
if (primitiveManager.hasObservers()) {
|
|
7652
|
+
return [2 /*return*/];
|
|
7653
|
+
}
|
|
7654
|
+
primitiveManager.unsubscribe();
|
|
7655
|
+
key = this.buildPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7656
|
+
this.primitiveManagers.delete(key);
|
|
7657
|
+
return [4 /*yield*/, this.disconnectIfNoMoreObservables()];
|
|
7658
|
+
case 1:
|
|
7659
|
+
_a.sent();
|
|
7660
|
+
return [2 /*return*/];
|
|
7661
|
+
}
|
|
7662
|
+
});
|
|
7663
|
+
});
|
|
7664
|
+
};
|
|
7665
|
+
WebsocketService.prototype.disconnectIfNoMoreObservables = function () {
|
|
7666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7667
|
+
return __generator(this, function (_a) {
|
|
7668
|
+
switch (_a.label) {
|
|
7669
|
+
case 0:
|
|
7670
|
+
if (!(this.getObserversCount() === 0)) return [3 /*break*/, 2];
|
|
7671
|
+
this.debug('Manually disconnecting because there are no more observers');
|
|
7672
|
+
return [4 /*yield*/, this.disconnect()];
|
|
7673
|
+
case 1:
|
|
7674
|
+
_a.sent();
|
|
7675
|
+
_a.label = 2;
|
|
7676
|
+
case 2: return [2 /*return*/];
|
|
7677
|
+
}
|
|
7678
|
+
});
|
|
7679
|
+
});
|
|
7680
|
+
};
|
|
7462
7681
|
WebsocketService.prototype.getObserversCount = function () {
|
|
7463
|
-
var e_5, _a;
|
|
7464
7682
|
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
|
-
}
|
|
7683
|
+
this.primitiveManagers.forEach(function (primitiveManager) {
|
|
7684
|
+
observersCount += primitiveManager.getObserversCount();
|
|
7685
|
+
});
|
|
7478
7686
|
return observersCount;
|
|
7479
7687
|
};
|
|
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();
|
|
7688
|
+
WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
|
|
7689
|
+
return this.stompClient.subscribe(destination, function (message) {
|
|
7690
|
+
var event = JSON.parse(message.body || '{}');
|
|
7691
|
+
primitiveManager.fireEvent(event);
|
|
7692
|
+
});
|
|
7505
7693
|
};
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7694
|
+
WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
|
|
7695
|
+
var subscriptionUrlWithToken = this.buildSubscriptionUrlWithToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7696
|
+
var subscriptionUrlWithoutToken = this.getSubscriptionUrlWithoutToken(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
|
|
7697
|
+
var stompSubscriptionWithToken = this.createStompSubscription(subscriptionUrlWithToken, primitiveManager);
|
|
7698
|
+
var stompSubscriptionWithoutToken = this.createStompSubscription(subscriptionUrlWithoutToken, primitiveManager);
|
|
7699
|
+
primitiveManager.subscribe(stompSubscriptionWithToken, stompSubscriptionWithoutToken);
|
|
7700
|
+
this.subscribed$.next(primitiveManager);
|
|
7509
7701
|
};
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
WebsocketService
|
|
7517
|
-
|
|
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([
|
|
7702
|
+
WebsocketService.prototype.getSubscriptionUrl = function () {
|
|
7703
|
+
return this.userInformationService.getWebSocketUrl() + "/subscription";
|
|
7704
|
+
};
|
|
7705
|
+
WebsocketService.ctorParameters = function () { return [
|
|
7706
|
+
{ type: UserInformationService }
|
|
7707
|
+
]; };
|
|
7708
|
+
WebsocketService.ɵprov = ɵɵdefineInjectable({ factory: function WebsocketService_Factory() { return new WebsocketService(ɵɵinject(UserInformationService)); }, token: WebsocketService, providedIn: "root" });
|
|
7709
|
+
WebsocketService = __decorate([
|
|
7523
7710
|
Injectable({
|
|
7524
7711
|
providedIn: 'root'
|
|
7525
7712
|
})
|
|
@@ -7595,6 +7782,73 @@ var VerifyModulePermission = /** @class */ (function () {
|
|
|
7595
7782
|
return VerifyModulePermission;
|
|
7596
7783
|
}());
|
|
7597
7784
|
|
|
7785
|
+
var VerifyModulePermissionsService = /** @class */ (function () {
|
|
7786
|
+
function VerifyModulePermissionsService(http) {
|
|
7787
|
+
this.http = http;
|
|
7788
|
+
}
|
|
7789
|
+
VerifyModulePermissionsService_1 = VerifyModulePermissionsService;
|
|
7790
|
+
VerifyModulePermissionsService.prototype.consultaModulos = function (request) {
|
|
7791
|
+
return this.http.post(VerifyModulePermissionsService_1.QUERY_MODULES_URL, request);
|
|
7792
|
+
};
|
|
7793
|
+
var VerifyModulePermissionsService_1;
|
|
7794
|
+
VerifyModulePermissionsService.QUERY_MODULES_URL = "erpx_fnd/empresa/queries/consultaModulos";
|
|
7795
|
+
VerifyModulePermissionsService.ctorParameters = function () { return [
|
|
7796
|
+
{ type: HttpClient }
|
|
7797
|
+
]; };
|
|
7798
|
+
VerifyModulePermissionsService.ɵprov = ɵɵdefineInjectable({ factory: function VerifyModulePermissionsService_Factory() { return new VerifyModulePermissionsService(ɵɵinject(HttpClient)); }, token: VerifyModulePermissionsService, providedIn: "any" });
|
|
7799
|
+
VerifyModulePermissionsService = VerifyModulePermissionsService_1 = __decorate([
|
|
7800
|
+
Injectable({
|
|
7801
|
+
providedIn: "any"
|
|
7802
|
+
})
|
|
7803
|
+
], VerifyModulePermissionsService);
|
|
7804
|
+
return VerifyModulePermissionsService;
|
|
7805
|
+
}());
|
|
7806
|
+
|
|
7807
|
+
var VerifyModulePermissions = /** @class */ (function () {
|
|
7808
|
+
function VerifyModulePermissions(verifyModulePermissionsService) {
|
|
7809
|
+
this.verifyModulePermissionsService = verifyModulePermissionsService;
|
|
7810
|
+
}
|
|
7811
|
+
VerifyModulePermissions_1 = VerifyModulePermissions;
|
|
7812
|
+
/**
|
|
7813
|
+
* Method to verify if user has permission on a specific module
|
|
7814
|
+
* @param modules Modules to verify the permission
|
|
7815
|
+
* @param requestPermission Indicative if must be call the primitive
|
|
7816
|
+
* @returns An boolean Observable
|
|
7817
|
+
*/
|
|
7818
|
+
VerifyModulePermissions.prototype.hasPermissions = function (modules, requestPermission) {
|
|
7819
|
+
var moduleSubject = VerifyModulePermissions_1.subjectsPerModuleMap.get(modules);
|
|
7820
|
+
if (!moduleSubject || requestPermission) {
|
|
7821
|
+
var newModuleSubject_1 = new ReplaySubject(1);
|
|
7822
|
+
VerifyModulePermissions_1.subjectsPerModuleMap.set(modules, newModuleSubject_1);
|
|
7823
|
+
this.verifyModulePermissionsService
|
|
7824
|
+
.consultaModulos({ modulo: modules, somenteAtivo: true })
|
|
7825
|
+
.pipe(take(1))
|
|
7826
|
+
.subscribe(function (response) {
|
|
7827
|
+
var hasPermissions = (response === null || response === void 0 ? void 0 : response.modulos) || [];
|
|
7828
|
+
newModuleSubject_1.next(hasPermissions);
|
|
7829
|
+
}, function (err) {
|
|
7830
|
+
VerifyModulePermissions_1.subjectsPerModuleMap.delete(modules);
|
|
7831
|
+
newModuleSubject_1.error(err);
|
|
7832
|
+
newModuleSubject_1.unsubscribe();
|
|
7833
|
+
});
|
|
7834
|
+
return newModuleSubject_1.asObservable();
|
|
7835
|
+
}
|
|
7836
|
+
return moduleSubject.asObservable();
|
|
7837
|
+
};
|
|
7838
|
+
var VerifyModulePermissions_1;
|
|
7839
|
+
VerifyModulePermissions.ctorParameters = function () { return [
|
|
7840
|
+
{ type: VerifyModulePermissionsService }
|
|
7841
|
+
]; };
|
|
7842
|
+
VerifyModulePermissions.subjectsPerModuleMap = new Map();
|
|
7843
|
+
VerifyModulePermissions.ɵprov = ɵɵdefineInjectable({ factory: function VerifyModulePermissions_Factory() { return new VerifyModulePermissions(ɵɵinject(VerifyModulePermissionsService)); }, token: VerifyModulePermissions, providedIn: "root" });
|
|
7844
|
+
VerifyModulePermissions = VerifyModulePermissions_1 = __decorate([
|
|
7845
|
+
Injectable({
|
|
7846
|
+
providedIn: "root"
|
|
7847
|
+
})
|
|
7848
|
+
], VerifyModulePermissions);
|
|
7849
|
+
return VerifyModulePermissions;
|
|
7850
|
+
}());
|
|
7851
|
+
|
|
7598
7852
|
var ModulesEnum;
|
|
7599
7853
|
(function (ModulesEnum) {
|
|
7600
7854
|
ModulesEnum["CONTROLADORIA"] = "CONTROLADORIA";
|
|
@@ -7613,5 +7867,5 @@ var ModulesEnum;
|
|
|
7613
7867
|
* Generated bundle index. Do not edit.
|
|
7614
7868
|
*/
|
|
7615
7869
|
|
|
7616
|
-
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, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, EnumAnaSin as ɵb, EnumNatCtb as ɵc, StorageService as ɵd,
|
|
7870
|
+
export { AgreementLookup, BankLookup, BeneficioFiscalLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ContaInternaFilialLookup, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, DocumentoLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E043MpcLookup, E043PcmLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E069GreLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E081TabLookup, E082TprLookup, E085PesLookup, E089DocLookup, E090HrpComGerLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E099UsuSupCprLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E501TcpLookup, E600CcoLookup, E640LotLookup, EntityPersonProductLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, HTTP_STATUS_CODE, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NotaFiscalEntradaLookup, NpsService, ParametersLookup, PrimitiveManager, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, SegmentoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, VerifyModulePermissions, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, EnumAnaSin as ɵb, EnumNatCtb as ɵc, StorageService as ɵd, UserInformationService as ɵe, VerifyModulePermissionService as ɵf, VerifyModulePermissionsService as ɵg };
|
|
7617
7871
|
//# sourceMappingURL=senior-gestao-empresarial-angular-components.js.map
|