@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
  var domain;
3
3
 
4
4
  // This constructor is used to store event handlers. Instantiating this is
@@ -18190,7 +18190,7 @@ let Cache = _Cache;
18190
18190
 
18191
18191
  var pkg = {
18192
18192
  name: "@nextgis/ngw-connector",
18193
- version: "3.0.0-alpha.14",
18193
+ version: "3.0.0-alpha.16",
18194
18194
  _priority: 12,
18195
18195
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18196
18196
  main: "index.js",
@@ -18682,7 +18682,10 @@ function request(path, options, cacheEngine) {
18682
18682
  });
18683
18683
  }
18684
18684
  } else {
18685
- cacheEngine.clean();
18685
+ const ignoredForClean = ["api/feature_layer/identify"];
18686
+ if (ignoredForClean.every((part) => !path.includes(part))) {
18687
+ cacheEngine.clean();
18688
+ }
18686
18689
  }
18687
18690
  }
18688
18691
  return makeRequest();
@@ -18988,12 +18991,16 @@ class NgwConnector {
18988
18991
  __publicField$s(this, "user");
18989
18992
  __publicField$s(this, "cache");
18990
18993
  __publicField$s(this, "withCredentials");
18994
+ // Dedicated cache for route requests, as these are executed before any other requests.
18995
+ // This cache does not need to be cleared during the session.
18996
+ __publicField$s(this, "routeCache");
18991
18997
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18992
18998
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
18993
18999
  __publicField$s(this, "activeRequests", {});
18994
19000
  __publicField$s(this, "requestTransform");
18995
19001
  const exist = findConnector(options);
18996
19002
  this.cache = new Cache({ namespace: options.cacheId });
19003
+ this.routeCache = new Cache({ namespace: "routecache" });
18997
19004
  if (exist) {
18998
19005
  return exist;
18999
19006
  } else {
@@ -19054,19 +19061,9 @@ class NgwConnector {
19054
19061
  }
19055
19062
  }
19056
19063
  const routeUrl = `${this.routeStr}?client=${this.client}`;
19057
- return this.makeQuery(
19058
- routeUrl,
19059
- {},
19060
- {
19061
- cacheName: "route",
19062
- signal,
19063
- cache: true,
19064
- cacheProps: {
19065
- id: this.id,
19066
- auth,
19067
- baseUrl: this.options.baseUrl
19068
- }
19069
- }
19064
+ return this.routeCache.add(
19065
+ this.options.baseUrl || String(this.id),
19066
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
19070
19067
  );
19071
19068
  });
19072
19069
  }
@@ -19087,6 +19084,7 @@ class NgwConnector {
19087
19084
  removeConnector(this);
19088
19085
  this.options.auth = void 0;
19089
19086
  this.user = void 0;
19087
+ this.routeCache.clean();
19090
19088
  this.clearCache();
19091
19089
  this.emitter.emit("logout");
19092
19090
  }
@@ -19193,7 +19191,7 @@ class NgwConnector {
19193
19191
  this._cleanActiveRequest(id);
19194
19192
  }
19195
19193
  });
19196
- if (method === "GET") {
19194
+ if (method === "GET" && cache !== false) {
19197
19195
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$i(__spreadValues$r({}, objectRemoveEmpty({
19198
19196
  headers,
19199
19197
  withCredentials,