@nextgis/geocoder 3.0.0-alpha.8 → 3.0.0

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.
package/lib/index.d.ts CHANGED
@@ -1,22 +1,8 @@
1
1
  import { LngLatBoundsArray, LngLatArray } from '@nextgis/utils';
2
2
  import { GeoJsonObject } from 'geojson';
3
- import NgwConnector, { FeatureItem, ResourceItem, NgwConnectorOptions } from '@nextgis/ngw-connector';
3
+ import NgwConnector, { FeatureItem, NgwConnectorOptions } from '@nextgis/ngw-connector';
4
4
  import { FetchNgwItemsOptions } from '@nextgis/ngw-kit';
5
-
6
- interface ResultItem {
7
- /**
8
- * Display text of the result item.
9
- */
10
- text: string;
11
- /**
12
- * Bounding box of the result item in [west, south, east, north] format.
13
- */
14
- extent: LngLatBoundsArray;
15
- /**
16
- * Optional GeoJSON geometry associated with this result item.
17
- */
18
- geom?: GeoJsonObject;
19
- }
5
+ import { CompositeRead } from '@nextgisweb/resource/type/api';
20
6
 
21
7
  /**
22
8
  * Options for initializing a basic search provider.
@@ -52,6 +38,21 @@ declare abstract class BaseProvider<O extends BaseProviderOptions = BaseProvider
52
38
  label?: string;
53
39
  }
54
40
 
41
+ interface ResultItem {
42
+ /**
43
+ * Display text of the result item.
44
+ */
45
+ text: string;
46
+ /**
47
+ * Bounding box of the result item in [west, south, east, north] format.
48
+ */
49
+ extent: LngLatBoundsArray;
50
+ /**
51
+ * Optional GeoJSON geometry associated with this result item.
52
+ */
53
+ geom?: GeoJsonObject;
54
+ }
55
+
55
56
  interface SearchItem {
56
57
  /**
57
58
  * A dynamic property bucket for the `SearchItem`.
@@ -165,7 +166,7 @@ interface NgwSearchItem extends SearchItem {
165
166
  /** The specific feature item from NGW */
166
167
  item: FeatureItem;
167
168
  /** The NGW resource item */
168
- resourceItem: ResourceItem;
169
+ resourceItem: CompositeRead;
169
170
  }
170
171
  /**
171
172
  * Defines the structure for a rendered search item.
@@ -174,7 +175,7 @@ interface RenderSearchItem {
174
175
  /** The specific feature item */
175
176
  item: FeatureItem;
176
177
  /** The NGW resource item */
177
- resourceItem: ResourceItem;
178
+ resourceItem: CompositeRead;
178
179
  }
179
180
  /**
180
181
  * Options for searching within a NGW resource.
@@ -210,10 +211,28 @@ declare class NgwProvider extends BaseProvider<NgwProviderOptions> {
210
211
  private _items;
211
212
  }
212
213
 
213
- declare class NominatimProvider extends BaseProvider {
214
+ /**
215
+ * Nominatim based options {@link https://nominatim.org/release-docs/latest/api/Search}
216
+ */
217
+ interface NominatimProviderOptions extends BaseProviderOptions {
218
+ /** Browser language string */
219
+ language?: string;
220
+ /** Comma-separated list of country codes {}*/
221
+ countrycodes?: string;
222
+ /** Limit the number of search results */
223
+ limit?: number;
224
+ /** Include address details in the results */
225
+ addressdetails?: boolean;
226
+ /** Restrict the results to the specified viewbox */
227
+ bounded?: boolean;
228
+ /** Focuses the search on the given area [minLon, minLat, maxLon, maxLat] */
229
+ viewbox?: [number, number, number, number];
230
+ }
231
+ declare class NominatimProvider extends BaseProvider<NominatimProviderOptions> implements NominatimProviderOptions {
232
+ options?: NominatimProviderOptions | undefined;
214
233
  searchUrl: string;
215
- private _abort;
216
- constructor(options?: BaseProviderOptions);
234
+ private _abortControllers;
235
+ constructor(options?: NominatimProviderOptions | undefined);
217
236
  abort(): void;
218
237
  search(val: string): AsyncGenerator<SearchItem, void, unknown>;
219
238
  result(model: SearchItem): Promise<ResultItem>;
@@ -222,4 +241,5 @@ declare class NominatimProvider extends BaseProvider {
222
241
 
223
242
  declare function create(options: GeocoderOptions): Geocoder;
224
243
 
225
- export { BaseProvider, type BaseProviderOptions, Geocoder, type GeocoderOptions, NgwProvider, NominatimProvider, type ResultItem, type SearchItem, create };
244
+ export { BaseProvider, Geocoder, NgwProvider, NominatimProvider, create };
245
+ export type { BaseProviderOptions, GeocoderOptions, ResultItem, SearchItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextgis/geocoder",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "lib/geocoder.esm-bundler.js",
@@ -8,16 +8,16 @@
8
8
  "jsdelivr": "lib/geocoder.global.prod.js",
9
9
  "types": "lib/index.d.ts",
10
10
  "dependencies": {
11
- "@nextgis/cancelable-promise": "^3.0.0-alpha.5",
12
- "@nextgis/ngw-connector": "^3.0.0-alpha.8",
13
- "@nextgis/ngw-kit": "^3.0.0-alpha.8",
14
- "@nextgis/utils": "^3.0.0-alpha.5",
11
+ "@nextgis/cancelable-promise": "3.0.0",
12
+ "@nextgis/ngw-connector": "3.0.0",
13
+ "@nextgis/ngw-kit": "3.0.0",
14
+ "@nextgis/utils": "3.0.0",
15
15
  "@types/events": "^3.0.0",
16
16
  "@types/geojson": "^7946.0.14",
17
17
  "events": "*"
18
18
  },
19
19
  "devDependencies": {
20
- "@nextgis/build-tools": "^3.0.0-alpha.5"
20
+ "@nextgis/build-tools": "3.0.0"
21
21
  },
22
22
  "buildOptions": {
23
23
  "name": "Geocoder",
@@ -53,5 +53,5 @@
53
53
  "bugs": {
54
54
  "url": "https://github.com/nextgis/nextgis_frontend/issues"
55
55
  },
56
- "gitHead": "ef384211e9024fbf72594c5d34a5c2c554534b2c"
56
+ "gitHead": "9a06597ef6f097f255ff52843c96375247a5e064"
57
57
  }