@maptiler/client 1.3.0 → 1.5.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.
Files changed (70) hide show
  1. package/dist/maptiler-client.cjs +70 -16
  2. package/dist/maptiler-client.cjs.map +1 -1
  3. package/dist/maptiler-client.d.ts +27 -0
  4. package/dist/maptiler-client.min.mjs +1 -1
  5. package/dist/maptiler-client.mjs +70 -16
  6. package/dist/maptiler-client.mjs.map +1 -1
  7. package/dist/maptiler-client.umd.js +70 -16
  8. package/dist/maptiler-client.umd.js.map +1 -1
  9. package/dist/maptiler-client.umd.min.js +1 -1
  10. package/docs/assets/search.js +1 -1
  11. package/docs/classes/config.ClientConfig.html +9 -9
  12. package/docs/classes/services_ServiceError.ServiceError.html +7 -7
  13. package/docs/functions/language.getAutoLanguageGeocoding.html +5 -5
  14. package/docs/functions/services_simplify.default.html +5 -5
  15. package/docs/index.html +16 -10
  16. package/docs/modules/config.html +5 -5
  17. package/docs/modules/language.html +5 -5
  18. package/docs/modules/services_ServiceError.html +5 -5
  19. package/docs/modules/services_coordinates.html +5 -5
  20. package/docs/modules/services_data.html +5 -5
  21. package/docs/modules/services_geocoding.html +5 -5
  22. package/docs/modules/services_geolocation.html +5 -5
  23. package/docs/modules/services_simplify.html +5 -5
  24. package/docs/modules/services_staticMaps.html +5 -5
  25. package/docs/modules.html +4 -4
  26. package/docs/types/config.FetchFunction.html +5 -5
  27. package/docs/types/language.LanguageGeocodingString.html +5 -5
  28. package/docs/types/services_coordinates.CoordinateExport.html +5 -5
  29. package/docs/types/services_coordinates.CoordinateGrid.html +5 -5
  30. package/docs/types/services_coordinates.CoordinateId.html +5 -5
  31. package/docs/types/services_coordinates.CoordinateSearch.html +5 -5
  32. package/docs/types/services_coordinates.CoordinateSearchResult.html +5 -5
  33. package/docs/types/services_coordinates.CoordinateTransformResult.html +5 -5
  34. package/docs/types/services_coordinates.CoordinateTransformation.html +5 -5
  35. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +5 -5
  36. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +5 -5
  37. package/docs/types/services_coordinates.XYZ.html +5 -5
  38. package/docs/types/services_data.GetDataOptions.html +5 -5
  39. package/docs/types/services_geocoding.ByIdGeocodingOptions.html +5 -5
  40. package/docs/types/services_geocoding.CommonForwardAndReverseGeocodingOptions.html +5 -5
  41. package/docs/types/services_geocoding.Coordinates.html +5 -5
  42. package/docs/types/services_geocoding.FeatureHierarchy.html +5 -5
  43. package/docs/types/services_geocoding.GeocodingFeature.html +5 -5
  44. package/docs/types/services_geocoding.GeocodingOptions.html +5 -5
  45. package/docs/types/services_geocoding.GeocodingSearchResult.html +5 -5
  46. package/docs/types/services_geocoding.LanguageGeocodingOptions.html +5 -5
  47. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +5 -5
  48. package/docs/types/services_geolocation.GeolocationInfoOptions.html +5 -5
  49. package/docs/types/services_geolocation.GeolocationResult.html +5 -5
  50. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +5 -5
  51. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +5 -5
  52. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +5 -5
  53. package/docs/types/services_staticMaps.StaticMapBaseOptions.html +5 -5
  54. package/docs/types/services_staticMaps.StaticMapMarker.html +5 -5
  55. package/docs/variables/config.config.html +5 -5
  56. package/docs/variables/language.LanguageGeocoding.html +5 -5
  57. package/docs/variables/services_coordinates.coordinates.html +5 -5
  58. package/docs/variables/services_data.data.html +5 -5
  59. package/docs/variables/services_geocoding.geocoding.html +29 -9
  60. package/docs/variables/services_geolocation.geolocation.html +5 -5
  61. package/docs/variables/services_staticMaps.staticMaps.html +5 -5
  62. package/docsmd/README.md +44 -42
  63. package/docsmd/classes/ClientConfig.md +5 -5
  64. package/docsmd/classes/MapStyleVariant.md +13 -13
  65. package/docsmd/classes/ReferenceMapStyle.md +9 -9
  66. package/docsmd/classes/ServiceError.md +3 -3
  67. package/package.json +3 -1
  68. package/readme.md +8 -4
  69. package/src/mapstyle.ts +49 -0
  70. package/src/services/geocoding.ts +71 -21
@@ -217,6 +217,24 @@ function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
217
217
  }
218
218
  addLanguageGeocodingOptions(searchParams, options);
219
219
  }
220
+ function addForwardGeocodingOptions(searchParams, options) {
221
+ addCommonForwardAndReverseGeocodingOptions(searchParams, options);
222
+ if (options.bbox != void 0) {
223
+ searchParams.set("bbox", options.bbox.join(","));
224
+ }
225
+ if (options.proximity != void 0) {
226
+ searchParams.set("proximity", options.proximity.join(","));
227
+ }
228
+ if (options.country != void 0) {
229
+ searchParams.set("country", options.country.join(","));
230
+ }
231
+ if (options.fuzzyMatch != void 0) {
232
+ searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
233
+ }
234
+ if (options.autocomplete != void 0) {
235
+ searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
236
+ }
237
+ }
220
238
  function forward(_0) {
221
239
  return __async$3(this, arguments, function* (query, options = {}) {
222
240
  var _a;
@@ -228,22 +246,7 @@ function forward(_0) {
228
246
  defaults.maptilerApiURL
229
247
  );
230
248
  const { searchParams } = endpoint;
231
- addCommonForwardAndReverseGeocodingOptions(searchParams, options);
232
- if (options.bbox != void 0) {
233
- searchParams.set("bbox", options.bbox.join(","));
234
- }
235
- if (options.proximity != void 0) {
236
- searchParams.set("proximity", options.proximity.join(","));
237
- }
238
- if (options.country != void 0) {
239
- searchParams.set("country", options.country.join(","));
240
- }
241
- if (options.fuzzyMatch != void 0) {
242
- searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
243
- }
244
- if (options.autocomplete != void 0) {
245
- searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
246
- }
249
+ addForwardGeocodingOptions(searchParams, options);
247
250
  const urlWithParams = endpoint.toString();
248
251
  const res = yield callFetch(urlWithParams);
249
252
  if (!res.ok) {
@@ -287,10 +290,33 @@ function byId(_0) {
287
290
  return obj;
288
291
  });
289
292
  }
293
+ function batch(_0) {
294
+ return __async$3(this, arguments, function* (queries, options = {}) {
295
+ var _a;
296
+ if (!queries.length) {
297
+ return [];
298
+ }
299
+ const joinedQuery = queries.map((query) => encodeURIComponent(query)).join(";");
300
+ const endpoint = new URL(
301
+ `geocoding/${joinedQuery}.json`,
302
+ defaults.maptilerApiURL
303
+ );
304
+ const { searchParams } = endpoint;
305
+ addForwardGeocodingOptions(searchParams, options);
306
+ const urlWithParams = endpoint.toString();
307
+ const res = yield callFetch(urlWithParams);
308
+ if (!res.ok) {
309
+ throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
310
+ }
311
+ const obj = yield res.json();
312
+ return queries.length === 1 ? [obj] : obj;
313
+ });
314
+ }
290
315
  const geocoding = {
291
316
  forward,
292
317
  reverse,
293
318
  byId,
319
+ batch,
294
320
  language: LanguageGeocoding
295
321
  };
296
322
 
@@ -981,6 +1007,34 @@ const mapStylePresetList = [
981
1007
  }
982
1008
  ]
983
1009
  },
1010
+ {
1011
+ referenceStyleID: "BACKDROP",
1012
+ name: "Backdrop",
1013
+ description: "",
1014
+ variants: [
1015
+ {
1016
+ id: "backdrop",
1017
+ name: "Default",
1018
+ variantType: "DEFAULT",
1019
+ description: "",
1020
+ imageURL: ""
1021
+ },
1022
+ {
1023
+ id: "backdrop-dark",
1024
+ name: "Dark",
1025
+ variantType: "DARK",
1026
+ description: "",
1027
+ imageURL: ""
1028
+ },
1029
+ {
1030
+ id: "backdrop-light",
1031
+ name: "Light",
1032
+ variantType: "LIGHT",
1033
+ description: "",
1034
+ imageURL: ""
1035
+ }
1036
+ ]
1037
+ },
984
1038
  {
985
1039
  referenceStyleID: "OCEAN",
986
1040
  name: "Ocean",