@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
@@ -219,6 +219,24 @@
219
219
  }
220
220
  addLanguageGeocodingOptions(searchParams, options);
221
221
  }
222
+ function addForwardGeocodingOptions(searchParams, options) {
223
+ addCommonForwardAndReverseGeocodingOptions(searchParams, options);
224
+ if (options.bbox != void 0) {
225
+ searchParams.set("bbox", options.bbox.join(","));
226
+ }
227
+ if (options.proximity != void 0) {
228
+ searchParams.set("proximity", options.proximity.join(","));
229
+ }
230
+ if (options.country != void 0) {
231
+ searchParams.set("country", options.country.join(","));
232
+ }
233
+ if (options.fuzzyMatch != void 0) {
234
+ searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
235
+ }
236
+ if (options.autocomplete != void 0) {
237
+ searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
238
+ }
239
+ }
222
240
  function forward(_0) {
223
241
  return __async$3(this, arguments, function* (query, options = {}) {
224
242
  var _a;
@@ -230,22 +248,7 @@
230
248
  defaults.maptilerApiURL
231
249
  );
232
250
  const { searchParams } = endpoint;
233
- addCommonForwardAndReverseGeocodingOptions(searchParams, options);
234
- if (options.bbox != void 0) {
235
- searchParams.set("bbox", options.bbox.join(","));
236
- }
237
- if (options.proximity != void 0) {
238
- searchParams.set("proximity", options.proximity.join(","));
239
- }
240
- if (options.country != void 0) {
241
- searchParams.set("country", options.country.join(","));
242
- }
243
- if (options.fuzzyMatch != void 0) {
244
- searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
245
- }
246
- if (options.autocomplete != void 0) {
247
- searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
248
- }
251
+ addForwardGeocodingOptions(searchParams, options);
249
252
  const urlWithParams = endpoint.toString();
250
253
  const res = yield callFetch(urlWithParams);
251
254
  if (!res.ok) {
@@ -289,10 +292,33 @@
289
292
  return obj;
290
293
  });
291
294
  }
295
+ function batch(_0) {
296
+ return __async$3(this, arguments, function* (queries, options = {}) {
297
+ var _a;
298
+ if (!queries.length) {
299
+ return [];
300
+ }
301
+ const joinedQuery = queries.map((query) => encodeURIComponent(query)).join(";");
302
+ const endpoint = new URL(
303
+ `geocoding/${joinedQuery}.json`,
304
+ defaults.maptilerApiURL
305
+ );
306
+ const { searchParams } = endpoint;
307
+ addForwardGeocodingOptions(searchParams, options);
308
+ const urlWithParams = endpoint.toString();
309
+ const res = yield callFetch(urlWithParams);
310
+ if (!res.ok) {
311
+ throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
312
+ }
313
+ const obj = yield res.json();
314
+ return queries.length === 1 ? [obj] : obj;
315
+ });
316
+ }
292
317
  const geocoding = {
293
318
  forward,
294
319
  reverse,
295
320
  byId,
321
+ batch,
296
322
  language: LanguageGeocoding
297
323
  };
298
324
 
@@ -983,6 +1009,34 @@
983
1009
  }
984
1010
  ]
985
1011
  },
1012
+ {
1013
+ referenceStyleID: "BACKDROP",
1014
+ name: "Backdrop",
1015
+ description: "",
1016
+ variants: [
1017
+ {
1018
+ id: "backdrop",
1019
+ name: "Default",
1020
+ variantType: "DEFAULT",
1021
+ description: "",
1022
+ imageURL: ""
1023
+ },
1024
+ {
1025
+ id: "backdrop-dark",
1026
+ name: "Dark",
1027
+ variantType: "DARK",
1028
+ description: "",
1029
+ imageURL: ""
1030
+ },
1031
+ {
1032
+ id: "backdrop-light",
1033
+ name: "Light",
1034
+ variantType: "LIGHT",
1035
+ description: "",
1036
+ imageURL: ""
1037
+ }
1038
+ ]
1039
+ },
986
1040
  {
987
1041
  referenceStyleID: "OCEAN",
988
1042
  name: "Ocean",