@tomtom-org/maps-sdk 0.56.0 → 0.57.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 +32 -0
- package/README.md +1 -1
- package/core/dist/core.es.js +1 -1
- package/map/dist/index.d.ts +459 -301
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/package.json +1 -1
- package/services/dist/index.d.ts +61 -30
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
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.
|
|
5
|
+
"version": "0.57.0",
|
|
6
6
|
"description": "TomTom maps, search, geocoding, routing, isochrones, EV and traffic for JavaScript — typed GeoJSON services and a MapLibre GL JS map.",
|
|
7
7
|
"homepage": "https://docs.tomtom.com/maps-sdk-js/introduction/overview",
|
|
8
8
|
"repository": {
|
package/services/dist/index.d.ts
CHANGED
|
@@ -3186,7 +3186,7 @@ type SummaryQueryType = 'NEARBY' | 'NON_NEAR';
|
|
|
3186
3186
|
* });
|
|
3187
3187
|
*
|
|
3188
3188
|
* const summary = results.summary;
|
|
3189
|
-
* console.log(`Found ${summary.totalResults} total results`);
|
|
3189
|
+
* console.log(`Found ${summary.totalResults ?? 'an unknown number of'} total results`);
|
|
3190
3190
|
* console.log(`Showing ${summary.numResults} results`);
|
|
3191
3191
|
* console.log(`Query type: ${summary.queryType}`); // 'NEARBY'
|
|
3192
3192
|
* console.log(`Search took ${summary.queryTime}ms`);
|
|
@@ -3233,7 +3233,8 @@ export type SearchSummary = {
|
|
|
3233
3233
|
* Number of results included in this response.
|
|
3234
3234
|
*
|
|
3235
3235
|
* This is the actual count of features in the results array,
|
|
3236
|
-
* which may be less than `totalResults` due to pagination limits.
|
|
3236
|
+
* which may be less than `totalResults` due to pagination limits. Unlike `totalResults` this
|
|
3237
|
+
* is always present — it is the length of the array you were given.
|
|
3237
3238
|
*
|
|
3238
3239
|
* @remarks
|
|
3239
3240
|
* Controlled by the `limit` parameter in the search request.
|
|
@@ -3275,10 +3276,11 @@ export type SearchSummary = {
|
|
|
3275
3276
|
* regardless of pagination limits.
|
|
3276
3277
|
*
|
|
3277
3278
|
* @remarks
|
|
3278
|
-
*
|
|
3279
|
+
* Optional — a total is not guaranteed, so guard it rather than assuming a number. Where it
|
|
3280
|
+
* is present, use it with `offset` and `numResults` to paginate:
|
|
3279
3281
|
* - Current page: `offset / limit + 1`
|
|
3280
|
-
* - Total pages: `Math.ceil(totalResults / limit)`
|
|
3281
|
-
* - Has more results: `offset + numResults < totalResults`
|
|
3282
|
+
* - Total pages: `totalResults === undefined ? undefined : Math.ceil(totalResults / limit)`
|
|
3283
|
+
* - Has more results: `totalResults !== undefined && offset + numResults < totalResults`
|
|
3282
3284
|
*
|
|
3283
3285
|
* @example
|
|
3284
3286
|
* ```typescript
|
|
@@ -3289,7 +3291,7 @@ export type SearchSummary = {
|
|
|
3289
3291
|
* // Can fetch more with offset: 10, 20, 30, 40
|
|
3290
3292
|
* ```
|
|
3291
3293
|
*/
|
|
3292
|
-
totalResults
|
|
3294
|
+
totalResults?: number;
|
|
3293
3295
|
/**
|
|
3294
3296
|
* Maximum fuzzy matching level used to find results.
|
|
3295
3297
|
*
|
|
@@ -3306,6 +3308,9 @@ export type SearchSummary = {
|
|
|
3306
3308
|
* If results are found with exact or near-exact matching, this will be low.
|
|
3307
3309
|
* If the query has typos, this increases to find matches.
|
|
3308
3310
|
*
|
|
3311
|
+
* Optional — where match strictness is not reported the field is absent rather than `0`, so
|
|
3312
|
+
* read a missing value as "not reported" rather than as an exact match.
|
|
3313
|
+
*
|
|
3309
3314
|
* @example
|
|
3310
3315
|
* ```typescript
|
|
3311
3316
|
* // Query: "amstrdam" (typo)
|
|
@@ -3315,7 +3320,7 @@ export type SearchSummary = {
|
|
|
3315
3320
|
* fuzzyLevel: 0 // Exact match, no fuzzy matching needed
|
|
3316
3321
|
* ```
|
|
3317
3322
|
*/
|
|
3318
|
-
fuzzyLevel
|
|
3323
|
+
fuzzyLevel?: number;
|
|
3319
3324
|
/**
|
|
3320
3325
|
* Geographic position used to bias search results.
|
|
3321
3326
|
*
|
|
@@ -3436,9 +3441,17 @@ type AddressRangesAPI = {
|
|
|
3436
3441
|
to: LatLonAPI;
|
|
3437
3442
|
};
|
|
3438
3443
|
/**
|
|
3444
|
+
* The summary envelope as the places endpoints send it.
|
|
3445
|
+
*
|
|
3446
|
+
* @remarks
|
|
3447
|
+
* Derived from {@link SearchSummary}, but `totalResults` and `fuzzyLevel` are pinned back to
|
|
3448
|
+
* required here. They are optional on the public type so that consumers guard them; the endpoints
|
|
3449
|
+
* we call always send them, and this type is what asserts that. Relaxing it would let a parser
|
|
3450
|
+
* silently stop populating them.
|
|
3451
|
+
*
|
|
3439
3452
|
* @ignore
|
|
3440
3453
|
*/
|
|
3441
|
-
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias'> & {
|
|
3454
|
+
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias'> & Required<Pick<SearchSummary, 'totalResults' | 'fuzzyLevel'>> & {
|
|
3442
3455
|
geoBias?: LatLonAPI;
|
|
3443
3456
|
};
|
|
3444
3457
|
/**
|
|
@@ -4033,7 +4046,7 @@ type AutocompleteSearchSegmentType = 'brand' | 'category' | 'plaintext';
|
|
|
4033
4046
|
*
|
|
4034
4047
|
* @group Autocomplete Search
|
|
4035
4048
|
*/
|
|
4036
|
-
type AutocompleteSearchParams = CommonServiceParams<
|
|
4049
|
+
type AutocompleteSearchParams = CommonServiceParams<GetObject, AutocompleteSearchResponseAPI> & {
|
|
4037
4050
|
/**
|
|
4038
4051
|
* Search query string (partial user input).
|
|
4039
4052
|
*
|
|
@@ -4131,7 +4144,7 @@ type AutocompleteSearchParams = CommonServiceParams<URL, AutocompleteSearchRespo
|
|
|
4131
4144
|
* Autocomplete service template type.
|
|
4132
4145
|
* @ignore
|
|
4133
4146
|
*/
|
|
4134
|
-
type AutocompleteSearchTemplate = ServiceTemplate<AutocompleteSearchParams,
|
|
4147
|
+
type AutocompleteSearchTemplate = ServiceTemplate<AutocompleteSearchParams, GetObject, AutocompleteSearchResponseAPI, AutocompleteSearchResponse>;
|
|
4135
4148
|
//#endregion
|
|
4136
4149
|
//#region src/autocomplete-search/autocompleteSearch.d.ts
|
|
4137
4150
|
/**
|
|
@@ -4220,7 +4233,7 @@ declare const customize$11: {
|
|
|
4220
4233
|
* Default function for building autocomplete request from {@link AutocompleteSearchParams}
|
|
4221
4234
|
* @param params The autocomplete parameters, with global configuration already merged into them.
|
|
4222
4235
|
*/
|
|
4223
|
-
declare const buildAutocompleteSearchRequest: (params: AutocompleteSearchParams) =>
|
|
4236
|
+
declare const buildAutocompleteSearchRequest: (params: AutocompleteSearchParams) => GetObject;
|
|
4224
4237
|
//#endregion
|
|
4225
4238
|
//#region src/autocomplete-search/responseParser.d.ts
|
|
4226
4239
|
/**
|
|
@@ -4333,6 +4346,13 @@ type EVChargingStationsAvailabilityTemplate = ServiceTemplate<ChargingStationsAv
|
|
|
4333
4346
|
/**
|
|
4334
4347
|
* Default method for building ev charging stations availability request from {@link ChargingStationsAvailabilityParams}
|
|
4335
4348
|
* @param params The charging availability parameters, with global configuration already merged into them.
|
|
4349
|
+
*
|
|
4350
|
+
* @remarks
|
|
4351
|
+
* Unlike the other places services, this one keeps `key=` and `apiVersion=` in the query string.
|
|
4352
|
+
* `/maps/orbis/places/ev/id` answers 401 to a header-only credential, while `search`,
|
|
4353
|
+
* `poiCategories`, `geocode`, `place` and `additionalData` all accept one — probed against
|
|
4354
|
+
* production. Moving this one to headers breaks it outright rather than subtly, so it stays until
|
|
4355
|
+
* the endpoint catches up.
|
|
4336
4356
|
*/
|
|
4337
4357
|
declare const buildEVChargingStationsAvailabilityRequest: (params: ChargingStationsAvailabilityParams) => URL;
|
|
4338
4358
|
//#endregion
|
|
@@ -4462,7 +4482,7 @@ type GeocodingIndexTypesAbbreviation = Exclude<SearchIndexType, 'POI'>;
|
|
|
4462
4482
|
*
|
|
4463
4483
|
* @group Geocoding
|
|
4464
4484
|
*/
|
|
4465
|
-
type GeocodingParams = Omit<CommonPlacesParams<
|
|
4485
|
+
type GeocodingParams = Omit<CommonPlacesParams<GetObject, GeocodingResponseAPI> & CommonGeocodeAndFuzzySearchParams, 'extendedPostalCodesFor'> & {
|
|
4466
4486
|
/**
|
|
4467
4487
|
* Address or location query to geocode.
|
|
4468
4488
|
*
|
|
@@ -4522,14 +4542,14 @@ type GeocodingParams = Omit<CommonPlacesParams<URL, GeocodingResponseAPI> & Comm
|
|
|
4522
4542
|
* Geocoding service template type.
|
|
4523
4543
|
* @ignore
|
|
4524
4544
|
*/
|
|
4525
|
-
type GeocodingTemplate = ServiceTemplate<GeocodingParams,
|
|
4545
|
+
type GeocodingTemplate = ServiceTemplate<GeocodingParams, GetObject, GeocodingResponseAPI, GeocodingResponse>;
|
|
4526
4546
|
//#endregion
|
|
4527
4547
|
//#region src/geocode/requestBuilder.d.ts
|
|
4528
4548
|
/**
|
|
4529
4549
|
* Default method for building geocoding request from {@link GeocodingParams}
|
|
4530
4550
|
* @param params The geocoding parameters, with global configuration already merged into them.
|
|
4531
4551
|
*/
|
|
4532
|
-
declare const buildGeocodingRequest: (params: GeocodingParams) =>
|
|
4552
|
+
declare const buildGeocodingRequest: (params: GeocodingParams) => GetObject;
|
|
4533
4553
|
//#endregion
|
|
4534
4554
|
//#region src/geocode/responseParser.d.ts
|
|
4535
4555
|
/**
|
|
@@ -4584,7 +4604,7 @@ type GeometriesInput = string[];
|
|
|
4584
4604
|
*
|
|
4585
4605
|
* @group Geometry
|
|
4586
4606
|
*/
|
|
4587
|
-
type CommonServiceParamsWithZoom = CommonServiceParams<
|
|
4607
|
+
type CommonServiceParamsWithZoom = CommonServiceParams<GetObject, GeometryDataResponseAPI> & {
|
|
4588
4608
|
/**
|
|
4589
4609
|
* Optional zoom level for geometry detail.
|
|
4590
4610
|
*
|
|
@@ -4738,14 +4758,14 @@ type GeometryParams = GeometryDataParams | GeometryPlaceParams;
|
|
|
4738
4758
|
/**
|
|
4739
4759
|
* @ignore
|
|
4740
4760
|
*/
|
|
4741
|
-
type GeometryDataTemplate = ServiceTemplate<GeometryParams,
|
|
4761
|
+
type GeometryDataTemplate = ServiceTemplate<GeometryParams, GetObject, GeometryDataResponseAPI, PolygonFeatures>;
|
|
4742
4762
|
//#endregion
|
|
4743
4763
|
//#region src/geometry-data/requestBuilder.d.ts
|
|
4744
4764
|
/**
|
|
4745
4765
|
* Default function for building a geometry data request from {@link GeometryDataParams}
|
|
4746
4766
|
* @param params The geometry data parameters, with global configuration already merged into them.
|
|
4747
4767
|
*/
|
|
4748
|
-
declare const buildGeometryDataRequest: (params: GeometryParams) =>
|
|
4768
|
+
declare const buildGeometryDataRequest: (params: GeometryParams) => GetObject;
|
|
4749
4769
|
//#endregion
|
|
4750
4770
|
//#region src/geometry-data/responseParser.d.ts
|
|
4751
4771
|
/**
|
|
@@ -5339,7 +5359,7 @@ type PlaceByIdMandatoryParams = {
|
|
|
5339
5359
|
*
|
|
5340
5360
|
* @group Place
|
|
5341
5361
|
*/
|
|
5342
|
-
type PlaceByIdParams = CommonServiceParams<
|
|
5362
|
+
type PlaceByIdParams = CommonServiceParams<GetObject, PlaceByIdResponseAPI> & PlaceByIdMandatoryParams & PlaceByIdOptionalParams;
|
|
5343
5363
|
//#endregion
|
|
5344
5364
|
//#region src/place-by-id/types/placeByIdResponse.d.ts
|
|
5345
5365
|
/**
|
|
@@ -5361,14 +5381,14 @@ type PlaceByIdResponse = Place<SearchPlaceProps> | undefined;
|
|
|
5361
5381
|
* Place By Is template type.
|
|
5362
5382
|
* @ignore
|
|
5363
5383
|
*/
|
|
5364
|
-
type PlaceByIdTemplate = ServiceTemplate<PlaceByIdParams,
|
|
5384
|
+
type PlaceByIdTemplate = ServiceTemplate<PlaceByIdParams, GetObject, PlaceByIdResponseAPI, PlaceByIdResponse>;
|
|
5365
5385
|
//#endregion
|
|
5366
5386
|
//#region src/place-by-id/requestBuilder.d.ts
|
|
5367
5387
|
/**
|
|
5368
5388
|
* Default method for building place by id request from {@link PlaceByIdParams}
|
|
5369
5389
|
* @param params The place by id parameters, with global configuration already merged into them.
|
|
5370
5390
|
*/
|
|
5371
|
-
declare const buildPlaceByIdRequest: (params: PlaceByIdParams) =>
|
|
5391
|
+
declare const buildPlaceByIdRequest: (params: PlaceByIdParams) => GetObject;
|
|
5372
5392
|
//#endregion
|
|
5373
5393
|
//#region src/place-by-id/responseParser.d.ts
|
|
5374
5394
|
/**
|
|
@@ -7552,16 +7572,23 @@ declare const customize: {
|
|
|
7552
7572
|
*
|
|
7553
7573
|
* @example
|
|
7554
7574
|
* ```typescript
|
|
7555
|
-
* import { mergeFromGlobal } from '@tomtom-org/maps-sdk/core';
|
|
7575
|
+
* import { isProxyCredentialsMode, mergeFromGlobal } from '@tomtom-org/maps-sdk/core';
|
|
7556
7576
|
* import { customizeService } from '@tomtom-org/maps-sdk/services';
|
|
7557
7577
|
*
|
|
7558
7578
|
* const { buildGeocodingRequest, parseGeocodingResponse } = customizeService.geocode;
|
|
7559
7579
|
*
|
|
7560
7580
|
* // Request builders expect the global configuration to be merged in already
|
|
7561
|
-
* const
|
|
7562
|
-
*
|
|
7563
|
-
*
|
|
7564
|
-
*
|
|
7581
|
+
* const config = mergeFromGlobal({ query: 'Amsterdam' });
|
|
7582
|
+
* const { url, headers } = buildGeocodingRequest(config);
|
|
7583
|
+
*
|
|
7584
|
+
* // Send the request yourself, then parse the raw API payload. The credential travels in
|
|
7585
|
+
* // `headers` — pass them on, or the request is unauthenticated. With a credentials proxy
|
|
7586
|
+
* // (no `apiKey`, custom `commonBaseURL`) the proxy's session cookie has to travel instead,
|
|
7587
|
+
* // so send `credentials: 'include'` the way the SDK's own fetch does.
|
|
7588
|
+
* const apiResponse = await fetch(url, {
|
|
7589
|
+
* headers,
|
|
7590
|
+
* ...(isProxyCredentialsMode(config) && { credentials: 'include' }),
|
|
7591
|
+
* });
|
|
7565
7592
|
* const places = parseGeocodingResponse(await apiResponse.json());
|
|
7566
7593
|
* ```
|
|
7567
7594
|
*
|
|
@@ -7949,7 +7976,7 @@ type PoiCategoriesResponseAPI = {
|
|
|
7949
7976
|
*
|
|
7950
7977
|
* @group POI Categories
|
|
7951
7978
|
*/
|
|
7952
|
-
type POICategoriesParams = CommonServiceParams<
|
|
7979
|
+
type POICategoriesParams = CommonServiceParams<GetObject, PoiCategoriesResponseAPI> & {
|
|
7953
7980
|
/**
|
|
7954
7981
|
* One or more filter strings applied client-side against the text index.
|
|
7955
7982
|
*
|
|
@@ -8344,8 +8371,12 @@ type FuzzySearchFeatureCollectionProps = SearchSummary & {
|
|
|
8344
8371
|
*
|
|
8345
8372
|
* Indicates how the search engine interpreted the query
|
|
8346
8373
|
* (e.g., as coordinates, nearby search, what3words, or bookmark).
|
|
8374
|
+
*
|
|
8375
|
+
* @remarks
|
|
8376
|
+
* Optional — query-intent detection is not guaranteed, so guard it rather than assuming it is
|
|
8377
|
+
* present.
|
|
8347
8378
|
*/
|
|
8348
|
-
queryIntent
|
|
8379
|
+
queryIntent?: QueryIntent[];
|
|
8349
8380
|
};
|
|
8350
8381
|
/**
|
|
8351
8382
|
* Union type for all possible query intents.
|
|
@@ -8533,7 +8564,7 @@ type FuzzySearchResponseAPI = {
|
|
|
8533
8564
|
* Summary information about the search that was performed.
|
|
8534
8565
|
*/
|
|
8535
8566
|
summary: SummaryAPI$1 & {
|
|
8536
|
-
queryIntent
|
|
8567
|
+
queryIntent?: QueryIntentAPI[];
|
|
8537
8568
|
};
|
|
8538
8569
|
/**
|
|
8539
8570
|
* The result list, sorted in descending order by score.
|
|
@@ -8640,7 +8671,7 @@ type NearbyIntentDetailsAPI = Omit<NearbyIntentDetails, 'position'> & {
|
|
|
8640
8671
|
*
|
|
8641
8672
|
* @group Search
|
|
8642
8673
|
*/
|
|
8643
|
-
type FuzzySearchParams = CommonSearchParams<
|
|
8674
|
+
type FuzzySearchParams = CommonSearchParams<GetObject, FuzzySearchResponseAPI> & CommonGeocodeAndFuzzySearchParams & {
|
|
8644
8675
|
/**
|
|
8645
8676
|
* Minimum fuzziness level to be used.
|
|
8646
8677
|
*
|
|
@@ -8698,7 +8729,7 @@ type FuzzySearchParams = CommonSearchParams<URL, FuzzySearchResponseAPI> & Commo
|
|
|
8698
8729
|
* Fuzzy search service template type.
|
|
8699
8730
|
* @ignore
|
|
8700
8731
|
*/
|
|
8701
|
-
type FuzzySearchTemplate = ServiceTemplate<FuzzySearchParams,
|
|
8732
|
+
type FuzzySearchTemplate = ServiceTemplate<FuzzySearchParams, GetObject, FuzzySearchResponseAPI, FuzzySearchResponse>;
|
|
8702
8733
|
//#endregion
|
|
8703
8734
|
//#region src/search/search.d.ts
|
|
8704
8735
|
type SearchFeatureCollectionProps = SearchSummary & {
|