@nextgis/ngw-leaflet 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-leaflet; version: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.13.7; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -16916,6 +16916,7 @@ var WebMapLayers = /** @class */ (function (_super) {
16916
16916
  };
16917
16917
  /** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
16918
16918
  WebMapLayers.prototype.addTileLayer = function (url, options) {
16919
+ if (options === void 0) { options = {}; }
16919
16920
  return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
16920
16921
  };
16921
16922
  WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
@@ -18704,6 +18705,7 @@ var NgwConnector = /** @class */ (function () {
18704
18705
  this.id = ID$1++;
18705
18706
  this.emitter = new events.exports.EventEmitter();
18706
18707
  this.routeStr = '/api/component/pyramid/route';
18708
+ this.activeRequests = [];
18707
18709
  var exist = findConnector(options);
18708
18710
  if (exist) {
18709
18711
  return exist;
@@ -18789,6 +18791,7 @@ var NgwConnector = /** @class */ (function () {
18789
18791
  * Disconnecting a user. Aborting all current requests
18790
18792
  */
18791
18793
  NgwConnector.prototype.logout = function () {
18794
+ this.abort();
18792
18795
  removeConnector(this);
18793
18796
  this.options.auth = undefined;
18794
18797
  this.user = undefined;
@@ -18841,6 +18844,17 @@ var NgwConnector = /** @class */ (function () {
18841
18844
  }
18842
18845
  }
18843
18846
  };
18847
+ /** Stop all api requests */
18848
+ NgwConnector.prototype.abort = function () {
18849
+ for (var _i = 0, _a = this.activeRequests; _i < _a.length; _i++) {
18850
+ var req = _a[_i];
18851
+ req.cancel();
18852
+ }
18853
+ this.activeRequests = [];
18854
+ };
18855
+ NgwConnector.prototype.getActiveApiRequests = function () {
18856
+ return __spreadArray([], this.activeRequests, true);
18857
+ };
18844
18858
  /**
18845
18859
  * Send request to NGW api router.
18846
18860
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -19062,7 +19076,13 @@ var NgwConnector = /** @class */ (function () {
19062
19076
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
19063
19077
  }
19064
19078
  loadData(url, resolve, options, reject, onCancel);
19065
- }).catch(function (httpError) {
19079
+ })
19080
+ .then(function (resp) {
19081
+ _this._cleanActiveRequests(request);
19082
+ return resp;
19083
+ })
19084
+ .catch(function (httpError) {
19085
+ _this._cleanActiveRequests(request);
19066
19086
  if (httpError instanceof CancelablePromise.CancelError) ;
19067
19087
  else {
19068
19088
  // @ts-ignore
@@ -19081,8 +19101,15 @@ var NgwConnector = /** @class */ (function () {
19081
19101
  request.cancel();
19082
19102
  });
19083
19103
  }
19104
+ this.activeRequests.push(request);
19084
19105
  return request;
19085
19106
  };
19107
+ NgwConnector.prototype._cleanActiveRequests = function (request) {
19108
+ var activeRequestIndex = this.activeRequests.indexOf(request);
19109
+ if (activeRequestIndex !== -1) {
19110
+ this.activeRequests.splice(activeRequestIndex, 1);
19111
+ }
19112
+ };
19086
19113
  NgwConnector.prototype._handleHttpError = function (er) {
19087
19114
  if (er) {
19088
19115
  if (er instanceof NgwError) {
@@ -19895,6 +19922,8 @@ function ngwApiToAdapterOptions(_a) {
19895
19922
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
19896
19923
  return {
19897
19924
  url: url,
19925
+ sourceLayer: 'ngw:' + resourceId,
19926
+ featureIdName: '$id',
19898
19927
  };
19899
19928
  }
19900
19929
  if (adapter === 'TERRAIN') {