@nextgis/ngw-map 3.0.0-alpha.14 → 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-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
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -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
  const svgPath = {
3
3
  brill: '<path d="m6 0-5 6 5 6 5-6z"/>',
4
4
  circle: '<circle cx="6" cy="6" r="6"/>',
@@ -1065,7 +1065,7 @@ function unwrapListeners(arr) {
1065
1065
 
1066
1066
  var pkg = {
1067
1067
  name: "@nextgis/ngw-connector",
1068
- version: "3.0.0-alpha.14",
1068
+ version: "3.0.0-alpha.16",
1069
1069
  _priority: 12,
1070
1070
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1071
1071
  main: "index.js",
@@ -1557,7 +1557,10 @@ function request(path, options, cacheEngine) {
1557
1557
  });
1558
1558
  }
1559
1559
  } else {
1560
- cacheEngine.clean();
1560
+ const ignoredForClean = ["api/feature_layer/identify"];
1561
+ if (ignoredForClean.every((part) => !path.includes(part))) {
1562
+ cacheEngine.clean();
1563
+ }
1561
1564
  }
1562
1565
  }
1563
1566
  return makeRequest();
@@ -1863,12 +1866,16 @@ class NgwConnector {
1863
1866
  __publicField$s(this, "user");
1864
1867
  __publicField$s(this, "cache");
1865
1868
  __publicField$s(this, "withCredentials");
1869
+ // Dedicated cache for route requests, as these are executed before any other requests.
1870
+ // This cache does not need to be cleared during the session.
1871
+ __publicField$s(this, "routeCache");
1866
1872
  __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1867
1873
  __publicField$s(this, "routeStr", "/api/component/pyramid/route");
1868
1874
  __publicField$s(this, "activeRequests", {});
1869
1875
  __publicField$s(this, "requestTransform");
1870
1876
  const exist = findConnector(options);
1871
1877
  this.cache = new Cache({ namespace: options.cacheId });
1878
+ this.routeCache = new Cache({ namespace: "routecache" });
1872
1879
  if (exist) {
1873
1880
  return exist;
1874
1881
  } else {
@@ -1929,19 +1936,9 @@ class NgwConnector {
1929
1936
  }
1930
1937
  }
1931
1938
  const routeUrl = `${this.routeStr}?client=${this.client}`;
1932
- return this.makeQuery(
1933
- routeUrl,
1934
- {},
1935
- {
1936
- cacheName: "route",
1937
- signal,
1938
- cache: true,
1939
- cacheProps: {
1940
- id: this.id,
1941
- auth,
1942
- baseUrl: this.options.baseUrl
1943
- }
1944
- }
1939
+ return this.routeCache.add(
1940
+ this.options.baseUrl || String(this.id),
1941
+ () => this.makeQuery(routeUrl, null, { signal, cache: false })
1945
1942
  );
1946
1943
  });
1947
1944
  }
@@ -1962,6 +1959,7 @@ class NgwConnector {
1962
1959
  removeConnector(this);
1963
1960
  this.options.auth = void 0;
1964
1961
  this.user = void 0;
1962
+ this.routeCache.clean();
1965
1963
  this.clearCache();
1966
1964
  this.emitter.emit("logout");
1967
1965
  }
@@ -2068,7 +2066,7 @@ class NgwConnector {
2068
2066
  this._cleanActiveRequest(id);
2069
2067
  }
2070
2068
  });
2071
- if (method === "GET") {
2069
+ if (method === "GET" && cache !== false) {
2072
2070
  const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$u({}, objectRemoveEmpty({
2073
2071
  headers,
2074
2072
  withCredentials,
@@ -5873,15 +5871,19 @@ function createRasterAdapter(_0) {
5873
5871
  }
5874
5872
  showLayer() {
5875
5873
  this._layerVisibility = true;
5876
- if (this.layer) {
5877
- if (!this._blocked) {
5874
+ if (!this._blocked) {
5875
+ if (super.showLayer) {
5876
+ super.showLayer(this.layer);
5877
+ } else if (this.layer) {
5878
5878
  webMap.mapAdapter.showLayer(this.layer);
5879
5879
  }
5880
5880
  }
5881
5881
  }
5882
5882
  hideLayer() {
5883
5883
  this._layerVisibility = false;
5884
- if (this.layer) {
5884
+ if (super.hideLayer) {
5885
+ super.hideLayer(this.layer);
5886
+ } else if (this.layer) {
5885
5887
  webMap.mapAdapter.hideLayer(this.layer);
5886
5888
  }
5887
5889
  }
@@ -6428,24 +6430,26 @@ function getCompanyLogo(connector, options) {
6428
6430
  img.style.maxHeight = "100px";
6429
6431
  img.style.maxWidth = "100px";
6430
6432
  img.src = "";
6431
- try {
6432
- const resp = yield connector.route("pyramid.csettings").get();
6433
- const logo = (_b = resp.pyramid) == null ? void 0 : _b.header_logo;
6434
- if (logo) {
6435
- const [mimeType, base64Data] = logo;
6436
- const byteCharacters = atob(base64Data);
6437
- const byteNumbers = new Array(byteCharacters.length);
6438
- for (let i = 0; i < byteCharacters.length; i++) {
6439
- byteNumbers[i] = byteCharacters.charCodeAt(i);
6440
- }
6441
- const byteArray = new Uint8Array(byteNumbers);
6442
- const blob = new Blob([byteArray], { type: mimeType });
6443
- const urlCreator = window.URL || window.webkitURL;
6444
- const imageUrl = urlCreator.createObjectURL(blob);
6445
- img.src = imageUrl;
6433
+ const resp = yield connector.route("pyramid.csettings").get({
6434
+ query: {
6435
+ pyramid: ["header_logo"]
6446
6436
  }
6447
- } catch (er) {
6448
- console.warn(er);
6437
+ });
6438
+ const logo = (_b = resp.pyramid) == null ? void 0 : _b.header_logo;
6439
+ if (logo) {
6440
+ const [mimeType, base64Data] = logo;
6441
+ const byteCharacters = atob(base64Data);
6442
+ const byteNumbers = new Array(byteCharacters.length);
6443
+ for (let i = 0; i < byteCharacters.length; i++) {
6444
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
6445
+ }
6446
+ const byteArray = new Uint8Array(byteNumbers);
6447
+ const blob = new Blob([byteArray], { type: mimeType });
6448
+ const urlCreator = window.URL || window.webkitURL;
6449
+ const imageUrl = urlCreator.createObjectURL(blob);
6450
+ img.src = imageUrl;
6451
+ } else {
6452
+ return;
6449
6453
  }
6450
6454
  if (settings.company_logo.link !== null && settings.company_logo.link.trim() !== "") {
6451
6455
  anchor.href = settings.company_logo.link;