@nextgis/geocoder 3.0.0-alpha.0 → 3.0.0-alpha.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: 3.0.0-alpha.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.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/geocoder; version: 3.0.0-alpha.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.2; author: NextGIS */
2
2
  function defined(val) {
3
3
  return val !== void 0 && val !== null;
4
4
  }
@@ -890,6 +890,62 @@ const _Cache = class _Cache {
890
890
  __publicField$8(_Cache, "instance", {});
891
891
  let Cache = _Cache;
892
892
 
893
+ var pkg = {
894
+ name: "@nextgis/ngw-connector",
895
+ version: "3.0.0-alpha.2",
896
+ _priority: 12,
897
+ description: "A lightweight HTTP client optimized for use with NextGIS Web API",
898
+ main: "index.js",
899
+ module: "lib/ngw-connector.esm-bundler.js",
900
+ unpkg: "lib/ngw-connector.global.prod.js",
901
+ jsdelivr: "lib/ngw-connector.global.prod.js",
902
+ types: "lib/index.d.ts",
903
+ dependencies: {
904
+ "@nextgis/cache": "^3.0.0-alpha.1",
905
+ "@nextgis/cancelable-promise": "^3.0.0-alpha.1",
906
+ "@nextgis/utils": "^3.0.0-alpha.1",
907
+ "@types/events": "^3.0.0",
908
+ events: "*",
909
+ "form-data": "^4.0.0"
910
+ },
911
+ devDependencies: {
912
+ "@nextgis/build-tools": "^3.0.0-alpha.1"
913
+ },
914
+ scripts: {
915
+ clean: "rimraf ./lib",
916
+ dev: "node ../build-tools/lib/build.js",
917
+ prod: "npm run dev -- --release",
918
+ lint: "eslint ./src/**/*.ts --fix --c ../../.eslintrc",
919
+ watch: "npm run dev -- --watch",
920
+ "gen:types": "node ./scripts/generator"
921
+ },
922
+ buildOptions: {
923
+ name: "NgwConnector",
924
+ formats: [
925
+ "esm-bundler",
926
+ "esm-browser",
927
+ "cjs",
928
+ "global"
929
+ ]
930
+ },
931
+ keywords: [
932
+ "NextGIS",
933
+ "MAP"
934
+ ],
935
+ author: "NextGIS",
936
+ files: [
937
+ "index.js",
938
+ "lib"
939
+ ],
940
+ license: "MIT",
941
+ homepage: "https://github.com/nextgis/nextgis_frontend/tree/master/packages/ngw-connector#readme",
942
+ repository: {
943
+ type: "git",
944
+ url: "git://github.com/nextgis/nextgis_frontend.git"
945
+ },
946
+ gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
947
+ };
948
+
893
949
  var __defProp$a = Object.defineProperty;
894
950
  var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
895
951
  var __publicField$7 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1515,6 +1571,8 @@ class NgwConnector {
1515
1571
  __publicField$2(this, "user");
1516
1572
  __publicField$2(this, "resources");
1517
1573
  __publicField$2(this, "cache");
1574
+ __publicField$2(this, "withCredentials");
1575
+ __publicField$2(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1518
1576
  __publicField$2(this, "routeStr", "/api/component/pyramid/route");
1519
1577
  __publicField$2(this, "activeRequests", {});
1520
1578
  __publicField$2(this, "requestTransform");
@@ -1523,11 +1581,15 @@ class NgwConnector {
1523
1581
  if (exist) {
1524
1582
  return exist;
1525
1583
  } else {
1526
- if (this.options.route) {
1527
- this.routeStr = this.options.route;
1584
+ const { route, requestTransform, withCredentials } = this.options;
1585
+ if (route) {
1586
+ this.routeStr = route;
1587
+ }
1588
+ if (requestTransform) {
1589
+ this.requestTransform = requestTransform;
1528
1590
  }
1529
- if (this.options.requestTransform) {
1530
- this.requestTransform = this.options.requestTransform;
1591
+ if (withCredentials !== void 0) {
1592
+ this.withCredentials = withCredentials;
1531
1593
  }
1532
1594
  this.resources = new ResourcesControl({
1533
1595
  connector: this,
@@ -1581,8 +1643,9 @@ class NgwConnector {
1581
1643
  yield this._login({ login, password });
1582
1644
  }
1583
1645
  }
1646
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1584
1647
  return yield this.makeQuery(
1585
- this.routeStr,
1648
+ routeUrl,
1586
1649
  {},
1587
1650
  {
1588
1651
  cacheName: "route",
@@ -1801,6 +1864,7 @@ class NgwConnector {
1801
1864
  url = template(url, restParams);
1802
1865
  }
1803
1866
  url = encodeURI(fixUrlStr(url));
1867
+ options = __spreadValues$3({ withCredentials: this.withCredentials }, options);
1804
1868
  const {
1805
1869
  cache,
1806
1870
  signal: externalSignal,
@@ -2118,7 +2182,7 @@ function updateItemRequestParam(params, options) {
2118
2182
  if (extensionsStr !== "*") {
2119
2183
  params.extensions = extensionsStr;
2120
2184
  }
2121
- if (fields !== void 0) {
2185
+ if (fields !== void 0 && fields !== null) {
2122
2186
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2123
2187
  }
2124
2188
  if (geom !== void 0) {