@nextgis/ngw-map 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-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
  import { getIcon } from '@nextgis/icons';
3
3
  import NgwConnector from '@nextgis/ngw-connector';
4
4
  import { NgwKit, fetchNgwLayerItem, fetchNgwLayerItems, fetchNgwLayerFeature, fetchNgwLayerFeatureCollection, fetchIdentifyItem, fetchIdentifyGeoJson, createNgwLayerAdapter, fetchNgwExtent, sendIdentifyRequest, getCompanyLogo, getIdentifyItems, createIdentifyItem } from '@nextgis/ngw-kit';
@@ -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
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1068,7 +1068,7 @@ var NgwMap = (function (exports) {
1068
1068
 
1069
1069
  var pkg = {
1070
1070
  name: "@nextgis/ngw-connector",
1071
- version: "3.0.0-alpha.14",
1071
+ version: "3.0.0-alpha.16",
1072
1072
  _priority: 12,
1073
1073
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1074
1074
  main: "index.js",
@@ -1560,7 +1560,10 @@ var NgwMap = (function (exports) {
1560
1560
  });
1561
1561
  }
1562
1562
  } else {
1563
- cacheEngine.clean();
1563
+ const ignoredForClean = ["api/feature_layer/identify"];
1564
+ if (ignoredForClean.every((part) => !path.includes(part))) {
1565
+ cacheEngine.clean();
1566
+ }
1564
1567
  }
1565
1568
  }
1566
1569
  return makeRequest();
@@ -1866,12 +1869,16 @@ var NgwMap = (function (exports) {
1866
1869
  __publicField$s(this, "user");
1867
1870
  __publicField$s(this, "cache");
1868
1871
  __publicField$s(this, "withCredentials");
1872
+ // Dedicated cache for route requests, as these are executed before any other requests.
1873
+ // This cache does not need to be cleared during the session.
1874
+ __publicField$s(this, "routeCache");
1869
1875
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1870
1876
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
1871
1877
  __publicField$s(this, "activeRequests", {});
1872
1878
  __publicField$s(this, "requestTransform");
1873
1879
  const exist = findConnector(options);
1874
1880
  this.cache = new Cache({ namespace: options.cacheId });
1881
+ this.routeCache = new Cache({ namespace: "routecache" });
1875
1882
  if (exist) {
1876
1883
  return exist;
1877
1884
  } else {
@@ -1932,19 +1939,9 @@ var NgwMap = (function (exports) {
1932
1939
  }
1933
1940
  }
1934
1941
  const routeUrl = `${this.routeStr}?client=${this.client}`;
1935
- return this.makeQuery(
1936
- routeUrl,
1937
- {},
1938
- {
1939
- cacheName: "route",
1940
- signal,
1941
- cache: true,
1942
- cacheProps: {
1943
- id: this.id,
1944
- auth,
1945
- baseUrl: this.options.baseUrl
1946
- }
1947
- }
1942
+ return this.routeCache.add(
1943
+ this.options.baseUrl || String(this.id),
1944
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
1948
1945
  );
1949
1946
  });
1950
1947
  }
@@ -1965,6 +1962,7 @@ var NgwMap = (function (exports) {
1965
1962
  removeConnector(this);
1966
1963
  this.options.auth = void 0;
1967
1964
  this.user = void 0;
1965
+ this.routeCache.clean();
1968
1966
  this.clearCache();
1969
1967
  this.emitter.emit("logout");
1970
1968
  }
@@ -2071,7 +2069,7 @@ var NgwMap = (function (exports) {
2071
2069
  this._cleanActiveRequest(id);
2072
2070
  }
2073
2071
  });
2074
- if (method === "GET") {
2072
+ if (method === "GET" && cache !== false) {
2075
2073
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$u({}, objectRemoveEmpty({
2076
2074
  headers,
2077
2075
  withCredentials,
@@ -2742,7 +2740,7 @@ var NgwMap = (function (exports) {
2742
2740
  id: Number(resourceId),
2743
2741
  fid: featureId
2744
2742
  }).get({ cache, signal }).then((resp) => {
2745
- if (resp) {
2743
+ if (resp && resp.extent) {
2746
2744
  const { maxLat, maxLon, minLat, minLon } = resp.extent;
2747
2745
  const extentArray = [minLon, minLat, maxLon, maxLat];
2748
2746
  return extentArray;
@@ -3194,7 +3192,8 @@ var NgwMap = (function (exports) {
3194
3192
  };
3195
3193
  const FEATURE_REQUEST_PARAMS = {
3196
3194
  srs: 4326,
3197
- geom_format: "geojson"
3195
+ geom_format: "geojson",
3196
+ dt_format: "iso"
3198
3197
  };
3199
3198
  function createGeoJsonFeature(item) {
3200
3199
  const geometry = item.geom;
@@ -3676,10 +3675,12 @@ var NgwMap = (function (exports) {
3676
3675
  id: this.resourceId,
3677
3676
  fid: this.item.id
3678
3677
  }).get(opt).then((resp) => {
3679
- const { minLat, minLon, maxLat, maxLon } = resp.extent;
3680
- const lonLat = [minLon, minLat, maxLon, maxLat];
3681
- this._extent = lonLat;
3682
- return lonLat;
3678
+ if (resp.extent) {
3679
+ const { minLat, minLon, maxLat, maxLon } = resp.extent;
3680
+ const lonLat = [minLon, minLat, maxLon, maxLat];
3681
+ this._extent = lonLat;
3682
+ return lonLat;
3683
+ }
3683
3684
  });
3684
3685
  }
3685
3686
  geoJson(opt) {