@nextgis/geocoder 3.0.0-alpha.14 → 3.0.0-alpha.16

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: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.16; 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: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.16; author: NextGIS */
2
2
  function defined(val) {
3
3
  return val !== void 0 && val !== null;
4
4
  }
@@ -1017,7 +1017,7 @@ function unwrapListeners(arr) {
1017
1017
 
1018
1018
  var pkg = {
1019
1019
  name: "@nextgis/ngw-connector",
1020
- version: "3.0.0-alpha.14",
1020
+ version: "3.0.0-alpha.16",
1021
1021
  _priority: 12,
1022
1022
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1023
1023
  main: "index.js",
@@ -1509,7 +1509,10 @@ function request(path, options, cacheEngine) {
1509
1509
  });
1510
1510
  }
1511
1511
  } else {
1512
- cacheEngine.clean();
1512
+ const ignoredForClean = ["api/feature_layer/identify"];
1513
+ if (ignoredForClean.every((part) => !path.includes(part))) {
1514
+ cacheEngine.clean();
1515
+ }
1513
1516
  }
1514
1517
  }
1515
1518
  return makeRequest();
@@ -1815,12 +1818,16 @@ class NgwConnector {
1815
1818
  __publicField$4(this, "user");
1816
1819
  __publicField$4(this, "cache");
1817
1820
  __publicField$4(this, "withCredentials");
1821
+ // Dedicated cache for route requests, as these are executed before any other requests.
1822
+ // This cache does not need to be cleared during the session.
1823
+ __publicField$4(this, "routeCache");
1818
1824
  __publicField$4(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1819
1825
  __publicField$4(this, "routeStr", "/api/component/pyramid/route");
1820
1826
  __publicField$4(this, "activeRequests", {});
1821
1827
  __publicField$4(this, "requestTransform");
1822
1828
  const exist = findConnector(options);
1823
1829
  this.cache = new Cache({ namespace: options.cacheId });
1830
+ this.routeCache = new Cache({ namespace: "routecache" });
1824
1831
  if (exist) {
1825
1832
  return exist;
1826
1833
  } else {
@@ -1881,19 +1888,9 @@ class NgwConnector {
1881
1888
  }
1882
1889
  }
1883
1890
  const routeUrl = `${this.routeStr}?client=${this.client}`;
1884
- return this.makeQuery(
1885
- routeUrl,
1886
- {},
1887
- {
1888
- cacheName: "route",
1889
- signal,
1890
- cache: true,
1891
- cacheProps: {
1892
- id: this.id,
1893
- auth,
1894
- baseUrl: this.options.baseUrl
1895
- }
1896
- }
1891
+ return this.routeCache.add(
1892
+ this.options.baseUrl || String(this.id),
1893
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
1897
1894
  );
1898
1895
  });
1899
1896
  }
@@ -1914,6 +1911,7 @@ class NgwConnector {
1914
1911
  removeConnector(this);
1915
1912
  this.options.auth = void 0;
1916
1913
  this.user = void 0;
1914
+ this.routeCache.clean();
1917
1915
  this.clearCache();
1918
1916
  this.emitter.emit("logout");
1919
1917
  }
@@ -2020,7 +2018,7 @@ class NgwConnector {
2020
2018
  this._cleanActiveRequest(id);
2021
2019
  }
2022
2020
  });
2023
- if (method === "GET") {
2021
+ if (method === "GET" && cache !== false) {
2024
2022
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$3(__spreadValues$4({}, objectRemoveEmpty({
2025
2023
  headers,
2026
2024
  withCredentials,