Skip to content

Commit

Permalink
Merge pull request #18 from maptiler/build-1.4.0
Browse files Browse the repository at this point in the history
BUILD
  • Loading branch information
jonathanlurie authored May 12, 2023
2 parents 9ad7364 + ca90952 commit 8bd7bfc
Show file tree
Hide file tree
Showing 66 changed files with 498 additions and 389 deletions.
58 changes: 42 additions & 16 deletions dist/maptiler-client.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,24 @@ function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
}
addLanguageGeocodingOptions(searchParams, options);
}
function addForwardGeocodingOptions(searchParams, options) {
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
if (options.bbox != void 0) {
searchParams.set("bbox", options.bbox.join(","));
}
if (options.proximity != void 0) {
searchParams.set("proximity", options.proximity.join(","));
}
if (options.country != void 0) {
searchParams.set("country", options.country.join(","));
}
if (options.fuzzyMatch != void 0) {
searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
}
if (options.autocomplete != void 0) {
searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
}
}
function forward(_0) {
return __async$3(this, arguments, function* (query, options = {}) {
var _a;
Expand All @@ -228,22 +246,7 @@ function forward(_0) {
defaults.maptilerApiURL
);
const { searchParams } = endpoint;
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
if (options.bbox != void 0) {
searchParams.set("bbox", options.bbox.join(","));
}
if (options.proximity != void 0) {
searchParams.set("proximity", options.proximity.join(","));
}
if (options.country != void 0) {
searchParams.set("country", options.country.join(","));
}
if (options.fuzzyMatch != void 0) {
searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
}
if (options.autocomplete != void 0) {
searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
}
addForwardGeocodingOptions(searchParams, options);
const urlWithParams = endpoint.toString();
const res = yield callFetch(urlWithParams);
if (!res.ok) {
Expand Down Expand Up @@ -287,10 +290,33 @@ function byId(_0) {
return obj;
});
}
function batch(_0) {
return __async$3(this, arguments, function* (queries, options = {}) {
var _a;
if (!queries.length) {
return [];
}
const joinedQuery = queries.map((query) => encodeURIComponent(query)).join(";");
const endpoint = new URL(
`geocoding/${joinedQuery}.json`,
defaults.maptilerApiURL
);
const { searchParams } = endpoint;
addForwardGeocodingOptions(searchParams, options);
const urlWithParams = endpoint.toString();
const res = yield callFetch(urlWithParams);
if (!res.ok) {
throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
}
const obj = yield res.json();
return queries.length === 1 ? [obj] : obj;
});
}
const geocoding = {
forward,
reverse,
byId,
batch,
language: LanguageGeocoding
};

Expand Down
2 changes: 1 addition & 1 deletion dist/maptiler-client.cjs.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions dist/maptiler-client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ declare function reverse(position: Position, options?: ReverseGeocodingOptions):
* @returns
*/
declare function byId(id: string, options?: ByIdGeocodingOptions): Promise<GeocodingSearchResult>;
/**
* Perform a batch geocoding query to MapTiler API.
* Provide multiple queries in the array. Each query can be forward, reverse or by feature ID.
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/geocoding/#batch-geocoding
* @param queries
* @param options
* @returns
*/
declare function batch(queries: string[], options?: GeocodingOptions): Promise<GeocodingSearchResult[]>;
/**
* The **geocoding** namespace contains asynchronous functions to call the [MapTiler Geocoding API](https://docs.maptiler.com/cloud/api/geocoding/).
* The **Geocoding API** provides ways to get geographic coordinates from a human-readable search query of a place (forward geocoding)
Expand All @@ -238,6 +247,7 @@ declare const geocoding: {
forward: typeof forward;
reverse: typeof reverse;
byId: typeof byId;
batch: typeof batch;
language: {
AUTO: string;
ALBANIAN: string;
Expand Down
2 changes: 1 addition & 1 deletion dist/maptiler-client.min.mjs

Large diffs are not rendered by default.

58 changes: 42 additions & 16 deletions dist/maptiler-client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
}
addLanguageGeocodingOptions(searchParams, options);
}
function addForwardGeocodingOptions(searchParams, options) {
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
if (options.bbox != void 0) {
searchParams.set("bbox", options.bbox.join(","));
}
if (options.proximity != void 0) {
searchParams.set("proximity", options.proximity.join(","));
}
if (options.country != void 0) {
searchParams.set("country", options.country.join(","));
}
if (options.fuzzyMatch != void 0) {
searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
}
if (options.autocomplete != void 0) {
searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
}
}
function forward(_0) {
return __async$3(this, arguments, function* (query, options = {}) {
var _a;
Expand All @@ -224,22 +242,7 @@ function forward(_0) {
defaults.maptilerApiURL
);
const { searchParams } = endpoint;
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
if (options.bbox != void 0) {
searchParams.set("bbox", options.bbox.join(","));
}
if (options.proximity != void 0) {
searchParams.set("proximity", options.proximity.join(","));
}
if (options.country != void 0) {
searchParams.set("country", options.country.join(","));
}
if (options.fuzzyMatch != void 0) {
searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
}
if (options.autocomplete != void 0) {
searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
}
addForwardGeocodingOptions(searchParams, options);
const urlWithParams = endpoint.toString();
const res = yield callFetch(urlWithParams);
if (!res.ok) {
Expand Down Expand Up @@ -283,10 +286,33 @@ function byId(_0) {
return obj;
});
}
function batch(_0) {
return __async$3(this, arguments, function* (queries, options = {}) {
var _a;
if (!queries.length) {
return [];
}
const joinedQuery = queries.map((query) => encodeURIComponent(query)).join(";");
const endpoint = new URL(
`geocoding/${joinedQuery}.json`,
defaults.maptilerApiURL
);
const { searchParams } = endpoint;
addForwardGeocodingOptions(searchParams, options);
const urlWithParams = endpoint.toString();
const res = yield callFetch(urlWithParams);
if (!res.ok) {
throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
}
const obj = yield res.json();
return queries.length === 1 ? [obj] : obj;
});
}
const geocoding = {
forward,
reverse,
byId,
batch,
language: LanguageGeocoding
};

Expand Down
2 changes: 1 addition & 1 deletion dist/maptiler-client.mjs.map

Large diffs are not rendered by default.

58 changes: 42 additions & 16 deletions dist/maptiler-client.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/maptiler-client.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/maptiler-client.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/classes/config.ClientConfig.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ClientConfig | MapTiler Client - v1.3.0</title><meta name="description" content="Documentation for MapTiler Client - v1.3.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ClientConfig | MapTiler Client - v1.4.0</title><meta name="description" content="Documentation for MapTiler Client - v1.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<div class="tsd-toolbar-contents container">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
<div class="field">
<div id="tsd-toolbar-links"></div></div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">MapTiler Client - v1.3.0</a></div>
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">MapTiler Client - v1.4.0</a></div>
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
<div class="container container-main">
<div class="col-8 col-content">
<div class="tsd-page-title">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">MapTiler Client - v1.3.0</a></li>
<li><a href="../modules.html">MapTiler Client - v1.4.0</a></li>
<li><a href="../modules/config.html">config</a></li>
<li><a href="config.ClientConfig.html">ClientConfig</a></li></ul>
<h1>Class ClientConfig</h1></div>
Expand All @@ -24,7 +24,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">ClientConfig</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/5fa2a6c/src/config.ts#L19">config.ts:19</a></li></ul></aside>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/9ad7364/src/config.ts#L19">config.ts:19</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -58,7 +58,7 @@ <h3 class="tsd-anchor-link"><span>api<wbr/>Key</span><a href="#apiKey" aria-labe
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/5fa2a6c/src/config.ts#L41">config.ts:41</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/9ad7364/src/config.ts#L41">config.ts:41</a></li></ul></aside></li>
<li class="tsd-signature" id="apiKey.apiKey-2"><span class="tsd-signature-symbol">set</span> apiKey<span class="tsd-signature-symbol">(</span>k<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-comment tsd-typography"><p>Set the MapTiler Cloud API key</p>
Expand All @@ -70,7 +70,7 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>k: <span class="tsd-signature-type">string</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/5fa2a6c/src/config.ts#L34">config.ts:34</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/9ad7364/src/config.ts#L34">config.ts:34</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="fetch" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>fetch</span><a href="#fetch" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
Expand All @@ -80,7 +80,7 @@ <h3 class="tsd-anchor-link"><span>fetch</span><a href="#fetch" aria-label="Perma
</div>
<h4 class="tsd-returns-title">Returns <a href="../types/config.FetchFunction.html" class="tsd-signature-type" data-tsd-kind="Type alias">FetchFunction</a></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/5fa2a6c/src/config.ts#L55">config.ts:55</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/9ad7364/src/config.ts#L55">config.ts:55</a></li></ul></aside></li>
<li class="tsd-signature" id="fetch.fetch-2"><span class="tsd-signature-symbol">set</span> fetch<span class="tsd-signature-symbol">(</span>f<span class="tsd-signature-symbol">: </span><a href="../types/config.FetchFunction.html" class="tsd-signature-type" data-tsd-kind="Type alias">FetchFunction</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-comment tsd-typography"><p>Set a the custom fetch function to replace the default one</p>
Expand All @@ -92,7 +92,7 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>f: <a href="../types/config.FetchFunction.html" class="tsd-signature-type" data-tsd-kind="Type alias">FetchFunction</a></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/5fa2a6c/src/config.ts#L48">config.ts:48</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/9ad7364/src/config.ts#L48">config.ts:48</a></li></ul></aside></li></ul></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand All @@ -109,7 +109,7 @@ <h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
<div class="tsd-accordion-details">
<ul>
<li class="current"><a href="../modules.html">Map<wbr/>Tiler <wbr/>Client -<wbr/> v1.3.0</a>
<li class="current"><a href="../modules.html">Map<wbr/>Tiler <wbr/>Client -<wbr/> v1.4.0</a>
<ul>
<li class="current tsd-kind-module"><a href="../modules/config.html">config</a></li>
<li class="tsd-kind-module"><a href="../modules/language.html">language</a></li>
Expand Down
Loading

0 comments on commit 8bd7bfc

Please sign in to comment.