@nextgis/ngw-leaflet 3.0.0-alpha.15 → 3.0.0-alpha.17

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
@@ -17261,7 +17261,7 @@ class ImageAdapter extends BaseAdapter {
17261
17261
  const url = options && options.url;
17262
17262
  if (url) {
17263
17263
  const updateWmsParamsFromOpt = options.updateWmsParams;
17264
- this.layer = new ImageLayer(url, __spreadProps$n(__spreadValues$z(__spreadValues$z(__spreadValues$z({
17264
+ this.layer = new ImageLayer(url, __spreadValues$z(__spreadValues$z(__spreadValues$z({
17265
17265
  pane: this.pane,
17266
17266
  headers: options.headers,
17267
17267
  setViewDelay: options.setViewDelay
@@ -17269,9 +17269,7 @@ class ImageAdapter extends BaseAdapter {
17269
17269
  transparent: true
17270
17270
  }, options), {
17271
17271
  opacity: (_a = options.opacity) != null ? _a : void 0
17272
- })), options.params), options.nativeOptions), {
17273
- maxZoom: 12
17274
- }));
17272
+ })), options.params), options.nativeOptions));
17275
17273
  if (updateWmsParamsFromOpt) {
17276
17274
  const updateWmsParams = this.layer.updateWmsParams;
17277
17275
  this.layer.updateWmsParams = function(map) {
@@ -18190,7 +18188,7 @@ let Cache = _Cache;
18190
18188
 
18191
18189
  var pkg = {
18192
18190
  name: "@nextgis/ngw-connector",
18193
- version: "3.0.0-alpha.14",
18191
+ version: "3.0.0-alpha.16",
18194
18192
  _priority: 12,
18195
18193
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18196
18194
  main: "index.js",
@@ -18682,7 +18680,10 @@ function request(path, options, cacheEngine) {
18682
18680
  });
18683
18681
  }
18684
18682
  } else {
18685
- cacheEngine.clean();
18683
+ const ignoredForClean = ["api/feature_layer/identify"];
18684
+ if (ignoredForClean.every((part) => !path.includes(part))) {
18685
+ cacheEngine.clean();
18686
+ }
18686
18687
  }
18687
18688
  }
18688
18689
  return makeRequest();
@@ -18988,12 +18989,16 @@ class NgwConnector {
18988
18989
  __publicField$s(this, "user");
18989
18990
  __publicField$s(this, "cache");
18990
18991
  __publicField$s(this, "withCredentials");
18992
+ // Dedicated cache for route requests, as these are executed before any other requests.
18993
+ // This cache does not need to be cleared during the session.
18994
+ __publicField$s(this, "routeCache");
18991
18995
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18992
18996
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
18993
18997
  __publicField$s(this, "activeRequests", {});
18994
18998
  __publicField$s(this, "requestTransform");
18995
18999
  const exist = findConnector(options);
18996
19000
  this.cache = new Cache({ namespace: options.cacheId });
19001
+ this.routeCache = new Cache({ namespace: "routecache" });
18997
19002
  if (exist) {
18998
19003
  return exist;
18999
19004
  } else {
@@ -19054,19 +19059,9 @@ class NgwConnector {
19054
19059
  }
19055
19060
  }
19056
19061
  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
- }
19062
+ return this.routeCache.add(
19063
+ this.options.baseUrl || String(this.id),
19064
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
19070
19065
  );
19071
19066
  });
19072
19067
  }
@@ -19087,6 +19082,7 @@ class NgwConnector {
19087
19082
  removeConnector(this);
19088
19083
  this.options.auth = void 0;
19089
19084
  this.user = void 0;
19085
+ this.routeCache.clean();
19090
19086
  this.clearCache();
19091
19087
  this.emitter.emit("logout");
19092
19088
  }
@@ -19193,7 +19189,7 @@ class NgwConnector {
19193
19189
  this._cleanActiveRequest(id);
19194
19190
  }
19195
19191
  });
19196
- if (method === "GET") {
19192
+ if (method === "GET" && cache !== false) {
19197
19193
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$i(__spreadValues$r({}, objectRemoveEmpty({
19198
19194
  headers,
19199
19195
  withCredentials,
@@ -19864,7 +19860,7 @@ function fetchNgwLayerItemExtent({
19864
19860
  id: Number(resourceId),
19865
19861
  fid: featureId
19866
19862
  }).get({ cache, signal }).then((resp) => {
19867
- if (resp) {
19863
+ if (resp && resp.extent) {
19868
19864
  const { maxLat, maxLon, minLat, minLon } = resp.extent;
19869
19865
  const extentArray = [minLon, minLat, maxLon, maxLat];
19870
19866
  return extentArray;
@@ -20222,7 +20218,8 @@ var __async$l = (__this, __arguments, generator) => {
20222
20218
  };
20223
20219
  const FEATURE_REQUEST_PARAMS = {
20224
20220
  srs: 4326,
20225
- geom_format: "geojson"
20221
+ geom_format: "geojson",
20222
+ dt_format: "iso"
20226
20223
  };
20227
20224
  function createGeoJsonFeature(item) {
20228
20225
  const geometry = item.geom;
@@ -20704,10 +20701,12 @@ class BookmarkItem {
20704
20701
  id: this.resourceId,
20705
20702
  fid: this.item.id
20706
20703
  }).get(opt).then((resp) => {
20707
- const { minLat, minLon, maxLat, maxLon } = resp.extent;
20708
- const lonLat = [minLon, minLat, maxLon, maxLat];
20709
- this._extent = lonLat;
20710
- return lonLat;
20704
+ if (resp.extent) {
20705
+ const { minLat, minLon, maxLat, maxLon } = resp.extent;
20706
+ const lonLat = [minLon, minLat, maxLon, maxLat];
20707
+ this._extent = lonLat;
20708
+ return lonLat;
20709
+ }
20711
20710
  });
20712
20711
  }
20713
20712
  geoJson(opt) {