@tomtom-org/maps-sdk 0.58.0 → 0.59.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/CHANGELOG.md +133 -0
- package/README.md +2 -1
- package/THIRD_PARTY.txt +1 -1
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +38 -76
- package/map/dist/index.d.ts +9709 -9435
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +1 -1
- package/package.json +2 -2
- package/services/dist/THIRD_PARTY.txt +35 -0
- package/services/dist/index.d.ts +393 -534
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
- package/services/dist/third-party.json +11 -0
- package/services/package.json +2 -1
package/services/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressProperties, AreaAnalyticsMetricKey, Avoidable, ChargingPark, ChargingParkWithAvailability, ChargingStation, ChargingStationsAccessType, ChargingStationsAvailability, ChargingStopProps, CommonPlaceProps, Connector, ConnectorType, CurrentType, EVChargingStationWithAvailabilityPlaceProps, EntryPoint, Fuel, GeographyType, GetPositionEntryPointOption, GlobalConfig, HasBBox, HasLngLat, MapcodeType, OpeningHours, OpeningHoursMode, POICategory, Place, PlaceType, Places, PlugType, PolygonFeature, PolygonFeatures, RevGeoAddressProps, RoadShieldReference, Route, RoutePlanningLocation, Routes, SearchPlaceProps, TimeZone, TomTomAPIHeaders, TomTomHeaders, TrafficAreaAnalytics, TrafficIncidentDetails, TrafficIncidentRequestCategory, TrafficIncidentTEC, TrafficIncidentTimeValidity, TravelMode, View, inputSectionTypes } from "@tomtom-org/maps-sdk/core";
|
|
1
|
+
import { AddressProperties, AreaAnalyticsMetricKey, Avoidable, ChargingPark, ChargingParkWithAvailability, ChargingPoint, ChargingStation, ChargingStationsAccessType, ChargingStationsAvailability, ChargingStopProps, CommonPlaceProps, Connector, ConnectorType, CurrentType, EVChargingStationWithAvailabilityPlaceProps, EntryPoint, Fuel, GeographyType, GetPositionEntryPointOption, GlobalConfig, HasBBox, HasLngLat, MapcodeType, OpeningHours, OpeningHoursMode, POICategory, Place, PlaceType, Places, PlugType, PolygonFeature, PolygonFeatures, RevGeoAddressProps, RoadShieldReference, Route, RoutePlanningLocation, Routes, SearchPlaceProps, StaticChargingPoint, TimeZone, TomTomAPIHeaders, TomTomHeaders, TrafficAreaAnalytics, TrafficIncidentDetails, TrafficIncidentRequestCategory, TrafficIncidentTEC, TrafficIncidentTimeValidity, TravelMode, View, inputSectionTypes } from "@tomtom-org/maps-sdk/core";
|
|
2
2
|
import { ZodError, ZodIssue, ZodObject } from "zod";
|
|
3
3
|
//#region ../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
|
|
4
4
|
/**
|
|
@@ -285,7 +285,7 @@ type RequestValidationConfig<Params = any> = {
|
|
|
285
285
|
*
|
|
286
286
|
* @remarks
|
|
287
287
|
* This type extends the global configuration and provides additional service-specific options
|
|
288
|
-
* such as
|
|
288
|
+
* such as request validation, cancellation, and lifecycle event listeners.
|
|
289
289
|
*
|
|
290
290
|
* @typeParam ApiRequest - The type of the API request object
|
|
291
291
|
* @typeParam ApiResponse - The type of the API response object
|
|
@@ -293,20 +293,6 @@ type RequestValidationConfig<Params = any> = {
|
|
|
293
293
|
* @group Shared
|
|
294
294
|
*/
|
|
295
295
|
export type CommonServiceParams<ApiRequest = any, ApiResponse = any> = Partial<GlobalConfig> & {
|
|
296
|
-
/**
|
|
297
|
-
* Custom base URL for the service endpoint.
|
|
298
|
-
*
|
|
299
|
-
* @remarks
|
|
300
|
-
* Should contain the URL up to the part that changes per service call.
|
|
301
|
-
*
|
|
302
|
-
* @example
|
|
303
|
-
* ```ts
|
|
304
|
-
* customServiceBaseURL: 'https://api.tomtom.com/search/10/reverseGeocode/'
|
|
305
|
-
* ```
|
|
306
|
-
*
|
|
307
|
-
* @defaultValue `undefined` (uses default service URL)
|
|
308
|
-
*/
|
|
309
|
-
customServiceBaseURL?: string;
|
|
310
296
|
/**
|
|
311
297
|
* Controls whether input request schema validation is performed.
|
|
312
298
|
*
|
|
@@ -349,20 +335,11 @@ export type CommonServiceParams<ApiRequest = any, ApiResponse = any> = Partial<G
|
|
|
349
335
|
* Compose signals to add a deadline: `AbortSignal.any([mine, AbortSignal.timeout(5000)])`.
|
|
350
336
|
*
|
|
351
337
|
* @example
|
|
352
|
-
*
|
|
338
|
+
* Keep only the latest search with {@link createLatestRequest}:
|
|
353
339
|
* ```ts
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* controller?.abort();
|
|
358
|
-
* controller = new AbortController();
|
|
359
|
-
* try {
|
|
360
|
-
* return await discoverPlaces({ query, signal: controller.signal });
|
|
361
|
-
* } catch (error) {
|
|
362
|
-
* if (error instanceof SDKAbortError) return;
|
|
363
|
-
* throw error;
|
|
364
|
-
* }
|
|
365
|
-
* };
|
|
340
|
+
* const latestSearch = createLatestRequest();
|
|
341
|
+
* const search = await latestSearch.run((signal) => discoverPlaces({ query, signal }));
|
|
342
|
+
* if (search.current) showResults(search.value);
|
|
366
343
|
* ```
|
|
367
344
|
*
|
|
368
345
|
* @defaultValue `undefined` (the request cannot be cancelled)
|
|
@@ -412,16 +389,11 @@ export type ServiceTemplate<Params extends CommonServiceParams<ApiRequest, ApiRe
|
|
|
412
389
|
*/
|
|
413
390
|
buildRequest: (params: Params) => ApiRequest;
|
|
414
391
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* @remarks
|
|
418
|
-
* Useful for services that require a specific API version different from the global configuration.
|
|
419
|
-
* If not provided, the API version from the global or provided configuration will be used.
|
|
392
|
+
* The API version the service calls. Callers cannot override it.
|
|
420
393
|
*
|
|
421
|
-
* @
|
|
422
|
-
* @returns The API version number
|
|
394
|
+
* @defaultValue 1
|
|
423
395
|
*/
|
|
424
|
-
|
|
396
|
+
apiVersion?: number;
|
|
425
397
|
/**
|
|
426
398
|
* Sends the constructed request to the API server.
|
|
427
399
|
*
|
|
@@ -558,12 +530,15 @@ export declare class SDKServiceError extends SDKError {
|
|
|
558
530
|
* the convention used by `fetch`, and the original abort reason — including a custom
|
|
559
531
|
* value passed to `AbortController.abort(reason)` — is available on `cause`.
|
|
560
532
|
*
|
|
533
|
+
* To drop a call a newer one supersedes without catching this error, run it through
|
|
534
|
+
* {@link createLatestRequest}.
|
|
535
|
+
*
|
|
561
536
|
* @example
|
|
562
537
|
* ```typescript
|
|
563
538
|
* try {
|
|
564
|
-
* await discoverPlaces({ query: 'cafe', signal:
|
|
539
|
+
* await discoverPlaces({ query: 'cafe', signal: AbortSignal.timeout(5000) });
|
|
565
540
|
* } catch (error) {
|
|
566
|
-
* if (error instanceof SDKAbortError) return
|
|
541
|
+
* if (error instanceof SDKAbortError) return showMessage('Search timed out');
|
|
567
542
|
* throw error;
|
|
568
543
|
* }
|
|
569
544
|
* ```
|
|
@@ -601,6 +576,78 @@ export declare const buildResponseError: (error: unknown, serviceName: ServiceNa
|
|
|
601
576
|
*/
|
|
602
577
|
export declare const buildValidationError: (error: ValidationError, serviceName: ServiceName) => SDKError;
|
|
603
578
|
//#endregion
|
|
579
|
+
//#region src/shared/types/latestRequest.d.ts
|
|
580
|
+
/**
|
|
581
|
+
* What {@link LatestRequest.run} resolves to.
|
|
582
|
+
*
|
|
583
|
+
* `current: false` means a newer `run` or a `cancel` retired the request, so its value — or its
|
|
584
|
+
* error — is stale and must not be shown.
|
|
585
|
+
*
|
|
586
|
+
* @group Shared
|
|
587
|
+
*/
|
|
588
|
+
export type LatestRequestResult<T> = {
|
|
589
|
+
current: true;
|
|
590
|
+
value: T;
|
|
591
|
+
} | {
|
|
592
|
+
current: false;
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* One in-flight request slot, where each new request retires the one before it.
|
|
596
|
+
*
|
|
597
|
+
* @see {@link createLatestRequest}
|
|
598
|
+
*
|
|
599
|
+
* @group Shared
|
|
600
|
+
*/
|
|
601
|
+
export type LatestRequest = {
|
|
602
|
+
/**
|
|
603
|
+
* Aborts the request in flight, if any, then starts this one.
|
|
604
|
+
*
|
|
605
|
+
* @remarks
|
|
606
|
+
* `request` is called synchronously with a fresh signal, which it passes to every service
|
|
607
|
+
* call it makes. A rejection is rethrown only while the request is still current, so a
|
|
608
|
+
* deadline of your own composed onto the signal still surfaces as an {@link SDKAbortError}.
|
|
609
|
+
*
|
|
610
|
+
* @param request - The work to run, typically one or more service calls sharing the signal
|
|
611
|
+
*/
|
|
612
|
+
run: <T>(request: (signal: AbortSignal) => Promise<T>) => Promise<LatestRequestResult<T>>;
|
|
613
|
+
/**
|
|
614
|
+
* Aborts the request in flight without starting another, so it resolves `{ current: false }`.
|
|
615
|
+
*/
|
|
616
|
+
cancel: () => void;
|
|
617
|
+
/**
|
|
618
|
+
* Whether a request is in flight and not yet retired.
|
|
619
|
+
*/
|
|
620
|
+
isRunning: () => boolean;
|
|
621
|
+
};
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/shared/latestRequest.d.ts
|
|
624
|
+
/**
|
|
625
|
+
* Creates a slot that keeps only the latest request: starting one aborts its predecessor, and an
|
|
626
|
+
* answer that arrives after a newer request or a `cancel` is dropped rather than returned.
|
|
627
|
+
*
|
|
628
|
+
* @remarks
|
|
629
|
+
* Use one per thing that can be superseded — a click lookup, a search box, a refetch on map move.
|
|
630
|
+
* Aborting stops the network work; checking again once the answer is in also catches a `cancel`
|
|
631
|
+
* that arrives after the response but before the caller paints it.
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```ts
|
|
635
|
+
* const lookup = createLatestRequest();
|
|
636
|
+
*
|
|
637
|
+
* map.mapLibreMap.on('click', async (event) => {
|
|
638
|
+
* const result = await lookup.run((signal) => reverseGeocode({ position: event.lngLat.toArray(), signal }));
|
|
639
|
+
* if (!result.current) return;
|
|
640
|
+
* showAddress(result.value);
|
|
641
|
+
* });
|
|
642
|
+
* clearButton.addEventListener('click', lookup.cancel);
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @see [Keeping only the latest request](https://docs.tomtom.com/maps-sdk-js/guides/services/request-options-and-errors#keeping-only-the-latest-request)
|
|
646
|
+
*
|
|
647
|
+
* @group Shared
|
|
648
|
+
*/
|
|
649
|
+
export declare const createLatestRequest: () => LatestRequest;
|
|
650
|
+
//#endregion
|
|
604
651
|
//#region src/shared/types/geoBias.d.ts
|
|
605
652
|
/**
|
|
606
653
|
* A point to search around, optionally bounded by a radius.
|
|
@@ -661,135 +708,6 @@ export type GeoBias = (PointGeoBias & {
|
|
|
661
708
|
radiusMeters?: never;
|
|
662
709
|
});
|
|
663
710
|
//#endregion
|
|
664
|
-
//#region src/shared/types/commonGeocodeAndFuzzySearchParams.d.ts
|
|
665
|
-
/**
|
|
666
|
-
* Common parameters shared between fuzzy search and geocoding services.
|
|
667
|
-
*
|
|
668
|
-
* These parameters control search behavior that applies to both fuzzy search
|
|
669
|
-
* and geocoding operations, including autocomplete mode, pagination, and geographic filtering.
|
|
670
|
-
*
|
|
671
|
-
* @remarks
|
|
672
|
-
* Used by:
|
|
673
|
-
* - {@link fuzzySearch}
|
|
674
|
-
* - {@link geocode}
|
|
675
|
-
*
|
|
676
|
-
* @group Places Search
|
|
677
|
-
*/
|
|
678
|
-
export type CommonGeocodeAndFuzzySearchParams = {
|
|
679
|
-
/**
|
|
680
|
-
* Enable predictive/autocomplete mode for partial input queries.
|
|
681
|
-
*
|
|
682
|
-
* When true, the query is treated as incomplete text being typed by a user,
|
|
683
|
-
* and the search returns suggestions that match the partial input.
|
|
684
|
-
*
|
|
685
|
-
* @remarks
|
|
686
|
-
* **Autocomplete Behavior:**
|
|
687
|
-
* - Optimized for real-time search-as-you-type
|
|
688
|
-
* - Returns results that start with or contain the query
|
|
689
|
-
* - Better for interactive search boxes
|
|
690
|
-
* - Lower result quality thresholds to show more options
|
|
691
|
-
*
|
|
692
|
-
* **Regular Search (false):**
|
|
693
|
-
* - Treats query as complete input
|
|
694
|
-
* - Higher quality thresholds
|
|
695
|
-
* - Better for final search submission
|
|
696
|
-
*
|
|
697
|
-
* @default false
|
|
698
|
-
*
|
|
699
|
-
* @example
|
|
700
|
-
* ```typescript
|
|
701
|
-
* // Autocomplete mode for "Amst" input
|
|
702
|
-
* typeahead: true // Returns: Amsterdam, Amstelveen, etc.
|
|
703
|
-
*
|
|
704
|
-
* // Regular search mode
|
|
705
|
-
* typeahead: false // Expects complete query
|
|
706
|
-
* ```
|
|
707
|
-
*/
|
|
708
|
-
typeahead?: boolean;
|
|
709
|
-
/**
|
|
710
|
-
* Starting position within the complete result set for pagination.
|
|
711
|
-
*
|
|
712
|
-
* Use with `limit` to implement pagination through large result sets.
|
|
713
|
-
* Zero-based index indicating which result to start from.
|
|
714
|
-
*
|
|
715
|
-
* @remarks
|
|
716
|
-
* **Pagination Pattern:**
|
|
717
|
-
* - Page 1: `offset: 0, limit: 10` (results 0-9)
|
|
718
|
-
* - Page 2: `offset: 10, limit: 10` (results 10-19)
|
|
719
|
-
* - Page 3: `offset: 20, limit: 10` (results 20-29)
|
|
720
|
-
*
|
|
721
|
-
* **Performance Note:**
|
|
722
|
-
* Very high offset values may have slower performance.
|
|
723
|
-
*
|
|
724
|
-
* @default 0
|
|
725
|
-
*
|
|
726
|
-
* @example
|
|
727
|
-
* ```typescript
|
|
728
|
-
* // First page
|
|
729
|
-
* offset: 0
|
|
730
|
-
*
|
|
731
|
-
* // Second page (assuming limit: 10)
|
|
732
|
-
* offset: 10
|
|
733
|
-
*
|
|
734
|
-
* // Third page
|
|
735
|
-
* offset: 20
|
|
736
|
-
* ```
|
|
737
|
-
*/
|
|
738
|
-
offset?: number;
|
|
739
|
-
/**
|
|
740
|
-
* Where to look: a point with an optional radius, or a bounding box.
|
|
741
|
-
*
|
|
742
|
-
* @remarks
|
|
743
|
-
* A point without `radiusMeters` biases the ranking; with one, or with a `boundingBox`, results
|
|
744
|
-
* are confined to that area. Leave it out to search without a geographic bias.
|
|
745
|
-
*
|
|
746
|
-
* @example
|
|
747
|
-
* ```typescript
|
|
748
|
-
* geoBias: { position: [4.9, 52.3], radiusMeters: 2000 }
|
|
749
|
-
* geoBias: { boundingBox: [4.8, 52.3, 5.0, 52.4] }
|
|
750
|
-
* ```
|
|
751
|
-
*/
|
|
752
|
-
geoBias?: GeoBias;
|
|
753
|
-
/**
|
|
754
|
-
* Restrict search to specific countries.
|
|
755
|
-
*
|
|
756
|
-
* Limits results to locations within the specified countries only.
|
|
757
|
-
* Useful for country-specific searches or compliance requirements.
|
|
758
|
-
*
|
|
759
|
-
* @remarks
|
|
760
|
-
* **Country Code Formats:**
|
|
761
|
-
* - ISO 3166-1 alpha-2: Two-letter codes (e.g., "US", "FR", "DE")
|
|
762
|
-
* - ISO 3166-1 alpha-3: Three-letter codes (e.g., "USA", "FRA", "DEU")
|
|
763
|
-
* - Can mix formats: `["US", "FRA", "DE"]`
|
|
764
|
-
*
|
|
765
|
-
* **Behavior:**
|
|
766
|
-
* - Multiple countries create OR condition (results from any listed country)
|
|
767
|
-
* - Case-insensitive
|
|
768
|
-
* - The `view` parameter may affect available countries
|
|
769
|
-
*
|
|
770
|
-
* **Use Cases:**
|
|
771
|
-
* - Regional applications (EU-only, North America-only)
|
|
772
|
-
* - Compliance with data sovereignty rules
|
|
773
|
-
* - Simplifying results for specific markets
|
|
774
|
-
*
|
|
775
|
-
* @example
|
|
776
|
-
* ```typescript
|
|
777
|
-
* // Single country (United States)
|
|
778
|
-
* countries: ['US']
|
|
779
|
-
*
|
|
780
|
-
* // Multiple countries (Europe)
|
|
781
|
-
* countries: ['FR', 'DE', 'NL', 'BE']
|
|
782
|
-
*
|
|
783
|
-
* // Mixed formats
|
|
784
|
-
* countries: ['US', 'GBR', 'CA']
|
|
785
|
-
*
|
|
786
|
-
* // North America
|
|
787
|
-
* countries: ['USA', 'CAN', 'MEX']
|
|
788
|
-
* ```
|
|
789
|
-
*/
|
|
790
|
-
countries?: string[];
|
|
791
|
-
};
|
|
792
|
-
//#endregion
|
|
793
711
|
//#region src/shared/types/commonPlacesParams.d.ts
|
|
794
712
|
/**
|
|
795
713
|
* Index representing the type of place data to search.
|
|
@@ -838,18 +756,11 @@ export type SearchIndexType = 'Geo' | 'PAD' | 'Addr' | 'Str' | 'XStr' | 'POI';
|
|
|
838
756
|
* **Key Features:**
|
|
839
757
|
* - Result limits and pagination
|
|
840
758
|
* - Geographic biasing for location-aware results
|
|
841
|
-
* - Result type filtering (addresses, POIs, geographies)
|
|
842
759
|
* - Additional data inclusion (mapcodes, extended postal codes)
|
|
843
760
|
* - Geopolitical view context for disputed territories
|
|
844
761
|
*
|
|
845
762
|
* @example
|
|
846
763
|
* ```typescript
|
|
847
|
-
* // Search with geography type filter
|
|
848
|
-
* const citySearch: CommonPlacesParams<URL, Response> = {
|
|
849
|
-
* geographyTypes: ['Municipality'], // Only cities
|
|
850
|
-
* limit: 10
|
|
851
|
-
* };
|
|
852
|
-
*
|
|
853
764
|
* // Search with mapcodes and specific geopolitical view
|
|
854
765
|
* const detailedSearch: CommonPlacesParams<URL, Response> = {
|
|
855
766
|
* view: 'IN', // India's perspective
|
|
@@ -860,7 +771,6 @@ export type SearchIndexType = 'Geo' | 'PAD' | 'Addr' | 'Str' | 'XStr' | 'POI';
|
|
|
860
771
|
*
|
|
861
772
|
* // Address search with extended postal codes
|
|
862
773
|
* const addressSearch: CommonPlacesParams<URL, Response> = {
|
|
863
|
-
* geographyTypes: ['Country', 'Municipality'],
|
|
864
774
|
* extendedPostalCodesFor: ['Geo', 'PAD', 'Addr'],
|
|
865
775
|
* limit: 15
|
|
866
776
|
* };
|
|
@@ -873,7 +783,7 @@ export type CommonPlacesParams<ApiRequest, ApiResponse> = CommonServiceParams<Ap
|
|
|
873
783
|
* Maximum number of results to return.
|
|
874
784
|
*
|
|
875
785
|
* Controls pagination by limiting the number of results in a single response.
|
|
876
|
-
*
|
|
786
|
+
* Fuzzy search and geocoding page with `cursor`; see {@link CommonGeocodeAndFuzzySearchParams.cursor}.
|
|
877
787
|
*
|
|
878
788
|
* @remarks
|
|
879
789
|
* **Range:** 1 to 100
|
|
@@ -996,54 +906,154 @@ export type CommonPlacesParams<ApiRequest, ApiResponse> = CommonServiceParams<Ap
|
|
|
996
906
|
* ```
|
|
997
907
|
*/
|
|
998
908
|
view?: View;
|
|
909
|
+
};
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/shared/types/searchFilters.d.ts
|
|
912
|
+
/**
|
|
913
|
+
* Which countries results may come from. Everything here **excludes** results.
|
|
914
|
+
*
|
|
915
|
+
* @remarks
|
|
916
|
+
* Separate from {@link PlaceFilters} because geometry and along-route search take no country
|
|
917
|
+
* restriction. Where to look is {@link GeoBias}, not a filter.
|
|
918
|
+
*
|
|
919
|
+
* @group Places Search
|
|
920
|
+
*/
|
|
921
|
+
export type GeographicFilters = {
|
|
922
|
+
/** Countries to restrict to, as ISO 3166-1 alpha-2 or alpha-3 codes. */
|
|
923
|
+
countries?: string[];
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* What kind of places may come back. Everything here **excludes** results: a place that does not
|
|
927
|
+
* match is dropped, not ranked lower.
|
|
928
|
+
*
|
|
929
|
+
* @remarks
|
|
930
|
+
* Values within one member are OR'd: `poiBrands: ['Shell', 'BP']` keeps a place of either brand.
|
|
931
|
+
* Members are AND'd with each other.
|
|
932
|
+
*
|
|
933
|
+
* Fuzzy search intersects it with {@link GeographicFilters} as {@link SearchFilters}, so one
|
|
934
|
+
* `filters` object carries the country and the attribute restrictions together.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* filters: { poiCategories: ['RESTAURANT', 'CAFE'] }
|
|
939
|
+
* filters: { poiBrands: ['Shell', 'BP'], fuelTypes: ['Diesel'] }
|
|
940
|
+
* filters: { connectors: ['IEC62196Type2CCS'], minPowerKW: 50, maxPowerKW: 150 }
|
|
941
|
+
* ```
|
|
942
|
+
*
|
|
943
|
+
* @group Places Search
|
|
944
|
+
*/
|
|
945
|
+
export type PlaceFilters = {
|
|
946
|
+
/** POI categories to restrict to. */
|
|
947
|
+
poiCategories?: POICategory[];
|
|
948
|
+
/** POI brands to restrict to, by name. Case-sensitive; quote a name containing a comma: `'"A,B"'`. */
|
|
949
|
+
poiBrands?: string[];
|
|
950
|
+
/** Which kinds of place data to search. Defaults to all. */
|
|
951
|
+
indexes?: SearchIndexType[];
|
|
952
|
+
/** Geography types to restrict `Geography` results to. */
|
|
953
|
+
geographyTypes?: GeographyType[];
|
|
954
|
+
/** EV connector types to restrict charging results to. */
|
|
955
|
+
connectors?: ConnectorType[];
|
|
956
|
+
/** Fuel types to restrict fuel station results to. */
|
|
957
|
+
fuelTypes?: Fuel[];
|
|
958
|
+
/** Minimum EV charging power, in kilowatts. */
|
|
959
|
+
minPowerKW?: number;
|
|
960
|
+
/** Maximum EV charging power, in kilowatts. */
|
|
961
|
+
maxPowerKW?: number;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Both halves of `filters` in one object: what fuzzy search takes.
|
|
965
|
+
*
|
|
966
|
+
* @group Places Search
|
|
967
|
+
*/
|
|
968
|
+
export type SearchFilters = PlaceFilters & GeographicFilters;
|
|
969
|
+
//#endregion
|
|
970
|
+
//#region src/shared/types/commonGeocodeAndFuzzySearchParams.d.ts
|
|
971
|
+
/**
|
|
972
|
+
* Common parameters shared between fuzzy search and geocoding services.
|
|
973
|
+
*
|
|
974
|
+
* These parameters control search behavior that applies to both fuzzy search
|
|
975
|
+
* and geocoding operations, including autocomplete mode, pagination, and geographic filtering.
|
|
976
|
+
*
|
|
977
|
+
* @remarks
|
|
978
|
+
* Used by:
|
|
979
|
+
* - {@link fuzzySearch}
|
|
980
|
+
* - {@link geocode}
|
|
981
|
+
*
|
|
982
|
+
* @group Places Search
|
|
983
|
+
*/
|
|
984
|
+
export type CommonGeocodeAndFuzzySearchParams = {
|
|
999
985
|
/**
|
|
1000
|
-
*
|
|
986
|
+
* Enable predictive/autocomplete mode for partial input queries.
|
|
1001
987
|
*
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
988
|
+
* When true, the query is treated as incomplete text being typed by a user,
|
|
989
|
+
* and the search returns suggestions that match the partial input.
|
|
1004
990
|
*
|
|
1005
991
|
* @remarks
|
|
1006
|
-
* **
|
|
1007
|
-
* -
|
|
1008
|
-
* -
|
|
1009
|
-
* -
|
|
1010
|
-
* -
|
|
1011
|
-
* - `Municipality`: Cities, towns
|
|
1012
|
-
* - `MunicipalitySubdivision`: City districts
|
|
1013
|
-
* - `Neighbourhood`: Neighborhoods, quarters
|
|
1014
|
-
* - `PostalCodeArea`: Areas defined by postal codes
|
|
1015
|
-
*
|
|
1016
|
-
* **Filtering Behavior:**
|
|
1017
|
-
* When specified, only Geography results with matching entity types
|
|
1018
|
-
* are returned. POIs, addresses, and other result types are excluded.
|
|
992
|
+
* **Autocomplete Behavior:**
|
|
993
|
+
* - Optimized for real-time search-as-you-type
|
|
994
|
+
* - Returns results that start with or contain the query
|
|
995
|
+
* - Better for interactive search boxes
|
|
996
|
+
* - Lower result quality thresholds to show more options
|
|
1019
997
|
*
|
|
1020
|
-
* **
|
|
1021
|
-
* -
|
|
1022
|
-
* -
|
|
1023
|
-
* -
|
|
1024
|
-
*
|
|
998
|
+
* **Regular Search (false):**
|
|
999
|
+
* - Treats query as complete input
|
|
1000
|
+
* - Higher quality thresholds
|
|
1001
|
+
* - Better for final search submission
|
|
1002
|
+
*
|
|
1003
|
+
* @default false
|
|
1025
1004
|
*
|
|
1026
1005
|
* @example
|
|
1027
1006
|
* ```typescript
|
|
1028
|
-
* //
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
* // Search for countries and cities
|
|
1032
|
-
* geographyTypes: ['Country', 'Municipality']
|
|
1033
|
-
*
|
|
1034
|
-
* // Search for all administrative levels
|
|
1035
|
-
* geographyTypes: [
|
|
1036
|
-
* 'Country',
|
|
1037
|
-
* 'CountrySubdivision',
|
|
1038
|
-
* 'CountrySecondarySubdivision',
|
|
1039
|
-
* 'Municipality'
|
|
1040
|
-
* ]
|
|
1007
|
+
* // Autocomplete mode for "Amst" input
|
|
1008
|
+
* typeahead: true // Returns: Amsterdam, Amstelveen, etc.
|
|
1041
1009
|
*
|
|
1042
|
-
* //
|
|
1043
|
-
*
|
|
1010
|
+
* // Regular search mode
|
|
1011
|
+
* typeahead: false // Expects complete query
|
|
1044
1012
|
* ```
|
|
1045
1013
|
*/
|
|
1046
|
-
|
|
1014
|
+
typeahead?: boolean;
|
|
1015
|
+
/**
|
|
1016
|
+
* Continues a previous search: its response's `nextCursor`, passed back unchanged alongside the
|
|
1017
|
+
* same parameters. Leave it out for the first page.
|
|
1018
|
+
*
|
|
1019
|
+
* @remarks
|
|
1020
|
+
* The value is **opaque**: the SDK mints it and only the SDK reads it, which lets the pagination
|
|
1021
|
+
* mechanism change without breaking callers. Passing a value this SDK did not produce throws.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```typescript
|
|
1025
|
+
* let response = await discoverPlaces({ query: 'cafe', limit: 20 });
|
|
1026
|
+
*
|
|
1027
|
+
* while (response.properties?.nextCursor) {
|
|
1028
|
+
* response = await discoverPlaces({ query: 'cafe', limit: 20, cursor: response.properties?.nextCursor });
|
|
1029
|
+
* }
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
cursor?: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Where to look: a point with an optional radius, or a bounding box.
|
|
1035
|
+
*
|
|
1036
|
+
* @remarks
|
|
1037
|
+
* A point without `radiusMeters` biases the ranking; with one, or with a `boundingBox`, results
|
|
1038
|
+
* are confined to that area. Leave it out to search without a geographic bias.
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```typescript
|
|
1042
|
+
* geoBias: { position: [4.9, 52.3], radiusMeters: 2000 }
|
|
1043
|
+
* geoBias: { boundingBox: [4.8, 52.3, 5.0, 52.4] }
|
|
1044
|
+
* ```
|
|
1045
|
+
*/
|
|
1046
|
+
geoBias?: GeoBias;
|
|
1047
|
+
/**
|
|
1048
|
+
* Which countries results may come from: see {@link GeographicFilters}. Fuzzy search's `filters`
|
|
1049
|
+
* also carries {@link PlaceFilters}; geocoding's also carries `geographyTypes`.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```typescript
|
|
1053
|
+
* filters: { countries: ['NL', 'BE'] }
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
filters?: GeographicFilters;
|
|
1047
1057
|
};
|
|
1048
1058
|
//#endregion
|
|
1049
1059
|
//#region src/shared/types/vehicleEngineParams.d.ts
|
|
@@ -1374,6 +1384,9 @@ type PredefinedVehicleModel = {
|
|
|
1374
1384
|
* Physical properties of the vehicle.
|
|
1375
1385
|
*
|
|
1376
1386
|
* @remarks
|
|
1387
|
+
* Weight is the only dimension routing takes: there are no height, width, length or axle-weight
|
|
1388
|
+
* restrictions. `TravelMode` lists the modes routing offers.
|
|
1389
|
+
*
|
|
1377
1390
|
* The vehicle weight is used to:
|
|
1378
1391
|
* - Check road weight restrictions
|
|
1379
1392
|
* - Calculate toll costs (weight-based pricing)
|
|
@@ -2628,7 +2641,7 @@ export type DepartArriveParams<Option extends DepartArriveOption = DepartArriveO
|
|
|
2628
2641
|
* },
|
|
2629
2642
|
* engine: {
|
|
2630
2643
|
* consumption: {
|
|
2631
|
-
*
|
|
2644
|
+
* speedsToConsumptionsKWH: [
|
|
2632
2645
|
* { speedKMH: 50, consumptionUnitsPer100KM: 15 },
|
|
2633
2646
|
* { speedKMH: 90, consumptionUnitsPer100KM: 18 },
|
|
2634
2647
|
* { speedKMH: 120, consumptionUnitsPer100KM: 22 }
|
|
@@ -2642,13 +2655,12 @@ export type DepartArriveParams<Option extends DepartArriveOption = DepartArriveO
|
|
|
2642
2655
|
* }
|
|
2643
2656
|
* };
|
|
2644
2657
|
*
|
|
2645
|
-
* //
|
|
2646
|
-
* const
|
|
2658
|
+
* // Heavy, speed-limited vehicle, described by weight alone (see `VehicleDimensions`)
|
|
2659
|
+
* const heavyVehicleParams: CommonRoutingParams = {
|
|
2647
2660
|
* costModel: {
|
|
2648
2661
|
* routeType: 'short',
|
|
2649
2662
|
* avoid: ['tollRoads', 'ferries']
|
|
2650
2663
|
* },
|
|
2651
|
-
* travelMode: 'truck',
|
|
2652
2664
|
* vehicle: {
|
|
2653
2665
|
* model: {
|
|
2654
2666
|
* dimensions: {
|
|
@@ -2751,8 +2763,8 @@ export type TimeZoneRequest = 'iana';
|
|
|
2751
2763
|
/**
|
|
2752
2764
|
* Common parameters for search services with POI filtering capabilities.
|
|
2753
2765
|
*
|
|
2754
|
-
* Extends basic places parameters with
|
|
2755
|
-
*
|
|
2766
|
+
* Extends basic places parameters with the POI attribute filters — categories, brands, EV
|
|
2767
|
+
* charging specifics — grouped under `filters`.
|
|
2756
2768
|
*
|
|
2757
2769
|
* @typeParam ApiRequest - The API request type
|
|
2758
2770
|
* @typeParam ApiResponse - The API response type
|
|
@@ -2763,10 +2775,8 @@ export type TimeZoneRequest = 'iana';
|
|
|
2763
2775
|
* - {@link fuzzySearch}
|
|
2764
2776
|
* - {@link geometrySearch}
|
|
2765
2777
|
*
|
|
2766
|
-
* Provides
|
|
2767
|
-
* - POI
|
|
2768
|
-
* - EV charging station specifications
|
|
2769
|
-
* - Fuel type availability
|
|
2778
|
+
* Provides:
|
|
2779
|
+
* - POI category, brand, EV charging and fuel type filters (`filters`)
|
|
2770
2780
|
* - Opening hours and timezone data
|
|
2771
2781
|
* - Related POI relationships
|
|
2772
2782
|
*
|
|
@@ -2779,8 +2789,8 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
2779
2789
|
* Search query string.
|
|
2780
2790
|
*
|
|
2781
2791
|
* The text to search for — can be a place name, POI, address, or any free-form location query.
|
|
2782
|
-
* When omitted, results are driven entirely by
|
|
2783
|
-
*
|
|
2792
|
+
* When omitted, results are driven entirely by `filters` — a category, a brand, a fuel type —
|
|
2793
|
+
* or by `geometries` on geometry search.
|
|
2784
2794
|
*
|
|
2785
2795
|
* @remarks
|
|
2786
2796
|
* **Query Examples:**
|
|
@@ -2796,173 +2806,12 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
2796
2806
|
* query: 'coffee shop'
|
|
2797
2807
|
*
|
|
2798
2808
|
* // Omit query to search purely by category
|
|
2799
|
-
* poiCategories: ['CHARGING_LOCATION']
|
|
2809
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] }
|
|
2800
2810
|
* ```
|
|
2801
2811
|
*/
|
|
2802
2812
|
query?: string;
|
|
2803
|
-
/**
|
|
2804
|
-
|
|
2805
|
-
*
|
|
2806
|
-
* Fine-tunes search by selecting specific data categories to include.
|
|
2807
|
-
* By default, all indexes are searched.
|
|
2808
|
-
*
|
|
2809
|
-
* @remarks
|
|
2810
|
-
* **Available Indexes:**
|
|
2811
|
-
* - `Geo`: Geographic entities (countries, cities, etc.)
|
|
2812
|
-
* - `PAD`: Point addresses with building numbers
|
|
2813
|
-
* - `Addr`: Address ranges on streets
|
|
2814
|
-
* - `Str`: Street names
|
|
2815
|
-
* - `XStr`: Cross streets (intersections)
|
|
2816
|
-
* - `POI`: Points of interest
|
|
2817
|
-
*
|
|
2818
|
-
* **Use Cases:**
|
|
2819
|
-
* - POI-only search: `['POI']`
|
|
2820
|
-
* - Address-only search: `['PAD', 'Addr']`
|
|
2821
|
-
* - Exclude geographies: `['PAD', 'Addr', 'Str', 'POI']`
|
|
2822
|
-
*
|
|
2823
|
-
* @example
|
|
2824
|
-
* ```typescript
|
|
2825
|
-
* // Search only POIs
|
|
2826
|
-
* indexes: ['POI']
|
|
2827
|
-
*
|
|
2828
|
-
* // Search addresses and streets only
|
|
2829
|
-
* indexes: ['PAD', 'Addr', 'Str']
|
|
2830
|
-
* ```
|
|
2831
|
-
*/
|
|
2832
|
-
indexes?: SearchIndexType[];
|
|
2833
|
-
/**
|
|
2834
|
-
* Filter results to specific POI categories.
|
|
2835
|
-
*
|
|
2836
|
-
* Restricts results to Points of Interest belonging to the specified
|
|
2837
|
-
* categories. Use values from the {@link POICategory} type.
|
|
2838
|
-
*
|
|
2839
|
-
* @remarks
|
|
2840
|
-
* **Multiple Categories:**
|
|
2841
|
-
* Results include POIs matching ANY of the specified categories (OR logic).
|
|
2842
|
-
*
|
|
2843
|
-
* **Discovering Categories:**
|
|
2844
|
-
* Use the {@link getPOICategories} service to search and browse available
|
|
2845
|
-
* categories by name or synonym, then pass the resulting `code` values here.
|
|
2846
|
-
*
|
|
2847
|
-
* @example
|
|
2848
|
-
* ```typescript
|
|
2849
|
-
* // Filter to specific categories
|
|
2850
|
-
* poiCategories: ['RESTAURANT', 'CAFE']
|
|
2851
|
-
*
|
|
2852
|
-
* // Category-only search (no query)
|
|
2853
|
-
* poiCategories: ['CHARGING_LOCATION']
|
|
2854
|
-
*
|
|
2855
|
-
* // Discovered via getPOICategories() service
|
|
2856
|
-
* import { getPOICategoryCodes } from '@tomtom-org/maps-sdk/services';
|
|
2857
|
-
* const codes = await getPOICategoryCodes({ filters: ['italian'] });
|
|
2858
|
-
* const results = await discoverPlaces({ poiCategories: codes, position });
|
|
2859
|
-
* ```
|
|
2860
|
-
*/
|
|
2861
|
-
poiCategories?: POICategory[];
|
|
2862
|
-
/**
|
|
2863
|
-
* Filter results to specific POI brands.
|
|
2864
|
-
*
|
|
2865
|
-
* Restricts results to Points of Interest belonging to the specified
|
|
2866
|
-
* brand names. Useful for finding specific chain locations.
|
|
2867
|
-
*
|
|
2868
|
-
* @remarks
|
|
2869
|
-
* **Brand Names:**
|
|
2870
|
-
* - Case-sensitive
|
|
2871
|
-
* - Exact match required
|
|
2872
|
-
* - Brands with commas must be quoted: `"A,B,C"`
|
|
2873
|
-
*
|
|
2874
|
-
* **Multiple Brands:**
|
|
2875
|
-
* Results include POIs matching ANY of the specified brands (OR logic).
|
|
2876
|
-
*
|
|
2877
|
-
* **Use Cases:**
|
|
2878
|
-
* - Find specific chain stores: "Starbucks", "McDonald's"
|
|
2879
|
-
* - Compare competing brands
|
|
2880
|
-
* - Brand-specific navigation
|
|
2881
|
-
*
|
|
2882
|
-
* @example
|
|
2883
|
-
* ```typescript
|
|
2884
|
-
* // Single brand
|
|
2885
|
-
* poiBrands: ['Starbucks']
|
|
2886
|
-
*
|
|
2887
|
-
* // Multiple brands
|
|
2888
|
-
* poiBrands: ['Shell', 'BP', 'Chevron']
|
|
2889
|
-
*
|
|
2890
|
-
* // Brand with comma in name
|
|
2891
|
-
* poiBrands: ['"A,B,C"']
|
|
2892
|
-
* ```
|
|
2893
|
-
*/
|
|
2894
|
-
poiBrands?: string[];
|
|
2895
|
-
/**
|
|
2896
|
-
* Filter EV charging stations by connector types.
|
|
2897
|
-
*
|
|
2898
|
-
* Restricts results to EV charging stations that support at least one
|
|
2899
|
-
* of the specified connector types. Essential for EV drivers to find
|
|
2900
|
-
* compatible charging infrastructure.
|
|
2901
|
-
*
|
|
2902
|
-
* @remarks
|
|
2903
|
-
* **Common Connector Types:**
|
|
2904
|
-
* - `IEC62196Type2CableAttached`: Type 2 / Mennekes (Europe)
|
|
2905
|
-
* - `IEC62196Type2CCS`: CCS Combo 2 (Europe)
|
|
2906
|
-
* - `IEC62196Type1CCS`: CCS Combo 1 (North America)
|
|
2907
|
-
* - `Chademo`: CHAdeMO (Japan)
|
|
2908
|
-
* - `Tesla`: Tesla proprietary
|
|
2909
|
-
*
|
|
2910
|
-
* **Multiple Connectors:**
|
|
2911
|
-
* Results include stations with ANY of the specified connectors (OR logic).
|
|
2912
|
-
*
|
|
2913
|
-
* **Use Cases:**
|
|
2914
|
-
* - Find compatible chargers for specific EV model
|
|
2915
|
-
* - Route planning for long-distance EV travel
|
|
2916
|
-
* - Filter by fast charging capability
|
|
2917
|
-
*
|
|
2918
|
-
* @example
|
|
2919
|
-
* ```typescript
|
|
2920
|
-
* // CCS Combo 2 (common in Europe)
|
|
2921
|
-
* connectors: ['IEC62196Type2CCS']
|
|
2922
|
-
*
|
|
2923
|
-
* // Multiple connector types
|
|
2924
|
-
* connectors: ['IEC62196Type2CCS', 'Chademo']
|
|
2925
|
-
*
|
|
2926
|
-
* // Tesla or CCS
|
|
2927
|
-
* connectors: ['Tesla', 'IEC62196Type2CCS']
|
|
2928
|
-
* ```
|
|
2929
|
-
*/
|
|
2930
|
-
connectors?: ConnectorType[];
|
|
2931
|
-
/**
|
|
2932
|
-
* Filter fuel stations by available fuel types.
|
|
2933
|
-
*
|
|
2934
|
-
* Restricts results to fuel stations that offer the specified fuel types.
|
|
2935
|
-
* Can be used with empty query to find any station with specific fuel.
|
|
2936
|
-
*
|
|
2937
|
-
* @remarks
|
|
2938
|
-
* **Common Fuel Types:**
|
|
2939
|
-
* - Petrol/Gasoline
|
|
2940
|
-
* - Diesel
|
|
2941
|
-
* - LPG (Liquefied Petroleum Gas)
|
|
2942
|
-
* - CNG (Compressed Natural Gas)
|
|
2943
|
-
* - E85 (Ethanol blend)
|
|
2944
|
-
* - AdBlue (Diesel exhaust fluid)
|
|
2945
|
-
*
|
|
2946
|
-
* **Multiple Fuel Types:**
|
|
2947
|
-
* Results include stations offering ANY of the specified fuels (OR logic).
|
|
2948
|
-
*
|
|
2949
|
-
* **Empty Query:**
|
|
2950
|
-
* When `fuelTypes` is specified, the query parameter can be empty,
|
|
2951
|
-
* and all POIs with matching fuel types will be returned.
|
|
2952
|
-
*
|
|
2953
|
-
* @example
|
|
2954
|
-
* ```typescript
|
|
2955
|
-
* // Diesel stations only
|
|
2956
|
-
* fuelTypes: ['Diesel']
|
|
2957
|
-
*
|
|
2958
|
-
* // Alternative fuels
|
|
2959
|
-
* fuelTypes: ['CNG', 'LPG', 'E85']
|
|
2960
|
-
*
|
|
2961
|
-
* // Standard fuels
|
|
2962
|
-
* fuelTypes: ['Petrol', 'Diesel']
|
|
2963
|
-
* ```
|
|
2964
|
-
*/
|
|
2965
|
-
fuelTypes?: Fuel[];
|
|
2813
|
+
/** What kind of places may come back: see {@link PlaceFilters}. */
|
|
2814
|
+
filters?: PlaceFilters;
|
|
2966
2815
|
/**
|
|
2967
2816
|
* Request opening hours information for POIs.
|
|
2968
2817
|
*
|
|
@@ -3044,67 +2893,6 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
3044
2893
|
* ```
|
|
3045
2894
|
*/
|
|
3046
2895
|
relatedPois?: RelatedPoisRequest;
|
|
3047
|
-
/**
|
|
3048
|
-
* Minimum charging power for EV stations (in kilowatts).
|
|
3049
|
-
*
|
|
3050
|
-
* Filters EV charging stations to those supporting at least one
|
|
3051
|
-
* connector with the specified minimum power output. Useful for
|
|
3052
|
-
* finding fast charging capabilities.
|
|
3053
|
-
*
|
|
3054
|
-
* @remarks
|
|
3055
|
-
* **Power Levels:**
|
|
3056
|
-
* - 3-7 kW: Level 2 AC (slow charging)
|
|
3057
|
-
* - 7-22 kW: Level 2 AC (moderate charging)
|
|
3058
|
-
* - 50+ kW: DC fast charging
|
|
3059
|
-
* - 150+ kW: Ultra-fast charging
|
|
3060
|
-
* - 350 kW: Maximum current technology
|
|
3061
|
-
*
|
|
3062
|
-
* **Closed Interval:**
|
|
3063
|
-
* Includes stations with exactly this power value.
|
|
3064
|
-
*
|
|
3065
|
-
* @example
|
|
3066
|
-
* ```typescript
|
|
3067
|
-
* // Fast charging (50kW+)
|
|
3068
|
-
* minPowerKW: 50
|
|
3069
|
-
*
|
|
3070
|
-
* // Ultra-fast charging (150kW+)
|
|
3071
|
-
* minPowerKW: 150
|
|
3072
|
-
*
|
|
3073
|
-
* // Combined with max power
|
|
3074
|
-
* minPowerKW: 50,
|
|
3075
|
-
* maxPowerKW: 150 // 50-150 kW range
|
|
3076
|
-
* ```
|
|
3077
|
-
*/
|
|
3078
|
-
minPowerKW?: number;
|
|
3079
|
-
/**
|
|
3080
|
-
* Maximum charging power for EV stations (in kilowatts).
|
|
3081
|
-
*
|
|
3082
|
-
* Filters EV charging stations to those with at least one connector
|
|
3083
|
-
* not exceeding the specified maximum power output.
|
|
3084
|
-
*
|
|
3085
|
-
* @remarks
|
|
3086
|
-
* **Use Cases:**
|
|
3087
|
-
* - Find charging compatible with vehicle's maximum charge rate
|
|
3088
|
-
* - Exclude ultra-fast chargers when not needed
|
|
3089
|
-
* - Filter by infrastructure capability
|
|
3090
|
-
*
|
|
3091
|
-
* **Closed Interval:**
|
|
3092
|
-
* Includes stations with exactly this power value.
|
|
3093
|
-
*
|
|
3094
|
-
* @example
|
|
3095
|
-
* ```typescript
|
|
3096
|
-
* // Level 2 charging only (up to 22kW)
|
|
3097
|
-
* maxPowerKW: 22
|
|
3098
|
-
*
|
|
3099
|
-
* // Moderate fast charging (up to 50kW)
|
|
3100
|
-
* maxPowerKW: 50
|
|
3101
|
-
*
|
|
3102
|
-
* // Power range 50-150 kW
|
|
3103
|
-
* minPowerKW: 50,
|
|
3104
|
-
* maxPowerKW: 150
|
|
3105
|
-
* ```
|
|
3106
|
-
*/
|
|
3107
|
-
maxPowerKW?: number;
|
|
3108
2896
|
};
|
|
3109
2897
|
//#endregion
|
|
3110
2898
|
//#region src/shared/types/searchSummary.d.ts
|
|
@@ -3123,29 +2911,29 @@ type SummaryQueryType = 'NEARBY' | 'NON_NEAR';
|
|
|
3123
2911
|
/**
|
|
3124
2912
|
* Metadata summary for search API responses.
|
|
3125
2913
|
*
|
|
3126
|
-
* Provides information about the search query execution, result counts,
|
|
3127
|
-
*
|
|
3128
|
-
*
|
|
2914
|
+
* Provides information about the search query execution, result counts, and the cursor that
|
|
2915
|
+
* continues the search. This metadata helps understand how the search was processed and page
|
|
2916
|
+
* through results.
|
|
3129
2917
|
*
|
|
3130
2918
|
* @remarks
|
|
3131
2919
|
* This summary is included in responses from:
|
|
3132
2920
|
* - {@link discoverPlaces}
|
|
3133
2921
|
* - {@link fuzzySearch}
|
|
3134
2922
|
* - {@link geometrySearch}
|
|
2923
|
+
* - {@link geocode}
|
|
3135
2924
|
*
|
|
3136
2925
|
* @example
|
|
3137
2926
|
* ```typescript
|
|
3138
2927
|
* const results = await discoverPlaces({
|
|
3139
|
-
* key: 'your-api-key',
|
|
3140
2928
|
* query: 'pizza',
|
|
3141
|
-
*
|
|
2929
|
+
* geoBias: { position: [4.9, 52.3] }
|
|
3142
2930
|
* });
|
|
3143
2931
|
*
|
|
3144
|
-
* const summary = results.
|
|
3145
|
-
* console.log(`Found ${summary
|
|
3146
|
-
* console.log(`Showing ${summary
|
|
3147
|
-
* console.log(`Query type: ${summary
|
|
3148
|
-
* console.log(`Search took ${summary
|
|
2932
|
+
* const summary = results.properties;
|
|
2933
|
+
* console.log(`Found ${summary?.totalResults ?? 'an unknown number of'} total results`);
|
|
2934
|
+
* console.log(`Showing ${summary?.numResults} results`);
|
|
2935
|
+
* console.log(`Query type: ${summary?.queryType}`); // 'NEARBY'
|
|
2936
|
+
* console.log(`Search took ${summary?.queryTime}ms`);
|
|
3149
2937
|
* ```
|
|
3150
2938
|
*
|
|
3151
2939
|
* @group Places Search
|
|
@@ -3204,27 +2992,14 @@ export type SearchSummary = {
|
|
|
3204
2992
|
*/
|
|
3205
2993
|
numResults: number;
|
|
3206
2994
|
/**
|
|
3207
|
-
*
|
|
3208
|
-
*
|
|
3209
|
-
* Zero-based index indicating where this page of results begins.
|
|
3210
|
-
* Used for pagination to retrieve subsequent pages.
|
|
2995
|
+
* The opaque cursor that continues this search: pass it back as the request's `cursor`, see
|
|
2996
|
+
* {@link CommonGeocodeAndFuzzySearchParams.cursor}. Only fuzzy search and geocoding page this way.
|
|
3211
2997
|
*
|
|
3212
2998
|
* @remarks
|
|
3213
|
-
*
|
|
3214
|
-
*
|
|
3215
|
-
* @example
|
|
3216
|
-
* ```typescript
|
|
3217
|
-
* // First page (results 0-9)
|
|
3218
|
-
* offset: 0, numResults: 10
|
|
3219
|
-
*
|
|
3220
|
-
* // Second page (results 10-19)
|
|
3221
|
-
* offset: 10, numResults: 10
|
|
3222
|
-
*
|
|
3223
|
-
* // Third page (results 20-29)
|
|
3224
|
-
* offset: 20, numResults: 10
|
|
3225
|
-
* ```
|
|
2999
|
+
* Absent means pagination has ended: the result set is exhausted, this page came back empty, or
|
|
3000
|
+
* the next page would start past result 1900, the furthest the backend serves.
|
|
3226
3001
|
*/
|
|
3227
|
-
|
|
3002
|
+
nextCursor?: string;
|
|
3228
3003
|
/**
|
|
3229
3004
|
* Total number of matching results found by the search.
|
|
3230
3005
|
*
|
|
@@ -3232,19 +3007,16 @@ export type SearchSummary = {
|
|
|
3232
3007
|
* regardless of pagination limits.
|
|
3233
3008
|
*
|
|
3234
3009
|
* @remarks
|
|
3235
|
-
* Optional — a total is not guaranteed, so guard it rather than assuming a number.
|
|
3236
|
-
*
|
|
3237
|
-
*
|
|
3238
|
-
* - Total pages: `totalResults === undefined ? undefined : Math.ceil(totalResults / limit)`
|
|
3239
|
-
* - Has more results: `totalResults !== undefined && offset + numResults < totalResults`
|
|
3010
|
+
* Optional — a total is not guaranteed, so guard it rather than assuming a number. Use it to
|
|
3011
|
+
* size a progress indicator, such as a page count of `Math.ceil(totalResults / limit)`, not to
|
|
3012
|
+
* drive pagination: `nextCursor` decides whether a further page exists.
|
|
3240
3013
|
*
|
|
3241
3014
|
* @example
|
|
3242
3015
|
* ```typescript
|
|
3243
3016
|
* totalResults: 50 // 50 total matches found
|
|
3244
3017
|
* numResults: 10 // Showing first 10
|
|
3245
|
-
* offset: 0 // Starting from beginning
|
|
3246
3018
|
*
|
|
3247
|
-
* //
|
|
3019
|
+
* // Fetch the rest by passing `nextCursor` back as `cursor`
|
|
3248
3020
|
* ```
|
|
3249
3021
|
*/
|
|
3250
3022
|
totalResults?: number;
|
|
@@ -3405,10 +3177,14 @@ type AddressRangesAPI = {
|
|
|
3405
3177
|
* we call always send them, and this type is what asserts that. Relaxing it would let a parser
|
|
3406
3178
|
* silently stop populating them.
|
|
3407
3179
|
*
|
|
3180
|
+
* The wire pages by `offset`; `nextCursor` is the SDK's own, minted from it by the parser.
|
|
3181
|
+
*
|
|
3408
3182
|
* @ignore
|
|
3409
3183
|
*/
|
|
3410
|
-
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias'> & Required<Pick<SearchSummary, 'totalResults' | 'fuzzyLevel'>> & {
|
|
3184
|
+
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias' | 'nextCursor'> & Required<Pick<SearchSummary, 'totalResults' | 'fuzzyLevel'>> & {
|
|
3411
3185
|
geoBias?: LatLonAPI;
|
|
3186
|
+
/** Where this page starts in the full result set, zero-based. */
|
|
3187
|
+
offset: number;
|
|
3412
3188
|
};
|
|
3413
3189
|
/**
|
|
3414
3190
|
* @ignore
|
|
@@ -3463,17 +3239,22 @@ type POIAPI = {
|
|
|
3463
3239
|
timeZone?: TimeZone;
|
|
3464
3240
|
};
|
|
3465
3241
|
/**
|
|
3242
|
+
* A connector as the places APIs return it: `chargingSpeed` is derived by the SDK.
|
|
3466
3243
|
* @ignore
|
|
3467
3244
|
*/
|
|
3468
|
-
type ConnectorAPI = Omit<Connector, '
|
|
3469
|
-
connectorType: ConnectorType;
|
|
3470
|
-
};
|
|
3245
|
+
type ConnectorAPI = Omit<Connector, 'chargingSpeed'>;
|
|
3471
3246
|
/**
|
|
3247
|
+
* A charging point as the places APIs return it: `ev/id` omits empty `capabilities` and `restrictions`.
|
|
3472
3248
|
* @ignore
|
|
3473
3249
|
*/
|
|
3474
|
-
type
|
|
3475
|
-
connectors
|
|
3250
|
+
type ChargingPointAPI = Omit<StaticChargingPoint, 'capabilities' | 'restrictions' | 'connectors'> & Partial<Pick<StaticChargingPoint, 'capabilities' | 'restrictions'>> & {
|
|
3251
|
+
connectors?: ConnectorAPI[];
|
|
3476
3252
|
};
|
|
3253
|
+
/**
|
|
3254
|
+
* @typeParam Status - `Pick<ChargingPoint, 'status'>` from `ev/id`; nothing from the search services.
|
|
3255
|
+
* @ignore
|
|
3256
|
+
*/
|
|
3257
|
+
type ChargingStationAPI<Status extends object = object> = ChargingStation<ChargingPointAPI & Status>;
|
|
3477
3258
|
/**
|
|
3478
3259
|
* @ignore
|
|
3479
3260
|
*/
|
|
@@ -3486,7 +3267,7 @@ type CommonSearchPlaceResultAPI = Omit<SearchPlaceProps, 'distance' | 'position'
|
|
|
3486
3267
|
entryPoints?: EntryPointAPI[];
|
|
3487
3268
|
address?: AddressProperties;
|
|
3488
3269
|
poi?: POIAPI;
|
|
3489
|
-
|
|
3270
|
+
chargingStations?: ChargingStationAPI[];
|
|
3490
3271
|
};
|
|
3491
3272
|
//#endregion
|
|
3492
3273
|
//#region src/along-route-search/types/alongRouteSearchResponseAPI.d.ts
|
|
@@ -3556,7 +3337,7 @@ type AlongRouteSortBy = 'detourTime' | 'detourOffset';
|
|
|
3556
3337
|
* const chargers = await discoverPlaces({
|
|
3557
3338
|
* route: [[4.9, 52.37], [4.95, 52.28], [5.1, 52.09]],
|
|
3558
3339
|
* maxDetourTimeSeconds: 600,
|
|
3559
|
-
* poiCategories: ['CHARGING_LOCATION'],
|
|
3340
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] },
|
|
3560
3341
|
* sortBy: 'detourOffset',
|
|
3561
3342
|
* });
|
|
3562
3343
|
* ```
|
|
@@ -3656,7 +3437,7 @@ type AlongRouteSearchResponse = Places<SearchPlaceProps, SearchSummary>;
|
|
|
3656
3437
|
* const chargers = await alongRouteSearch({
|
|
3657
3438
|
* route: routeResult.features[0].geometry,
|
|
3658
3439
|
* maxDetourTimeSeconds: 600,
|
|
3659
|
-
* poiCategories: ['CHARGING_LOCATION'],
|
|
3440
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] },
|
|
3660
3441
|
* sortBy: 'detourOffset',
|
|
3661
3442
|
* });
|
|
3662
3443
|
* ```
|
|
@@ -3678,7 +3459,7 @@ type EVChargingStationResultAPI = {
|
|
|
3678
3459
|
openingHours: OpeningHoursAPI;
|
|
3679
3460
|
timeZone: TimeZone;
|
|
3680
3461
|
accessType: ChargingStationsAccessType;
|
|
3681
|
-
chargingStations:
|
|
3462
|
+
chargingStations: ChargingStationAPI<Pick<ChargingPoint, 'status'>>[];
|
|
3682
3463
|
};
|
|
3683
3464
|
/**
|
|
3684
3465
|
* @ignore
|
|
@@ -3770,6 +3551,9 @@ type ChargingStationsAvailabilityParams = CommonServiceParams<URL, ChargingStati
|
|
|
3770
3551
|
* - **Access information**: Public, private, or restricted access
|
|
3771
3552
|
* - **Opening hours**: When the charging facility is accessible
|
|
3772
3553
|
*
|
|
3554
|
+
* Returns availability records, not places. To show stations with their availability, pass the
|
|
3555
|
+
* places to {@link getPlacesWithEVAvailability} instead, and its result to `PlacesModule.show()`.
|
|
3556
|
+
*
|
|
3773
3557
|
* @param params - Charging availability parameters with station ID
|
|
3774
3558
|
*
|
|
3775
3559
|
* @returns Promise resolving to charging station availability information
|
|
@@ -3778,17 +3562,17 @@ type ChargingStationsAvailabilityParams = CommonServiceParams<URL, ChargingStati
|
|
|
3778
3562
|
* ```typescript
|
|
3779
3563
|
* // Get availability for a specific charging park
|
|
3780
3564
|
* const availability = await evChargingStationsAvailability({
|
|
3781
|
-
*
|
|
3565
|
+
* apiKey: 'YOUR_API_KEY',
|
|
3782
3566
|
* id: 'charging-park-id-123'
|
|
3783
3567
|
* });
|
|
3784
3568
|
*
|
|
3785
3569
|
* // Check how many chargers are available
|
|
3786
|
-
* const availableCount = availability
|
|
3570
|
+
* const availableCount = availability?.chargingPointAvailability.statusCounts.Available ?? 0;
|
|
3787
3571
|
* console.log(`${availableCount} chargers available`);
|
|
3788
3572
|
*
|
|
3789
|
-
* //
|
|
3790
|
-
* const ccsConnectors = availability
|
|
3791
|
-
*
|
|
3573
|
+
* // CCS connectors, one entry per power level
|
|
3574
|
+
* const ccsConnectors = availability?.connectorAvailabilities.filter(
|
|
3575
|
+
* ({ connector }) => connector.type === 'IEC62196Type2CCS'
|
|
3792
3576
|
* );
|
|
3793
3577
|
* ```
|
|
3794
3578
|
*
|
|
@@ -3807,13 +3591,15 @@ export declare const evChargingStationsAvailability: (params: ChargingStationsAv
|
|
|
3807
3591
|
*
|
|
3808
3592
|
* @remarks
|
|
3809
3593
|
* Needs the same API key access as {@link evChargingStationsAvailability}. A failed request,
|
|
3810
|
-
* including one from a key without that access, is logged and resolves to `undefined`.
|
|
3594
|
+
* including one from a key without that access, is logged and resolves to `undefined`. A
|
|
3595
|
+
* cancellation is the caller's own decision rather than a data gap, so it rejects the call instead.
|
|
3811
3596
|
*
|
|
3812
3597
|
* @param place - The place to enhance with availability data
|
|
3813
|
-
* @param commonParams - Common service parameters (e.g. `
|
|
3598
|
+
* @param commonParams - Common service parameters (e.g. `apiKey`, `onAPIRequest`, `signal`) forwarded to the availability request
|
|
3814
3599
|
*
|
|
3815
3600
|
* @returns Promise resolving to the place with merged availability information
|
|
3816
3601
|
* @returns undefined if no availability data is present for the `place` input parameter.
|
|
3602
|
+
* @throws {@link SDKAbortError} when `commonParams.signal` is aborted
|
|
3817
3603
|
*
|
|
3818
3604
|
* @example
|
|
3819
3605
|
* ```typescript
|
|
@@ -3822,10 +3608,9 @@ export declare const evChargingStationsAvailability: (params: ChargingStationsAv
|
|
|
3822
3608
|
* const place = searchResult.features[0];
|
|
3823
3609
|
*
|
|
3824
3610
|
* const enhancedPlace = await getPlaceWithEVAvailability(place);
|
|
3825
|
-
*
|
|
3826
|
-
*
|
|
3827
|
-
*
|
|
3828
|
-
* console.log('Available chargers:', availability.chargingPointAvailability.count);
|
|
3611
|
+
* if (enhancedPlace) {
|
|
3612
|
+
* const { count, statusCounts } = enhancedPlace.properties.chargingPark.availability.chargingPointAvailability;
|
|
3613
|
+
* console.log(`${statusCounts.Available ?? 0} of ${count} chargers available`);
|
|
3829
3614
|
* }
|
|
3830
3615
|
* ```
|
|
3831
3616
|
*
|
|
@@ -3841,13 +3626,14 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3841
3626
|
* @remarks
|
|
3842
3627
|
* **Important**: Availability requests are made sequentially to avoid exceeding
|
|
3843
3628
|
* API rate limits (QPS - Queries Per Second). For large result sets, this may
|
|
3844
|
-
* take some time.
|
|
3629
|
+
* take some time. Pass a `signal` to stop early: aborting it cancels the in-flight
|
|
3630
|
+
* request, skips the remaining ones and rejects with {@link SDKAbortError}.
|
|
3845
3631
|
*
|
|
3846
3632
|
* Needs the same API key access as {@link evChargingStationsAvailability}. A place whose request
|
|
3847
3633
|
* fails, including for a key without that access, counts as having unknown availability.
|
|
3848
3634
|
*
|
|
3849
3635
|
* @param places - Collection of places to enhance
|
|
3850
|
-
* @param options - Configuration options, including common service parameters (e.g. `
|
|
3636
|
+
* @param options - Configuration options, including common service parameters (e.g. `apiKey`, `onAPIRequest`, `signal`) forwarded to each availability request
|
|
3851
3637
|
*
|
|
3852
3638
|
* @returns Promise resolving to places collection with merged availability
|
|
3853
3639
|
*
|
|
@@ -3856,8 +3642,7 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3856
3642
|
* // Search for charging stations and add availability
|
|
3857
3643
|
* const results = await discoverPlaces({
|
|
3858
3644
|
* query: 'EV charging',
|
|
3859
|
-
*
|
|
3860
|
-
* radius: 5000
|
|
3645
|
+
* geoBias: { position: [4.9, 52.3], radiusMeters: 5000 }
|
|
3861
3646
|
* });
|
|
3862
3647
|
*
|
|
3863
3648
|
* const withAvailability = await getPlacesWithEVAvailability(results, {
|
|
@@ -3866,8 +3651,8 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3866
3651
|
*
|
|
3867
3652
|
* // Display only stations with known availability
|
|
3868
3653
|
* withAvailability.features.forEach(place => {
|
|
3869
|
-
* const
|
|
3870
|
-
* console.log(`${place.properties.poi?.name}: ${
|
|
3654
|
+
* const { count, statusCounts } = place.properties.chargingPark.availability.chargingPointAvailability;
|
|
3655
|
+
* console.log(`${place.properties.poi?.name}: ${statusCounts.Available ?? 0} of ${count} chargers available`);
|
|
3871
3656
|
* });
|
|
3872
3657
|
* ```
|
|
3873
3658
|
*
|
|
@@ -3933,11 +3718,11 @@ type GeocodingProps = Omit<SearchPlaceProps, 'info'> & {
|
|
|
3933
3718
|
* Response from the geocoding service.
|
|
3934
3719
|
*
|
|
3935
3720
|
* Collection of places matching the geocoding query, each with address information
|
|
3936
|
-
* and match confidence scoring.
|
|
3721
|
+
* and match confidence scoring. Its {@link SearchSummary} carries the `nextCursor` for the next page.
|
|
3937
3722
|
*
|
|
3938
3723
|
* @group Geocoding
|
|
3939
3724
|
*/
|
|
3940
|
-
type GeocodingResponse = Places<GeocodingProps>;
|
|
3725
|
+
type GeocodingResponse = Places<GeocodingProps, SearchSummary>;
|
|
3941
3726
|
//#endregion
|
|
3942
3727
|
//#region src/geocode/types/apiTypes.d.ts
|
|
3943
3728
|
/**
|
|
@@ -4006,6 +3791,19 @@ type GeocodingIndexTypesAbbreviation = Exclude<SearchIndexType, 'POI'>;
|
|
|
4006
3791
|
* @group Geocoding
|
|
4007
3792
|
*/
|
|
4008
3793
|
type GeocodingParams = Omit<CommonPlacesParams<GetObject, GeocodingResponseAPI> & CommonGeocodeAndFuzzySearchParams, 'extendedPostalCodesFor'> & {
|
|
3794
|
+
/**
|
|
3795
|
+
* Where results may come from. Everything here **excludes** results.
|
|
3796
|
+
*
|
|
3797
|
+
* @remarks
|
|
3798
|
+
* {@link GeographicFilters} plus `geographyTypes`, which restricts the kinds of geography that
|
|
3799
|
+
* come back. Geocoding has no POI notion, so the rest of {@link PlaceFilters} does not apply.
|
|
3800
|
+
*
|
|
3801
|
+
* @example
|
|
3802
|
+
* ```typescript
|
|
3803
|
+
* filters: { countries: ['NL'], geographyTypes: ['Municipality'] }
|
|
3804
|
+
* ```
|
|
3805
|
+
*/
|
|
3806
|
+
filters?: GeographicFilters & Pick<PlaceFilters, 'geographyTypes'>;
|
|
4009
3807
|
/**
|
|
4010
3808
|
* Address or location query to geocode.
|
|
4011
3809
|
*
|
|
@@ -4019,7 +3817,7 @@ type GeocodingParams = Omit<CommonPlacesParams<GetObject, GeocodingResponseAPI>
|
|
|
4019
3817
|
* - City name: "Amsterdam"
|
|
4020
3818
|
* - Intersection: "Broadway & 42nd St, New York"
|
|
4021
3819
|
* - Landmark: "Eiffel Tower, Paris"
|
|
4022
|
-
* - Partial address: "Dam Square" (city context resolved via `
|
|
3820
|
+
* - Partial address: "Dam Square" (city context resolved via `geoBias` or `filters.countries`)
|
|
4023
3821
|
*
|
|
4024
3822
|
* @example
|
|
4025
3823
|
* ```typescript
|
|
@@ -4355,6 +4153,9 @@ type GeometryParams = GeometryDataParams | GeometryPlaceParams;
|
|
|
4355
4153
|
* - Visualize administrative divisions
|
|
4356
4154
|
* - Calculate areas and spatial relationships
|
|
4357
4155
|
*
|
|
4156
|
+
* Returns polygons, not places. Pass the result to `GeometriesModule.show()`,
|
|
4157
|
+
* not `PlacesModule.show()`. The `geometryId` comes from a prior search result.
|
|
4158
|
+
*
|
|
4358
4159
|
* @param params - Geometry parameters with IDs or places to fetch boundaries for
|
|
4359
4160
|
*
|
|
4360
4161
|
* @returns Promise resolving to polygon features representing area boundaries
|
|
@@ -5013,7 +4814,7 @@ type POICategoryResult = {
|
|
|
5013
4814
|
/**
|
|
5014
4815
|
* The standardized enum value identifying this category.
|
|
5015
4816
|
*
|
|
5016
|
-
* Use this value in search `poiCategories`
|
|
4817
|
+
* Use this value in a search's `filters.poiCategories` to filter results by category,
|
|
5017
4818
|
* or to cross-reference with `Place.properties.poi.categories` on search results.
|
|
5018
4819
|
*/
|
|
5019
4820
|
code: POICategory;
|
|
@@ -5024,7 +4825,7 @@ type POICategoryResult = {
|
|
|
5024
4825
|
* possible sub-categories — so you can understand the category hierarchy without
|
|
5025
4826
|
* additional lookups.
|
|
5026
4827
|
*
|
|
5027
|
-
* Use these values directly in search `poiCategories
|
|
4828
|
+
* Use these values directly in a search's `filters.poiCategories`.
|
|
5028
4829
|
*/
|
|
5029
4830
|
childCategoryCodes: POICategory[];
|
|
5030
4831
|
/**
|
|
@@ -5050,7 +4851,7 @@ type POICategoriesResponse = {
|
|
|
5050
4851
|
* Retrieve the list of POI category types supported by the TomTom Search API.
|
|
5051
4852
|
*
|
|
5052
4853
|
* The returned `code` values (`POICategory`) serve two purposes:
|
|
5053
|
-
* - Pass to `discoverPlaces({ poiCategories })` to filter search results by category.
|
|
4854
|
+
* - Pass to `discoverPlaces({ filters: { poiCategories } })` to filter search results by category.
|
|
5054
4855
|
* - Pass to `POIsModule.filterCategories()` to filter the map's built-in POI icons.
|
|
5055
4856
|
* Generic parent codes (e.g. `'RESTAURANT'`) are supported there; overly specific child
|
|
5056
4857
|
* codes (e.g. `'ITALIAN_RESTAURANT'`) are not — use a parent or a `POICategoryGroup` instead.
|
|
@@ -5077,7 +4878,7 @@ export declare const getPOICategories: (params?: POICategoriesParams) => Promise
|
|
|
5077
4878
|
* Convenience wrapper around {@link getPOICategories} that returns a flat array of `POICategory` codes.
|
|
5078
4879
|
*
|
|
5079
4880
|
* The returned codes serve two purposes:
|
|
5080
|
-
* - Pass to `discoverPlaces({ poiCategories })` to filter search results by category.
|
|
4881
|
+
* - Pass to `discoverPlaces({ filters: { poiCategories } })` to filter search results by category.
|
|
5081
4882
|
* - Pass to `POIsModule.filterCategories()` to filter the map's built-in POI icons.
|
|
5082
4883
|
* Generic parent codes (e.g. `'RESTAURANT'`) are supported there; overly specific child
|
|
5083
4884
|
* codes (e.g. `'ITALIAN_RESTAURANT'`) are not — use a parent or a `POICategoryGroup` instead.
|
|
@@ -7108,7 +6909,7 @@ type NearbyIntentDetailsAPI = Omit<NearbyIntentDetails, 'position'> & {
|
|
|
7108
6909
|
* const params: FuzzySearchParams = {
|
|
7109
6910
|
* key: 'your-api-key',
|
|
7110
6911
|
* query: 'pizz', // Will find "pizza" restaurants
|
|
7111
|
-
* position: [4.9041, 52.3676]
|
|
6912
|
+
* geoBias: { position: [4.9041, 52.3676] }
|
|
7112
6913
|
* };
|
|
7113
6914
|
*
|
|
7114
6915
|
* // Fuzzy search with custom fuzziness
|
|
@@ -7124,6 +6925,8 @@ type NearbyIntentDetailsAPI = Omit<NearbyIntentDetails, 'position'> & {
|
|
|
7124
6925
|
* @group Places Search
|
|
7125
6926
|
*/
|
|
7126
6927
|
type FuzzySearchParams = CommonSearchParams<GetObject, FuzzySearchResponseAPI> & CommonGeocodeAndFuzzySearchParams & {
|
|
6928
|
+
/** What may come back: the country and the POI-attribute restrictions together. */
|
|
6929
|
+
filters?: SearchFilters;
|
|
7127
6930
|
/**
|
|
7128
6931
|
* Minimum fuzziness level to be used.
|
|
7129
6932
|
*
|
|
@@ -7180,6 +6983,24 @@ type FuzzySearchParams = CommonSearchParams<GetObject, FuzzySearchResponseAPI> &
|
|
|
7180
6983
|
type SearchFeatureCollectionProps = SearchSummary & {
|
|
7181
6984
|
queryIntent?: QueryIntent[];
|
|
7182
6985
|
};
|
|
6986
|
+
/** The keys of `Params` that `Base` lacks, each forbidden. */
|
|
6987
|
+
type Without<Params, Base> = { [Key in Exclude<keyof Params, keyof Base>]?: never; };
|
|
6988
|
+
/**
|
|
6989
|
+
* What {@link discoverPlaces} takes: one search variant's params, with the other variants' own
|
|
6990
|
+
* options forbidden. So `{ geometries, cursor }` is a compile error rather than a cursor silently
|
|
6991
|
+
* dropped, as it would be with a plain union.
|
|
6992
|
+
*
|
|
6993
|
+
* @group Places Search
|
|
6994
|
+
*/
|
|
6995
|
+
export type DiscoverPlacesParams = (FuzzySearchParams & Without<GeometrySearchParams, FuzzySearchParams> & Without<AlongRouteSearchParams, FuzzySearchParams>) | (GeometrySearchParams & Without<FuzzySearchParams, GeometrySearchParams> & Without<AlongRouteSearchParams, GeometrySearchParams> & {
|
|
6996
|
+
filters?: {
|
|
6997
|
+
countries?: never;
|
|
6998
|
+
};
|
|
6999
|
+
}) | (AlongRouteSearchParams & Without<FuzzySearchParams, AlongRouteSearchParams> & Without<GeometrySearchParams, AlongRouteSearchParams> & {
|
|
7000
|
+
filters?: {
|
|
7001
|
+
countries?: never;
|
|
7002
|
+
};
|
|
7003
|
+
});
|
|
7183
7004
|
/**
|
|
7184
7005
|
* Search service response containing places that match the query.
|
|
7185
7006
|
*
|
|
@@ -7205,7 +7026,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7205
7026
|
*
|
|
7206
7027
|
* Results are ranked by relevance with scores and optional distances.
|
|
7207
7028
|
*
|
|
7208
|
-
* @param params - Search parameters
|
|
7029
|
+
* @param params - Search parameters: {@link FuzzySearchParams}, {@link GeometrySearchParams} or {@link AlongRouteSearchParams}
|
|
7209
7030
|
*
|
|
7210
7031
|
* @returns Promise resolving to a collection of matching places
|
|
7211
7032
|
*
|
|
@@ -7227,7 +7048,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7227
7048
|
*
|
|
7228
7049
|
* // Category search
|
|
7229
7050
|
* const restaurants = await discoverPlaces({
|
|
7230
|
-
* poiCategories: ['ITALIAN_RESTAURANT'],
|
|
7051
|
+
* filters: { poiCategories: ['ITALIAN_RESTAURANT'] },
|
|
7231
7052
|
* geoBias: { position: [4.9041, 52.3676], radiusMeters: 5000 } // Within 5km
|
|
7232
7053
|
* });
|
|
7233
7054
|
* ```
|
|
@@ -7238,7 +7059,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7238
7059
|
*
|
|
7239
7060
|
* @group Places Search
|
|
7240
7061
|
*/
|
|
7241
|
-
export declare const discoverPlaces: (params:
|
|
7062
|
+
export declare const discoverPlaces: (params: DiscoverPlacesParams) => Promise<DiscoverPlacesResponse>;
|
|
7242
7063
|
/**
|
|
7243
7064
|
* Search for a single place by text query.
|
|
7244
7065
|
*
|
|
@@ -7369,11 +7190,9 @@ type SearchSuggestion = PlaceSuggestion | RefinementSuggestion;
|
|
|
7369
7190
|
* Shaped after Places Search v3's `suggest` body: `filters` for what narrows the result set, and
|
|
7370
7191
|
* `origin` for the point to search around.
|
|
7371
7192
|
*
|
|
7372
|
-
* No `customServiceBaseURL`: the call spans two endpoints, and one URL cannot stand for both.
|
|
7373
|
-
*
|
|
7374
7193
|
* @group Places Search
|
|
7375
7194
|
*/
|
|
7376
|
-
type SearchSuggestionsParams =
|
|
7195
|
+
type SearchSuggestionsParams = CommonServiceParams & {
|
|
7377
7196
|
/** What the user typed. A partial query is fine; so is a complete one. */
|
|
7378
7197
|
query: string;
|
|
7379
7198
|
/**
|
|
@@ -7795,6 +7614,34 @@ type TrafficIncidentDetailsByBBoxParams = TrafficIncidentDetailsBaseParams & {
|
|
|
7795
7614
|
* ```
|
|
7796
7615
|
*/
|
|
7797
7616
|
bbox: HasBBox;
|
|
7617
|
+
polygon?: never;
|
|
7618
|
+
ids?: never;
|
|
7619
|
+
};
|
|
7620
|
+
/**
|
|
7621
|
+
* Parameters for fetching incidents within a polygon, such as a city boundary.
|
|
7622
|
+
*
|
|
7623
|
+
* @remarks
|
|
7624
|
+
* The API only accepts a bounding box, so the request is sent with the polygon's bounding box and the
|
|
7625
|
+
* response is then trimmed to the incidents that intersect the polygon. A `LineString` incident that
|
|
7626
|
+
* crosses the boundary is kept. The 10,000 km² limit applies to that bounding box.
|
|
7627
|
+
*
|
|
7628
|
+
* @example
|
|
7629
|
+
* ```typescript
|
|
7630
|
+
* const place = await geocodeOne('Amsterdam');
|
|
7631
|
+
* const params: TrafficIncidentDetailsByPolygonParams = {
|
|
7632
|
+
* polygon: await geometryData({ geometries: [place] })
|
|
7633
|
+
* };
|
|
7634
|
+
* ```
|
|
7635
|
+
*
|
|
7636
|
+
* @group Traffic
|
|
7637
|
+
*/
|
|
7638
|
+
type TrafficIncidentDetailsByPolygonParams = TrafficIncidentDetailsBaseParams & {
|
|
7639
|
+
/**
|
|
7640
|
+
* Area to query: a `Polygon` or `MultiPolygon`, a `Feature` wrapping one, or a `FeatureCollection` of
|
|
7641
|
+
* them, such as the {@link PolygonFeatures} that {@link geometryData} returns.
|
|
7642
|
+
*/
|
|
7643
|
+
polygon: Polygon | MultiPolygon | Feature<Polygon | MultiPolygon> | FeatureCollection<Polygon | MultiPolygon>;
|
|
7644
|
+
bbox?: never;
|
|
7798
7645
|
ids?: never;
|
|
7799
7646
|
};
|
|
7800
7647
|
/**
|
|
@@ -7826,30 +7673,33 @@ type TrafficIncidentDetailsByIdsParams = TrafficIncidentDetailsBaseParams & {
|
|
|
7826
7673
|
*/
|
|
7827
7674
|
ids: string[];
|
|
7828
7675
|
bbox?: never;
|
|
7676
|
+
polygon?: never;
|
|
7829
7677
|
};
|
|
7830
7678
|
/**
|
|
7831
7679
|
* Parameters for the Traffic Incident Details service.
|
|
7832
7680
|
*
|
|
7833
|
-
* Provide
|
|
7834
|
-
*
|
|
7681
|
+
* Provide one of a `bbox` or a `polygon` to search within an area, or a list of `ids` to look up
|
|
7682
|
+
* specific incidents.
|
|
7835
7683
|
*
|
|
7836
7684
|
* @group Traffic
|
|
7837
7685
|
*/
|
|
7838
|
-
type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | TrafficIncidentDetailsByIdsParams;
|
|
7686
|
+
type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | TrafficIncidentDetailsByPolygonParams | TrafficIncidentDetailsByIdsParams;
|
|
7839
7687
|
//#endregion
|
|
7840
7688
|
//#region src/traffic-incident-details/trafficIncidentDetails.d.ts
|
|
7841
7689
|
/**
|
|
7842
7690
|
* Fetch detailed information about traffic incidents.
|
|
7843
7691
|
*
|
|
7844
|
-
* Query incidents
|
|
7692
|
+
* Query incidents by a geographic bounding box, by a polygon, or by a list of incident IDs.
|
|
7845
7693
|
* Results are GeoJSON Features whose geometry is a `Point` (localised incidents) or
|
|
7846
7694
|
* a `LineString` (incidents spanning a stretch of road).
|
|
7847
7695
|
*
|
|
7848
7696
|
* @remarks
|
|
7849
|
-
* **
|
|
7697
|
+
* **Three query modes:**
|
|
7850
7698
|
*
|
|
7851
7699
|
* - **Bounding box** (`bbox`): Returns all incidents within the given area.
|
|
7852
7700
|
* Maximum area is 10,000 km².
|
|
7701
|
+
* - **Polygon** (`polygon`): Returns the incidents that intersect a polygon, such as a city boundary.
|
|
7702
|
+
* The request covers the polygon's bounding box, and the response is trimmed to the polygon.
|
|
7853
7703
|
* - **By IDs** (`ids`): Returns the specified incidents directly.
|
|
7854
7704
|
* GET is used automatically for up to 5 IDs; POST for up to 100 IDs.
|
|
7855
7705
|
*
|
|
@@ -7860,7 +7710,7 @@ type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | Traffic
|
|
|
7860
7710
|
* - Time information: start/end times and whether the incident is `present` or `future`
|
|
7861
7711
|
* - Events: one or more detailed event descriptions
|
|
7862
7712
|
*
|
|
7863
|
-
* @param params - Traffic Incident Details parameters (bbox or ids)
|
|
7713
|
+
* @param params - Traffic Incident Details parameters (bbox, polygon or ids)
|
|
7864
7714
|
*
|
|
7865
7715
|
* @returns Promise resolving to a {@link TrafficIncidentDetails} object containing the matching incidents
|
|
7866
7716
|
*
|
|
@@ -7880,6 +7730,15 @@ type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | Traffic
|
|
|
7880
7730
|
*
|
|
7881
7731
|
* @example
|
|
7882
7732
|
* ```typescript
|
|
7733
|
+
* // Query within a city boundary rather than its bounding box
|
|
7734
|
+
* const place = await geocodeOne('Amsterdam');
|
|
7735
|
+
* const result = await trafficIncidentDetails({
|
|
7736
|
+
* polygon: await geometryData({ geometries: [place] })
|
|
7737
|
+
* });
|
|
7738
|
+
* ```
|
|
7739
|
+
*
|
|
7740
|
+
* @example
|
|
7741
|
+
* ```typescript
|
|
7883
7742
|
* // Query up to 5 specific incidents by ID (GET)
|
|
7884
7743
|
* const result = await trafficIncidentDetails({
|
|
7885
7744
|
* ids: ['incident-id-1', 'incident-id-2']
|
|
@@ -7911,4 +7770,4 @@ type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | Traffic
|
|
|
7911
7770
|
*/
|
|
7912
7771
|
export declare const trafficIncidentDetails: (params: TrafficIncidentDetailsParams) => Promise<TrafficIncidentDetails>;
|
|
7913
7772
|
//#endregion
|
|
7914
|
-
export type { AdditionalDataAPI, AlongRouteSearchParams, AlongRouteSearchPayloadAPI, AlongRouteSearchRequestAPI, AlongRouteSearchResponse, AlongRouteSearchResponseAPI, AlongRouteSearchResultAPI, AlongRouteSortBy, AreaAnalyticsDateInput, ArrivalSide, BookmarkIntent, BookmarkIntentDetails, BrandSuggestion, CalculateRouteParams, CategorySuggestion, ChargingStationsAvailabilityParams, ChargingStopsStrategy, Circle, CircleAPI, CommonServiceParamsWithZoom, ComputeTravelTimeFor, CoordinateIntent, CoordinateIntentAPI, CoordinateIntentDetails, CoordinateIntentDetailsAPI, ExtendedRouteRepresentation, FunctionalRoadClass, FuzzySearchParams, FuzzySearchResponse, FuzzySearchResponseAPI, FuzzySearchResultAPI, GeocodingParams, GeocodingProps, GeocodingResponse, GeometriesInput, GeometryAPI, GeometryDataParams, GeometryDataResponseAPI, GeometryParams, GeometryPlaceParams, GeometrySearchFeatureCollectionProps, GeometrySearchParams, GeometrySearchPayloadAPI, GeometrySearchRequestAPI, GeometrySearchResponse, GeometrySearchResponseAPI, GeometrySearchResultAPI, GuidanceParams, InputSectionType, InputSectionTypes, LegCostModel, MaxNumberOfAlternatives, NearbyIntent, NearbyIntentAPI, NearbyIntentDetails, NearbyIntentDetailsAPI, POICategoriesParams, POICategoriesResponse, POICategoryResult, PlaceDetailsMandatoryParams, PlaceDetailsOptionalParams, PlaceDetailsParams, PlaceDetailsResponse, PlaceDetailsResponseAPI, PlaceDetailsResultAPI, PlaceSuggestion, PoiCategoriesResponseAPI, PoiCategoryAPI, PolygonAPI, QueryIntent, QueryIntentAPI, RefinementSuggestion, ReverseGeocodingMandatoryParams, ReverseGeocodingOptionalParams, ReverseGeocodingParams, RoutePointAPI, RouteStopOptions, SearchGeometryInput, SearchSuggestion, SearchSuggestionKind, SearchSuggestionsParams, SearchSuggestionsResponse, TrafficAreaAnalyticsDateRange, TrafficAreaAnalyticsDays, TrafficAreaAnalyticsParams, TrafficIncidentDetailsByBBoxParams, TrafficIncidentDetailsByIdsParams, TrafficIncidentDetailsParams, W3WIntent, W3WIntentDetails, arrivalSides, chargingStopsStrategies, functionalRoadClasses };
|
|
7773
|
+
export type { AdditionalDataAPI, AlongRouteSearchParams, AlongRouteSearchPayloadAPI, AlongRouteSearchRequestAPI, AlongRouteSearchResponse, AlongRouteSearchResponseAPI, AlongRouteSearchResultAPI, AlongRouteSortBy, AreaAnalyticsDateInput, ArrivalSide, BookmarkIntent, BookmarkIntentDetails, BrandSuggestion, CalculateRouteParams, CategorySuggestion, ChargingStationsAvailabilityParams, ChargingStopsStrategy, Circle, CircleAPI, CommonServiceParamsWithZoom, ComputeTravelTimeFor, CoordinateIntent, CoordinateIntentAPI, CoordinateIntentDetails, CoordinateIntentDetailsAPI, ExtendedRouteRepresentation, FunctionalRoadClass, FuzzySearchParams, FuzzySearchResponse, FuzzySearchResponseAPI, FuzzySearchResultAPI, GeocodingParams, GeocodingProps, GeocodingResponse, GeometriesInput, GeometryAPI, GeometryDataParams, GeometryDataResponseAPI, GeometryParams, GeometryPlaceParams, GeometrySearchFeatureCollectionProps, GeometrySearchParams, GeometrySearchPayloadAPI, GeometrySearchRequestAPI, GeometrySearchResponse, GeometrySearchResponseAPI, GeometrySearchResultAPI, GuidanceParams, InputSectionType, InputSectionTypes, LegCostModel, MaxNumberOfAlternatives, NearbyIntent, NearbyIntentAPI, NearbyIntentDetails, NearbyIntentDetailsAPI, POICategoriesParams, POICategoriesResponse, POICategoryResult, PlaceDetailsMandatoryParams, PlaceDetailsOptionalParams, PlaceDetailsParams, PlaceDetailsResponse, PlaceDetailsResponseAPI, PlaceDetailsResultAPI, PlaceSuggestion, PoiCategoriesResponseAPI, PoiCategoryAPI, PolygonAPI, QueryIntent, QueryIntentAPI, RefinementSuggestion, ReverseGeocodingMandatoryParams, ReverseGeocodingOptionalParams, ReverseGeocodingParams, RoutePointAPI, RouteStopOptions, SearchGeometryInput, SearchSuggestion, SearchSuggestionKind, SearchSuggestionsParams, SearchSuggestionsResponse, TrafficAreaAnalyticsDateRange, TrafficAreaAnalyticsDays, TrafficAreaAnalyticsParams, TrafficIncidentDetailsByBBoxParams, TrafficIncidentDetailsByIdsParams, TrafficIncidentDetailsByPolygonParams, TrafficIncidentDetailsParams, W3WIntent, W3WIntentDetails, arrivalSides, chargingStopsStrategies, functionalRoadClasses };
|