@nextgis/geocoder 2.5.0 → 2.5.2

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: 2.5.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 2.5.2; author: NextGIS */
2
2
  import CancelablePromise from '@nextgis/cancelable-promise';
3
3
  import { objectAssign, fixUrlStr } from '@nextgis/utils';
4
4
  import NgwConnector from '@nextgis/ngw-connector';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 2.5.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 2.5.2; author: NextGIS */
2
2
  var Geocoder = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1208,6 +1208,62 @@ var Geocoder = (function (exports) {
1208
1208
  __publicField$8(_Cache, "instance", {});
1209
1209
  let Cache = _Cache;
1210
1210
 
1211
+ var pkg = {
1212
+ name: "@nextgis/ngw-connector",
1213
+ version: "2.5.2",
1214
+ _priority: 12,
1215
+ description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1216
+ main: "index.js",
1217
+ module: "lib/ngw-connector.esm-bundler.js",
1218
+ unpkg: "lib/ngw-connector.global.prod.js",
1219
+ jsdelivr: "lib/ngw-connector.global.prod.js",
1220
+ types: "lib/index.d.ts",
1221
+ dependencies: {
1222
+ "@nextgis/cache": "^2.5.0",
1223
+ "@nextgis/cancelable-promise": "^2.5.0",
1224
+ "@nextgis/utils": "^2.5.0",
1225
+ "@types/events": "^3.0.0",
1226
+ events: "*",
1227
+ "form-data": "^4.0.0"
1228
+ },
1229
+ devDependencies: {
1230
+ "@nextgis/build-tools": "^2.5.0"
1231
+ },
1232
+ scripts: {
1233
+ clean: "rimraf ./lib",
1234
+ dev: "node ../build-tools/lib/build.js",
1235
+ prod: "npm run dev -- --release",
1236
+ lint: "eslint ./src/**/*.ts --fix --c ../../.eslintrc",
1237
+ watch: "npm run dev -- --watch",
1238
+ "gen:types": "node ./scripts/generator"
1239
+ },
1240
+ buildOptions: {
1241
+ name: "NgwConnector",
1242
+ formats: [
1243
+ "esm-bundler",
1244
+ "esm-browser",
1245
+ "cjs",
1246
+ "global"
1247
+ ]
1248
+ },
1249
+ keywords: [
1250
+ "NextGIS",
1251
+ "MAP"
1252
+ ],
1253
+ author: "NextGIS",
1254
+ files: [
1255
+ "index.js",
1256
+ "lib"
1257
+ ],
1258
+ license: "MIT",
1259
+ homepage: "https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-connector#readme",
1260
+ repository: {
1261
+ type: "git",
1262
+ url: "git://github.com/nextgis/nextgis_frontend.git"
1263
+ },
1264
+ gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
1265
+ };
1266
+
1211
1267
  var __defProp$9 = Object.defineProperty;
1212
1268
  var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1213
1269
  var __publicField$7 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1786,6 +1842,7 @@ var Geocoder = (function (exports) {
1786
1842
  __publicField$2(this, "resources");
1787
1843
  __publicField$2(this, "cache");
1788
1844
  __publicField$2(this, "withCredentials");
1845
+ __publicField$2(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1789
1846
  __publicField$2(this, "routeStr", "/api/component/pyramid/route");
1790
1847
  __publicField$2(this, "activeRequests", []);
1791
1848
  __publicField$2(this, "requestTransform");
@@ -1851,7 +1908,8 @@ var Geocoder = (function (exports) {
1851
1908
  const auth = this.options.auth;
1852
1909
  const makeConnect = () => new CancelablePromise((resolve, reject) => {
1853
1910
  const makeQuery = () => {
1854
- return this.makeQuery(this.routeStr, {}, {}).then((route) => {
1911
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1912
+ return this.makeQuery(routeUrl.toString(), {}, {}).then((route) => {
1855
1913
  resolve(route);
1856
1914
  }).catch((er) => {
1857
1915
  reject(er);
@@ -1924,9 +1982,9 @@ var Geocoder = (function (exports) {
1924
1982
  credentials = credentials || this.options.auth;
1925
1983
  if (credentials) {
1926
1984
  const { login, password } = credentials;
1927
- const str = unescape(encodeURIComponent(`${login}:${password}`));
1985
+ const encodedStr = [login, password].map(encodeURIComponent).join(":");
1928
1986
  {
1929
- return window.btoa(str);
1987
+ return window.btoa(encodedStr);
1930
1988
  }
1931
1989
  }
1932
1990
  }
@@ -2342,7 +2400,7 @@ var Geocoder = (function (exports) {
2342
2400
  if (extensionsStr !== "*") {
2343
2401
  params.extensions = extensionsStr;
2344
2402
  }
2345
- if (fields !== void 0) {
2403
+ if (fields !== void 0 && fields !== null) {
2346
2404
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2347
2405
  }
2348
2406
  if (geom !== void 0) {