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