@evergis/api 5.0.29 → 5.0.31
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/LICENSE +21 -21
- package/README.md +12 -12
- package/dist/Api.d.ts +3 -14
- package/dist/__generated__/DataSourceService.d.ts +45 -9
- package/dist/__generated__/data-contracts.d.ts +1 -52
- package/dist/api.esm.js +56 -280
- package/dist/api.esm.js.map +1 -1
- package/dist/index.js +55 -281
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +0 -1
- package/package.json +2 -3
- package/dist/__generated__/NotificationService.d.ts +0 -69
- package/dist/services/Notification.d.ts +0 -48
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var ky = require('ky');
|
|
4
4
|
var queryString = require('query-string');
|
|
5
|
-
var signalr = require('@microsoft/signalr');
|
|
6
5
|
var nanoid = require('nanoid');
|
|
7
6
|
|
|
8
7
|
const API_USER_INFO_KEY = "@evergis/user-info";
|
|
@@ -2330,13 +2329,27 @@ function isString(v) {
|
|
|
2330
2329
|
* @baseUrl /sp
|
|
2331
2330
|
*/
|
|
2332
2331
|
class DataSourceService extends Service {
|
|
2332
|
+
/**
|
|
2333
|
+
* No description
|
|
2334
|
+
*
|
|
2335
|
+
* @tags DataSource
|
|
2336
|
+
* @name TestConnection
|
|
2337
|
+
* @operationId DataSourceController_TestConnection
|
|
2338
|
+
* @summary Test ArcGIS data source connection.
|
|
2339
|
+
* @request POST:/ds/arcgis/test-connection
|
|
2340
|
+
* @secure
|
|
2341
|
+
* @response `200` OK
|
|
2342
|
+
*/
|
|
2343
|
+
testConnection(data) {
|
|
2344
|
+
return this.http.post(`/ds/arcgis/test-connection`, data).then(() => { });
|
|
2345
|
+
}
|
|
2333
2346
|
/**
|
|
2334
2347
|
* No description
|
|
2335
2348
|
*
|
|
2336
2349
|
* @tags DataSource
|
|
2337
2350
|
* @name CreateArcGisDataSource
|
|
2338
2351
|
* @operationId DataSourceController_CreateArcGisDataSource
|
|
2339
|
-
* @summary Create
|
|
2352
|
+
* @summary Create ArcGIS data source.
|
|
2340
2353
|
* @request POST:/ds/arcgis
|
|
2341
2354
|
* @secure
|
|
2342
2355
|
* @response `200` OK
|
|
@@ -2350,7 +2363,7 @@ class DataSourceService extends Service {
|
|
|
2350
2363
|
* @tags DataSource
|
|
2351
2364
|
* @name UpdateArcGisDataSource
|
|
2352
2365
|
* @operationId DataSourceController_UpdateArcGisDataSource
|
|
2353
|
-
* @summary Update
|
|
2366
|
+
* @summary Update ArcGIS data source.
|
|
2354
2367
|
* @request PATCH:/ds/arcgis
|
|
2355
2368
|
* @secure
|
|
2356
2369
|
* @response `200` OK
|
|
@@ -2434,15 +2447,15 @@ class DataSourceService extends Service {
|
|
|
2434
2447
|
* No description
|
|
2435
2448
|
*
|
|
2436
2449
|
* @tags DataSource
|
|
2437
|
-
* @name
|
|
2438
|
-
* @operationId
|
|
2439
|
-
* @summary Test
|
|
2440
|
-
* @request POST:/ds/
|
|
2450
|
+
* @name TestConnection1
|
|
2451
|
+
* @operationId DataSourceController_TestConnection_1
|
|
2452
|
+
* @summary Test data.mos.ru data source connection.
|
|
2453
|
+
* @request POST:/ds/dataMosRu/test-connection
|
|
2441
2454
|
* @secure
|
|
2442
2455
|
* @response `200` OK
|
|
2443
2456
|
*/
|
|
2444
|
-
|
|
2445
|
-
return this.http.post(`/ds/
|
|
2457
|
+
testConnection1(data) {
|
|
2458
|
+
return this.http.post(`/ds/dataMosRu/test-connection`, data).then(() => { });
|
|
2446
2459
|
}
|
|
2447
2460
|
/**
|
|
2448
2461
|
* No description
|
|
@@ -2472,6 +2485,34 @@ class DataSourceService extends Service {
|
|
|
2472
2485
|
updateMosRuDataSource(data) {
|
|
2473
2486
|
return this.http.patch(`/ds/dataMosRu`, data).then(() => { });
|
|
2474
2487
|
}
|
|
2488
|
+
/**
|
|
2489
|
+
* No description
|
|
2490
|
+
*
|
|
2491
|
+
* @tags DataSource
|
|
2492
|
+
* @name TestConnection2
|
|
2493
|
+
* @operationId DataSourceController_TestConnection_2
|
|
2494
|
+
* @summary Test PostgreSQL data source connection.
|
|
2495
|
+
* @request POST:/ds/test-connection
|
|
2496
|
+
* @secure
|
|
2497
|
+
* @response `200` OK
|
|
2498
|
+
*/
|
|
2499
|
+
testConnection2(data) {
|
|
2500
|
+
return this.http.post(`/ds/test-connection`, data).then(() => { });
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* No description
|
|
2504
|
+
*
|
|
2505
|
+
* @tags DataSource
|
|
2506
|
+
* @name TestConnection3
|
|
2507
|
+
* @operationId DataSourceController_TestConnection_3
|
|
2508
|
+
* @summary Test S3 data source connection.
|
|
2509
|
+
* @request POST:/ds/s3/test-connection
|
|
2510
|
+
* @secure
|
|
2511
|
+
* @response `200` OK
|
|
2512
|
+
*/
|
|
2513
|
+
testConnection3(data) {
|
|
2514
|
+
return this.http.post(`/ds/s3/test-connection`, data).then(() => { });
|
|
2515
|
+
}
|
|
2475
2516
|
/**
|
|
2476
2517
|
* No description
|
|
2477
2518
|
*
|
|
@@ -2492,7 +2533,7 @@ class DataSourceService extends Service {
|
|
|
2492
2533
|
* @tags DataSource
|
|
2493
2534
|
* @name UpdateS3DataSource
|
|
2494
2535
|
* @operationId DataSourceController_UpdateS3DataSource
|
|
2495
|
-
* @summary
|
|
2536
|
+
* @summary Update S3 data source.
|
|
2496
2537
|
* @request PATCH:/ds/s3
|
|
2497
2538
|
* @secure
|
|
2498
2539
|
* @response `200` OK
|
|
@@ -2760,7 +2801,6 @@ class Api extends EventEmitter {
|
|
|
2760
2801
|
tables;
|
|
2761
2802
|
projects;
|
|
2762
2803
|
security;
|
|
2763
|
-
notification;
|
|
2764
2804
|
file;
|
|
2765
2805
|
filters;
|
|
2766
2806
|
import;
|
|
@@ -2776,7 +2816,6 @@ class Api extends EventEmitter {
|
|
|
2776
2816
|
bulk;
|
|
2777
2817
|
statistic;
|
|
2778
2818
|
feedback;
|
|
2779
|
-
snappingHub;
|
|
2780
2819
|
vectorTiles;
|
|
2781
2820
|
spatialReference;
|
|
2782
2821
|
eql;
|
|
@@ -2785,10 +2824,9 @@ class Api extends EventEmitter {
|
|
|
2785
2824
|
dataSource;
|
|
2786
2825
|
remoteTaskManager;
|
|
2787
2826
|
http;
|
|
2788
|
-
wsUrl;
|
|
2789
2827
|
urlPath;
|
|
2790
2828
|
refreshingToken = false;
|
|
2791
|
-
constructor({ url,
|
|
2829
|
+
constructor({ url, http, urlPath, httpOptions, }) {
|
|
2792
2830
|
super();
|
|
2793
2831
|
const { hooks } = httpOptions || {};
|
|
2794
2832
|
this.http =
|
|
@@ -2855,7 +2893,6 @@ class Api extends EventEmitter {
|
|
|
2855
2893
|
},
|
|
2856
2894
|
});
|
|
2857
2895
|
this.url = url;
|
|
2858
|
-
this.wsUrl = wsUrl || url;
|
|
2859
2896
|
this.urlPath = urlPath || this.defineUrlPath();
|
|
2860
2897
|
this.layers = new Layers(this.http);
|
|
2861
2898
|
this.tables = new Tables(this.http);
|
|
@@ -2866,7 +2903,6 @@ class Api extends EventEmitter {
|
|
|
2866
2903
|
this.accountPreview = new AccountPreview(this.http);
|
|
2867
2904
|
this.bulk = new BulkOperations(this.http);
|
|
2868
2905
|
this.security = new Security(this.http, this.account);
|
|
2869
|
-
this.notification = new Notification(this.http, this, wsKeepAlive);
|
|
2870
2906
|
this.file = new FileUpload(this.http);
|
|
2871
2907
|
this.filters = new Filters(this.http);
|
|
2872
2908
|
this.import = new Import(this.http);
|
|
@@ -2886,19 +2922,6 @@ class Api extends EventEmitter {
|
|
|
2886
2922
|
this.names = new Names({
|
|
2887
2923
|
account: this.account,
|
|
2888
2924
|
});
|
|
2889
|
-
this.snappingHub = snappingHubUrl
|
|
2890
|
-
? new signalr.HubConnectionBuilder()
|
|
2891
|
-
.withUrl(snappingHubUrl, {
|
|
2892
|
-
withCredentials: true,
|
|
2893
|
-
skipNegotiation: true,
|
|
2894
|
-
transport: signalr.HttpTransportType.WebSockets,
|
|
2895
|
-
accessTokenFactory: () => {
|
|
2896
|
-
return window.localStorage.getItem(STORAGE_TOKEN_KEY) || "";
|
|
2897
|
-
},
|
|
2898
|
-
})
|
|
2899
|
-
.withAutomaticReconnect()
|
|
2900
|
-
.build()
|
|
2901
|
-
: null;
|
|
2902
2925
|
}
|
|
2903
2926
|
get isShared() {
|
|
2904
2927
|
return this.urlPath === exports.UrlPath.Shared;
|
|
@@ -2906,21 +2929,17 @@ class Api extends EventEmitter {
|
|
|
2906
2929
|
get isPresentation() {
|
|
2907
2930
|
return this.urlPath === exports.UrlPath.Presentation || window.location.port === SHARED_PORT;
|
|
2908
2931
|
}
|
|
2909
|
-
async init({ authParams, authQueryParams,
|
|
2932
|
+
async init({ authParams, authQueryParams, fetchSettings, fetchUser, useJwt, }) {
|
|
2910
2933
|
try {
|
|
2911
2934
|
await this.account.login(authParams, authQueryParams, useJwt);
|
|
2912
2935
|
if (fetchUser) {
|
|
2913
2936
|
await this.account.fetchCurrentUser();
|
|
2914
2937
|
}
|
|
2915
|
-
if (connectWs) {
|
|
2916
|
-
await this.connectWs();
|
|
2917
|
-
}
|
|
2918
2938
|
if (fetchSettings) {
|
|
2919
2939
|
await this.clientSettings.fetchClientSettings({
|
|
2920
2940
|
urlPath: getFetchingUrlPath(this.urlPath),
|
|
2921
2941
|
});
|
|
2922
2942
|
}
|
|
2923
|
-
await this.notification.subscribe("service_update" /* SubscriptionTag.ServiceUpdate */);
|
|
2924
2943
|
}
|
|
2925
2944
|
catch (e) {
|
|
2926
2945
|
throw errorHandler(e);
|
|
@@ -2939,26 +2958,6 @@ class Api extends EventEmitter {
|
|
|
2939
2958
|
throw errorHandler(e);
|
|
2940
2959
|
}
|
|
2941
2960
|
}
|
|
2942
|
-
async connectWs() {
|
|
2943
|
-
if (this.account.isAuth) {
|
|
2944
|
-
this.notification.connectWs(this.wsUrl);
|
|
2945
|
-
this.notification.on("ConnectionStatus" /* NotificationTag.ConnectionStatus */, connection => {
|
|
2946
|
-
if (connection.data === exports.ConnectionStatus.Lost) {
|
|
2947
|
-
this.emit(exports.ApiEvent.ConnectionLost, connection.data);
|
|
2948
|
-
}
|
|
2949
|
-
else if (connection.data === exports.ConnectionStatus.SessionClosed) {
|
|
2950
|
-
this.emit(exports.ApiEvent.SessionClosed, connection.data);
|
|
2951
|
-
}
|
|
2952
|
-
});
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
async connectSignalR() {
|
|
2956
|
-
if (this.account.isAuth &&
|
|
2957
|
-
this.snappingHub &&
|
|
2958
|
-
this.snappingHub.state !== signalr.HubConnectionState.Connected) {
|
|
2959
|
-
await this.snappingHub.start();
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
2961
|
async logout() {
|
|
2963
2962
|
await this.account.logout();
|
|
2964
2963
|
await this.security.reset();
|
|
@@ -3853,6 +3852,7 @@ function isTileLayerService(layer) {
|
|
|
3853
3852
|
}
|
|
3854
3853
|
|
|
3855
3854
|
const RESOURCE_TEMP_WORKSPACE = "temp";
|
|
3855
|
+
const generateFirstLatinLetter = nanoid.customAlphabet("abcdefghijklmnopqrstuvwxyz", 1);
|
|
3856
3856
|
exports.ResourceSeparator = void 0;
|
|
3857
3857
|
(function (ResourceSeparator) {
|
|
3858
3858
|
ResourceSeparator["Server"] = ".";
|
|
@@ -3864,7 +3864,7 @@ class Names {
|
|
|
3864
3864
|
}
|
|
3865
3865
|
/** Generates unique identifier */
|
|
3866
3866
|
createId() {
|
|
3867
|
-
return generateId();
|
|
3867
|
+
return generateFirstLatinLetter() + generateId().slice(1);
|
|
3868
3868
|
}
|
|
3869
3869
|
/** Generates new resource name using for client\server interactions */
|
|
3870
3870
|
createResourceName(params = {}) {
|
|
@@ -3910,230 +3910,6 @@ class Names {
|
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
3912
|
|
|
3913
|
-
/* eslint-disable */
|
|
3914
|
-
/* tslint:disable */
|
|
3915
|
-
/*
|
|
3916
|
-
* ---------------------------------------------------------------
|
|
3917
|
-
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
3918
|
-
* ## ##
|
|
3919
|
-
* ## AUTHOR: acacode ##
|
|
3920
|
-
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
3921
|
-
* ---------------------------------------------------------------
|
|
3922
|
-
*/
|
|
3923
|
-
// @ts-nocheck
|
|
3924
|
-
/**
|
|
3925
|
-
* @title Spatial Processing Gateway API
|
|
3926
|
-
* @version 1.5.1.0
|
|
3927
|
-
* @baseUrl /sp
|
|
3928
|
-
*/
|
|
3929
|
-
class NotificationService extends Service {
|
|
3930
|
-
/**
|
|
3931
|
-
* No description
|
|
3932
|
-
*
|
|
3933
|
-
* @tags NotificationService
|
|
3934
|
-
* @name GetSubscriptionList
|
|
3935
|
-
* @operationId NotificationServiceController_GetSubscriptionList
|
|
3936
|
-
* @summary Returns a list of notification tags that the current session is subscribed to.
|
|
3937
|
-
* @request GET:/notifications/subscribes
|
|
3938
|
-
* @secure
|
|
3939
|
-
* @response `200` OK
|
|
3940
|
-
*/
|
|
3941
|
-
getSubscriptionList() {
|
|
3942
|
-
return this.http.get(`/notifications/subscribes`).json();
|
|
3943
|
-
}
|
|
3944
|
-
/**
|
|
3945
|
-
* No description
|
|
3946
|
-
*
|
|
3947
|
-
* @tags NotificationService
|
|
3948
|
-
* @name SubscribeOperation
|
|
3949
|
-
* @operationId NotificationServiceController_SubscribeOperation
|
|
3950
|
-
* @summary Subscribe current session by subscribe tag. A subscribed session will receive all notifications added for the specified tag.
|
|
3951
|
-
* @request POST:/notifications/subscribes
|
|
3952
|
-
* @secure
|
|
3953
|
-
* @response `200` OK
|
|
3954
|
-
*/
|
|
3955
|
-
subscribeOperation(query) {
|
|
3956
|
-
return this.http.post(`/notifications/subscribes`, null, query).then(() => { });
|
|
3957
|
-
}
|
|
3958
|
-
/**
|
|
3959
|
-
* No description
|
|
3960
|
-
*
|
|
3961
|
-
* @tags NotificationService
|
|
3962
|
-
* @name UnsubscribeOperation
|
|
3963
|
-
* @operationId NotificationServiceController_UnsubscribeOperation
|
|
3964
|
-
* @summary Unsubscribe from receiving notifications that come for the specified tag.
|
|
3965
|
-
* @request DELETE:/notifications/subscribes
|
|
3966
|
-
* @secure
|
|
3967
|
-
* @response `200` OK
|
|
3968
|
-
*/
|
|
3969
|
-
unsubscribeOperation(query) {
|
|
3970
|
-
return this.http.delete(`/notifications/subscribes`, null, query).then(() => { });
|
|
3971
|
-
}
|
|
3972
|
-
/**
|
|
3973
|
-
* No description
|
|
3974
|
-
*
|
|
3975
|
-
* @tags NotificationService
|
|
3976
|
-
* @name SubscribeListOperation
|
|
3977
|
-
* @operationId NotificationServiceController_SubscribeListOperation
|
|
3978
|
-
* @summary Subscribe current session by subscribe tags. A subscribed session will receive all notifications added for the specified tags.
|
|
3979
|
-
* @request POST:/notifications/subscribe-list
|
|
3980
|
-
* @secure
|
|
3981
|
-
* @response `200` OK
|
|
3982
|
-
*/
|
|
3983
|
-
subscribeListOperation(data) {
|
|
3984
|
-
return this.http.post(`/notifications/subscribe-list`, data).then(() => { });
|
|
3985
|
-
}
|
|
3986
|
-
/**
|
|
3987
|
-
* No description
|
|
3988
|
-
*
|
|
3989
|
-
* @tags NotificationService
|
|
3990
|
-
* @name UnsubscribeListOperation
|
|
3991
|
-
* @operationId NotificationServiceController_UnsubscribeListOperation
|
|
3992
|
-
* @summary Unsubscribe from receiving notifications that come for the specified tags.
|
|
3993
|
-
* @request POST:/notifications/unsubscribe-list
|
|
3994
|
-
* @secure
|
|
3995
|
-
* @response `200` OK
|
|
3996
|
-
*/
|
|
3997
|
-
unsubscribeListOperation(data) {
|
|
3998
|
-
return this.http.post(`/notifications/unsubscribe-list`, data).then(() => { });
|
|
3999
|
-
}
|
|
4000
|
-
}
|
|
4001
|
-
|
|
4002
|
-
exports.ConnectionStatus = void 0;
|
|
4003
|
-
(function (ConnectionStatus) {
|
|
4004
|
-
ConnectionStatus["Initialized"] = "Initialized";
|
|
4005
|
-
ConnectionStatus["Connected"] = "Connected";
|
|
4006
|
-
ConnectionStatus["Break"] = "Break";
|
|
4007
|
-
ConnectionStatus["Lost"] = "Lost";
|
|
4008
|
-
ConnectionStatus["SessionClosed"] = "SessionClosed";
|
|
4009
|
-
})(exports.ConnectionStatus || (exports.ConnectionStatus = {}));
|
|
4010
|
-
const SUBSCRIPTION_DELAY = 500;
|
|
4011
|
-
const KEEP_ALIVE_INTERVAL = 5 * 1000;
|
|
4012
|
-
class Notification extends NotificationService {
|
|
4013
|
-
api;
|
|
4014
|
-
MAX_WS_RECONNECT_TRIES = 10;
|
|
4015
|
-
emitter;
|
|
4016
|
-
keepAlive = false;
|
|
4017
|
-
ws;
|
|
4018
|
-
wsUrl;
|
|
4019
|
-
reconnectTries = 0;
|
|
4020
|
-
subscriptions = [];
|
|
4021
|
-
keepAliveTimeout;
|
|
4022
|
-
_connectStatus = exports.ConnectionStatus.Initialized;
|
|
4023
|
-
// @ts-ignore
|
|
4024
|
-
get connectStatus() {
|
|
4025
|
-
return this._connectStatus;
|
|
4026
|
-
}
|
|
4027
|
-
// @ts-ignore
|
|
4028
|
-
set connectStatus(connectStatus) {
|
|
4029
|
-
this.emitter.emit("ConnectionStatus" /* NotificationTag.ConnectionStatus */, new NotificationEvent(connectStatus));
|
|
4030
|
-
this._connectStatus = connectStatus;
|
|
4031
|
-
}
|
|
4032
|
-
get currentWs() {
|
|
4033
|
-
return this.ws;
|
|
4034
|
-
}
|
|
4035
|
-
constructor(http, api, keepAlive = false) {
|
|
4036
|
-
super(http);
|
|
4037
|
-
this.api = api;
|
|
4038
|
-
this.emitter = new EventEmitter();
|
|
4039
|
-
this.keepAlive = keepAlive;
|
|
4040
|
-
}
|
|
4041
|
-
on(tag, handler) {
|
|
4042
|
-
this.emitter.on(tag, handler);
|
|
4043
|
-
}
|
|
4044
|
-
off(tag, handler) {
|
|
4045
|
-
this.emitter.off(tag, handler);
|
|
4046
|
-
}
|
|
4047
|
-
async subscribe(tag) {
|
|
4048
|
-
this.subscriptions.push(tag);
|
|
4049
|
-
setTimeout(() => {
|
|
4050
|
-
if (!this.api.isShared && !this.api.isPresentation && this.subscriptions.length) {
|
|
4051
|
-
this.subscribeListOperation(this.subscriptions);
|
|
4052
|
-
}
|
|
4053
|
-
this.subscriptions = [];
|
|
4054
|
-
}, SUBSCRIPTION_DELAY);
|
|
4055
|
-
}
|
|
4056
|
-
async unsubscribe(tag) {
|
|
4057
|
-
const subscriptions = await this.getSubscriptionList();
|
|
4058
|
-
if (subscriptions.includes(tag)) {
|
|
4059
|
-
return this.unsubscribeOperation({ tag });
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
4062
|
-
connectWs(url) {
|
|
4063
|
-
const urlWithWsScheme = url
|
|
4064
|
-
.replace("http://", "ws://")
|
|
4065
|
-
.replace("https://", "wss://");
|
|
4066
|
-
this.wsUrl = urlWithWsScheme;
|
|
4067
|
-
this.connect();
|
|
4068
|
-
}
|
|
4069
|
-
connect() {
|
|
4070
|
-
if (this.wsUrl) {
|
|
4071
|
-
this.ws = new WebSocket(this.wsUrl);
|
|
4072
|
-
this.ws.onopen = this.onWsConnected;
|
|
4073
|
-
this.ws.onclose = this.onWsClosed;
|
|
4074
|
-
this.ws.onmessage = this.onWsMessage;
|
|
4075
|
-
}
|
|
4076
|
-
else {
|
|
4077
|
-
console.warn("Connection to WebSocket not allowed. wsUrl not provided");
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
onWsConnected = () => {
|
|
4081
|
-
this.connectStatus = exports.ConnectionStatus.Connected;
|
|
4082
|
-
if (this.keepAlive) {
|
|
4083
|
-
this.keepAliveTimeout = setInterval(() => {
|
|
4084
|
-
if (this.ws) {
|
|
4085
|
-
this.ws.send(JSON.stringify({ keepAlive: true }));
|
|
4086
|
-
}
|
|
4087
|
-
}, KEEP_ALIVE_INTERVAL);
|
|
4088
|
-
}
|
|
4089
|
-
// TODO: comment for now. it launch endless flow of reconnections
|
|
4090
|
-
// this.reconnectTries = 0;
|
|
4091
|
-
};
|
|
4092
|
-
onWsClosed = (event) => {
|
|
4093
|
-
if (event.code === 4001 /* WsCloseStatusCode.SessionClosed */ ||
|
|
4094
|
-
event.code === 4002 /* WsCloseStatusCode.InvalidSession */) {
|
|
4095
|
-
this.connectStatus = exports.ConnectionStatus.SessionClosed;
|
|
4096
|
-
}
|
|
4097
|
-
else if (this.reconnectTries < this.MAX_WS_RECONNECT_TRIES) {
|
|
4098
|
-
this.connectStatus = exports.ConnectionStatus.Break;
|
|
4099
|
-
this.reconnectTries++;
|
|
4100
|
-
if (this.ws) {
|
|
4101
|
-
this.ws.onopen = null;
|
|
4102
|
-
this.ws.onclose = null;
|
|
4103
|
-
this.ws.onmessage = null;
|
|
4104
|
-
this.ws = void 0;
|
|
4105
|
-
}
|
|
4106
|
-
this.keepAliveTimeout && clearInterval(this.keepAliveTimeout);
|
|
4107
|
-
setTimeout(() => {
|
|
4108
|
-
this.connect();
|
|
4109
|
-
}, 0);
|
|
4110
|
-
}
|
|
4111
|
-
else {
|
|
4112
|
-
this.connectStatus = exports.ConnectionStatus.Lost;
|
|
4113
|
-
}
|
|
4114
|
-
};
|
|
4115
|
-
onWsMessage = (event) => {
|
|
4116
|
-
let message = {};
|
|
4117
|
-
try {
|
|
4118
|
-
message = JSON.parse(event.data);
|
|
4119
|
-
}
|
|
4120
|
-
catch (e) {
|
|
4121
|
-
console.debug("Failed to parse ws message from sp.");
|
|
4122
|
-
// ignore
|
|
4123
|
-
}
|
|
4124
|
-
if (message.type === "notification" && message.data) {
|
|
4125
|
-
const { tag, data } = message.data;
|
|
4126
|
-
tag && this.emitter.emit(tag, new NotificationEvent(data));
|
|
4127
|
-
}
|
|
4128
|
-
};
|
|
4129
|
-
}
|
|
4130
|
-
class NotificationEvent {
|
|
4131
|
-
data;
|
|
4132
|
-
constructor(data) {
|
|
4133
|
-
this.data = data;
|
|
4134
|
-
}
|
|
4135
|
-
}
|
|
4136
|
-
|
|
4137
3913
|
class PortalSettings extends ClientSettingsService {
|
|
4138
3914
|
config = null;
|
|
4139
3915
|
async fetchPortalSettings(query) {
|
|
@@ -5307,8 +5083,6 @@ exports.HttpClient = HttpClient;
|
|
|
5307
5083
|
exports.Import = Import;
|
|
5308
5084
|
exports.Layers = Layers;
|
|
5309
5085
|
exports.Names = Names;
|
|
5310
|
-
exports.Notification = Notification;
|
|
5311
|
-
exports.NotificationEvent = NotificationEvent;
|
|
5312
5086
|
exports.PortalSettings = PortalSettings;
|
|
5313
5087
|
exports.Projects = Projects;
|
|
5314
5088
|
exports.RemoteTaskManager = RemoteTaskManager;
|