@nextgis/ngw-map 1.15.0 → 1.15.1

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.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.15.1; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { deepmerge, isObject, defined, deprecatedWarn } from '@nextgis/utils';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.15.1; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -4647,6 +4647,9 @@ var NgwMap = (function (exports) {
4647
4647
  if (this.options.route) {
4648
4648
  this.routeStr = this.options.route;
4649
4649
  }
4650
+ if (this.options.requestTransform) {
4651
+ this.requestTransform = this.options.requestTransform;
4652
+ }
4650
4653
  this.resources = new ResourcesControl(this);
4651
4654
  addConnector(this);
4652
4655
  }
@@ -4654,6 +4657,9 @@ var NgwMap = (function (exports) {
4654
4657
  NgwConnector.create = function (options) {
4655
4658
  return new this(options);
4656
4659
  };
4660
+ NgwConnector.prototype.setRequestTransform = function (requestTransform) {
4661
+ this.requestTransform = requestTransform;
4662
+ };
4657
4663
  /**
4658
4664
  * Fast way to specify the connection address to NextGIS Web.
4659
4665
  * The current connection will be severed.
@@ -4913,9 +4919,8 @@ var NgwMap = (function (exports) {
4913
4919
  if (params) {
4914
4920
  url = template(url, params);
4915
4921
  }
4916
- // remove double slash
4917
- url = fixUrlStr(url);
4918
- return this._loadData(encodeURI(url), options);
4922
+ url = encodeURI(fixUrlStr(url));
4923
+ return this._loadData(url, options);
4919
4924
  }
4920
4925
  else {
4921
4926
  throw new Error('Empty `url` not allowed');
@@ -5008,6 +5013,11 @@ var NgwMap = (function (exports) {
5008
5013
  // options.withCredentials = true;
5009
5014
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
5010
5015
  }
5016
+ if (_this.requestTransform) {
5017
+ var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
5018
+ url = transUrl;
5019
+ options = transOptions;
5020
+ }
5011
5021
  loadData(url, resolve, options, reject, onCancel);
5012
5022
  })
5013
5023
  .then(function (resp) {
@@ -5032,6 +5042,7 @@ var NgwMap = (function (exports) {
5032
5042
  typeof options.signal.addEventListener === 'function') {
5033
5043
  options.signal.addEventListener('abort', function () {
5034
5044
  request.cancel();
5045
+ _this._cleanActiveRequests(request);
5035
5046
  });
5036
5047
  }
5037
5048
  this.activeRequests.push(request);