@nextgis/ngw-map 3.0.0-alpha.15 → 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/ngw-map; version: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; 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/ngw-map; version: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.16; author: NextGIS */
2
2
  const svgPath = {
3
3
  brill: '<path d="m6 0-5 6 5 6 5-6z"/>',
4
4
  circle: '<circle cx="6" cy="6" r="6"/>',
@@ -1065,7 +1065,7 @@ function unwrapListeners(arr) {
1065
1065
 
1066
1066
  var pkg = {
1067
1067
  name: "@nextgis/ngw-connector",
1068
- version: "3.0.0-alpha.14",
1068
+ version: "3.0.0-alpha.16",
1069
1069
  _priority: 12,
1070
1070
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1071
1071
  main: "index.js",
@@ -1557,7 +1557,10 @@ function request(path, options, cacheEngine) {
1557
1557
  });
1558
1558
  }
1559
1559
  } else {
1560
- cacheEngine.clean();
1560
+ const ignoredForClean = ["api/feature_layer/identify"];
1561
+ if (ignoredForClean.every((part) => !path.includes(part))) {
1562
+ cacheEngine.clean();
1563
+ }
1561
1564
  }
1562
1565
  }
1563
1566
  return makeRequest();
@@ -1863,12 +1866,16 @@ class NgwConnector {
1863
1866
  __publicField$s(this, "user");
1864
1867
  __publicField$s(this, "cache");
1865
1868
  __publicField$s(this, "withCredentials");
1869
+ // Dedicated cache for route requests, as these are executed before any other requests.
1870
+ // This cache does not need to be cleared during the session.
1871
+ __publicField$s(this, "routeCache");
1866
1872
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1867
1873
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
1868
1874
  __publicField$s(this, "activeRequests", {});
1869
1875
  __publicField$s(this, "requestTransform");
1870
1876
  const exist = findConnector(options);
1871
1877
  this.cache = new Cache({ namespace: options.cacheId });
1878
+ this.routeCache = new Cache({ namespace: "routecache" });
1872
1879
  if (exist) {
1873
1880
  return exist;
1874
1881
  } else {
@@ -1929,19 +1936,9 @@ class NgwConnector {
1929
1936
  }
1930
1937
  }
1931
1938
  const routeUrl = `${this.routeStr}?client=${this.client}`;
1932
- return this.makeQuery(
1933
- routeUrl,
1934
- {},
1935
- {
1936
- cacheName: "route",
1937
- signal,
1938
- cache: true,
1939
- cacheProps: {
1940
- id: this.id,
1941
- auth,
1942
- baseUrl: this.options.baseUrl
1943
- }
1944
- }
1939
+ return this.routeCache.add(
1940
+ this.options.baseUrl || String(this.id),
1941
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
1945
1942
  );
1946
1943
  });
1947
1944
  }
@@ -1962,6 +1959,7 @@ class NgwConnector {
1962
1959
  removeConnector(this);
1963
1960
  this.options.auth = void 0;
1964
1961
  this.user = void 0;
1962
+ this.routeCache.clean();
1965
1963
  this.clearCache();
1966
1964
  this.emitter.emit("logout");
1967
1965
  }
@@ -2068,7 +2066,7 @@ class NgwConnector {
2068
2066
  this._cleanActiveRequest(id);
2069
2067
  }
2070
2068
  });
2071
- if (method === "GET") {
2069
+ if (method === "GET" && cache !== false) {
2072
2070
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$u({}, objectRemoveEmpty({
2073
2071
  headers,
2074
2072
  withCredentials,