@nextgis/ngw-map 1.13.2 → 1.13.7

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
- /** Bundle of @nextgis/ngw-map; version: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.13.7; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.13.7; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -2825,6 +2825,7 @@ var WebMapLayers = /** @class */ (function (_super) {
2825
2825
  };
2826
2826
  /** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
2827
2827
  WebMapLayers.prototype.addTileLayer = function (url, options) {
2828
+ if (options === void 0) { options = {}; }
2828
2829
  return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
2829
2830
  };
2830
2831
  WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
@@ -4631,6 +4632,7 @@ var NgwConnector$1 = /** @class */ (function () {
4631
4632
  this.id = ID$1++;
4632
4633
  this.emitter = new events.exports.EventEmitter();
4633
4634
  this.routeStr = '/api/component/pyramid/route';
4635
+ this.activeRequests = [];
4634
4636
  var exist = findConnector(options);
4635
4637
  if (exist) {
4636
4638
  return exist;
@@ -4716,6 +4718,7 @@ var NgwConnector$1 = /** @class */ (function () {
4716
4718
  * Disconnecting a user. Aborting all current requests
4717
4719
  */
4718
4720
  NgwConnector.prototype.logout = function () {
4721
+ this.abort();
4719
4722
  removeConnector(this);
4720
4723
  this.options.auth = undefined;
4721
4724
  this.user = undefined;
@@ -4768,6 +4771,17 @@ var NgwConnector$1 = /** @class */ (function () {
4768
4771
  }
4769
4772
  }
4770
4773
  };
4774
+ /** Stop all api requests */
4775
+ NgwConnector.prototype.abort = function () {
4776
+ for (var _i = 0, _a = this.activeRequests; _i < _a.length; _i++) {
4777
+ var req = _a[_i];
4778
+ req.cancel();
4779
+ }
4780
+ this.activeRequests = [];
4781
+ };
4782
+ NgwConnector.prototype.getActiveApiRequests = function () {
4783
+ return __spreadArray([], this.activeRequests, true);
4784
+ };
4771
4785
  /**
4772
4786
  * Send request to NGW api router.
4773
4787
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -4989,7 +5003,13 @@ var NgwConnector$1 = /** @class */ (function () {
4989
5003
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
4990
5004
  }
4991
5005
  loadData(url, resolve, options, reject, onCancel);
4992
- }).catch(function (httpError) {
5006
+ })
5007
+ .then(function (resp) {
5008
+ _this._cleanActiveRequests(request);
5009
+ return resp;
5010
+ })
5011
+ .catch(function (httpError) {
5012
+ _this._cleanActiveRequests(request);
4993
5013
  if (httpError instanceof CancelablePromise.CancelError) ;
4994
5014
  else {
4995
5015
  // @ts-ignore
@@ -5008,8 +5028,15 @@ var NgwConnector$1 = /** @class */ (function () {
5008
5028
  request.cancel();
5009
5029
  });
5010
5030
  }
5031
+ this.activeRequests.push(request);
5011
5032
  return request;
5012
5033
  };
5034
+ NgwConnector.prototype._cleanActiveRequests = function (request) {
5035
+ var activeRequestIndex = this.activeRequests.indexOf(request);
5036
+ if (activeRequestIndex !== -1) {
5037
+ this.activeRequests.splice(activeRequestIndex, 1);
5038
+ }
5039
+ };
5013
5040
  NgwConnector.prototype._handleHttpError = function (er) {
5014
5041
  if (er) {
5015
5042
  if (er instanceof NgwError) {
@@ -5834,6 +5861,8 @@ function ngwApiToAdapterOptions(_a) {
5834
5861
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
5835
5862
  return {
5836
5863
  url: url,
5864
+ sourceLayer: 'ngw:' + resourceId,
5865
+ featureIdName: '$id',
5837
5866
  };
5838
5867
  }
5839
5868
  if (adapter === 'TERRAIN') {