@nextgis/geocoder 1.15.0 → 1.16.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.16.1; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 1.15.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 1.16.1; author: NextGIS */
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -1967,6 +1967,9 @@ var NgwConnector$1 = /** @class */ (function () {
1967
1967
  if (this.options.route) {
1968
1968
  this.routeStr = this.options.route;
1969
1969
  }
1970
+ if (this.options.requestTransform) {
1971
+ this.requestTransform = this.options.requestTransform;
1972
+ }
1970
1973
  this.resources = new ResourcesControl(this);
1971
1974
  addConnector(this);
1972
1975
  }
@@ -1974,6 +1977,9 @@ var NgwConnector$1 = /** @class */ (function () {
1974
1977
  NgwConnector.create = function (options) {
1975
1978
  return new this(options);
1976
1979
  };
1980
+ NgwConnector.prototype.setRequestTransform = function (requestTransform) {
1981
+ this.requestTransform = requestTransform;
1982
+ };
1977
1983
  /**
1978
1984
  * Fast way to specify the connection address to NextGIS Web.
1979
1985
  * The current connection will be severed.
@@ -2233,9 +2239,8 @@ var NgwConnector$1 = /** @class */ (function () {
2233
2239
  if (params) {
2234
2240
  url = template(url, params);
2235
2241
  }
2236
- // remove double slash
2237
- url = fixUrlStr(url);
2238
- return this._loadData(encodeURI(url), options);
2242
+ url = encodeURI(fixUrlStr(url));
2243
+ return this._loadData(url, options);
2239
2244
  }
2240
2245
  else {
2241
2246
  throw new Error('Empty `url` not allowed');
@@ -2328,6 +2333,11 @@ var NgwConnector$1 = /** @class */ (function () {
2328
2333
  // options.withCredentials = true;
2329
2334
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
2330
2335
  }
2336
+ if (_this.requestTransform) {
2337
+ var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
2338
+ url = transUrl;
2339
+ options = transOptions;
2340
+ }
2331
2341
  loadData(url, resolve, options, reject, onCancel);
2332
2342
  })
2333
2343
  .then(function (resp) {
@@ -2352,6 +2362,7 @@ var NgwConnector$1 = /** @class */ (function () {
2352
2362
  typeof options.signal.addEventListener === 'function') {
2353
2363
  options.signal.addEventListener('abort', function () {
2354
2364
  request.cancel();
2365
+ _this._cleanActiveRequests(request);
2355
2366
  });
2356
2367
  }
2357
2368
  this.activeRequests.push(request);