@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
  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.0; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.2; 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.2",
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.1",
908
+ "@nextgis/cancelable-promise": "^3.0.0-alpha.1",
909
+ "@nextgis/utils": "^3.0.0-alpha.1",
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.1"
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);
@@ -1518,6 +1574,8 @@ var Geocoder = (function (exports) {
1518
1574
  __publicField$2(this, "user");
1519
1575
  __publicField$2(this, "resources");
1520
1576
  __publicField$2(this, "cache");
1577
+ __publicField$2(this, "withCredentials");
1578
+ __publicField$2(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
1521
1579
  __publicField$2(this, "routeStr", "/api/component/pyramid/route");
1522
1580
  __publicField$2(this, "activeRequests", {});
1523
1581
  __publicField$2(this, "requestTransform");
@@ -1526,11 +1584,15 @@ var Geocoder = (function (exports) {
1526
1584
  if (exist) {
1527
1585
  return exist;
1528
1586
  } else {
1529
- if (this.options.route) {
1530
- this.routeStr = this.options.route;
1587
+ const { route, requestTransform, withCredentials } = this.options;
1588
+ if (route) {
1589
+ this.routeStr = route;
1590
+ }
1591
+ if (requestTransform) {
1592
+ this.requestTransform = requestTransform;
1531
1593
  }
1532
- if (this.options.requestTransform) {
1533
- this.requestTransform = this.options.requestTransform;
1594
+ if (withCredentials !== void 0) {
1595
+ this.withCredentials = withCredentials;
1534
1596
  }
1535
1597
  this.resources = new ResourcesControl({
1536
1598
  connector: this,
@@ -1584,8 +1646,9 @@ var Geocoder = (function (exports) {
1584
1646
  yield this._login({ login, password });
1585
1647
  }
1586
1648
  }
1649
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
1587
1650
  return yield this.makeQuery(
1588
- this.routeStr,
1651
+ routeUrl,
1589
1652
  {},
1590
1653
  {
1591
1654
  cacheName: "route",
@@ -1804,6 +1867,7 @@ var Geocoder = (function (exports) {
1804
1867
  url = template(url, restParams);
1805
1868
  }
1806
1869
  url = encodeURI(fixUrlStr(url));
1870
+ options = __spreadValues$3({ withCredentials: this.withCredentials }, options);
1807
1871
  const {
1808
1872
  cache,
1809
1873
  signal: externalSignal,
@@ -2121,7 +2185,7 @@ var Geocoder = (function (exports) {
2121
2185
  if (extensionsStr !== "*") {
2122
2186
  params.extensions = extensionsStr;
2123
2187
  }
2124
- if (fields !== void 0) {
2188
+ if (fields !== void 0 && fields !== null) {
2125
2189
  params.fields = Array.isArray(fields) ? fields.join(",") : "";
2126
2190
  }
2127
2191
  if (geom !== void 0) {