{"_id":"@artesa/feathers-google-maps","_rev":"3-e4ebe6ed58d79faecd44260279f39267","name":"@artesa/feathers-google-maps","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.0":{"name":"@artesa/feathers-google-maps","version":"2.0.0","keywords":["feathers","google maps"],"author":{"name":"Nils Bergmann","email":"contact+feathers-google-maps@noim.net"},"license":"MIT","_id":"@artesa/feathers-google-maps@2.0.0","maintainers":[{"name":"thenoim","email":"nilsbergmann@noim.io"},{"name":"fratzinger","email":"f.ashidian@gmail.com"}],"homepage":"https://github.com/artesa/feathers-google-maps#readme","bugs":{"url":"https://github.com/artesa/feathers-google-maps/issues"},"dist":{"shasum":"a684ff0a07f3fd4fbf7d4c2982e374945fb3c8a7","tarball":"https://registry.npmjs.org/@artesa/feathers-google-maps/-/feathers-google-maps-2.0.0.tgz","fileCount":7,"integrity":"sha512-xWUGFdnWeNcDUJX9Lh0XATTkprikBuLy5XLznAmCuvvyqnL6J9ocbxVGDB+KCwGMNFiBn95pXlbRDGeca7+a7Q==","signatures":[{"sig":"MEUCIQC4+6srqUGUusa1IapHmsP+vvVTQzq+DiAQBebTRLRzyAIgO6S2VzMGMQFZ67gIMAYnTu5REqpq7qrLXQgU43mdWRo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22105},"main":"./dist/index.cjs","type":"module","_from":"file:artesa-feathers-google-maps-2.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">= 22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"private":false,"scripts":{"build":"tsdown"},"_npmUser":{"name":"thenoim","email":"nilsbergmann@noim.io"},"_resolved":"/private/var/folders/38/h_n6mssn5nngpdw6xpx5wd680000gn/T/c568a26594d357cb4beb3e60c188a25c/artesa-feathers-google-maps-2.0.0.tgz","_integrity":"sha512-xWUGFdnWeNcDUJX9Lh0XATTkprikBuLy5XLznAmCuvvyqnL6J9ocbxVGDB+KCwGMNFiBn95pXlbRDGeca7+a7Q==","repository":{"url":"git+https://github.com/artesa/feathers-google-maps.git","type":"git"},"_npmVersion":"10.9.2","description":"A Feathers service for interacting with the Google Maps API","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.11.11","typescript":"^5.0.3","@types/node":"^22.15.19"},"peerDependencies":{"@feathersjs/errors":"^5.0.1","@feathersjs/feathers":"^5.0.1","@googlemaps/google-maps-services-js":"^3.3.28"},"_npmOperationalInternal":{"tmp":"tmp/feathers-google-maps_2.0.0_1747652829265_0.5505824517226183","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@artesa/feathers-google-maps","version":"2.0.1","keywords":["feathers","google maps"],"author":{"name":"Nils Bergmann","email":"contact+feathers-google-maps@noim.net"},"license":"MIT","_id":"@artesa/feathers-google-maps@2.0.1","maintainers":[{"name":"thenoim","email":"nilsbergmann@noim.io"},{"name":"fratzinger","email":"f.ashidian@gmail.com"}],"homepage":"https://github.com/artesa/feathers-google-maps#readme","bugs":{"url":"https://github.com/artesa/feathers-google-maps/issues"},"dist":{"shasum":"2ebd8601740285acf5d7349a6fa860ddbcbbb232","tarball":"https://registry.npmjs.org/@artesa/feathers-google-maps/-/feathers-google-maps-2.0.1.tgz","fileCount":7,"integrity":"sha512-lVm50wBwUgXuv30CSgcgkDOY+jTi1OQVZdzK4rYCBKStw/FJAQaQAcwXKmJDbkLsY63BSAzDm5QVD9pYPQD1lQ==","signatures":[{"sig":"MEYCIQDcJI8rwxIJu2scWalCRPIIoaxyY7j7Efzi++Hn8rv7TAIhAOiZPjMO235z6AO02frkl9MVAeRhCSRs/BCDGRvvJaue","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22255},"main":"./dist/index.cjs","type":"module","_from":"file:artesa-feathers-google-maps-2.0.1.tgz","types":"./dist/index.d.ts","engines":{"node":">= 22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"private":false,"scripts":{"build":"tsdown"},"_npmUser":{"name":"thenoim","email":"nilsbergmann@noim.io"},"_resolved":"/private/var/folders/38/h_n6mssn5nngpdw6xpx5wd680000gn/T/337ec2967682ac5cbca26cb91ec73e12/artesa-feathers-google-maps-2.0.1.tgz","_integrity":"sha512-lVm50wBwUgXuv30CSgcgkDOY+jTi1OQVZdzK4rYCBKStw/FJAQaQAcwXKmJDbkLsY63BSAzDm5QVD9pYPQD1lQ==","repository":{"url":"git+https://github.com/artesa/feathers-google-maps.git","type":"git"},"_npmVersion":"10.9.2","description":"A Feathers service for interacting with the Google Maps API","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.11.11","typescript":"^5.0.3","@types/node":"^22.15.19"},"peerDependencies":{"@feathersjs/errors":"^5.0.1","@feathersjs/feathers":"^5.0.1","@googlemaps/google-maps-services-js":"^3.3.28"},"_npmOperationalInternal":{"tmp":"tmp/feathers-google-maps_2.0.1_1747654383167_0.5863806064523782","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@artesa/feathers-google-maps","version":"2.0.2","description":"A Feathers service for interacting with the Google Maps API","keywords":["feathers","google maps"],"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">= 22.0.0"},"repository":{"type":"git","url":"git+https://github.com/artesa/feathers-google-maps.git"},"author":{"name":"Nils Bergmann","email":"contact+feathers-google-maps@noim.net"},"license":"MIT","bugs":{"url":"https://github.com/artesa/feathers-google-maps/issues"},"homepage":"https://github.com/artesa/feathers-google-maps#readme","peerDependencies":{"@feathersjs/errors":"^5.0.1","@feathersjs/feathers":"^5.0.1","@googlemaps/google-maps-services-js":"^3.3.28"},"devDependencies":{"@types/node":"^22.15.19","tsdown":"^0.11.11","typescript":"^5.0.3"},"scripts":{"build":"tsdown"},"_id":"@artesa/feathers-google-maps@2.0.2","_integrity":"sha512-+2cQu0LwHlDJauL5Lcfgyy3BRlZ76HWgr9NofNr6APug3fUoqvEYa3S1KudjOd/7HzG9T/Y+XhK3vbEzPibnQw==","_resolved":"/private/var/folders/38/h_n6mssn5nngpdw6xpx5wd680000gn/T/3e5c83d2032784860d04ef7819228fac/artesa-feathers-google-maps-2.0.2.tgz","_from":"file:artesa-feathers-google-maps-2.0.2.tgz","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-+2cQu0LwHlDJauL5Lcfgyy3BRlZ76HWgr9NofNr6APug3fUoqvEYa3S1KudjOd/7HzG9T/Y+XhK3vbEzPibnQw==","shasum":"6896c6dd937052303d2c8b8f1159f155c2365fa6","tarball":"https://registry.npmjs.org/@artesa/feathers-google-maps/-/feathers-google-maps-2.0.2.tgz","fileCount":7,"unpackedSize":22196,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCfDOOfeKO/J5ZWrGpdjqHXX7PgfzSLIZT09qTgkn23DAIgUPetpG8oRSJLc5KHCqatuxtEeEvZBAS8l7YBhsSBDoo="}]},"_npmUser":{"name":"thenoim","email":"nilsbergmann@noim.io"},"directories":{},"maintainers":[{"name":"thenoim","email":"nilsbergmann@noim.io"},{"name":"fratzinger","email":"f.ashidian@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/feathers-google-maps_2.0.2_1747728182888_0.5482026453330784"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-19T11:07:09.196Z","modified":"2025-05-20T08:03:03.272Z","2.0.0":"2025-05-19T11:07:09.439Z","2.0.1":"2025-05-19T11:33:03.382Z","2.0.2":"2025-05-20T08:03:03.058Z"},"bugs":{"url":"https://github.com/artesa/feathers-google-maps/issues"},"author":{"name":"Nils Bergmann","email":"contact+feathers-google-maps@noim.net"},"license":"MIT","homepage":"https://github.com/artesa/feathers-google-maps#readme","keywords":["feathers","google maps"],"repository":{"type":"git","url":"git+https://github.com/artesa/feathers-google-maps.git"},"description":"A Feathers service for interacting with the Google Maps API","maintainers":[{"name":"thenoim","email":"nilsbergmann@noim.io"},{"name":"fratzinger","email":"f.ashidian@gmail.com"}],"readme":"# @artesa/feathers-google-maps\n\n> A Feathers service for Google Maps API\n\n## Installation\n\n```\npnpm add @artesa/feathers-google-maps\n```\n\n## Documentation\n\nThis service is a light wrapper around the @googlemaps/google-maps-services-js library. Please refer to the [@googlemaps/google-maps-services-js](https://github.com/googlemaps/google-maps-services-js) documenation for options that can be passed. You will also find it helpful to reference the [Google Maps Web Service APIs](https://developers.google.com/maps/apis-by-platform#web_service_apis) docs.\n\n### Available Services\n\nThe following methods are supported and map to the appropriate @google/maps methods:\n\n- directions\n- distancematrix\n- elevation\n- findPlaceFromText\n- geocode\n- geolocate\n- nearestRoads\n- placeAutocomplete\n- placeDetails\n- placePhoto\n- placeQueryAutocomplete\n- placesNearby\n- reverseGeocode\n- snapToRoads\n- textSearch\n- timezone\n\n## Creating a Service\n\n```js\nconst GoogleMapsService = require('@artesa/feathers-google-maps');\n\nconst Directions = new GoogleMapsService({\n  key: 'YOUR API KEY',\n  method: 'directions'\n});\n\napp.use('directions', Directions);\n```\n\nThe service exposes two methods, `find(params)` and `create(data, params)`. These two methods are functionally equivalent. The `create()` method is added so that you can take advantage of the `.on('created')` service event.\n\nWhen using the `find(params)` method, include the `query` as the params to be passed to the underlying GoogleMaps method.\n\n```js\napp.service('directions').find({\n  query: {\n    origin: 'Nashville, TN',\n    destination: 'Memphis, TN'\n  }\n});\n\n// This will call the googlMaps method like\ngoogleMaps.directions({\n  params: {\n    origin: 'Nashville, TN',\n    destination: 'Memphis, TN',\n    key: 'YOUR API KEY'\n  }\n});\n```\n\nWhen using the `create(data, params)` method, the `data` will be passed to the underlying GoogleMaps method.\n\n```js\napp.service('directions').create({\n  origin: 'Nashville, TN',\n  destination: 'Memphis, TN'\n});\n\n// This will also call the googlMaps method like\ngoogleMaps.directions({\n  params: {\n    origin: 'Nashville, TN',\n    destination: 'Memphis, TN',\n    key: 'YOUR API KEY'\n  }\n});\n```\n\n## Complete Example\n\n```js\nconst feathers = require('@feathersjs/feathers');\nconst express = require('@feathersjs/express');\nconst socketio = require('@feathersjs/socketio');\nconst GoogleMapsService = require('@artesa/feathers-google-maps');\n\n// Initialize the application\nconst app = feathers()\n  .configure(express.rest())\n  .configure(socketio())\n  .use(express.json())\n  .use(express.urlencoded({ extended: true }))\n  .use(express.errorHandler({ html: false }));\n\n// Create a directions service\napp.use('directions', new GoogleMapsService({\n  key: 'YOUR API KEY',\n  method: 'directions'\n}));\n\n// Create a geocode service\napp.use('geocode', new GoogleMapsService({\n  key: 'YOUR API KEY',\n  method: 'geocode'\n}));\n\nconst directionsService = app.service('directions');\nconst geocodeService = app.service('geocode');\n\nconst successHook = context => {\n  // On success, context.params.googleMaps will include a `response`\n  console.log('Success: ', context.data, context.params.googleMaps);\n}\n\nconst errorHook = context => {\n  // On error, context.params.googleMaps will include an `error`\n  console.log('Error: ', context.error, context.params.googleMaps);\n}\n\ndirectionsService.hooks(\n  after: {\n    find: [successHook]\n    create: [successHook]\n  },\n  error: {\n    find: [errorHook]\n    create: [errorHook]\n  },\n);\n\ndirectionsService.on('created', result => {\n  console.log('Directions created event');\n})\n\ngeocodeService.hooks(\n  after: {\n    find: [successHook]\n    create: [successHook]\n  },\n  error: {\n    find: [errorHook]\n    create: [errorHook]\n  },\n);\n\ngeocodeService.on('created', result => {\n  console.log('Geocode created event');\n})\n\ndirectionsService\n  .find({ query: { origin: 'Nashville, TN', destination: 'Memphis, TN' } })\n  .then(result => {\n    console.log('Directions found', result);\n  })\n  .catch(error => {\n    console.log('Error finding directions', error);\n  });\n\ndirectionsService\n  .create({ origin: 'Nashville, TN', destination: 'Memphis, TN' })\n  .then(result => {\n    console.log('Directions created', result);\n  })\n  .catch(error => {\n    console.log('Error creating directions', error);\n  });\n\ngeocodeService\n  .find({ query: { address: '1010 Forrest Ave, Nashville, TN' } })\n  .then(result => {\n    console.log('Geocode found', result);\n  })\n  .catch(error => {\n    console.log('Error geocoding', error);\n  });\n\ngeocodeService\n  .create({ address: '1010 Forrest Ave, Nashville, TN' })\n  .then(result => {\n    console.log('Geocode found', result);\n  })\n  .catch(error => {\n    console.log('Error geocoding', error);\n  });\n\napp.listen(3030);\n\nconsole.log('Feathers app started on 127.0.0.1:3030');\n```\n\n## License\n\nCopyright (c) 2023\n\nLicensed under the [MIT license](LICENSE).\n","readmeFilename":"README.md"}