@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
  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
 
@@ -17264,7 +17264,7 @@ var NgwLeaflet = (function () {
17264
17264
  const url = options && options.url;
17265
17265
  if (url) {
17266
17266
  const updateWmsParamsFromOpt = options.updateWmsParams;
17267
- this.layer = new ImageLayer(url, __spreadProps$n(__spreadValues$z(__spreadValues$z(__spreadValues$z({
17267
+ this.layer = new ImageLayer(url, __spreadValues$z(__spreadValues$z(__spreadValues$z({
17268
17268
  pane: this.pane,
17269
17269
  headers: options.headers,
17270
17270
  setViewDelay: options.setViewDelay
@@ -17272,9 +17272,7 @@ var NgwLeaflet = (function () {
17272
17272
  transparent: true
17273
17273
  }, options), {
17274
17274
  opacity: (_a = options.opacity) != null ? _a : void 0
17275
- })), options.params), options.nativeOptions), {
17276
- maxZoom: 12
17277
- }));
17275
+ })), options.params), options.nativeOptions));
17278
17276
  if (updateWmsParamsFromOpt) {
17279
17277
  const updateWmsParams = this.layer.updateWmsParams;
17280
17278
  this.layer.updateWmsParams = function(map) {
@@ -18193,7 +18191,7 @@ var NgwLeaflet = (function () {
18193
18191
 
18194
18192
  var pkg = {
18195
18193
  name: "@nextgis/ngw-connector",
18196
- version: "3.0.0-alpha.14",
18194
+ version: "3.0.0-alpha.16",
18197
18195
  _priority: 12,
18198
18196
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18199
18197
  main: "index.js",
@@ -18685,7 +18683,10 @@ var NgwLeaflet = (function () {
18685
18683
  });
18686
18684
  }
18687
18685
  } else {
18688
- cacheEngine.clean();
18686
+ const ignoredForClean = ["api/feature_layer/identify"];
18687
+ if (ignoredForClean.every((part) => !path.includes(part))) {
18688
+ cacheEngine.clean();
18689
+ }
18689
18690
  }
18690
18691
  }
18691
18692
  return makeRequest();
@@ -18991,12 +18992,16 @@ var NgwLeaflet = (function () {
18991
18992
  __publicField$s(this, "user");
18992
18993
  __publicField$s(this, "cache");
18993
18994
  __publicField$s(this, "withCredentials");
18995
+ // Dedicated cache for route requests, as these are executed before any other requests.
18996
+ // This cache does not need to be cleared during the session.
18997
+ __publicField$s(this, "routeCache");
18994
18998
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18995
18999
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
18996
19000
  __publicField$s(this, "activeRequests", {});
18997
19001
  __publicField$s(this, "requestTransform");
18998
19002
  const exist = findConnector(options);
18999
19003
  this.cache = new Cache({ namespace: options.cacheId });
19004
+ this.routeCache = new Cache({ namespace: "routecache" });
19000
19005
  if (exist) {
19001
19006
  return exist;
19002
19007
  } else {
@@ -19057,19 +19062,9 @@ var NgwLeaflet = (function () {
19057
19062
  }
19058
19063
  }
19059
19064
  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
- }
19065
+ return this.routeCache.add(
19066
+ this.options.baseUrl || String(this.id),
19067
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
19073
19068
  );
19074
19069
  });
19075
19070
  }
@@ -19090,6 +19085,7 @@ var NgwLeaflet = (function () {
19090
19085
  removeConnector(this);
19091
19086
  this.options.auth = void 0;
19092
19087
  this.user = void 0;
19088
+ this.routeCache.clean();
19093
19089
  this.clearCache();
19094
19090
  this.emitter.emit("logout");
19095
19091
  }
@@ -19196,7 +19192,7 @@ var NgwLeaflet = (function () {
19196
19192
  this._cleanActiveRequest(id);
19197
19193
  }
19198
19194
  });
19199
- if (method === "GET") {
19195
+ if (method === "GET" && cache !== false) {
19200
19196
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$i(__spreadValues$r({}, objectRemoveEmpty({
19201
19197
  headers,
19202
19198
  withCredentials,
@@ -19867,7 +19863,7 @@ var NgwLeaflet = (function () {
19867
19863
  id: Number(resourceId),
19868
19864
  fid: featureId
19869
19865
  }).get({ cache, signal }).then((resp) => {
19870
- if (resp) {
19866
+ if (resp && resp.extent) {
19871
19867
  const { maxLat, maxLon, minLat, minLon } = resp.extent;
19872
19868
  const extentArray = [minLon, minLat, maxLon, maxLat];
19873
19869
  return extentArray;
@@ -20225,7 +20221,8 @@ var NgwLeaflet = (function () {
20225
20221
  };
20226
20222
  const FEATURE_REQUEST_PARAMS = {
20227
20223
  srs: 4326,
20228
- geom_format: "geojson"
20224
+ geom_format: "geojson",
20225
+ dt_format: "iso"
20229
20226
  };
20230
20227
  function createGeoJsonFeature(item) {
20231
20228
  const geometry = item.geom;
@@ -20707,10 +20704,12 @@ var NgwLeaflet = (function () {
20707
20704
  id: this.resourceId,
20708
20705
  fid: this.item.id
20709
20706
  }).get(opt).then((resp) => {
20710
- const { minLat, minLon, maxLat, maxLon } = resp.extent;
20711
- const lonLat = [minLon, minLat, maxLon, maxLat];
20712
- this._extent = lonLat;
20713
- return lonLat;
20707
+ if (resp.extent) {
20708
+ const { minLat, minLon, maxLat, maxLon } = resp.extent;
20709
+ const lonLat = [minLon, minLat, maxLon, maxLat];
20710
+ this._extent = lonLat;
20711
+ return lonLat;
20712
+ }
20714
20713
  });
20715
20714
  }
20716
20715
  geoJson(opt) {