@maptiler/client 2.7.0-rc.1 → 2.8.0-rc.1
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 +13 -5
- package/dist/maptiler-client.cjs +17 -5
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +11 -6
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +17 -5
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +31 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
# MapTiler Client Changelog
|
|
2
|
+
|
|
3
|
+
## NEXT
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
- Adds new option `adjustSearchParams` to all functions in `geocoding` module
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
None
|
|
10
|
+
|
|
11
|
+
### Others
|
|
12
|
+
None
|
|
13
|
+
|
|
2
14
|
## 2.7.0
|
|
3
15
|
|
|
4
16
|
### New Features
|
|
@@ -39,16 +51,12 @@
|
|
|
39
51
|
|
|
40
52
|
|
|
41
53
|
### Bug fixes
|
|
42
|
-
|
|
54
|
+
- `math.latitudeToMercatorY` now always returns a value that is valid in Web Mercator context.
|
|
43
55
|
|
|
44
56
|
### Others
|
|
45
57
|
- Switches from explicit exported types to inferred types for the `MapStyle`export.
|
|
46
58
|
- Adds testing for type and member exports.
|
|
47
59
|
|
|
48
|
-
## NEXT
|
|
49
|
-
### Bug Fixes
|
|
50
|
-
- `math.latitudeToMercatorY` now always returns a value that is valid in Web Mercator context.
|
|
51
|
-
|
|
52
60
|
## 2.6.0
|
|
53
61
|
### New Features
|
|
54
62
|
- Bumps 'Streets' & 'Landscape' styles (and their variants) to new v4 styles.
|
package/dist/maptiler-client.cjs
CHANGED
|
@@ -1037,6 +1037,13 @@ const customMessages$4 = {
|
|
|
1037
1037
|
400: "Query too long / Invalid parameters",
|
|
1038
1038
|
403: "Key is missing, invalid or restricted"
|
|
1039
1039
|
};
|
|
1040
|
+
function addBaseGeocodingOptions(searchParams, options) {
|
|
1041
|
+
const { adjustSearchParams, apiKey } = options;
|
|
1042
|
+
if (typeof adjustSearchParams === "function") {
|
|
1043
|
+
adjustSearchParams(searchParams);
|
|
1044
|
+
}
|
|
1045
|
+
searchParams.set("key", apiKey ?? config.apiKey);
|
|
1046
|
+
}
|
|
1040
1047
|
function addLanguageGeocodingOptions(searchParams, options) {
|
|
1041
1048
|
const { language } = options;
|
|
1042
1049
|
if (language === void 0) {
|
|
@@ -1051,8 +1058,7 @@ function toValidGeocodingLanguageCode(lang) {
|
|
|
1051
1058
|
return langInfo?.geocoding ? langInfo.code : null;
|
|
1052
1059
|
}
|
|
1053
1060
|
function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
|
|
1054
|
-
const {
|
|
1055
|
-
searchParams.set("key", apiKey ?? config.apiKey);
|
|
1061
|
+
const { limit, types, excludeTypes } = options;
|
|
1056
1062
|
if (limit !== void 0) {
|
|
1057
1063
|
searchParams.set("limit", String(limit));
|
|
1058
1064
|
}
|
|
@@ -1062,10 +1068,8 @@ function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
|
|
|
1062
1068
|
if (excludeTypes !== void 0) {
|
|
1063
1069
|
searchParams.set("excludeTypes", String(excludeTypes));
|
|
1064
1070
|
}
|
|
1065
|
-
addLanguageGeocodingOptions(searchParams, options);
|
|
1066
1071
|
}
|
|
1067
1072
|
function addForwardGeocodingOptions(searchParams, options) {
|
|
1068
|
-
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
|
|
1069
1073
|
const { bbox, proximity, country, fuzzyMatch, autocomplete } = options;
|
|
1070
1074
|
if (bbox !== void 0) {
|
|
1071
1075
|
searchParams.set("bbox", bbox.join(","));
|
|
@@ -1094,6 +1098,9 @@ async function forward(query, options = {}) {
|
|
|
1094
1098
|
`geocoding/${encodeURIComponent(query)}.json`,
|
|
1095
1099
|
defaults.maptilerApiURL
|
|
1096
1100
|
);
|
|
1101
|
+
addBaseGeocodingOptions(endpoint.searchParams, options);
|
|
1102
|
+
addLanguageGeocodingOptions(endpoint.searchParams, options);
|
|
1103
|
+
addCommonForwardAndReverseGeocodingOptions(endpoint.searchParams, options);
|
|
1097
1104
|
addForwardGeocodingOptions(endpoint.searchParams, options);
|
|
1098
1105
|
const res = await callFetch(endpoint.toString());
|
|
1099
1106
|
if (!res.ok) {
|
|
@@ -1109,6 +1116,8 @@ async function reverse(position, options = {}) {
|
|
|
1109
1116
|
`geocoding/${position[0]},${position[1]}.json`,
|
|
1110
1117
|
defaults.maptilerApiURL
|
|
1111
1118
|
);
|
|
1119
|
+
addBaseGeocodingOptions(endpoint.searchParams, options);
|
|
1120
|
+
addLanguageGeocodingOptions(endpoint.searchParams, options);
|
|
1112
1121
|
addCommonForwardAndReverseGeocodingOptions(endpoint.searchParams, options);
|
|
1113
1122
|
const res = await callFetch(endpoint.toString());
|
|
1114
1123
|
if (!res.ok) {
|
|
@@ -1118,7 +1127,7 @@ async function reverse(position, options = {}) {
|
|
|
1118
1127
|
}
|
|
1119
1128
|
async function byId(id, options = {}) {
|
|
1120
1129
|
const endpoint = new URL(`geocoding/${id}.json`, defaults.maptilerApiURL);
|
|
1121
|
-
endpoint.searchParams
|
|
1130
|
+
addBaseGeocodingOptions(endpoint.searchParams, options);
|
|
1122
1131
|
addLanguageGeocodingOptions(endpoint.searchParams, options);
|
|
1123
1132
|
const res = await callFetch(endpoint.toString());
|
|
1124
1133
|
if (!res.ok) {
|
|
@@ -1135,6 +1144,9 @@ async function batch$1(queries, options = {}) {
|
|
|
1135
1144
|
`geocoding/${joinedQuery}.json`,
|
|
1136
1145
|
defaults.maptilerApiURL
|
|
1137
1146
|
);
|
|
1147
|
+
addBaseGeocodingOptions(endpoint.searchParams, options);
|
|
1148
|
+
addLanguageGeocodingOptions(endpoint.searchParams, options);
|
|
1149
|
+
addCommonForwardAndReverseGeocodingOptions(endpoint.searchParams, options);
|
|
1138
1150
|
addForwardGeocodingOptions(endpoint.searchParams, options);
|
|
1139
1151
|
const res = await callFetch(endpoint.toString());
|
|
1140
1152
|
if (!res.ok) {
|