@nextgis/geocoder 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/geocoder; version: 3.0.0-alpha.1; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.3; author: NextGIS */
2
2
  import { objectAssign, fixUrlStr } from '@nextgis/utils';
3
3
  import NgwConnector from '@nextgis/ngw-connector';
4
4
  import { fetchNgwLayerItems } from '@nextgis/ngw-kit';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.1; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.3; author: NextGIS */
2
2
  var Geocoder = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -893,6 +893,62 @@ var Geocoder = (function (exports) {
893
893
  __publicField$8(_Cache, "instance", {});
894
894
  let Cache = _Cache;
895
895
 
896
+ var pkg = {
897
+ name: "@nextgis/ngw-connector",
898
+ version: "3.0.0-alpha.3",
899
+ _priority: 12,
900
+ description: "A lightweight HTTP client optimized for use with NextGIS Web API",
901
+ main: "index.js",
902
+ module: "lib/ngw-connector.esm-bundler.js",
903
+ unpkg: "lib/ngw-connector.global.prod.js",
904
+ jsdelivr: "lib/ngw-connector.global.prod.js",
905
+ types: "lib/index.d.ts",
906
+ dependencies: {
907
+ "@nextgis/cache": "^3.0.0-alpha.3",
908
+ "@nextgis/cancelable-promise": "^3.0.0-alpha.3",
909
+ "@nextgis/utils": "^3.0.0-alpha.3",
910
+ "@types/events": "^3.0.0",
911
+ events: "*",
912
+ "form-data": "^4.0.0"
913
+ },
914
+ devDependencies: {
915
+ "@nextgis/build-tools": "^3.0.0-alpha.3"
916
+ },
917
+ scripts: {
918
+ clean: "rimraf ./lib",
919
+ dev: "node ../build-tools/lib/build.js",
920
+ prod: "npm run dev -- --release",
921
+ lint: "eslint ./src/**/*.ts --fix --c ../../.eslintrc",
922
+ watch: "npm run dev -- --watch",
923
+ "gen:types": "node ./scripts/generator"
924
+ },
925
+ buildOptions: {
926
+ name: "NgwConnector",
927
+ formats: [
928
+ "esm-bundler",
929
+ "esm-browser",
930
+ "cjs",
931
+ "global"
932
+ ]
933
+ },
934
+ keywords: [
935
+ "NextGIS",
936
+ "MAP"
937
+ ],
938
+ author: "NextGIS",
939
+ files: [
940
+ "index.js",
941
+ "lib"
942
+ ],
943
+ license: "MIT",
944
+ homepage: "https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-connector#readme",
945
+ repository: {
946
+ type: "git",
947
+ url: "git://github.com/nextgis/nextgis_frontend.git"
948
+ },
949
+ gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
950
+ };
951
+
896
952
  var __defProp$a = Object.defineProperty;
897
953
  var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
898
954
  var __publicField$7 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1519,6 +1575,7 @@ var Geocoder = (function (exports) {
1519
1575
  __publicField$2(this, "resources");
1520
1576
  __publicField$2(this, "cache");
1521
1577
  __publicField$2(this, "withCredentials");
1578
+ __publicField$2(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1522
1579
  __publicField$2(this, "routeStr", "/api/component/pyramid/route");
1523
1580
  __publicField$2(this, "activeRequests", {});
1524
1581
  __publicField$2(this, "requestTransform");
@@ -1589,8 +1646,9 @@ var Geocoder = (function (exports) {
1589
1646
  yield this._login({ login, password });
1590
1647
  }
1591
1648
  }
1649
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1592
1650
  return yield this.makeQuery(
1593
- this.routeStr,
1651
+ routeUrl,
1594
1652
  {},
1595
1653
  {
1596
1654
  cacheName: "route",
@@ -1657,8 +1715,7 @@ var Geocoder = (function (exports) {
1657
1715
  credentials = credentials || this.options.auth;
1658
1716
  if (credentials) {
1659
1717
  const { login, password } = credentials;
1660
- const str = `${login}:${password}`;
1661
- const encodedStr = encodeURIComponent(str);
1718
+ const encodedStr = [login, password].map(encodeURIComponent).join(":");
1662
1719
  {
1663
1720
  return window.btoa(encodedStr);
1664
1721
  }
@@ -2127,7 +2184,7 @@ var Geocoder = (function (exports) {
2127
2184
  if (extensionsStr !== "*") {
2128
2185
  params.extensions = extensionsStr;
2129
2186
  }
2130
- if (fields !== void 0) {
2187
+ if (fields !== void 0 && fields !== null) {
2131
2188
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2132
2189
  }
2133
2190
  if (geom !== void 0) {