{"analyzedAt":"2022-07-12T03:38:48.192Z","collected":{"metadata":{"name":"@layeredapps/maxmind-geoip","scope":"layeredapps","version":"1.0.26","description":"MaxMind GeoIP module for Dashboard","date":"2022-05-19T10:33:07.095Z","publisher":{"username":"beninsydney","email":"benodev@protonmail.com"},"maintainers":[{"username":"beninsydney","email":"benodev@protonmail.com"}],"repository":{"type":"git","url":"git://github.com/layeredapps/maxmind-geoip.git"},"links":{"npm":"https://www.npmjs.com/package/%40layeredapps%2Fmaxmind-geoip","homepage":"https://github.com/layeredapps/maxmind-geoip#readme","repository":"https://github.com/layeredapps/maxmind-geoip","bugs":"https://github.com/layeredapps/maxmind-geoip/issues"},"license":"MIT","dependencies":{"maxmind":"^4.3.1"},"devDependencies":{"@layeredapps/dashboard":"latest","@faker-js/faker":"latest","ibm_db":"latest","mocha":"latest","mysql2":"latest","pg":"latest","pg-hstore":"latest","puppeteer":"latest","sqlite3":"latest","standard":"latest","tedious":"latest"},"peerDependencies":{"@layeredapps/dashboard":"latest"},"releases":[{"from":"2022-06-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":0},{"from":"2022-04-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":14},{"from":"2022-01-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":28},{"from":"2021-07-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":28},{"from":"2020-07-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":28}],"hasTestScript":true,"readme":"# Documentation for Maxmind GeoIP module\n\n#### Shortcuts\n\n- [Documentation website](https://layeredapps.github.io)\n- [Module documentation](https://layeredapps.github.io/maxmind-geoip-module)\n- [API documentation](https://layeredapps.github.io/maxmind-geoip-api)\n\n#### Index\n\n- [Introduction](#introduction)\n- [Import this module](#import-this-module)\n- [Provided server, content and proxy handlers](#provided-server-content-and-proxy-handlers)\n- [Access the API](#access-the-api)\n- [Github repository](https://github.com/layeredapps/maxmind-geoip)\n- [NPM package](https://npmjs.org/layeredapps/maxmind-geoip)\n\n# Introduction\n\nDashboard bundles everything a web app needs, all the \"boilerplate\" like signing in and changing passwords, into a parallel server so you can write a much smaller web app.\n\n[MaxMind](https://www.maxmind.com/en/home) provide a database that converts IP addresses to countries and this module adds API routes for identifying the country by IP and a server handler that will automatically attach a Country object to each HttpRequest using their database.  There is much more data in the MaxMind database than is exposed via the API, pull requests are welcome to add more routes to access it. \n\n## Import this module\n\nInstall the module with NPM:\n\n    $ npm install @layeredapps/maxmind-geoip\n\nEdit your `package.json` to activate the module:\n\n    \"dashboard\": {\n      \"modules\": [\n        \"@layeredapps/maxmind-geoip\"\n      ]\n    }\n\n# Provided server, content and proxy handlers\n\nThis module comes with some convenience scripts you can add to your `package.json`:\n\n| Type     | Script path                                            | Description                                               |\n|----------|--------------------------------------------------------|-----------------------------------------------------------|\n| proxy    | @layeredapps/maxmind-geoip/src/proxy/x-country.js      | Include the Maxmind Country object in `x-country` header  |\n| server   | @layeredapps/maxmind-geoip/src/server/bind-country.js  | The MaxMind Country object will be bound to `req.country` |\n\n## Access the API\n\nDashboard and official modules are completely API-driven and you can access the same APIs on behalf of the user making requests.  You perform `GET`, `POST`, `PATCH`, and `DELETE` HTTP requests against the API endpoints to fetch or modify data.  This example fetches the user's country information using NodeJS, you can do this with any language:\n\n    const country = await proxy(`/api/user/geoip/country?ip=1.2.3.4`, accountid, sessionid)\n\n    const proxy = util.promisify((path, accountid, sessionid, callback) => {\n        const requestOptions = {\n            host: 'dashboard.example.com',\n            path: path,\n            port: '443',\n            method: 'GET',\n            headers: {\n                'x-application-server': 'application.example.com',\n                'x-application-server-token': process.env.APPLICATION_SERVER_TOKEN\n            }\n        }\n        if (accountid) {\n            requestOptions.headers['x-accountid'] = accountid\n            requestOptions.headers['x-sessionid'] = sessionid\n        }\n        const proxyRequest = require('https').request(requestOptions, (proxyResponse) => {\n            let body = ''\n            proxyResponse.on('data', (chunk) => {\n                body += chunk\n            })\n            return proxyResponse.on('end', () => {\n                return callback(null, JSON.parse(body))\n            })\n        })\n        proxyRequest.on('error', (error) => {\n            return callback(error)\n        })\n        return proxyRequest.end()\n      })\n    }"},"npm":{"downloads":[{"from":"2022-07-11T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":0},{"from":"2022-07-05T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":1},{"from":"2022-06-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":100},{"from":"2022-04-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":1715},{"from":"2022-01-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":2480},{"from":"2021-07-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":2480}],"starsCount":0},"github":{"starsCount":0,"forksCount":0,"subscribersCount":0,"issues":{"count":1,"openCount":1,"distribution":{"3600":0,"10800":0,"32400":0,"97200":0,"291600":0,"874800":0,"2624400":0,"7873200":0,"23619600":1,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"actions-user","commitsCount":12},{"username":"beninsydney","commitsCount":73},{"username":"github-actions[bot]","commitsCount":13}],"commits":[{"from":"2022-07-05T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":0},{"from":"2022-06-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":0},{"from":"2022-04-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":41},{"from":"2022-01-13T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":98},{"from":"2021-07-12T00:00:00.000Z","to":"2022-07-12T00:00:00.000Z","count":98}]},"source":{"files":{"readmeSize":3642,"testsSize":2182},"linters":["standard"]}},"evaluation":{"quality":{"carefulness":0.84,"tests":0.6,"health":1,"branding":0},"popularity":{"communityInterest":3,"downloadsCount":571.6666666666666,"downloadsAcceleration":0.8805175038051756,"dependentsCount":0},"maintenance":{"releasesFrequency":1,"commitsFrequency":0.9792191780821917,"openIssues":0.9,"issuesDistribution":0.9}},"score":{"final":0.6144505830420715,"detail":{"quality":0.8262967790528932,"popularity":0.047382315843663536,"maintenance":0.9999363965169179}}}