@evergis/api 3.0.199 → 3.0.201

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.
@@ -1,4 +1,4 @@
1
- import { AccessControlListDc, AggregateAttributeParams, AggregationDataResultDc, AttributeDistinctsDc, BulkOperationResultDc, ClassifyDc, ClassifyParams, CompositeServiceConfigurationDc, CompositeServiceInfoDc, CreateFeaturesPayload, DeleteByConditionParams, DeleteFeatureParams, DeleteFeaturesParams, DeleteResourcesParams, DistinctsParams, EditAttributesInfoDc, EnvelopeDc, ExpressionValidationResultDc, FeatureDc, FeatureLayerServiceInfoDc, FeaturesContainsParams, FeatureSelectionDc, FeaturesListDc, FileUploadResponse, GetBulkFeaturesPayload, GetByGeometryGetParams, GetByGeometryParams, GetByGeometryPostParams, GetByGeometryPostPayload, GetByIdParams, GetFeatures1Params, GetFeaturesParametersDc, GetFilteredFeaturesCountDc, GetFilteredFeaturesCountParams, GetLayerExtentParams, GetLayerImageParams, GetLayersInfoParams, GetLayersListParams, GetRasterMetaParams4, GetTilesLayerImageParams, LayerUpdateInfo, LayerUpdateInfoDc, LinearServiceConfigurationDc, LocalTileServiceConfigurationDc, NetCdfMetaDc, PagedBulkFeaturesListDc, PagedFeaturesListDc, PbfServiceConfigurationDc, PbfServiceInfoDc, PostgresLayerServiceConfigurationDc, PostgresTileCatalogServiceConfigurationDc, ProxyServiceInfoDc, PublishProxyServicePayload, QueryLayerServiceConfigurationDc, QueryLayerServiceInfoDc, RasterMetaDc, RemoteTileServiceConfigurationDc, RemoteTileServiceInfo, RemoteTileServiceInfoDc, ResourceDependenciesDc, ResourceInfoDc, RouteFeatureDc, RouteServiceConfigurationDc, SelectFeaturesParams, ServiceInfoDc, ServiceListDc, SetPermissionsBatchPayload, SetPreviewPayload, SimpleSymbolDc, StyleDc, StyledLayerServiceConfigurationDc, SubtractParams, SubtractPayload, TileServiceInfoDc, UniteParams, UnitePayload, UpdateFeaturePayload, UpdateProxyServicePayload, ValidateExpressionParams } from './data-contracts';
1
+ import { AccessControlListDc, AggregateAttributeParams, AggregationDataResultDc, AttributeDistinctsDc, BulkOperationResultDc, ClassifyDc, ClassifyParams, CompositeServiceConfigurationDc, CompositeServiceInfoDc, CreateFeaturesPayload, DeleteByConditionParams, DeleteFeatureParams, DeleteFeaturesParams, DeleteResourcesParams, DistinctsParams, EditAttributesInfoDc, EnvelopeDc, ExpressionValidationResultDc, FeatureDc, FeatureLayerServiceInfoDc, FeaturesContainsParams, FeatureSelectionDc, FeaturesListDc, FileUploadResponse, GetBulkFeaturesPayload, GetByGeometryGetParams, GetByGeometryParams, GetByGeometryPostParams, GetByGeometryPostPayload, GetByIdParams, GetFeatures1Params, GetFeaturesParametersDc, GetFilteredFeaturesCountDc, GetFilteredFeaturesCountParams, GetLayerExtentParams, GetLayerImageParams, GetLayersInfoParams, GetLayersListParams, GetRasterMetaParams8, GetTilesLayerImageParams, LayerUpdateInfo, LayerUpdateInfoDc, LinearServiceConfigurationDc, LocalTileServiceConfigurationDc, NetCdfMetaDc, PagedBulkFeaturesListDc, PagedFeaturesListDc, PbfServiceConfigurationDc, PbfServiceInfoDc, PostgresLayerServiceConfigurationDc, PostgresTileCatalogServiceConfigurationDc, ProxyServiceInfoDc, PublishProxyServicePayload, QueryLayerServiceConfigurationDc, QueryLayerServiceInfoDc, RasterMetaDc, RemoteTileServiceConfigurationDc, RemoteTileServiceInfo, RemoteTileServiceInfoDc, ResourceDependenciesDc, ResourceInfoDc, RouteFeatureDc, RouteServiceConfigurationDc, SelectFeaturesParams, ServiceInfoDc, ServiceListDc, SetPermissionsBatchPayload, SetPreviewPayload, SimpleSymbolDc, StyleDc, StyledLayerServiceConfigurationDc, SubtractParams, SubtractPayload, TileServiceInfoDc, UniteParams, UnitePayload, UpdateFeaturePayload, UpdateProxyServicePayload, ValidateExpressionParams } from './data-contracts';
2
2
  import { Service } from './Service';
3
3
  /**
4
4
  * @title Spatial Processing Core API
@@ -589,7 +589,7 @@ export declare class LayersService extends Service {
589
589
  * @request GET:/layers/{name}/{id}/metadata
590
590
  * @response `200` OK
591
591
  */
592
- getRasterMeta({ name, id, ...query }: GetRasterMetaParams4): Promise<(RasterMetaDc | NetCdfMetaDc)[]>;
592
+ getRasterMeta({ name, id, ...query }: GetRasterMetaParams8): Promise<(RasterMetaDc | NetCdfMetaDc)[]>;
593
593
  /**
594
594
  * No description
595
595
  *
@@ -1,4 +1,4 @@
1
- import { AccessControlListDc, BulkOperationResultDc, DeleteResourcesParams9, ExtendedProjectInfoDc, ExtendedProjectLayersInfo, FileUploadResponse, GetProjectsInfoParams, GetProjectsListParams, PagedListProjectInfoDc, ProjectsListDc, ResourceDependenciesDc, SetPermissionsBatchBody, SetPreviewBody } from './data-contracts';
1
+ import { AccessControlListDc, BulkOperationResultDc, DeleteResourcesParams7, ExtendedProjectInfoDc, ExtendedProjectLayersInfo, FileUploadResponse, GetProjectsInfoParams, GetProjectsListParams, PagedListProjectInfoDc, ProjectsListDc, ResourceDependenciesDc, SetPermissionsBatchBody, SetPreviewBody } from './data-contracts';
2
2
  import { Service } from './Service';
3
3
  /**
4
4
  * @title Spatial Processing Core API
@@ -49,7 +49,7 @@ export declare class ProjectsService extends Service {
49
49
  * @request DELETE:/projects
50
50
  * @response `200` OK
51
51
  */
52
- deleteResources(query: DeleteResourcesParams9): Promise<BulkOperationResultDc[]>;
52
+ deleteResources(query: DeleteResourcesParams7): Promise<BulkOperationResultDc[]>;
53
53
  /**
54
54
  * No description
55
55
  *
@@ -1,4 +1,4 @@
1
- import { ClassifyDc, ClassifyParams5, GetClassifyDc, GetStatisticsDc, GetSumOfProductDc, StatisticsDbParams, StatisticsDc, SumOfProductParams } from './data-contracts';
1
+ import { ClassifyDc, ClassifyParams7, GetClassifyDc, GetStatisticsDc, GetSumOfProductDc, StatisticsDbParams, StatisticsDc, SumOfProductParams } from './data-contracts';
2
2
  import { Service } from './Service';
3
3
  /**
4
4
  * @title Spatial Processing Core API
@@ -38,7 +38,7 @@ export declare class StatisticService extends Service {
38
38
  * @request GET:/statistics/classify
39
39
  * @response `200` OK
40
40
  */
41
- classify(query: ClassifyParams5): Promise<ClassifyDc>;
41
+ classify(query: ClassifyParams7): Promise<ClassifyDc>;
42
42
  /**
43
43
  * No description
44
44
  *
@@ -1,4 +1,4 @@
1
- import { GetCapabilities1Params, GetCapabilitiesParams4, GetFeatureInfoParams, GetLegendGraphicParams, GetMapParams } from './data-contracts';
1
+ import { GetCapabilities1Params, GetCapabilitiesParams6, GetFeatureInfoParams, GetLegendGraphicParams, GetMapParams } from './data-contracts';
2
2
  import { Service } from './Service';
3
3
  /**
4
4
  * @title Spatial Processing Core API
@@ -16,7 +16,7 @@ export declare class WmsServerService extends Service {
16
16
  * @request GET:/wms#REQUEST=GetCapabilities
17
17
  * @response `200` OK
18
18
  */
19
- getCapabilities(query: GetCapabilitiesParams4): Promise<void>;
19
+ getCapabilities(query: GetCapabilitiesParams6): Promise<void>;
20
20
  /**
21
21
  * No description
22
22
  *
@@ -7745,7 +7745,7 @@ export interface ValidateExpressionParams {
7745
7745
  /** Layer name. */
7746
7746
  layerName: string;
7747
7747
  }
7748
- export interface GetRasterMetaParams4 {
7748
+ export interface GetRasterMetaParams8 {
7749
7749
  /**
7750
7750
  * Min value for build histogram.
7751
7751
  * @format double
@@ -7864,7 +7864,7 @@ export interface GetProjectsListParams {
7864
7864
  tags?: string[];
7865
7865
  }
7866
7866
  export declare type SetPermissionsBatchBody = ResourceAclDc[];
7867
- export interface DeleteResourcesParams9 {
7867
+ export interface DeleteResourcesParams7 {
7868
7868
  /** Resource names. */
7869
7869
  names?: string[];
7870
7870
  }
@@ -8147,7 +8147,7 @@ export interface StatisticsDbParams {
8147
8147
  */
8148
8148
  types?: AggregationFunction[];
8149
8149
  }
8150
- export interface ClassifyParams5 {
8150
+ export interface ClassifyParams7 {
8151
8151
  /** Layer name. */
8152
8152
  name: string;
8153
8153
  /** Attribute name. */
@@ -8437,7 +8437,7 @@ export interface GetPublicCapabilitiesParams {
8437
8437
  /** When omitted or not supported by server, server shall return service metadata document using the MIME type "text/xml". */
8438
8438
  AcceptFormats?: string[];
8439
8439
  }
8440
- export interface GetCapabilitiesParams4 {
8440
+ export interface GetCapabilitiesParams6 {
8441
8441
  /** Output format of service metadata. */
8442
8442
  Format?: string;
8443
8443
  /** Must be WMS. */
@@ -181,6 +181,9 @@ function _get(target, property, receiver) {
181
181
  return _get(target, property, receiver || target);
182
182
  }
183
183
 
184
+ const STORAGE_TOKEN_KEY = "evergis-jwt-token";
185
+ const STORAGE_REFRESH_TOKEN_KEY = "evergis-refresh-token";
186
+
184
187
  let HttpClient = /*#__PURE__*/function () {
185
188
  function HttpClient(options) {
186
189
  var _options$prefixUrl;
@@ -1435,13 +1438,18 @@ let Account = /*#__PURE__*/function (_AccountService) {
1435
1438
 
1436
1439
  _createClass(Account, [{
1437
1440
  key: "login",
1438
- value: async function login(params, authParams) {
1441
+ value: function login(params, authParams) {
1439
1442
  if (authParams === void 0) {
1440
1443
  authParams = {};
1441
1444
  }
1442
1445
 
1443
1446
  if (params) {
1444
- await _get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params);
1447
+ _get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params).then(resonse => {
1448
+ if (resonse) {
1449
+ window.localStorage.setItem(STORAGE_TOKEN_KEY, resonse.token);
1450
+ window.localStorage.setItem(STORAGE_REFRESH_TOKEN_KEY, resonse.refreshToken);
1451
+ }
1452
+ });
1445
1453
  }
1446
1454
  }
1447
1455
  }, {
@@ -1460,8 +1468,10 @@ let Account = /*#__PURE__*/function (_AccountService) {
1460
1468
  }, {
1461
1469
  key: "logout",
1462
1470
  value: async function logout() {
1471
+ window.localStorage.removeItem(STORAGE_TOKEN_KEY);
1472
+ window.localStorage.removeItem(STORAGE_REFRESH_TOKEN_KEY);
1463
1473
  await this.revokeToken();
1464
- updateUserInfo(void 0);
1474
+ updateUserInfo(undefined);
1465
1475
  this.userInfo = {};
1466
1476
  }
1467
1477
  }, {
@@ -7476,6 +7486,13 @@ let VectorTiles = /*#__PURE__*/function (_VectorTileService) {
7476
7486
  return VectorTiles;
7477
7487
  }(VectorTileService);
7478
7488
 
7489
+ const parseJwt = token => {
7490
+ const base64Url = token.split(".")[1];
7491
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
7492
+ const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
7493
+ return JSON.parse(jsonPayload);
7494
+ };
7495
+
7479
7496
  (function (UrlPath) {
7480
7497
  UrlPath["Base"] = "/map";
7481
7498
  UrlPath["Shared"] = "/shared";
@@ -7493,6 +7510,8 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7493
7510
  var _super = /*#__PURE__*/_createSuper(Api);
7494
7511
 
7495
7512
  function Api(_ref) {
7513
+ var _hooks$beforeRequest;
7514
+
7496
7515
  var _this;
7497
7516
 
7498
7517
  let {
@@ -7516,7 +7535,26 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7516
7535
  timeout: false
7517
7536
  }, httpOptions || {}, {
7518
7537
  hooks: _extends({}, hooks || {}, {
7519
- beforeRequest: [...(hooks && hooks.beforeRequest || [])],
7538
+ beforeRequest: [async request => {
7539
+ const token = window.localStorage.getItem(STORAGE_TOKEN_KEY);
7540
+ const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
7541
+
7542
+ if (token && refreshToken) {
7543
+ var _request$headers;
7544
+
7545
+ const {
7546
+ exp
7547
+ } = parseJwt(token) || {};
7548
+
7549
+ if (typeof exp === 'number' && exp - new Date().getTime() < 60 * 1000) {
7550
+ await _this.account.refreshToken({
7551
+ refreshToken
7552
+ });
7553
+ }
7554
+
7555
+ (_request$headers = request.headers) == null ? void 0 : _request$headers.set('Authorization', "Bearer " + (token || ''));
7556
+ }
7557
+ }, ...((_hooks$beforeRequest = hooks == null ? void 0 : hooks.beforeRequest) != null ? _hooks$beforeRequest : [])],
7520
7558
  afterResponse: [response => {
7521
7559
  const apiEvent = apiEventsByResponseStatus[response.status];
7522
7560
 
@@ -7525,7 +7563,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7525
7563
  }
7526
7564
 
7527
7565
  return response;
7528
- }, ...(hooks && hooks.afterResponse || [])]
7566
+ }, ...((hooks == null ? void 0 : hooks.afterResponse) || [])]
7529
7567
  })
7530
7568
  }));
7531
7569
  _this.url = url;
@@ -7588,7 +7626,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7588
7626
  } = _ref2;
7589
7627
 
7590
7628
  try {
7591
- await this.account.login(authParams, authQueryParams);
7629
+ this.account.login(authParams, authQueryParams);
7592
7630
 
7593
7631
  if (fetchUser) {
7594
7632
  await this.account.fetchCurrentUser();