@pretto/places 0.46.0 → 0.46.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/README.md CHANGED
@@ -209,5 +209,4 @@ This library is based on the API of data.gouv.
209
209
  These data are quite precise and are regularly updated:
210
210
  ![title](https://adresse.data.gouv.fr/_next/image?url=%2Fimages%2Fdonnees-nationales%2Fschema-donnees-ban.svg&w=1080&q=75)
211
211
 
212
- - https://adresse.data.gouv.fr/
213
- - https://api.gouv.fr/
212
+ - [https://geo.api.gouv.fr/](https://geo.api.gouv.fr/)
@@ -1,6 +1,6 @@
1
- export declare const MUNICIPALITY_API_URL = "https://geo.api.gouv.fr/communes";
2
- export declare const DEPARTMENT_API_URL = "https://geo.api.gouv.fr/departements";
3
- export declare const ADDRESS_API_URL = "https://api-adresse.data.gouv.fr/search";
1
+ export declare const MUNICIPALITY_API_URL = "https://api-geo.production.pretto.fr/communes";
2
+ export declare const DEPARTMENT_API_URL = "https://api-geo.production.pretto.fr/departements";
3
+ export declare const ADDRESS_API_URL = "https://addok.production.pretto.fr/search";
4
4
  export declare const FIELDS = "&fields=codeDepartement,nom,codesPostaux,contour,mairie,centre";
5
5
  export declare const BOOST = "&boost=population";
6
6
  export declare const TYPES = "&type=arrondissement-municipal,commune-actuelle";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,qCAAqC,CAAA;AACtE,eAAO,MAAM,kBAAkB,yCAAyC,CAAA;AACxE,eAAO,MAAM,eAAe,4CAA4C,CAAA;AAExE,eAAO,MAAM,MAAM,mEAAmE,CAAA;AACtF,eAAO,MAAM,KAAK,sBAAsB,CAAA;AACxC,eAAO,MAAM,KAAK,oDAAoD,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,kDAAkD,CAAA;AACnF,eAAO,MAAM,kBAAkB,sDAAsD,CAAA;AACrF,eAAO,MAAM,eAAe,8CAA8C,CAAA;AAE1E,eAAO,MAAM,MAAM,mEAAmE,CAAA;AACtF,eAAO,MAAM,KAAK,sBAAsB,CAAA;AACxC,eAAO,MAAM,KAAK,oDAAoD,CAAA"}
package/dist/index.js CHANGED
@@ -47,9 +47,9 @@ const getSignal = () => {
47
47
  return controller.current.signal;
48
48
  };
49
49
 
50
- const MUNICIPALITY_API_URL = 'https://geo.api.gouv.fr/communes';
51
- const DEPARTMENT_API_URL = 'https://geo.api.gouv.fr/departements';
52
- const ADDRESS_API_URL = 'https://api-adresse.data.gouv.fr/search';
50
+ const MUNICIPALITY_API_URL = 'https://api-geo.production.pretto.fr/communes';
51
+ const DEPARTMENT_API_URL = 'https://api-geo.production.pretto.fr/departements';
52
+ const ADDRESS_API_URL = 'https://addok.production.pretto.fr/search';
53
53
  const FIELDS = '&fields=codeDepartement,nom,codesPostaux,contour,mairie,centre';
54
54
  const BOOST = '&boost=population';
55
55
  const TYPES = '&type=arrondissement-municipal,commune-actuelle';
@@ -104,23 +104,31 @@ function customFetch(url, options) {
104
104
  const searchByAddress = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
105
105
  const url = `${ADDRESS_API_URL}/?q=${searchValue}&autocomplete=1&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
106
106
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
107
- const addressResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
108
- const addressResult = yield addressResponse.json();
109
- const formatAddressResult = addressResult.features.reduce((acc, { properties }) => {
110
- return [
111
- ...acc,
112
- {
113
- label: `${properties.name} ${properties.postcode}, ${properties.city}`,
114
- value: {
115
- city: properties.city,
116
- country: 'fr',
117
- street: `${properties.name}`,
118
- zipcode: properties.postcode,
107
+ try {
108
+ const addressResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
109
+ const addressResult = yield addressResponse.json();
110
+ const formatAddressResult = addressResult.features.reduce((acc, { properties }) => {
111
+ return [
112
+ ...acc,
113
+ {
114
+ label: `${properties.name} ${properties.postcode}, ${properties.city}`,
115
+ value: {
116
+ city: properties.city,
117
+ country: 'fr',
118
+ street: `${properties.name}`,
119
+ zipcode: properties.postcode,
120
+ },
119
121
  },
120
- },
121
- ];
122
- }, []);
123
- return formatAddressResult;
122
+ ];
123
+ }, []);
124
+ return formatAddressResult;
125
+ }
126
+ catch (error) {
127
+ if (error instanceof DOMException && error.name === 'AbortError') {
128
+ return [];
129
+ }
130
+ throw error;
131
+ }
124
132
  });
125
133
 
126
134
  const formatToMunicipalitySearchResult = (results) => {
@@ -153,28 +161,36 @@ const searchByCoordinates = ({ latitude, longitude }, options) => __awaiter(void
153
161
  });
154
162
 
155
163
  const searchByDepartment = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
156
- if (isNaN(parseInt(searchValue))) {
157
- const nameDepartmentUrl = `${DEPARTMENT_API_URL}?nom=${searchValue}&fields=region,codeRegion&limit=21`;
158
- const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
159
- const departmentResponse = yield customFetch(nameDepartmentUrl, Object.assign(Object.assign({}, options), { signal }));
164
+ try {
165
+ if (isNaN(parseInt(searchValue))) {
166
+ const nameDepartmentUrl = `${DEPARTMENT_API_URL}?nom=${searchValue}&fields=region,codeRegion&limit=21`;
167
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
168
+ const departmentResponse = yield customFetch(nameDepartmentUrl, Object.assign(Object.assign({}, options), { signal }));
169
+ const departmentResult = yield departmentResponse.json();
170
+ return departmentResult.map(result => ({
171
+ label: `${result.nom} (${result.code})`,
172
+ value: {
173
+ code: result.code,
174
+ codeRegion: result.codeRegion,
175
+ country: 'fr',
176
+ region: result.region,
177
+ },
178
+ }));
179
+ }
180
+ const codeDepartmentUrl = `${DEPARTMENT_API_URL}/${searchValue}?limit=1`;
181
+ const departmentResponse = yield customFetch(codeDepartmentUrl, options);
160
182
  const departmentResult = yield departmentResponse.json();
161
- return departmentResult.map(result => ({
162
- label: `${result.nom} (${result.code})`,
163
- value: {
164
- code: result.code,
165
- codeRegion: result.codeRegion,
166
- country: 'fr',
167
- region: result.region,
168
- },
169
- }));
183
+ if ('nom' in departmentResult) {
184
+ return searchByDepartment(departmentResult.nom, options);
185
+ }
186
+ return [];
170
187
  }
171
- const codeDepartmentUrl = `${DEPARTMENT_API_URL}/${searchValue}?limit=1`;
172
- const departmentResponse = yield customFetch(codeDepartmentUrl, options);
173
- const departmentResult = yield departmentResponse.json();
174
- if ('nom' in departmentResult) {
175
- return searchByDepartment(departmentResult.nom, options);
188
+ catch (error) {
189
+ if (error instanceof DOMException && error.name === 'AbortError') {
190
+ return [];
191
+ }
192
+ throw error;
176
193
  }
177
- return [];
178
194
  });
179
195
 
180
196
  function isStartsWith(arr, value) {
@@ -200,40 +216,56 @@ const searchByMunicipality = (searchValue, options) => __awaiter(void 0, void 0,
200
216
  CURRENT_RESULT = [];
201
217
  const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}${FIELDS}${BOOST}&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
202
218
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
203
- const cityResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
204
- const cityResult = yield cityResponse.json();
205
- // The first result is Paris, Lyon or Marseille, we want get all arrondissements
206
- if (cityResult.length > 0 && ['75', '13', '69'].includes(cityResult[0].codeDepartement)) {
207
- const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}&codeDepartement=${cityResult[0].codeDepartement}${FIELDS}${BOOST}${TYPES}&limit=21`;
208
- const arrondissementsResponse = yield customFetch(url);
209
- const arrondissementsResult = yield arrondissementsResponse.json();
210
- const filtredAndSortArrondissementsResult = arrondissementsResult
211
- .reduce((acc, item) => {
212
- if (['75056', '13055', '69123'].includes(item.code))
213
- return acc;
214
- return [
215
- ...acc,
216
- Object.assign(Object.assign({}, item), { codesPostaux: [item.codesPostaux[0]] }),
217
- ];
218
- }, [])
219
- .sort((a, b) => parseInt(a.codesPostaux[0]) - parseInt(b.codesPostaux[0]));
220
- CURRENT_RESULT = filtredAndSortArrondissementsResult;
221
- if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase())) {
222
- const filtredCurrentResult = filterOnCurrentResult(searchValue);
223
- return formatToMunicipalitySearchResult(filtredCurrentResult);
219
+ try {
220
+ const cityResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
221
+ const cityResult = yield cityResponse.json();
222
+ // The first result is Paris, Lyon or Marseille, we want get all arrondissements
223
+ if (cityResult.length > 0 && ['75', '13', '69'].includes(cityResult[0].codeDepartement)) {
224
+ const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}&codeDepartement=${cityResult[0].codeDepartement}${FIELDS}${BOOST}${TYPES}&limit=21`;
225
+ const arrondissementsResponse = yield customFetch(url);
226
+ const arrondissementsResult = yield arrondissementsResponse.json();
227
+ const filtredAndSortArrondissementsResult = arrondissementsResult
228
+ .reduce((acc, item) => {
229
+ if (['75056', '13055', '69123'].includes(item.code))
230
+ return acc;
231
+ return [
232
+ ...acc,
233
+ Object.assign(Object.assign({}, item), { codesPostaux: [item.codesPostaux[0]] }),
234
+ ];
235
+ }, [])
236
+ .sort((a, b) => parseInt(a.codesPostaux[0]) - parseInt(b.codesPostaux[0]));
237
+ CURRENT_RESULT = filtredAndSortArrondissementsResult;
238
+ if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase())) {
239
+ const filtredCurrentResult = filterOnCurrentResult(searchValue);
240
+ return formatToMunicipalitySearchResult(filtredCurrentResult);
241
+ }
242
+ return formatToMunicipalitySearchResult(filterCityResults([...filtredAndSortArrondissementsResult, ...cityResult]));
224
243
  }
225
- return formatToMunicipalitySearchResult(filterCityResults([...filtredAndSortArrondissementsResult, ...cityResult]));
244
+ return formatToMunicipalitySearchResult(filterCityResults(cityResult));
245
+ }
246
+ catch (error) {
247
+ if (error instanceof DOMException && error.name === 'AbortError') {
248
+ return [];
249
+ }
250
+ throw error;
226
251
  }
227
- return formatToMunicipalitySearchResult(filterCityResults(cityResult));
228
252
  });
229
253
 
230
254
  const searchByZipcode = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
231
255
  const url = `${MUNICIPALITY_API_URL}?codePostal=${searchValue}${FIELDS}${BOOST}${TYPES}`;
232
256
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
233
- const zipCodeResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
234
- const zipCodeResult = yield zipCodeResponse.json();
235
- const filtredZipCodeResult = zipCodeResult.filter(item => !['75056', '13055', '69123'].includes(item.code));
236
- return formatToMunicipalitySearchResult(filtredZipCodeResult);
257
+ try {
258
+ const zipCodeResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
259
+ const zipCodeResult = yield zipCodeResponse.json();
260
+ const filtredZipCodeResult = zipCodeResult.filter(item => !['75056', '13055', '69123'].includes(item.code));
261
+ return formatToMunicipalitySearchResult(filtredZipCodeResult);
262
+ }
263
+ catch (error) {
264
+ if (error instanceof DOMException && error.name === 'AbortError') {
265
+ return [];
266
+ }
267
+ throw error;
268
+ }
237
269
  });
238
270
 
239
271
  const convertFirstLetterToUpperCase = (str) => {
package/dist/module.js CHANGED
@@ -39,9 +39,9 @@ const getSignal = () => {
39
39
  return controller.current.signal;
40
40
  };
41
41
 
42
- const MUNICIPALITY_API_URL = 'https://geo.api.gouv.fr/communes';
43
- const DEPARTMENT_API_URL = 'https://geo.api.gouv.fr/departements';
44
- const ADDRESS_API_URL = 'https://api-adresse.data.gouv.fr/search';
42
+ const MUNICIPALITY_API_URL = 'https://api-geo.production.pretto.fr/communes';
43
+ const DEPARTMENT_API_URL = 'https://api-geo.production.pretto.fr/departements';
44
+ const ADDRESS_API_URL = 'https://addok.production.pretto.fr/search';
45
45
  const FIELDS = '&fields=codeDepartement,nom,codesPostaux,contour,mairie,centre';
46
46
  const BOOST = '&boost=population';
47
47
  const TYPES = '&type=arrondissement-municipal,commune-actuelle';
@@ -96,23 +96,31 @@ function customFetch(url, options) {
96
96
  const searchByAddress = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
97
97
  const url = `${ADDRESS_API_URL}/?q=${searchValue}&autocomplete=1&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
98
98
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
99
- const addressResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
100
- const addressResult = yield addressResponse.json();
101
- const formatAddressResult = addressResult.features.reduce((acc, { properties }) => {
102
- return [
103
- ...acc,
104
- {
105
- label: `${properties.name} ${properties.postcode}, ${properties.city}`,
106
- value: {
107
- city: properties.city,
108
- country: 'fr',
109
- street: `${properties.name}`,
110
- zipcode: properties.postcode,
99
+ try {
100
+ const addressResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
101
+ const addressResult = yield addressResponse.json();
102
+ const formatAddressResult = addressResult.features.reduce((acc, { properties }) => {
103
+ return [
104
+ ...acc,
105
+ {
106
+ label: `${properties.name} ${properties.postcode}, ${properties.city}`,
107
+ value: {
108
+ city: properties.city,
109
+ country: 'fr',
110
+ street: `${properties.name}`,
111
+ zipcode: properties.postcode,
112
+ },
111
113
  },
112
- },
113
- ];
114
- }, []);
115
- return formatAddressResult;
114
+ ];
115
+ }, []);
116
+ return formatAddressResult;
117
+ }
118
+ catch (error) {
119
+ if (error instanceof DOMException && error.name === 'AbortError') {
120
+ return [];
121
+ }
122
+ throw error;
123
+ }
116
124
  });
117
125
 
118
126
  const formatToMunicipalitySearchResult = (results) => {
@@ -145,28 +153,36 @@ const searchByCoordinates = ({ latitude, longitude }, options) => __awaiter(void
145
153
  });
146
154
 
147
155
  const searchByDepartment = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
148
- if (isNaN(parseInt(searchValue))) {
149
- const nameDepartmentUrl = `${DEPARTMENT_API_URL}?nom=${searchValue}&fields=region,codeRegion&limit=21`;
150
- const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
151
- const departmentResponse = yield customFetch(nameDepartmentUrl, Object.assign(Object.assign({}, options), { signal }));
156
+ try {
157
+ if (isNaN(parseInt(searchValue))) {
158
+ const nameDepartmentUrl = `${DEPARTMENT_API_URL}?nom=${searchValue}&fields=region,codeRegion&limit=21`;
159
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
160
+ const departmentResponse = yield customFetch(nameDepartmentUrl, Object.assign(Object.assign({}, options), { signal }));
161
+ const departmentResult = yield departmentResponse.json();
162
+ return departmentResult.map(result => ({
163
+ label: `${result.nom} (${result.code})`,
164
+ value: {
165
+ code: result.code,
166
+ codeRegion: result.codeRegion,
167
+ country: 'fr',
168
+ region: result.region,
169
+ },
170
+ }));
171
+ }
172
+ const codeDepartmentUrl = `${DEPARTMENT_API_URL}/${searchValue}?limit=1`;
173
+ const departmentResponse = yield customFetch(codeDepartmentUrl, options);
152
174
  const departmentResult = yield departmentResponse.json();
153
- return departmentResult.map(result => ({
154
- label: `${result.nom} (${result.code})`,
155
- value: {
156
- code: result.code,
157
- codeRegion: result.codeRegion,
158
- country: 'fr',
159
- region: result.region,
160
- },
161
- }));
175
+ if ('nom' in departmentResult) {
176
+ return searchByDepartment(departmentResult.nom, options);
177
+ }
178
+ return [];
162
179
  }
163
- const codeDepartmentUrl = `${DEPARTMENT_API_URL}/${searchValue}?limit=1`;
164
- const departmentResponse = yield customFetch(codeDepartmentUrl, options);
165
- const departmentResult = yield departmentResponse.json();
166
- if ('nom' in departmentResult) {
167
- return searchByDepartment(departmentResult.nom, options);
180
+ catch (error) {
181
+ if (error instanceof DOMException && error.name === 'AbortError') {
182
+ return [];
183
+ }
184
+ throw error;
168
185
  }
169
- return [];
170
186
  });
171
187
 
172
188
  function isStartsWith(arr, value) {
@@ -192,40 +208,56 @@ const searchByMunicipality = (searchValue, options) => __awaiter(void 0, void 0,
192
208
  CURRENT_RESULT = [];
193
209
  const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}${FIELDS}${BOOST}&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
194
210
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
195
- const cityResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
196
- const cityResult = yield cityResponse.json();
197
- // The first result is Paris, Lyon or Marseille, we want get all arrondissements
198
- if (cityResult.length > 0 && ['75', '13', '69'].includes(cityResult[0].codeDepartement)) {
199
- const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}&codeDepartement=${cityResult[0].codeDepartement}${FIELDS}${BOOST}${TYPES}&limit=21`;
200
- const arrondissementsResponse = yield customFetch(url);
201
- const arrondissementsResult = yield arrondissementsResponse.json();
202
- const filtredAndSortArrondissementsResult = arrondissementsResult
203
- .reduce((acc, item) => {
204
- if (['75056', '13055', '69123'].includes(item.code))
205
- return acc;
206
- return [
207
- ...acc,
208
- Object.assign(Object.assign({}, item), { codesPostaux: [item.codesPostaux[0]] }),
209
- ];
210
- }, [])
211
- .sort((a, b) => parseInt(a.codesPostaux[0]) - parseInt(b.codesPostaux[0]));
212
- CURRENT_RESULT = filtredAndSortArrondissementsResult;
213
- if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase())) {
214
- const filtredCurrentResult = filterOnCurrentResult(searchValue);
215
- return formatToMunicipalitySearchResult(filtredCurrentResult);
211
+ try {
212
+ const cityResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
213
+ const cityResult = yield cityResponse.json();
214
+ // The first result is Paris, Lyon or Marseille, we want get all arrondissements
215
+ if (cityResult.length > 0 && ['75', '13', '69'].includes(cityResult[0].codeDepartement)) {
216
+ const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}&codeDepartement=${cityResult[0].codeDepartement}${FIELDS}${BOOST}${TYPES}&limit=21`;
217
+ const arrondissementsResponse = yield customFetch(url);
218
+ const arrondissementsResult = yield arrondissementsResponse.json();
219
+ const filtredAndSortArrondissementsResult = arrondissementsResult
220
+ .reduce((acc, item) => {
221
+ if (['75056', '13055', '69123'].includes(item.code))
222
+ return acc;
223
+ return [
224
+ ...acc,
225
+ Object.assign(Object.assign({}, item), { codesPostaux: [item.codesPostaux[0]] }),
226
+ ];
227
+ }, [])
228
+ .sort((a, b) => parseInt(a.codesPostaux[0]) - parseInt(b.codesPostaux[0]));
229
+ CURRENT_RESULT = filtredAndSortArrondissementsResult;
230
+ if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase())) {
231
+ const filtredCurrentResult = filterOnCurrentResult(searchValue);
232
+ return formatToMunicipalitySearchResult(filtredCurrentResult);
233
+ }
234
+ return formatToMunicipalitySearchResult(filterCityResults([...filtredAndSortArrondissementsResult, ...cityResult]));
216
235
  }
217
- return formatToMunicipalitySearchResult(filterCityResults([...filtredAndSortArrondissementsResult, ...cityResult]));
236
+ return formatToMunicipalitySearchResult(filterCityResults(cityResult));
237
+ }
238
+ catch (error) {
239
+ if (error instanceof DOMException && error.name === 'AbortError') {
240
+ return [];
241
+ }
242
+ throw error;
218
243
  }
219
- return formatToMunicipalitySearchResult(filterCityResults(cityResult));
220
244
  });
221
245
 
222
246
  const searchByZipcode = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
223
247
  const url = `${MUNICIPALITY_API_URL}?codePostal=${searchValue}${FIELDS}${BOOST}${TYPES}`;
224
248
  const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal();
225
- const zipCodeResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
226
- const zipCodeResult = yield zipCodeResponse.json();
227
- const filtredZipCodeResult = zipCodeResult.filter(item => !['75056', '13055', '69123'].includes(item.code));
228
- return formatToMunicipalitySearchResult(filtredZipCodeResult);
249
+ try {
250
+ const zipCodeResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
251
+ const zipCodeResult = yield zipCodeResponse.json();
252
+ const filtredZipCodeResult = zipCodeResult.filter(item => !['75056', '13055', '69123'].includes(item.code));
253
+ return formatToMunicipalitySearchResult(filtredZipCodeResult);
254
+ }
255
+ catch (error) {
256
+ if (error instanceof DOMException && error.name === 'AbortError') {
257
+ return [];
258
+ }
259
+ throw error;
260
+ }
229
261
  });
230
262
 
231
263
  const convertFirstLetterToUpperCase = (str) => {
@@ -1 +1 @@
1
- {"version":3,"file":"searchByAddress.d.ts","sourceRoot":"","sources":["../src/searchByAddress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAalE,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,mBAAmB,EAAE,CAuB/B,CAAA"}
1
+ {"version":3,"file":"searchByAddress.d.ts","sourceRoot":"","sources":["../src/searchByAddress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAalE,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,mBAAmB,EAAE,CA8B/B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchByDepartment.d.ts","sourceRoot":"","sources":["../src/searchByDepartment.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,kBAAkB,EAAE,sBAAsB,EAC7C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,gBAChB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,sBAAsB,EAAE,CA4BlC,CAAA"}
1
+ {"version":3,"file":"searchByDepartment.d.ts","sourceRoot":"","sources":["../src/searchByDepartment.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,kBAAkB,EAAE,sBAAsB,EAC7C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,gBAChB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,sBAAsB,EAAE,CAmClC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchByMunicipality.d.ts","sourceRoot":"","sources":["../src/searchByMunicipality.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAoBrF,eAAO,MAAM,oBAAoB,gBAClB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CA+CpC,CAAA"}
1
+ {"version":3,"file":"searchByMunicipality.d.ts","sourceRoot":"","sources":["../src/searchByMunicipality.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAoBrF,eAAO,MAAM,oBAAoB,gBAClB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CAsDpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchByZipcode.d.ts","sourceRoot":"","sources":["../src/searchByZipcode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAErF,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CAUpC,CAAA"}
1
+ {"version":3,"file":"searchByZipcode.d.ts","sourceRoot":"","sources":["../src/searchByZipcode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAErF,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CAiBpC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",