@evergis/api 3.0.199 → 3.0.200

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, GetRasterMetaParams7, 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 }: GetRasterMetaParams7): 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, DeleteResourcesParams6, 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: DeleteResourcesParams6): 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, ClassifyParams8, 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: ClassifyParams8): Promise<ClassifyDc>;
42
42
  /**
43
43
  * No description
44
44
  *
@@ -1,4 +1,4 @@
1
- import { AccessControlListDc, BulkOperationResultDc, CreateViewFromQueryDc, CreateViewFromQueryLayerDc, DeleteResourcesParams4, DeleteTableDataParams, DetailedTableInfoDc, FileUploadResponse, GetTableDataParams, GetTableListParams, GetTablesInfoParams, GetUniqueDataRowsParams, MapTableInfoDc, MapTableParams, PagedListIEnumerable1, PagedListTableInfoDc, ResourceDependenciesDc, SetPermissionsBatchInput, SetPreviewInput, TableListDc, UpdateTableDataParams, UpdateTableDataPayload, UpdateTableDc, WriteTableDataPayload } from './data-contracts';
1
+ import { AccessControlListDc, BulkOperationResultDc, CreateViewFromQueryDc, CreateViewFromQueryLayerDc, DeleteResourcesParams5, DeleteTableDataParams, DetailedTableInfoDc, FileUploadResponse, GetTableDataParams, GetTableListParams, GetTablesInfoParams, GetUniqueDataRowsParams, MapTableInfoDc, MapTableParams, PagedListIEnumerable1, PagedListTableInfoDc, ResourceDependenciesDc, SetPermissionsBatchInput, SetPreviewInput, TableListDc, UpdateTableDataParams, UpdateTableDataPayload, UpdateTableDc, WriteTableDataPayload } 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 TablesService extends Service {
49
49
  * @request DELETE:/tables
50
50
  * @response `200` OK
51
51
  */
52
- deleteResources(query: DeleteResourcesParams4): Promise<BulkOperationResultDc[]>;
52
+ deleteResources(query: DeleteResourcesParams5): Promise<BulkOperationResultDc[]>;
53
53
  /**
54
54
  * No description
55
55
  *
@@ -7745,7 +7745,7 @@ export interface ValidateExpressionParams {
7745
7745
  /** Layer name. */
7746
7746
  layerName: string;
7747
7747
  }
7748
- export interface GetRasterMetaParams4 {
7748
+ export interface GetRasterMetaParams7 {
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 DeleteResourcesParams6 {
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 ClassifyParams8 {
8151
8151
  /** Layer name. */
8152
8152
  name: string;
8153
8153
  /** Attribute name. */
@@ -8280,7 +8280,7 @@ export interface GetTableListParams {
8280
8280
  acl?: string;
8281
8281
  }
8282
8282
  export declare type SetPermissionsBatchInput = ResourceAclDc[];
8283
- export interface DeleteResourcesParams4 {
8283
+ export interface DeleteResourcesParams5 {
8284
8284
  /** Resource names. */
8285
8285
  names?: string[];
8286
8286
  }
@@ -181,6 +181,16 @@ 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-jwt-token";
186
+
187
+ const parseJwt = token => {
188
+ const base64Url = token.split(".")[1];
189
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
190
+ const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
191
+ return JSON.parse(jsonPayload);
192
+ };
193
+
184
194
  let HttpClient = /*#__PURE__*/function () {
185
195
  function HttpClient(options) {
186
196
  var _options$prefixUrl;
@@ -200,7 +210,30 @@ let HttpClient = /*#__PURE__*/function () {
200
210
  value: function extend(options) {
201
211
  var _options$prefixUrl2;
202
212
 
203
- this.ky = ky__default.extend(options);
213
+ this.ky = ky__default.extend(_extends({}, options, {
214
+ hooks: {
215
+ beforeRequest: [async request => {
216
+ const token = window.localStorage.getItem(STORAGE_TOKEN_KEY);
217
+ const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
218
+
219
+ if (token) {
220
+ var _request$headers;
221
+
222
+ const {
223
+ exp
224
+ } = parseJwt(token) || {};
225
+
226
+ if (typeof exp === 'number' && exp - new Date().getTime() < 60 * 1000) {
227
+ await this.post("/account/refresh-token", {
228
+ refreshToken
229
+ });
230
+ }
231
+
232
+ (_request$headers = request.headers) == null ? void 0 : _request$headers.set('Authorization', "Bearer " + (token || ''));
233
+ }
234
+ }]
235
+ }
236
+ }));
204
237
  this.prefixUrl = ((_options$prefixUrl2 = options.prefixUrl) == null ? void 0 : _options$prefixUrl2.toString()) || '';
205
238
  }
206
239
  }, {
@@ -1435,13 +1468,18 @@ let Account = /*#__PURE__*/function (_AccountService) {
1435
1468
 
1436
1469
  _createClass(Account, [{
1437
1470
  key: "login",
1438
- value: async function login(params, authParams) {
1471
+ value: function login(params, authParams) {
1439
1472
  if (authParams === void 0) {
1440
1473
  authParams = {};
1441
1474
  }
1442
1475
 
1443
1476
  if (params) {
1444
- await _get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params);
1477
+ _get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params).then(resonse => {
1478
+ if (resonse) {
1479
+ window.localStorage.setItem(STORAGE_TOKEN_KEY, resonse.token);
1480
+ window.localStorage.setItem(STORAGE_REFRESH_TOKEN_KEY, resonse.refreshToken);
1481
+ }
1482
+ });
1445
1483
  }
1446
1484
  }
1447
1485
  }, {
@@ -1460,8 +1498,10 @@ let Account = /*#__PURE__*/function (_AccountService) {
1460
1498
  }, {
1461
1499
  key: "logout",
1462
1500
  value: async function logout() {
1501
+ window.localStorage.removeItem(STORAGE_TOKEN_KEY);
1502
+ window.localStorage.removeItem(STORAGE_REFRESH_TOKEN_KEY);
1463
1503
  await this.revokeToken();
1464
- updateUserInfo(void 0);
1504
+ updateUserInfo(undefined);
1465
1505
  this.userInfo = {};
1466
1506
  }
1467
1507
  }, {
@@ -7588,7 +7628,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7588
7628
  } = _ref2;
7589
7629
 
7590
7630
  try {
7591
- await this.account.login(authParams, authQueryParams);
7631
+ this.account.login(authParams, authQueryParams);
7592
7632
 
7593
7633
  if (fetchUser) {
7594
7634
  await this.account.fetchCurrentUser();