@tomtom-org/maps-sdk 0.45.8 → 0.45.9

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