@nextgis/ngw-leaflet 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-leaflet; version: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.16; author: NextGIS */
2
2
  import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
3
3
  import { NgwMap } from '@nextgis/ngw-map';
4
4
  import { Icon } from 'leaflet';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.14; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.16; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -18193,7 +18193,7 @@ var NgwLeaflet = (function () {
18193
18193
 
18194
18194
  var pkg = {
18195
18195
  name: "@nextgis/ngw-connector",
18196
- version: "3.0.0-alpha.14",
18196
+ version: "3.0.0-alpha.16",
18197
18197
  _priority: 12,
18198
18198
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18199
18199
  main: "index.js",
@@ -18685,7 +18685,10 @@ var NgwLeaflet = (function () {
18685
18685
  });
18686
18686
  }
18687
18687
  } else {
18688
- cacheEngine.clean();
18688
+ const ignoredForClean = ["api/feature_layer/identify"];
18689
+ if (ignoredForClean.every((part) => !path.includes(part))) {
18690
+ cacheEngine.clean();
18691
+ }
18689
18692
  }
18690
18693
  }
18691
18694
  return makeRequest();
@@ -18991,12 +18994,16 @@ var NgwLeaflet = (function () {
18991
18994
  __publicField$s(this, "user");
18992
18995
  __publicField$s(this, "cache");
18993
18996
  __publicField$s(this, "withCredentials");
18997
+ // Dedicated cache for route requests, as these are executed before any other requests.
18998
+ // This cache does not need to be cleared during the session.
18999
+ __publicField$s(this, "routeCache");
18994
19000
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18995
19001
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
18996
19002
  __publicField$s(this, "activeRequests", {});
18997
19003
  __publicField$s(this, "requestTransform");
18998
19004
  const exist = findConnector(options);
18999
19005
  this.cache = new Cache({ namespace: options.cacheId });
19006
+ this.routeCache = new Cache({ namespace: "routecache" });
19000
19007
  if (exist) {
19001
19008
  return exist;
19002
19009
  } else {
@@ -19057,19 +19064,9 @@ var NgwLeaflet = (function () {
19057
19064
  }
19058
19065
  }
19059
19066
  const routeUrl = `${this.routeStr}?client=${this.client}`;
19060
- return this.makeQuery(
19061
- routeUrl,
19062
- {},
19063
- {
19064
- cacheName: "route",
19065
- signal,
19066
- cache: true,
19067
- cacheProps: {
19068
- id: this.id,
19069
- auth,
19070
- baseUrl: this.options.baseUrl
19071
- }
19072
- }
19067
+ return this.routeCache.add(
19068
+ this.options.baseUrl || String(this.id),
19069
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
19073
19070
  );
19074
19071
  });
19075
19072
  }
@@ -19090,6 +19087,7 @@ var NgwLeaflet = (function () {
19090
19087
  removeConnector(this);
19091
19088
  this.options.auth = void 0;
19092
19089
  this.user = void 0;
19090
+ this.routeCache.clean();
19093
19091
  this.clearCache();
19094
19092
  this.emitter.emit("logout");
19095
19093
  }
@@ -19196,7 +19194,7 @@ var NgwLeaflet = (function () {
19196
19194
  this._cleanActiveRequest(id);
19197
19195
  }
19198
19196
  });
19199
- if (method === "GET") {
19197
+ if (method === "GET" && cache !== false) {
19200
19198
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$i(__spreadValues$r({}, objectRemoveEmpty({
19201
19199
  headers,
19202
19200
  withCredentials,