@nextgis/ngw-map 3.0.0-alpha.1 → 3.0.0-alpha.3

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.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.3; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import { getIcon } from '@nextgis/icons';
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.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.3; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -941,6 +941,62 @@ var NgwMap = (function (exports) {
941
941
  __publicField$v(_Cache, "instance", {});
942
942
  let Cache = _Cache;
943
943
 
944
+ var pkg = {
945
+ name: "@nextgis/ngw-connector",
946
+ version: "3.0.0-alpha.3",
947
+ _priority: 12,
948
+ description: "A lightweight HTTP client optimized for use with NextGIS Web API",
949
+ main: "index.js",
950
+ module: "lib/ngw-connector.esm-bundler.js",
951
+ unpkg: "lib/ngw-connector.global.prod.js",
952
+ jsdelivr: "lib/ngw-connector.global.prod.js",
953
+ types: "lib/index.d.ts",
954
+ dependencies: {
955
+ "@nextgis/cache": "^3.0.0-alpha.3",
956
+ "@nextgis/cancelable-promise": "^3.0.0-alpha.3",
957
+ "@nextgis/utils": "^3.0.0-alpha.3",
958
+ "@types/events": "^3.0.0",
959
+ events: "*",
960
+ "form-data": "^4.0.0"
961
+ },
962
+ devDependencies: {
963
+ "@nextgis/build-tools": "^3.0.0-alpha.3"
964
+ },
965
+ scripts: {
966
+ clean: "rimraf ./lib",
967
+ dev: "node ../build-tools/lib/build.js",
968
+ prod: "npm run dev -- --release",
969
+ lint: "eslint ./src/**/*.ts --fix --c ../../.eslintrc",
970
+ watch: "npm run dev -- --watch",
971
+ "gen:types": "node ./scripts/generator"
972
+ },
973
+ buildOptions: {
974
+ name: "NgwConnector",
975
+ formats: [
976
+ "esm-bundler",
977
+ "esm-browser",
978
+ "cjs",
979
+ "global"
980
+ ]
981
+ },
982
+ keywords: [
983
+ "NextGIS",
984
+ "MAP"
985
+ ],
986
+ author: "NextGIS",
987
+ files: [
988
+ "index.js",
989
+ "lib"
990
+ ],
991
+ license: "MIT",
992
+ homepage: "https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-connector#readme",
993
+ repository: {
994
+ type: "git",
995
+ url: "git://github.com/nextgis/nextgis_frontend.git"
996
+ },
997
+ gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
998
+ };
999
+
944
1000
  var __defProp$J = Object.defineProperty;
945
1001
  var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
946
1002
  var __publicField$u = (obj, key, value) => __defNormalProp$J(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1567,6 +1623,7 @@ var NgwMap = (function (exports) {
1567
1623
  __publicField$p(this, "resources");
1568
1624
  __publicField$p(this, "cache");
1569
1625
  __publicField$p(this, "withCredentials");
1626
+ __publicField$p(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1570
1627
  __publicField$p(this, "routeStr", "/api/component/pyramid/route");
1571
1628
  __publicField$p(this, "activeRequests", {});
1572
1629
  __publicField$p(this, "requestTransform");
@@ -1637,8 +1694,9 @@ var NgwMap = (function (exports) {
1637
1694
  yield this._login({ login, password });
1638
1695
  }
1639
1696
  }
1697
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1640
1698
  return yield this.makeQuery(
1641
- this.routeStr,
1699
+ routeUrl,
1642
1700
  {},
1643
1701
  {
1644
1702
  cacheName: "route",
@@ -1705,8 +1763,7 @@ var NgwMap = (function (exports) {
1705
1763
  credentials = credentials || this.options.auth;
1706
1764
  if (credentials) {
1707
1765
  const { login, password } = credentials;
1708
- const str = `${login}:${password}`;
1709
- const encodedStr = encodeURIComponent(str);
1766
+ const encodedStr = [login, password].map(encodeURIComponent).join(":");
1710
1767
  {
1711
1768
  return window.btoa(encodedStr);
1712
1769
  }
@@ -2209,7 +2266,7 @@ var NgwMap = (function (exports) {
2209
2266
  if (extensionsStr !== "*") {
2210
2267
  params.extensions = extensionsStr;
2211
2268
  }
2212
- if (fields !== void 0) {
2269
+ if (fields !== void 0 && fields !== null) {
2213
2270
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2214
2271
  }
2215
2272
  if (geom !== void 0) {