@nextgis/ngw-map 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/ngw-map; version: 2.5.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.5.2; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { getIcon } from '@nextgis/icons';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 2.5.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.5.2; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1256,6 +1256,62 @@ var NgwMap = (function (exports) {
1256
1256
  __publicField$v(_Cache, "instance", {});
1257
1257
  let Cache = _Cache;
1258
1258
 
1259
+ var pkg = {
1260
+ name: "@nextgis/ngw-connector",
1261
+ version: "2.5.2",
1262
+ _priority: 12,
1263
+ description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1264
+ main: "index.js",
1265
+ module: "lib/ngw-connector.esm-bundler.js",
1266
+ unpkg: "lib/ngw-connector.global.prod.js",
1267
+ jsdelivr: "lib/ngw-connector.global.prod.js",
1268
+ types: "lib/index.d.ts",
1269
+ dependencies: {
1270
+ "@nextgis/cache": "^2.5.0",
1271
+ "@nextgis/cancelable-promise": "^2.5.0",
1272
+ "@nextgis/utils": "^2.5.0",
1273
+ "@types/events": "^3.0.0",
1274
+ events: "*",
1275
+ "form-data": "^4.0.0"
1276
+ },
1277
+ devDependencies: {
1278
+ "@nextgis/build-tools": "^2.5.0"
1279
+ },
1280
+ scripts: {
1281
+ clean: "rimraf ./lib",
1282
+ dev: "node ../build-tools/lib/build.js",
1283
+ prod: "npm run dev -- --release",
1284
+ lint: "eslint ./src/**/*.ts --fix --c ../../.eslintrc",
1285
+ watch: "npm run dev -- --watch",
1286
+ "gen:types": "node ./scripts/generator"
1287
+ },
1288
+ buildOptions: {
1289
+ name: "NgwConnector",
1290
+ formats: [
1291
+ "esm-bundler",
1292
+ "esm-browser",
1293
+ "cjs",
1294
+ "global"
1295
+ ]
1296
+ },
1297
+ keywords: [
1298
+ "NextGIS",
1299
+ "MAP"
1300
+ ],
1301
+ author: "NextGIS",
1302
+ files: [
1303
+ "index.js",
1304
+ "lib"
1305
+ ],
1306
+ license: "MIT",
1307
+ homepage: "https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-connector#readme",
1308
+ repository: {
1309
+ type: "git",
1310
+ url: "git://github.com/nextgis/nextgis_frontend.git"
1311
+ },
1312
+ gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
1313
+ };
1314
+
1259
1315
  var __defProp$I = Object.defineProperty;
1260
1316
  var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1261
1317
  var __publicField$u = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1834,6 +1890,7 @@ var NgwMap = (function (exports) {
1834
1890
  __publicField$p(this, "resources");
1835
1891
  __publicField$p(this, "cache");
1836
1892
  __publicField$p(this, "withCredentials");
1893
+ __publicField$p(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1837
1894
  __publicField$p(this, "routeStr", "/api/component/pyramid/route");
1838
1895
  __publicField$p(this, "activeRequests", []);
1839
1896
  __publicField$p(this, "requestTransform");
@@ -1899,7 +1956,8 @@ var NgwMap = (function (exports) {
1899
1956
  const auth = this.options.auth;
1900
1957
  const makeConnect = () => new CancelablePromise((resolve, reject) => {
1901
1958
  const makeQuery = () => {
1902
- return this.makeQuery(this.routeStr, {}, {}).then((route) => {
1959
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1960
+ return this.makeQuery(routeUrl.toString(), {}, {}).then((route) => {
1903
1961
  resolve(route);
1904
1962
  }).catch((er) => {
1905
1963
  reject(er);
@@ -1972,9 +2030,9 @@ var NgwMap = (function (exports) {
1972
2030
  credentials = credentials || this.options.auth;
1973
2031
  if (credentials) {
1974
2032
  const { login, password } = credentials;
1975
- const str = unescape(encodeURIComponent(`${login}:${password}`));
2033
+ const encodedStr = [login, password].map(encodeURIComponent).join(":");
1976
2034
  {
1977
- return window.btoa(str);
2035
+ return window.btoa(encodedStr);
1978
2036
  }
1979
2037
  }
1980
2038
  }
@@ -2424,7 +2482,7 @@ var NgwMap = (function (exports) {
2424
2482
  if (extensionsStr !== "*") {
2425
2483
  params.extensions = extensionsStr;
2426
2484
  }
2427
- if (fields !== void 0) {
2485
+ if (fields !== void 0 && fields !== null) {
2428
2486
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2429
2487
  }
2430
2488
  if (geom !== void 0) {