{"_id":"@benswinburne/closest-aws-region","_rev":"4-a6b4b4f4a9c734a22dcad1e48bf365a4","name":"@benswinburne/closest-aws-region","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@benswinburne/closest-aws-region","version":"1.0.0","description":"Determines the closest AWS region using average latency between regions","main":"index.js","repository":{"type":"git","url":"git+https://github.com/benswinburne/closest-aws-region.git"},"author":{"name":"Ben Swinburne"},"license":"MIT","private":false,"scripts":{"test":"jest","test:watch":"jest --watch","lint":"eslint *.js","lint:fix":"eslint --fix *.js"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","eslint":"^5.16.0","eslint-config-prettier":"^4.1.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.0.1","eslint-plugin-promise":"^4.1.1","eslint-plugin-standard":"^4.0.0","husky":"^1.3.1","jest":"^24.7.1","lint-staged":"^8.1.5","prettier":"^1.16.4","yarpm":"^0.2.1"},"gitHead":"683d19739347e0f36368764941184e762c4b7771","bugs":{"url":"https://github.com/benswinburne/closest-aws-region/issues"},"homepage":"https://github.com/benswinburne/closest-aws-region#readme","_id":"@benswinburne/closest-aws-region@1.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-oiKFMHovB/7h/JcyvQot6nPqdrm4BVmwuYEeKEZ4cQ89wovXfJsJAtUR2g2yIiAYDqvBl/lb4RxZm8jOlTW5kQ==","shasum":"7c2990daeff5a63baff61b00007877d3c83a0b69","tarball":"https://registry.npmjs.org/@benswinburne/closest-aws-region/-/closest-aws-region-1.0.0.tgz","fileCount":11,"unpackedSize":239442,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcrMTPCRA9TVsSAnZWagAAwK4P+wbPuKhGmt98EOWcGajQ\nzwU4e+Q/dSQrJoHicC/N7lSc3FKZr+c6oYCAj5qzxG3df2ZuY4J/uTOWT6so\nMQOFT7UloE6/wBKYtLI5FKiQkTUKIh4K7z3fUcCO9ERR4qhUstaeEjyPUjb1\nyUpfC0LmI+tB6beHjdSA7ajaq3oSPXmnketnUH0cen7Vd1J8aXGG3wqS3+6+\ns3vJwo1ld/CQNfyTe+ICYbDCV6LmkI4do2BYyouWwRMitmxLEa6PnkAZSzs7\nNXADfY+o8RTqj1sDjjpLvHzsem/g+DY+td8t8/Lx+U1YgnHVsGli0YDOozH2\nQpVQY051F/BiceXTpyl7TI6Nu6kIbDT9BU/qc1aOYWb9DUlHxxoU5RimmAM6\nedM95iVP42QLsd2Mbq5uovc0bxuQJ0WibUDPym1NTDcZVXtHpZfCWJIjCK/T\nFaPhgHX2w9e4/rFsuBMIuBH9P/phe/6eahuefDdENxjfwjsXvKVfxXam/U1T\nLEErcn1VCIQI6Flv0cgGqLCrvcgI8Xgf2pw6Wmo9EW+eygcaFVoxNL+sB58i\nZzukGrj86cOiW4iJ4DQVzB/YlZ79bhCCsqxb1nYbLjJfHHjWx3BJT//meGqV\n7Cab0m4ACvhcBmSkLxwdsMNR+wbrus4WKdYv70TD+b01B5cfcHybwOL9E4F/\nUYzi\r\n=rXYa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDV1JEyKOuFdbOgLHLdQPl1DV4jWXLlTMFmhm08Vi9bhAiAeJ4zSUhHZXf6hT/9mO35DtvkvSwT1HgNSr+VE6KIWNw=="}]},"maintainers":[{"name":"benswinburne","email":"ben.swinburne@gmail.com"}],"_npmUser":{"name":"benswinburne","email":"ben.swinburne@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/closest-aws-region_1.0.0_1554826447089_0.48022854279671323"},"_hasShrinkwrap":false},"1.0.1":{"name":"@benswinburne/closest-aws-region","version":"1.0.1","description":"Determines the closest AWS region using average latency between regions","main":"index.js","repository":{"type":"git","url":"git+https://github.com/benswinburne/closest-aws-region.git"},"author":{"name":"Ben Swinburne"},"license":"MIT","private":false,"scripts":{"test":"jest","test:watch":"jest --watch","lint":"eslint *.js","lint:fix":"eslint --fix *.js"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","eslint":"^5.16.0","eslint-config-prettier":"^4.1.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.0.1","eslint-plugin-promise":"^4.1.1","eslint-plugin-standard":"^4.0.0","husky":"^1.3.1","jest":"^24.7.1","lint-staged":"^8.1.5","prettier":"^1.16.4","yarpm":"^0.2.1"},"gitHead":"c36dfc6c220d975dfc2965e9e5469188c82e7e8d","bugs":{"url":"https://github.com/benswinburne/closest-aws-region/issues"},"homepage":"https://github.com/benswinburne/closest-aws-region#readme","_id":"@benswinburne/closest-aws-region@1.0.1","_nodeVersion":"8.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-9MYP57urBAd8uu3n7cNubUFIQSi+o3y245V/wUZbpkoANHILY2OFhYyqHkW5UjCzcMVdHQq6uN5d8Xpf8GSIaA==","shasum":"701a6cb320925127da9f129901787e57e30eabb5","tarball":"https://registry.npmjs.org/@benswinburne/closest-aws-region/-/closest-aws-region-1.0.1.tgz","fileCount":11,"unpackedSize":239437,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcrMZNCRA9TVsSAnZWagAAD3EP/0RM9EjrUJscS6J7jRN/\n1y6tuPcmpaz4FrduDx0mUotz4jxY4oD6xeK/1xGLj4tx8owWaZdy2uUzF+Nq\n+FSF8ETNmAWzQDcVM3K7mddiYXE3LhN4yO/373vWDZWDREeHakQ/xjR9YGx9\nUUnT/qzhbXuuqqAFh4uNuAgnND9fdI34nzOFDS3So60QLMxAQy28S5RSI3sL\nM4fzaICmYCgFAKIEgoRRQFj1FXLGwV032NhOuyxmQfPbqFV2bByyt0KdFDoy\nagyGHUm2dui9224HhK3NdxfoNkpnpu9sMwr68lWnu1Ge4EN47M6T6doVjS5o\nElKK6NjXpj4lwevX50Y+IojY51fmLzTVWHq7BckbrRkjuzvVN+0xIylc5cRk\nzNI96TL0zzHZOoTmTpjM/vJlq9ncQU9B9oGWUKWpPs7pV149wHrTHsqDkoUo\nH9Qqevs9zQxzwxFx3zg9RasJ1S+TMMK6ys3ka+g6A1qubIl8Cxsk2ZEZqnHt\nZID9b76rHYwM+TiJCcqi/gdjijGjS0nKJP9t6gf9MRXKpNAr7FKUNXJ5M+OC\nhDOTyNWRtm7r+ClsBnD3Z826ysOua6X/Mt0CVnRqS03ZmP2i3SoEQ+IDgm7K\nVWCteT1BB+bXHBVBhm+X6rbcTlijVci8sEFBh5SCr0YlAd5YmLRtT2jQ/YTT\nG70g\r\n=hitq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlsocAgnQHTE0YH33RXZP+NB47XLsb/gFoY8gXsupxewIgXZZ05kMIuYF6CPjXBVCOTQH5NM+HE88xkLte7OkppGQ="}]},"maintainers":[{"name":"benswinburne","email":"ben.swinburne@gmail.com"}],"_npmUser":{"name":"benswinburne","email":"ben.swinburne@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/closest-aws-region_1.0.1_1554826828450_0.5228025000901713"},"_hasShrinkwrap":false},"2.0.0":{"name":"@benswinburne/closest-aws-region","version":"2.0.0","description":"Determines the closest AWS region using average latency between regions","main":"index.js","repository":{"type":"git","url":"https://github.com/benswinburne/closest-aws-region"},"author":{"name":"Ben Swinburne"},"license":"MIT","private":false,"scripts":{"test":"jest","test:watch":"jest --watch","lint":"eslint *.js","lint:fix":"eslint --fix *.js"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","cheerio":"^1.0.0-rc.6","eslint":"^5.16.0","eslint-config-prettier":"^4.1.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.0.1","eslint-plugin-promise":"^4.1.1","eslint-plugin-standard":"^4.0.0","got":"^11.8.2","husky":"^1.3.1","jest":"^24.7.1","lint-staged":"^8.1.5","nodemon":"^2.0.7","prettier":"^1.16.4","yarpm":"^0.2.1"},"licenseText":"MIT License\n\nCopyright (c) 2019 Ben Swinburne\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@benswinburne/closest-aws-region@2.0.0","dist":{"shasum":"6f9fee0755cdbd6846d6a3ee37b506598bc83a26","integrity":"sha512-2vlbW4Vvgs7dYYQ0otg7f72Ti+gnHaBwBPHShuE+s3ZPIzpcSn7I5foz8fUaPBet12Ou2w0eHQcV6euuN3pJtg==","tarball":"https://registry.npmjs.org/@benswinburne/closest-aws-region/-/closest-aws-region-2.0.0.tgz","fileCount":6,"unpackedSize":16703,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkuVhCRA9TVsSAnZWagAAeTcQAJ0gsETL0Dubyo1kvAF7\nFmtqWbbe06Ycy/0/SUeYkmoM4DmoTzp6OrhyM+jMA08T8nRBnk7b/Jgb0N76\neYm48U5LH/uL8yiIitdeZyrJULbZifLKS4lZ5qXdFI1vJvi0T6aJHd9XZyA0\nMWjV4krqAuhui5XODnyssMf2FGHlMStbnwg928hnU2Q0bUG8GBNlsM0Rdj+P\nSm+AwpW9jmaET175Cf3CcpudnxA0gkNgi6O2Em9ItWddL841fk8u52eZ04GZ\nyFgIcCy7XWtvLkt/ffo+qS3+u9JEqJP3nJn0faqVAleK82DFXrblfATOe07h\nXT0hwVuoG0QJ6iZBdn31ZIM6PHJ2jPmFYb6x5L9jG6BUyheKJqmJ2GnWoN6M\nklwj7lUzdwlm7eXm2LwX2zNao6nc6EZY5ZaKYF+xsA/JjTDNjzfoIqBRmUb6\nURTSSasr3CXh+uAoGygW3QJGROeHr5lTubq9KpV8u+5jriXlivTimIICHy+M\n1C9PIx0Sbtp3/09LsgbYijAckYvwpMLTS48a2tIrD3RW6jbPCMHwN81w+8d4\nroldC9EnWIPnaIy7B3rE7Oowkp2NO0MI1nkeah/Rxun2dGxdLfDNFEzPelYv\nDqWedGv6t7wQ1qed6lsfZlO6r6NUt52iUjBIH4+aUXpcanaTegSl8bC659H+\nMSib\r\n=4IoJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEzFoYF1OYkpa7Ttez2nARGOmw8RLM1TxNqBwMCEFsTwAiBBniklLEKQwyP6f3hIAnc7NbvDW/mH9rFqvkqREvQrSQ=="}]},"_npmUser":{"name":"benswinburne","email":"ben.swinburne@gmail.com"},"directories":{},"maintainers":[{"name":"benswinburne","email":"ben.swinburne@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/closest-aws-region_2.0.0_1620239712978_0.17292263268304442"},"_hasShrinkwrap":false},"2.0.1":{"name":"@benswinburne/closest-aws-region","version":"2.0.1","description":"Determines the closest AWS region using average latency between regions","main":"index.js","repository":{"type":"git","url":"git+https://github.com/benswinburne/closest-aws-region.git"},"author":{"name":"Ben Swinburne"},"license":"MIT","private":false,"scripts":{"test":"jest","test:watch":"jest --watch","lint":"eslint *.js","lint:fix":"eslint --fix *.js"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","cheerio":"^1.0.0-rc.6","eslint":"^5.16.0","eslint-config-prettier":"^4.1.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.0.1","eslint-plugin-promise":"^4.1.1","eslint-plugin-standard":"^4.0.0","got":"^11.8.2","husky":"^1.3.1","jest":"^24.7.1","lint-staged":"^8.1.5","nodemon":"^2.0.7","prettier":"^1.16.4","yarpm":"^0.2.1"},"gitHead":"4700ae5de7825390107f06660717ed9e3c0c6955","bugs":{"url":"https://github.com/benswinburne/closest-aws-region/issues"},"homepage":"https://github.com/benswinburne/closest-aws-region#readme","_id":"@benswinburne/closest-aws-region@2.0.1","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-ezsH763VXmbpP5dnFIO95zG18+adx7duHQwt6DvNKUP5uK3WFu8ISrh/cXNCS8nkqEQf9rkzg4o79AEjpI+pCg==","shasum":"e768136a4140e9e6ce09a5427401d00c32c66970","tarball":"https://registry.npmjs.org/@benswinburne/closest-aws-region/-/closest-aws-region-2.0.1.tgz","fileCount":5,"unpackedSize":16752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmV7kCRA9TVsSAnZWagAAK7YP/RsyNwTgDE+WC9e0ciNB\nkrOtxJfuSjYEfemU6lhNZpg9PdJ+qy1Sp+4UoUhm5zhkUF16c0q0h+G+kW7Q\nRePHvbSztYeVJQScUAu7T7Sldxg7wHjmVuvRVp54e45xm5rklH+/GiUeM46z\n5CUdLHx+GEPwK0R0AtElFEffu6igAgVTVBIMfCqoPntjxqKh14soXbAjcCwG\n8Sn43wPyu/29mzThAAhkpfo5jhLSXbiXyN7CAzh7qVtfwrytrwIdHbd8BgTf\nWh/uTZSETiSjBfO/r9rsfv6Nn4fW6Rfqe0ubzt4ffEWaaCABQHMiTS7i5TGV\nBzJPEmoXd1u3sr3WDdd4l8HfRrODnhfyXBoBpfGofUdULlSiIphKJdwCJfZg\nJbb69jjSdSNf5iX9zRFrYU3RiaDD/FxtYUvcMUdZTbhrcC2z+ga8arGC9woo\n8h6Iyz7OlQId60p13ybmT1ZSE4aCE87egxCER9GHabVRCFNugC2tilUgxKJZ\ne4ovN+TJ9eXgU3kPkDa/u7roHyECVlHkhztdzQXwy9AeuocbBdJJMcmnxlOv\nnUMeq0w01wMaLM95dIA6/czr0UaEe/KrdddQtlBNAbmJ67qZDPS1g1R9y6zl\nO24+0u8QWK41zY1btWtNqGCH0o3OSsu3iG9ebgPmNksxc0xmtaNWFxW9wzxD\ngqcn\r\n=IiLI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDs+XdKIA9t2Ok2YoGmdxwWP9yVLJY1kiIPSgKl/F9RGAIgKlAzo1R5P/+EWEdS/3h3n2aUSlV4yh6RffV83QxbDm0="}]},"_npmUser":{"name":"benswinburne","email":"ben.swinburne@gmail.com"},"directories":{},"maintainers":[{"name":"benswinburne","email":"ben.swinburne@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/closest-aws-region_2.0.1_1637441252349_0.0007692667747130066"},"_hasShrinkwrap":false}},"time":{"created":"2019-04-09T16:14:06.898Z","1.0.0":"2019-04-09T16:14:07.245Z","modified":"2022-04-04T18:23:58.934Z","1.0.1":"2019-04-09T16:20:28.645Z","2.0.0":"2021-05-05T18:35:13.154Z","2.0.1":"2021-11-20T20:47:32.524Z"},"maintainers":[{"name":"benswinburne","email":"ben.swinburne@gmail.com"}],"description":"Determines the closest AWS region using average latency between regions","repository":{"type":"git","url":"git+https://github.com/benswinburne/closest-aws-region.git"},"author":{"name":"Ben Swinburne"},"license":"MIT","readme":"# Find the Closest AWS Region\n\n## Why?\n\nWhilst using lambda@edge your code runs in any one of the available data\ncentres, which is not necessarily true for your data or other services perhaps.\n\nFor example, if I'm using Dynamodb global tables and my data exists in\n`eu-west-1`, `us-east-2` and `ap-southeast-1`, when my lambda@edge function\nruns and sets up a DocumentClient using `process.env.AWS_REGION`, the value of\nthis environment variable may be any of the available AWS regions, perhaps\n`eu-central-1`.\n\nWhat this means is that the DocumentClient will fail to retrieve the data as it\nattempts to access it from Dynamodb at `eu-central-1` as it hasn't been\nreplicated to that region.\n\nRather than hard coding or chosing one of the three regions in which I've\nstored my data, using this package I can determine which of the regions which\ncontains my data is closest to `process.env.AWS_REGION` (or at least has the\nlowest latency).\n\n## Installation\n\n`npm install @benswinburne/closest-aws-region`\n\n## Import/Require\n### CommonJS:\n`var closestAWSRegion = require('@benswinburne/closest-aws-region')`\n\n### ES Modules:\n`import closestAWSRegion from '@benswinburne/closest-aws-region'`\n\n# Quick Start\n\n```\n// AWS_REGION = eu-central-1\n\nconst region = findClosestAWSRegion(process.env.AWS_REGION, {\n  filters: ['eu-west-1', 'us-east-1', 'ap-southeast-1'],\n}); // eu-west-1\n```\n\n# API\n\n## `closestAWSRegion(to, [options])`\n\nFind the closest region to that specified in `to`.\n\n_Note: If `options.filters` is not set, the closest region will always be `to`._\n\n## Options\n\n### `default`\n\nThe default region to select in the event that no region is found. This\ndefaults to `us-east-1` if not set.\n\n### `filters`\n\nSpecify the region(s) to limit your search to.\n\n```\n// AWS_REGION = eu-central-1\n\nconst region = findClosestAWSRegion(process.env.AWS_REGION, {\n  filters: ['eu-west-1', 'us-east-1']\n}); // eu-west-1\n```\n\n### `excludeTo` (defaults to false)\n\nIf for example you are looking for the closest region to eu-west-1, with no\nfilters applied obviously eu-west-1 is the closted region. By excluding `to`,\nthe return value will be the closest region to eu-west-1 which is not eu-west-1.\n\n### `data`\n\nThis option allows for overwriting the static datasource. The format must\nfollow the structure used by cloudping.co.\n\n_Note: it's not recommended that a remote datasource is used with lambda@edge\nbecause the latency savings by finding the closest region are lost during the\nroundtrip to an external source_\n\n```\n// AWS_REGION = eu-central-1\n\nconst response = await fetch('https://api.cloudping.co/averages');\nconst data = await response.json();\n\nconst region = findClosestAWSRegion(process.env.AWS_REGION, {\n  data: data\n});\n```\n","readmeFilename":"readme.md","homepage":"https://github.com/benswinburne/closest-aws-region#readme","bugs":{"url":"https://github.com/benswinburne/closest-aws-region/issues"}}