@tomtom-org/maps-sdk 0.45.8 → 0.45.10

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tomtom-org/maps-sdk",
3
3
  "author": "TomTom International B.V.",
4
4
  "license": "See in LICENSE.txt",
5
- "version": "0.45.8",
5
+ "version": "0.45.10",
6
6
  "description": "TomTom Maps for JavaScript",
7
7
  "keywords": [
8
8
  "tomtom",
@@ -25,6 +25,7 @@ import { inputSectionTypes } from '@tomtom-org/maps-sdk/core';
25
25
  import { Instruction } from '@tomtom-org/maps-sdk/core';
26
26
  import { LaneDirection } from '@tomtom-org/maps-sdk/core';
27
27
  import { LegSummary } from '@tomtom-org/maps-sdk/core';
28
+ import { LineString } from 'geojson';
28
29
  import { Mapcode } from '@tomtom-org/maps-sdk/core';
29
30
  import { MapcodeType } from '@tomtom-org/maps-sdk/core';
30
31
  import { MultiPolygon } from 'geojson';
@@ -38,6 +39,7 @@ import { Places as Places_2 } from '@tomtom-org/maps-sdk/core';
38
39
  import { PlaceType } from '@tomtom-org/maps-sdk/core';
39
40
  import { PlugType } from '@tomtom-org/maps-sdk/core';
40
41
  import { POICategory } from '@tomtom-org/maps-sdk/core';
42
+ import { Point } from 'geojson';
41
43
  import { Polygon } from 'geojson';
42
44
  import { PolygonFeature } from '@tomtom-org/maps-sdk/core';
43
45
  import { PolygonFeatures } from '@tomtom-org/maps-sdk/core';
@@ -56,7 +58,10 @@ import { SearchPlaceProps as SearchPlaceProps_2 } from '@tomtom-org/maps-sdk/cor
56
58
  import { SideOfStreet } from '@tomtom-org/maps-sdk/core';
57
59
  import { TimeZone } from '@tomtom-org/maps-sdk/core';
58
60
  import { TomTomHeaders } from '@tomtom-org/maps-sdk/core';
61
+ import { TrafficIncidentCategory } from '@tomtom-org/maps-sdk/core';
62
+ import { TrafficIncidentDetails } from '@tomtom-org/maps-sdk/core';
59
63
  import { TrafficIncidentTEC } from '@tomtom-org/maps-sdk/core';
64
+ import { TrafficIncidentTimeValidity } from '@tomtom-org/maps-sdk/core';
60
65
  import { TravelMode } from '@tomtom-org/maps-sdk/core';
61
66
  import { View } from '@tomtom-org/maps-sdk/core';
62
67
  import { ZodError } from 'zod';
@@ -814,6 +819,12 @@ export declare const buildResponseError: (error: unknown, serviceName: ServiceNa
814
819
  */
815
820
  declare const buildRevGeoRequest: (params: ReverseGeocodingParams) => URL;
816
821
 
822
+ /**
823
+ * Default method for building a traffic incident details request from {@link TrafficIncidentDetailsParams}.
824
+ * @param params The traffic incident details parameters, with global configuration already merged into them.
825
+ */
826
+ declare const buildTrafficIncidentDetailsRequest: (params: TrafficIncidentDetailsParams) => FetchInput<TrafficIncidentDetailsPostBody>;
827
+
817
828
  /**
818
829
  * @ignore
819
830
  * @param error
@@ -3085,6 +3096,13 @@ declare const customize: {
3085
3096
  reverseGeocodingTemplate: ReverseGeocodingTemplate;
3086
3097
  };
3087
3098
 
3099
+ declare const customize_10: {
3100
+ autocompleteSearch: typeof autocompleteSearch;
3101
+ buildAutocompleteSearchRequest: typeof buildAutocompleteSearchRequest;
3102
+ parseAutocompleteSearchResponse: typeof parseAutocompleteSearchResponse;
3103
+ autocompleteSearchTemplate: AutocompleteSearchTemplate;
3104
+ };
3105
+
3088
3106
  declare const customize_2: {
3089
3107
  buildGeocodingRequest: typeof buildGeocodingRequest;
3090
3108
  parseGeocodingResponse: typeof parseGeocodingResponse;
@@ -3123,16 +3141,15 @@ declare const customize_7: {
3123
3141
  };
3124
3142
 
3125
3143
  declare const customize_8: {
3126
- buildPlaceByIdRequest: typeof buildPlaceByIdRequest;
3127
- parsePlaceByIdResponse: typeof parsePlaceByIdResponse;
3128
- placeByIdTemplate: PlaceByIdTemplate;
3144
+ buildTrafficIncidentDetailsRequest: typeof buildTrafficIncidentDetailsRequest;
3145
+ parseTrafficIncidentDetailsResponse: typeof parseTrafficIncidentDetailsResponse;
3146
+ trafficIncidentDetailsTemplate: TrafficIncidentDetailsTemplate;
3129
3147
  };
3130
3148
 
3131
3149
  declare const customize_9: {
3132
- autocompleteSearch: typeof autocompleteSearch;
3133
- buildAutocompleteSearchRequest: typeof buildAutocompleteSearchRequest;
3134
- parseAutocompleteSearchResponse: typeof parseAutocompleteSearchResponse;
3135
- autocompleteSearchTemplate: AutocompleteSearchTemplate;
3150
+ buildPlaceByIdRequest: typeof buildPlaceByIdRequest;
3151
+ parsePlaceByIdResponse: typeof parsePlaceByIdResponse;
3152
+ placeByIdTemplate: PlaceByIdTemplate;
3136
3153
  };
3137
3154
 
3138
3155
  /**
@@ -3185,8 +3202,9 @@ export declare const customizeService: {
3185
3202
  calculateRoute: typeof customize_5;
3186
3203
  reachableRange: typeof customize_6;
3187
3204
  evChargingStationsAvailability: typeof customize_7;
3188
- placeByID: typeof customize_8;
3189
- autocompleteSearch: typeof customize_9;
3205
+ trafficIncidentDetails: typeof customize_8;
3206
+ placeByID: typeof customize_9;
3207
+ autocompleteSearch: typeof customize_10;
3190
3208
  };
3191
3209
 
3192
3210
  /**
@@ -4822,6 +4840,77 @@ export declare type GuidanceParams = {
4822
4840
  */
4823
4841
  export declare const hasChargingAvailability: (chargingPark: ChargingPark | ChargingParkWithAvailability | undefined) => chargingPark is ChargingParkWithAvailability;
4824
4842
 
4843
+ /**
4844
+ * @ignore
4845
+ */
4846
+ declare type IncidentAPI = {
4847
+ type: 'Feature';
4848
+ geometry: IncidentGeometryAPI;
4849
+ properties: IncidentPropertiesAPI;
4850
+ };
4851
+
4852
+ /**
4853
+ * @ignore
4854
+ */
4855
+ declare type IncidentDetailsResponseAPI = {
4856
+ incidents: (IncidentAPI | null)[];
4857
+ };
4858
+
4859
+ /**
4860
+ * @ignore
4861
+ */
4862
+ declare type IncidentEventAPI = {
4863
+ description: string;
4864
+ code: number;
4865
+ iconCategory: number;
4866
+ };
4867
+
4868
+ /**
4869
+ * @ignore
4870
+ */
4871
+ declare type IncidentGeometryAPI = Point | LineString;
4872
+
4873
+ /**
4874
+ * @ignore
4875
+ */
4876
+ declare type IncidentPropertiesAPI = {
4877
+ id: string;
4878
+ iconCategory: number;
4879
+ magnitudeOfDelay: number;
4880
+ events: IncidentEventAPI[];
4881
+ startTime?: string;
4882
+ endTime?: string;
4883
+ from?: string;
4884
+ to?: string;
4885
+ length?: number;
4886
+ delay?: number;
4887
+ roadNumbers?: string[];
4888
+ timeValidity: string;
4889
+ probabilityOfOccurrence?: string;
4890
+ numberOfReports?: number;
4891
+ lastReportTime?: string;
4892
+ tmc?: IncidentTMCAPI;
4893
+ };
4894
+
4895
+ /**
4896
+ * @ignore
4897
+ */
4898
+ declare type IncidentTMCAPI = {
4899
+ countryCode: string;
4900
+ tableNumber: string;
4901
+ tableVersion: string;
4902
+ direction: string;
4903
+ points: IncidentTMCPointAPI[];
4904
+ };
4905
+
4906
+ /**
4907
+ * @ignore
4908
+ */
4909
+ declare type IncidentTMCPointAPI = {
4910
+ location: number;
4911
+ offset?: number;
4912
+ };
4913
+
4825
4914
  /**
4826
4915
  * Route section type that can be requested in routing parameters.
4827
4916
  *
@@ -5160,6 +5249,12 @@ export declare type ParseResponseError<T = DefaultAPIResponseErrorBody> = (apiEr
5160
5249
  */
5161
5250
  declare const parseRevGeoResponse: (apiResponse: ReverseGeocodingResponseAPI, params: ReverseGeocodingParams) => ReverseGeocodingResponse;
5162
5251
 
5252
+ /**
5253
+ * Default method for parsing a traffic incident details API response.
5254
+ * @param apiResponse The raw Traffic Incident Details API response.
5255
+ */
5256
+ declare const parseTrafficIncidentDetailsResponse: (apiResponse: IncidentDetailsResponseAPI) => TrafficIncidentDetails;
5257
+
5163
5258
  /**
5164
5259
  * Retrieve detailed information about a place using its unique identifier.
5165
5260
  *
@@ -6880,6 +6975,231 @@ export declare type TimeZoneRequest = 'iana';
6880
6975
  */
6881
6976
  declare type TrafficCategoryAPI = 'JAM' | 'ROAD_WORK' | 'ROAD_CLOSURE' | 'OTHER';
6882
6977
 
6978
+ /**
6979
+ * Fetch detailed information about traffic incidents.
6980
+ *
6981
+ * Query incidents either by a geographic bounding box or by a list of incident IDs.
6982
+ * Results are GeoJSON Features whose geometry is a `Point` (localised incidents) or
6983
+ * a `LineString` (incidents spanning a stretch of road).
6984
+ *
6985
+ * @remarks
6986
+ * **Two query modes:**
6987
+ *
6988
+ * - **Bounding box** (`bbox`): Returns all incidents within the given area.
6989
+ * Maximum area is 10,000 km².
6990
+ * - **By IDs** (`ids`): Returns the specified incidents directly.
6991
+ * GET is used automatically for up to 5 IDs; POST for up to 100 IDs.
6992
+ *
6993
+ * **Key data provided per incident:**
6994
+ * - Category (`iconCategory`): type of incident (accident, roadworks, jam, etc.)
6995
+ * - Delay magnitude: severity of the delay (`minor`, `moderate`, `major`, …)
6996
+ * - Geometry: exact location or extent of the incident on the road network
6997
+ * - Time information: start/end times and whether the incident is `present` or `future`
6998
+ * - Events: one or more detailed event descriptions
6999
+ *
7000
+ * @param params - Traffic Incident Details parameters (bbox or ids)
7001
+ * @param customTemplate - Advanced customization for request/response handling
7002
+ *
7003
+ * @returns Promise resolving to a {@link TrafficIncidentDetails} object containing the matching incidents
7004
+ *
7005
+ * @example
7006
+ * ```typescript
7007
+ * // Query by bounding box (Amsterdam area)
7008
+ * const result = await trafficIncidentDetails({
7009
+ * bbox: [4.728, 52.278, 5.080, 52.479]
7010
+ * });
7011
+ *
7012
+ * result.incidents.forEach(incident => {
7013
+ * console.log(incident.properties.iconCategory); // 'accident' | 'jam' | …
7014
+ * console.log(incident.properties.magnitudeOfDelay); // 'minor' | 'major' | …
7015
+ * console.log(incident.geometry); // Point or LineString
7016
+ * });
7017
+ * ```
7018
+ *
7019
+ * @example
7020
+ * ```typescript
7021
+ * // Query up to 5 specific incidents by ID (GET)
7022
+ * const result = await trafficIncidentDetails({
7023
+ * ids: ['incident-id-1', 'incident-id-2']
7024
+ * });
7025
+ * ```
7026
+ *
7027
+ * @example
7028
+ * ```typescript
7029
+ * // Query many incident IDs — POST is used automatically when ids.length > 5
7030
+ * const result = await trafficIncidentDetails({
7031
+ * ids: largeIdArray
7032
+ * });
7033
+ * ```
7034
+ *
7035
+ * @example
7036
+ * ```typescript
7037
+ * // Filter by category and include future incidents
7038
+ * const result = await trafficIncidentDetails({
7039
+ * bbox: [4.728, 52.278, 5.080, 52.479],
7040
+ * categoryFilter: ['accident', 'road-closed'],
7041
+ * timeValidityFilter: ['present', 'future']
7042
+ * });
7043
+ * ```
7044
+ *
7045
+ * @see [Incident Details API Documentation](https://docs.tomtom.com/traffic-api/documentation/tomtom-orbis-maps/traffic-incidents/incident-details)
7046
+ * @see [Incident Details Guide](https://docs.tomtom.com/maps-sdk-js/guides/services/traffic/incident-details)
7047
+ *
7048
+ * @group Traffic
7049
+ */
7050
+ export declare const trafficIncidentDetails: (params: TrafficIncidentDetailsParams, customTemplate?: Partial<TrafficIncidentDetailsTemplate>) => Promise<TrafficIncidentDetails>;
7051
+
7052
+ /**
7053
+ * Base parameters shared by all Traffic Incident Details query modes.
7054
+ *
7055
+ * @group Traffic
7056
+ */
7057
+ declare type TrafficIncidentDetailsBaseParams = CommonServiceParams & {
7058
+ /**
7059
+ * Traffic Model ID used to obtain consistent traffic data.
7060
+ *
7061
+ * @remarks
7062
+ * The Traffic Model ID is obtained from the Traffic Flow service and
7063
+ * is valid for approximately 2 minutes. Using the same ID across
7064
+ * different traffic API calls ensures temporal consistency.
7065
+ *
7066
+ * @example
7067
+ * ```typescript
7068
+ * trafficModelId: '1234567890'
7069
+ * ```
7070
+ */
7071
+ trafficModelId?: string;
7072
+ /**
7073
+ * Filter results to specific incident categories.
7074
+ *
7075
+ * @remarks
7076
+ * Provide {@link TrafficIncidentCategory} values to include. When omitted, all categories are returned.
7077
+ *
7078
+ * @example
7079
+ * ```typescript
7080
+ * // Only accidents and road closures
7081
+ * categoryFilter: ['accident', 'road-closed']
7082
+ * ```
7083
+ */
7084
+ categoryFilter?: TrafficIncidentCategory[];
7085
+ /**
7086
+ * Filter incidents by their temporal validity.
7087
+ *
7088
+ * @remarks
7089
+ * - `'present'`: Only return currently active incidents
7090
+ * - `'future'`: Only return scheduled or predicted incidents
7091
+ *
7092
+ * When omitted, only `'present'` incidents are returned.
7093
+ *
7094
+ * @example
7095
+ * ```typescript
7096
+ * // Include both present and future incidents
7097
+ * timeValidityFilter: ['present', 'future']
7098
+ * ```
7099
+ */
7100
+ timeValidityFilter?: TrafficIncidentTimeValidity[];
7101
+ };
7102
+
7103
+ /**
7104
+ * Parameters for fetching incidents within a bounding box.
7105
+ *
7106
+ * @remarks
7107
+ * The bounding box must cover an area no larger than 10,000 km².
7108
+ *
7109
+ * @example
7110
+ * ```typescript
7111
+ * // Raw bbox tuple
7112
+ * const params: TrafficIncidentDetailsByBBoxParams = {
7113
+ * bbox: [4.728, 52.278, 5.080, 52.479]
7114
+ * };
7115
+ *
7116
+ * // GeoJSON place returned by geocoding
7117
+ * const place = await geocodeOne('Amsterdam');
7118
+ * const params: TrafficIncidentDetailsByBBoxParams = { bbox: place };
7119
+ * ```
7120
+ *
7121
+ * @group Traffic
7122
+ */
7123
+ export declare type TrafficIncidentDetailsByBBoxParams = TrafficIncidentDetailsBaseParams & {
7124
+ /**
7125
+ * Bounding box to query for incidents.
7126
+ *
7127
+ * Accepts a raw `[minLon, minLat, maxLon, maxLat]` tuple, any GeoJSON object
7128
+ * (Feature, FeatureCollection, Geometry, …), or an array of GeoJSON objects.
7129
+ * When a GeoJSON value is provided, its bounding box is calculated automatically
7130
+ * via {@link bboxFromGeoJSON}.
7131
+ *
7132
+ * Maximum area: 10,000 km².
7133
+ *
7134
+ * @example
7135
+ * ```typescript
7136
+ * // Raw bbox tuple
7137
+ * bbox: [4.728, 52.278, 5.080, 52.479]
7138
+ *
7139
+ * // GeoJSON Feature returned by a geocode call
7140
+ * const place = await geocodeOne('Amsterdam');
7141
+ * bbox: place
7142
+ * ```
7143
+ */
7144
+ bbox: HasBBox;
7145
+ ids?: never;
7146
+ };
7147
+
7148
+ /**
7149
+ * Parameters for fetching specific incidents by their IDs.
7150
+ *
7151
+ * The HTTP method is chosen automatically: GET for up to 5 IDs, POST for more.
7152
+ *
7153
+ * @example
7154
+ * ```typescript
7155
+ * // Up to 5 IDs — sent as GET
7156
+ * const params: TrafficIncidentDetailsByIdsParams = {
7157
+ * ids: ['incident-id-1', 'incident-id-2']
7158
+ * };
7159
+ *
7160
+ * // More than 5 IDs — sent as POST automatically
7161
+ * const params: TrafficIncidentDetailsByIdsParams = {
7162
+ * ids: manyIds
7163
+ * };
7164
+ * ```
7165
+ *
7166
+ * @group Traffic
7167
+ */
7168
+ export declare type TrafficIncidentDetailsByIdsParams = TrafficIncidentDetailsBaseParams & {
7169
+ /**
7170
+ * List of incident IDs to fetch.
7171
+ *
7172
+ * @remarks
7173
+ * Up to 5 IDs are sent via GET; more than 5 are sent via POST (maximum 100).
7174
+ */
7175
+ ids: string[];
7176
+ bbox?: never;
7177
+ };
7178
+
7179
+ /**
7180
+ * Parameters for the Traffic Incident Details service.
7181
+ *
7182
+ * Provide either a `bbox` to search within an area, or a list of `ids` to
7183
+ * look up specific incidents.
7184
+ *
7185
+ * @group Traffic
7186
+ */
7187
+ export declare type TrafficIncidentDetailsParams = TrafficIncidentDetailsByBBoxParams | TrafficIncidentDetailsByIdsParams;
7188
+
7189
+ declare type TrafficIncidentDetailsPostBody = {
7190
+ ids: string[];
7191
+ };
7192
+
7193
+ declare type TrafficIncidentDetailsPostBody_2 = {
7194
+ ids: string[];
7195
+ };
7196
+
7197
+ /**
7198
+ * Traffic Incident Details service template type.
7199
+ * @ignore
7200
+ */
7201
+ declare type TrafficIncidentDetailsTemplate = ServiceTemplate<TrafficIncidentDetailsParams, FetchInput<TrafficIncidentDetailsPostBody_2>, IncidentDetailsResponseAPI, TrafficIncidentDetails>;
7202
+
6883
7203
  /**
6884
7204
  * Traffic consideration mode for route calculation.
6885
7205
  *