diff --git a/.env b/.env index 111eef8..d94b948 100644 --- a/.env +++ b/.env @@ -1,4 +1,3 @@ KEY_OPENCAGE=N2VlNTM4MTRmMmIxZjIxYzdjZGM0ZTBhZmNjZDA2MDA= -KEY_MAPZEN=c2VhcmNoLXhORE9ySkU= KEY_MAPQUEST=NXdMYU1ROVo1NnBWZ0lLcXhoRDJVYU0yQmV0bFI2Vno= -KEY_BING=QWdfVURtbkl4dl9rSXRvOUN2X1NRMU1OeTlhck9JYWpEU0h3TFNaTTI2eFZfb2ZZX0kyd2dSOVJ2NDkyQ0gwZg== +KEY_BING=QW1rZS02eUNGcV9YWC1Fd19DOGktS2paMEZvRXNSTVZFMkQzR1otaVk2cWs1T0NuRVNodk4zakN5SmhkcF84Zg== diff --git a/README.md b/README.md index c48aab0..f1d1a70 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ The plugin supports (for now) the following providers: * [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) — `'osm'`. * [MapQuest Geocoding API](http://open.mapquestapi.com/nominatim/) — requires KEY — `'mapquest'`. * [Photon](http://photon.komoot.de/) — `'photon'`. -* [Mapzen Search/Pelias](https://mapzen.com/projects/search) — requires KEY — `'pelias'`. * [Bing](https://msdn.microsoft.com/pt-br/library/ff701713.aspx) — requires KEY — `'bing'`. * [OpenCage](https://opencagedata.com) — requires KEY — `'opencage'`. diff --git a/examples/control-nominatim.js b/examples/control-nominatim.js index a388bb3..0c05aea 100644 --- a/examples/control-nominatim.js +++ b/examples/control-nominatim.js @@ -17,7 +17,7 @@ //Instantiate with some options and add the Control var geocoder = new Geocoder('nominatim', { - provider: 'photon', + provider: 'osm', targetType: 'text-input', lang: 'en', placeholder: 'Search for ...', diff --git a/konstants/index.js b/konstants/index.js index a6dc730..4655d99 100644 --- a/konstants/index.js +++ b/konstants/index.js @@ -22,11 +22,9 @@ export const FEATURE_SRC = export const PROVIDERS = { OSM: 'osm', MAPQUEST: 'mapquest', - GOOGLE: 'google', PHOTON: 'photon', BING: 'bing', OPENCAGE: 'opencage', - PELIAS: 'pelias', }; export const DEFAULT_OPTIONS = { diff --git a/package-lock.json b/package-lock.json index 3542020..84bb58b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1167,6 +1167,22 @@ "@types/yargs": "^12.0.9" } }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", + "dev": true + }, "@types/babel__core": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.2.tgz", @@ -1220,6 +1236,23 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", @@ -1251,6 +1284,12 @@ "integrity": "sha512-Ed+tSZ9qM1oYpi5kzdsBuOzcAIn1wDW+e8TFJ50IMJMlSopGdJgKAbhHzN6h1E1OfjlGOr2JepzEWtg9NIfoNg==", "dev": true }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "@types/node": { "version": "12.0.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.10.tgz", @@ -1531,12 +1570,6 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -2302,6 +2335,40 @@ "babel-helper-regex": "^6.24.1", "babel-runtime": "^6.22.0", "regexpu-core": "^2.0.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + } } }, "babel-plugin-transform-exponentiation-operator": { @@ -2798,55 +2865,35 @@ } }, "buble": { - "version": "0.19.7", - "resolved": "https://registry.npmjs.org/buble/-/buble-0.19.7.tgz", - "integrity": "sha512-YLgWxX/l+NnfotydBlxqCMPR4FREE4ubuHphALz0FxQ7u2hp3BzxTKQ4nKpapOaRJfEm1gukC68KnT2OymRK0g==", + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/buble/-/buble-0.19.8.tgz", + "integrity": "sha512-IoGZzrUTY5fKXVkgGHw3QeXFMUNBFv+9l8a4QJKG1JhG3nCMHTdEX1DCOg8568E2Q9qvAQIiSokv6Jsgx8p2cA==", "dev": true, "requires": { "acorn": "^6.1.1", "acorn-dynamic-import": "^4.0.0", "acorn-jsx": "^5.0.1", "chalk": "^2.4.2", - "magic-string": "^0.25.2", + "magic-string": "^0.25.3", "minimist": "^1.2.0", - "os-homedir": "^1.0.1", + "os-homedir": "^2.0.0", "regexpu-core": "^4.5.4" }, "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - }, - "regexpu-core": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", - "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", + "magic-string": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz", + "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==", "dev": true, "requires": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.0.2", - "regjsgen": "^0.5.0", - "regjsparser": "^0.6.0", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.1.0" + "sourcemap-codec": "^1.4.4" } }, - "regjsgen": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", - "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", + "os-homedir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-2.0.0.tgz", + "integrity": "sha512-saRNz0DSC5C/I++gFIaJTXoFJMRwiP5zHar5vV3xQ2TkgEw6hDCcU5F272JjUylpiVgBrZNQHnfjkLabTfb92Q==", "dev": true - }, - "regjsparser": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", - "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - } } } }, @@ -2907,6 +2954,12 @@ "unset-value": "^1.0.0" } }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, "caller-callsite": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", @@ -3324,9 +3377,9 @@ "dev": true }, "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", "dev": true }, "core-js-compat": { @@ -3843,6 +3896,15 @@ "integrity": "sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==", "dev": true }, + "dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "dev": true, + "requires": { + "path-type": "^3.0.0" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3919,9 +3981,9 @@ } }, "electron-to-chromium": { - "version": "1.3.52", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz", - "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=", + "version": "1.3.186", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.186.tgz", + "integrity": "sha512-lRyyEUDKenKv/EBVFgfDZDYTDdoAZhzuE+inMUP79+22NDPAA2Ox+f3AShILIjPoUIqRGwvPNbzFcyU8km8g4A==", "dev": true }, "elegant-spinner": { @@ -4188,9 +4250,9 @@ } }, "eslint-plugin-jest": { - "version": "22.7.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.7.1.tgz", - "integrity": "sha512-CrT3AzA738neimv8G8iK2HCkrCwHnAJeeo7k5TEHK86VMItKl6zdJT/tHBDImfnVVAYsVs4Y6BUdBZQCCgfiyw==", + "version": "22.7.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.7.2.tgz", + "integrity": "sha512-Aecqe3ulBVI7amgOycVI8ZPL8o0SnGHOf3zn2/Ciu8TXyXDHcjtwD3hOs3ss/Qh/VAwlW/DMcuiXg5btgF+XMA==", "dev": true }, "eslint-plugin-prettier": { @@ -4495,6 +4557,20 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "fast-glob": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + } + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -5344,6 +5420,12 @@ } } }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", @@ -5351,52 +5433,26 @@ "dev": true }, "globby": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-3.0.1.tgz", - "integrity": "sha1-IJSvhCHhkVIVDViT62QWsxLZoi8=", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", + "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", "dev": true, "requires": { - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "glob": "^5.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^1.0.0" + "@types/glob": "^7.1.1", + "array-union": "^1.0.2", + "dir-glob": "^2.2.2", + "fast-glob": "^2.2.6", + "glob": "^7.1.3", + "ignore": "^4.0.3", + "pify": "^4.0.1", + "slash": "^2.0.0" }, "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz", - "integrity": "sha1-Wkfyi6EBXQIBvae/DzWOR77Ix+Q=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true - }, - "pinkie-promise": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz", - "integrity": "sha1-0dpn9UglY7t89X8oauKCLs+/NnA=", - "dev": true, - "requires": { - "pinkie": "^1.0.0" - } } } }, @@ -5432,14 +5488,6 @@ "dev": true, "requires": { "lodash": "^4.17.5" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "growly": { @@ -7097,9 +7145,9 @@ } }, "match-url-wildcard": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/match-url-wildcard/-/match-url-wildcard-0.0.2.tgz", - "integrity": "sha512-XQWEV4NdsB6HymtjW5sJthh1oHr/IZZPp+lOhu+RPkWDD0iQYXVCe8ozGQmi5ZxWqXYteERjHhN80zxLV/TNWA==", + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/match-url-wildcard/-/match-url-wildcard-0.0.4.tgz", + "integrity": "sha512-R1XhQaamUZPWLOPtp4ig5j+3jctN+skhgRmEQTUamMzmNtRG69QEirQs0NZKLtHMR7tzWpmtnS4Eqv65DcgXUA==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -7253,6 +7301,12 @@ "readable-stream": "^2.0.1" } }, + "merge2": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -8997,26 +9051,29 @@ "dev": true }, "regexpu-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", - "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", "dev": true, "requires": { - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.0.2", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" } }, "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", + "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", "dev": true }, "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", + "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -9237,12 +9294,12 @@ } }, "rollup-plugin-buble": { - "version": "0.19.6", - "resolved": "https://registry.npmjs.org/rollup-plugin-buble/-/rollup-plugin-buble-0.19.6.tgz", - "integrity": "sha512-El5Fut4/wEO17ZN/n9BZvqd7DXXB2WbJr/DKvr89LXChC/cHllE0XwiUDeAalrTkgr0WrnyLDTCQvEv+cGywWQ==", + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/rollup-plugin-buble/-/rollup-plugin-buble-0.19.8.tgz", + "integrity": "sha512-8J4zPk2DQdk3rxeZvxgzhHh/rm5nJkjwgcsUYisCQg1QbT5yagW+hehYEW7ZNns/NVbDCTv4JQ7h4fC8qKGOKw==", "dev": true, "requires": { - "buble": "^0.19.6", + "buble": "^0.19.8", "rollup-pluginutils": "^2.3.3" } }, @@ -10377,9 +10434,9 @@ } }, "testcafe": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.2.1.tgz", - "integrity": "sha512-kLlrtujAPabG8mh2JNLFIUmhZSHgfeQlT1TO9PikkjBhduirK2OCL6ye8pvyw9rOQVqwIl214wCv5DgAJcaC0w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.3.0.tgz", + "integrity": "sha512-5OJoHKIEjKJB9CkNzdnQ7tzdegurohAlojw61fGyTtD7ZK0zZ4pd34+4pGMnJyqQh66U6RfYSNHdxWhHcDYnKA==", "dev": true, "requires": { "@types/node": "^10.12.19", @@ -10408,7 +10465,7 @@ "emittery": "^0.4.1", "endpoint-utils": "^1.0.2", "error-stack-parser": "^1.3.6", - "globby": "^3.0.1", + "globby": "^9.2.0", "graceful-fs": "^4.1.11", "graphlib": "^2.1.5", "import-lazy": "^3.1.0", @@ -10442,7 +10499,7 @@ "source-map-support": "^0.5.5", "strip-bom": "^2.0.0", "testcafe-browser-tools": "1.6.8", - "testcafe-hammerhead": "14.6.8", + "testcafe-hammerhead": "14.6.10", "testcafe-legacy-api": "3.1.11", "testcafe-reporter-json": "^2.1.0", "testcafe-reporter-list": "^2.1.0", @@ -10457,9 +10514,9 @@ }, "dependencies": { "@types/node": { - "version": "10.14.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.10.tgz", - "integrity": "sha512-V8wj+w2YMNvGuhgl/MA5fmTxgjmVHVoasfIaxMMZJV6Y8Kk+Ydpi1z2whoShDCJ2BuNVoqH/h1hrygnBxkrw/Q==", + "version": "10.14.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.12.tgz", + "integrity": "sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg==", "dev": true }, "ansi-styles": { @@ -10522,12 +10579,6 @@ "is-extglob": "^1.0.0" } }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", @@ -10658,9 +10709,9 @@ } }, "testcafe-hammerhead": { - "version": "14.6.8", - "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-14.6.8.tgz", - "integrity": "sha512-Ep/eBmIBli/utdtzczl1NFRO9Gl/WHzyLTh0kifkbV/xm5EM8FBnSEb72kNrTlPLngvFXAqJccAUaU4DALA+Jg==", + "version": "14.6.10", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-14.6.10.tgz", + "integrity": "sha512-fG/YTz7wKs6Fd0Fl9WlzO4j/ovDSAGxDLvLAz4ydzIKAdnZMZ22QbjYpfahCVpe9nzq/UHCQpSFdThQTmlFEmA==", "dev": true, "requires": { "acorn-hammerhead": "^0.2.0", @@ -10672,7 +10723,7 @@ "iconv-lite": "0.4.11", "lodash": "4.17.11", "lru-cache": "2.6.3", - "match-url-wildcard": "0.0.2", + "match-url-wildcard": "0.0.4", "merge-stream": "^1.0.1", "mime": "~1.4.1", "mustache": "^2.1.1", @@ -10694,12 +10745,6 @@ "integrity": "sha1-LstC/SlHRJIiCaLnxATayHk9it4=", "dev": true }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "lru-cache": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.3.tgz", diff --git a/package.json b/package.json index 117b85e..eebd3f1 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "eslint": "^6.0.1", "eslint-config-jwalker": "^5.2.0", "eslint-config-prettier": "^6.0.0", - "eslint-plugin-jest": "^22.7.1", + "eslint-plugin-jest": "^22.7.2", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-testcafe": "^0.2.1", "gzip-size": "^5.1.1", @@ -70,7 +70,7 @@ "postcss-reporter": "^6.0.1", "prettier": "^1.18.2", "rollup": "^1.16.4", - "rollup-plugin-buble": "^0.19.6", + "rollup-plugin-buble": "^0.19.8", "rollup-plugin-commonjs": "^10.0.1", "rollup-plugin-eslint": "^7.0.0", "rollup-plugin-filesize": "^6.1.1", @@ -78,7 +78,7 @@ "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-uglify": "^6.0.2", - "testcafe": "^1.2.1", + "testcafe": "^1.3.0", "uglify-es": "^3.3.9" } } diff --git a/src/nominatim.js b/src/nominatim.js index 5712436..6d47e52 100644 --- a/src/nominatim.js +++ b/src/nominatim.js @@ -6,7 +6,6 @@ import proj from 'ol/proj'; import { Photon } from './providers/photon'; import { OpenStreet } from './providers/osm'; import { MapQuest } from './providers/mapquest'; -import { Pelias } from './providers/pelias'; import { Bing } from './providers/bing'; import { OpenCage } from './providers/opencage'; import { VARS, TARGET_TYPE, PROVIDERS, EVENT_TYPE } from 'konstants'; @@ -111,6 +110,11 @@ export class Nominatim { } query(q) { + // lazy provider + if (!this.provider) { + this.provider = this.newProvider(); + } + const parameters = this.provider.getParameters({ query: q, key: this.options.key, @@ -283,8 +287,6 @@ export class Nominatim { return new MapQuest(); case PROVIDERS.PHOTON: return new Photon(); - case PROVIDERS.PELIAS: - return new Pelias(); case PROVIDERS.BING: return new Bing(); case PROVIDERS.OPENCAGE: diff --git a/src/providers/pelias.js b/src/providers/pelias.js deleted file mode 100644 index 79c9ea5..0000000 --- a/src/providers/pelias.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @class Pelias - */ -export class Pelias { - /** - * @constructor - */ - constructor() { - this.settings = { - url: 'http://search.mapzen.com/v1/search', - params: { - size: 10, - }, - }; - } - - getParameters(options) { - return { - url: this.settings.url, - params: { - text: options.query, - api_key: options.key, - size: options.limit || this.settings.params.size, - }, - }; - } - - handleResponse(results) { - if (!results.features.length) return; - return results.features.map(result => ({ - lon: result.geometry.coordinates[0], - lat: result.geometry.coordinates[1], - address: { - name: result.properties.name, - house_number: result.properties.housenumber, - postcode: result.properties.postalcode, - road: result.properties.street, - city: result.properties.city, - state: result.properties.region, - country: result.properties.country, - }, - original: { - formatted: result.properties.label, - details: result.properties, - }, - })); - } -} diff --git a/test/e2e/.eslintrc.js b/test/e2e/.eslintrc.js index 7b6b786..0b486a6 100644 --- a/test/e2e/.eslintrc.js +++ b/test/e2e/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { plugins: ['testcafe'], - extends: ['plugin:testcafe/recommended', 'jwalker'], + extends: ['plugin:testcafe/recommended'], rules: { 'no-console': 0, }, diff --git a/test/e2e/providers/mapzen.test.js b/test/e2e/providers/mapzen.test.js deleted file mode 100644 index 3f80f8b..0000000 --- a/test/e2e/providers/mapzen.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import '../../env'; -import { PROVIDERS } from '../../../konstants'; -import Page from './page'; - -const page = new Page(); -const key = Buffer.from(process.env.KEY_MAPQUEST, 'base64').toString('ascii'); - -fixture`Mapzen`.page`../pages/providers.html`; - -test('Searching', async t => { - await t - .typeText(page.provider, PROVIDERS.MAPQUEST) - .expect(page.provider.value) - .eql(PROVIDERS.MAPQUEST) - .typeText(page.key, key) - .expect(page.key.value) - .eql(key) - .typeText(page.input, 'New York') - .expect(page.input.value) - .eql('New York') - .pressKey('enter') - // .debug() - .expect(page.result.childElementCount) - .gt(1); -}); diff --git a/test/e2e/providers/osm.test.js b/test/e2e/providers/osm.test.js index d3990bb..9c156ca 100644 --- a/test/e2e/providers/osm.test.js +++ b/test/e2e/providers/osm.test.js @@ -1,4 +1,3 @@ -import '../../env'; import { PROVIDERS } from '../../../konstants'; import Page from './page';