@nextgis/geocoder 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/geocoder; version: 1.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 1.15.1; author: NextGIS */
2
2
  import CancelablePromise from '@nextgis/cancelable-promise';
3
3
  import { objectAssign, fixUrlStr } from '@nextgis/utils';
4
4
  import NgwConnector from '@nextgis/ngw-connector';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 1.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 1.15.1; author: NextGIS */
2
2
  var Geocoder = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1970,6 +1970,9 @@ var Geocoder = (function (exports) {
1970
1970
  if (this.options.route) {
1971
1971
  this.routeStr = this.options.route;
1972
1972
  }
1973
+ if (this.options.requestTransform) {
1974
+ this.requestTransform = this.options.requestTransform;
1975
+ }
1973
1976
  this.resources = new ResourcesControl(this);
1974
1977
  addConnector(this);
1975
1978
  }
@@ -1977,6 +1980,9 @@ var Geocoder = (function (exports) {
1977
1980
  NgwConnector.create = function (options) {
1978
1981
  return new this(options);
1979
1982
  };
1983
+ NgwConnector.prototype.setRequestTransform = function (requestTransform) {
1984
+ this.requestTransform = requestTransform;
1985
+ };
1980
1986
  /**
1981
1987
  * Fast way to specify the connection address to NextGIS Web.
1982
1988
  * The current connection will be severed.
@@ -2236,9 +2242,8 @@ var Geocoder = (function (exports) {
2236
2242
  if (params) {
2237
2243
  url = template(url, params);
2238
2244
  }
2239
- // remove double slash
2240
- url = fixUrlStr(url);
2241
- return this._loadData(encodeURI(url), options);
2245
+ url = encodeURI(fixUrlStr(url));
2246
+ return this._loadData(url, options);
2242
2247
  }
2243
2248
  else {
2244
2249
  throw new Error('Empty `url` not allowed');
@@ -2331,6 +2336,11 @@ var Geocoder = (function (exports) {
2331
2336
  // options.withCredentials = true;
2332
2337
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
2333
2338
  }
2339
+ if (_this.requestTransform) {
2340
+ var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
2341
+ url = transUrl;
2342
+ options = transOptions;
2343
+ }
2334
2344
  loadData(url, resolve, options, reject, onCancel);
2335
2345
  })
2336
2346
  .then(function (resp) {
@@ -2355,6 +2365,7 @@ var Geocoder = (function (exports) {
2355
2365
  typeof options.signal.addEventListener === 'function') {
2356
2366
  options.signal.addEventListener('abort', function () {
2357
2367
  request.cancel();
2368
+ _this._cleanActiveRequests(request);
2358
2369
  });
2359
2370
  }
2360
2371
  this.activeRequests.push(request);