{"_id":"@atombrenner/openmeteo","_rev":"5-4c59e99a345c0d003f53459d271a0758","name":"@atombrenner/openmeteo","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@atombrenner/openmeteo","version":"0.1.0","description":"Typesafe access to [Open-Meteo Weather Forecast API](https://open-meteo.com/en/docs)","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Your Name","email":"your.email@example.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"prepare":"tsc"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.1.0","gitHead":"ba3b8d64000f507cf97f5b15c7b964f55b2c6ae2","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.10.0","_npmVersion":"10.4.0","dist":{"integrity":"sha512-Ct9iRMqNjcAb0UKeJjae+avXsFq72cOkJJAyWg3QVdfxkoA2Nimj6VLID2wxuKfwgjATgWmmJ3J3sRojiE3hZg==","shasum":"c3e5b71ea1a5ef1824d13c7fd8307c6abd57627a","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.1.0.tgz","fileCount":7,"unpackedSize":14674,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFBX18NrTLDQMQ/gAn/FDi2G08pvJfRy6fuDohSCJchsAiEAxQen9ueUbaCievpaUyQb/YT6qEpeuE98cTMB7HY7Lz8="}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.1.0_1707321655987_0.6101896160736897"},"_hasShrinkwrap":false},"0.1.1":{"name":"@atombrenner/openmeteo","version":"0.1.1","description":"Typesafe Open-Meteo Weather API client","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Christian Rodemeyer"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"test":"bun test .ts","build":"tsc","prepublishOnly":"tsc && bun test .ts"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.1.1","gitHead":"e25fe4a1dd130d3392ffdb64c0cb703081f394fc","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.10.0","_npmVersion":"10.4.0","dist":{"integrity":"sha512-MVhWOryeBmGCNiEf5gI7GQ8tp09WaZgreRSqmv6pdz5ngmmM/am/CpXnVIsi+qGCZAW14YcZrZGLWuuk8LcuNg==","shasum":"f88cc17dc5ecee80923ab00a1681a6022cbb3889","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.1.1.tgz","fileCount":7,"unpackedSize":20170,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNn9wiDaHPBbEWIXAsD3ClD2kcCrDguwCpXKMVJ/NZNwIhAKY2S4WNcvv3eEBfWo1PAyjUB/fVz+Ie1fhNww7+1vTv"}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.1.1_1707643209529_0.950653784933112"},"_hasShrinkwrap":false},"0.1.2":{"name":"@atombrenner/openmeteo","version":"0.1.2","description":"Typesafe Open-Meteo Weather API client","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Christian Rodemeyer"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"test":"bun test .ts","build":"tsc","prepublishOnly":"tsc && bun test .ts"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.1.2","gitHead":"fcb5d6e20571e51924fe38e108679851541f9a48","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-dKYI5SdcCS6HA5+26XJl0uYRQW5y/NwwoBGA3LecKOynEuKOO4TQropVEMRYkizpzqA32He8v1NimSJJKUHJuw==","shasum":"567bf09c5b6a42559e663cc95f0c82da80872916","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.1.2.tgz","fileCount":7,"unpackedSize":20170,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atombrenner%2fopenmeteo@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFeP/k7EYIVFHQ9vE0Af0H6qwoFE9FydVG/lwh3O4b3wIhANpnKnwB+VvQr93ad9C8+82D9OMhrr7gYxF7mzEQmcgw"}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.1.2_1707668974119_0.4914306065025995"},"_hasShrinkwrap":false},"0.1.3":{"name":"@atombrenner/openmeteo","version":"0.1.3","description":"Typesafe Open-Meteo Weather API client","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Christian Rodemeyer"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"test":"bun test .ts","build":"tsc","prepublishOnly":"tsc && bun test .ts"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.1.3","gitHead":"d0ce36fb33e005b0674ec48ecc01dace1ddc7b51","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-+x3zsvyLg8IycdI37zKw69bSsG0R+3YUHGUZeJDxEUTql+IFlSCvbd8nhg1goXUArhzO8D6XOZEMnSe6CCma2w==","shasum":"ec4c97e0ea1879841aaf177554f387a85302a5f9","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.1.3.tgz","fileCount":7,"unpackedSize":21143,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atombrenner%2fopenmeteo@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGcDDAWjT9BWzdAhWvy2ZQExc6SxM3aBxYEITPBtCQJAIhAJWdpVtoTLfpxmI0+QrOdxuHcXp8Nk3Y4M8UZtP60R8q"}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.1.3_1708358359692_0.41334096114438146"},"_hasShrinkwrap":false},"0.1.4":{"name":"@atombrenner/openmeteo","version":"0.1.4","description":"Typesafe Open-Meteo Weather API client","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Christian Rodemeyer"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"test":"bun test .ts","build":"tsc","prepublishOnly":"tsc && bun test .ts"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.1.4","gitHead":"82bb50692c5514dae4af83f3b19812a4719911e0","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-ltMC+EZo9TrHS54kSh3mrS7GN4yq8XiJzL7hYkwpDxi1SOJ2yZPbYOJHUWnjXMMn7y9AXQiGHTZYTTrUSz9cPg==","shasum":"0c50d0344102f8c68deb49feaa53b6342cb22122","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.1.4.tgz","fileCount":7,"unpackedSize":20860,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atombrenner%2fopenmeteo@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGlUgissR3bj/XtGcFDgZ98GgNY5k1qHl6Ld1mLaAUwpAiEAzrztxHwlfWDbS2CsciYKmwM1Gjqfevpah+6fCqKA6Gw="}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.1.4_1708450366889_0.8781413369181692"},"_hasShrinkwrap":false},"0.2.0":{"name":"@atombrenner/openmeteo","version":"0.2.0","description":"Typesafe Open-Meteo Weather API client","keywords":["typescript","openmeteo","weather","forecast"],"author":{"name":"Christian Rodemeyer"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"type":"commonjs","main":"dist/main.js","types":"dist/main.d.ts","scripts":{"test":"bun test .ts","build":"tsc","prepublishOnly":"tsc && bun test .ts"},"devDependencies":{"@types/bun":"latest","prettier":"^3.2.5","typescript":"^5.3.0"},"dependencies":{"@openmeteo/sdk":"^1.9.0","flatbuffers":"^23.5.26"},"_id":"@atombrenner/openmeteo@0.2.0","gitHead":"6dcf1fe51052584f5a3df7b01f5bad99436b8f0e","bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"homepage":"https://github.com/atombrenner/openmeteo#readme","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-AeE+gw1KYkZVjRlDp1Eqaedn+ReNTJZA2yN6rReEYOy+OtGmj4YIu9GXvi0UqNzhRJyJHIHYaa0Y0m2gGBGUqg==","shasum":"3679fbcd749f20ce24c4abd17c5e8d6580a6768b","tarball":"https://registry.npmjs.org/@atombrenner/openmeteo/-/openmeteo-0.2.0.tgz","fileCount":7,"unpackedSize":20930,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@atombrenner%2fopenmeteo@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD81E3rJf1V8yhe4t+xKuNlihkeHRlOvEDuCzpkJfhsAgIgC1eYRbXAnwxUz01O2J6QYxN4WXgjH3AvLjkWtPItO3c="}]},"_npmUser":{"name":"atombrenner","email":"atombrenner@gmail.com"},"directories":{},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openmeteo_0.2.0_1708450603057_0.8007992205476755"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-07T16:00:55.855Z","0.1.0":"2024-02-07T16:00:56.168Z","modified":"2024-02-20T17:36:43.882Z","0.1.1":"2024-02-11T09:20:09.705Z","0.1.2":"2024-02-11T16:29:34.311Z","0.1.3":"2024-02-19T15:59:19.836Z","0.1.4":"2024-02-20T17:32:47.088Z","0.2.0":"2024-02-20T17:36:43.218Z"},"maintainers":[{"name":"atombrenner","email":"atombrenner@gmail.com"}],"description":"Typesafe Open-Meteo Weather API client","homepage":"https://github.com/atombrenner/openmeteo#readme","keywords":["typescript","openmeteo","weather","forecast"],"repository":{"type":"git","url":"git+https://github.com/atombrenner/openmeteo.git"},"author":{"name":"Christian Rodemeyer"},"bugs":{"url":"https://github.com/atombrenner/openmeteo/issues"},"license":"MIT","readme":"# OpenMeteo\n\n![version](https://img.shields.io/npm/v/@atombrenner/openmeteo)\n![issues](https://img.shields.io/github/issues/atombrenner/openmeteo)\n![build](https://github.com/atombrenner/openmeteo/actions/workflows/main.yaml/badge.svg?branch=main)\n\nThis is a typesafe client for the [Open-Meteo Weather Forecast API](https://open-meteo.com/en/docs).\nThe Open-Meteo API gives you unified access to high-precision weather forecast data from\nmany national weather services.\nThe client is designed to utilize [TypeScript](https://www.typescriptlang.org/) for maximum type safety and [flatbuffers](https://flatbuffers.dev/index.html#flatbuffers_overview)\nfor best performance.\n\n## Usage\n\n```\nnpm install @atombrenner/openmeteo\n```\n\nImport the `fetchWeatherData` function. It needs a runtime that implements a basic [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n\n```typescript\nimport { fetchWeatherData } from '@atombrenner/openmeteo'\n```\n\nFetch forecast data. The function accepts an object of type `WeatherDataParams` that mimics\nthe parameters of the Open-Meteo API as closely as possible. File an issue if you find\nsomething missing. Fetching data for multiple locations in one request is not supported.\n\n```typescript\nconst data = await fetchWeatherData({\n  latitude: 49.0699764,\n  longitude: 11.614277,\n  timezone: 'Europe/Berlin',\n  forecast_days: 5,\n  hourly: ['temperature_2m', 'rain'],\n  daily: ['temperature_2m_max', 'sunrise', 'sunset'],\n  current: ['apparent_temperature'],\n})\n```\n\nAll hourly, daily and current parameters documented by [DWD ICON](https://open-meteo.com/en/docs/dwd-api) are currently supported.\nThe weather variables arrays for hourly, daily and current data are typed with string literals,\nso autocompletion just works.\n\n![parameter autocomplete](doc/request_autocomplete.webp)\n\nAccess the returned data. Note that `daily` and `hourly` are time series and return an array of\nvalues. All values are of type `number`. Duration and timestamps are returned as seconds.\n\n```typescript\nconsole.log(data.hourly.temperature_2m[0]) // temperature in the first hour\nconsole.log(data.current.apparent_temperature)\n```\n\nThe returned data is typed depending on the parameters, which means that only requested\nvariables are part of the return type.\nIf you have requested `hourly: ['rain']` and try to access `data.hourly.temperature_2m`,\nTypeScript will raise a 'Property does not exist' error.\nWithout the `WeatherData` type depending on `WeatherDataParams` all properties\nwould need to be present and the user would need to do null checks all the time.\n\n![response autocomplete](doc/response_autocomplete.webp)\n\nIf you need to construct the parameter object dynamically,\nyou need the `as const` or the `weatherDataParams` utility function to prevent\ntype widening to string. See [examples](example.ts).\n\nThe returned data is modeled very closely to the JSON response of the Open-Meteo API.\nThere are a few caveats to be aware of:\n\n- durations and timestamps are returned in `seconds` (type number)\n- timestamps are always in UTC\n- data contains `utc_offset_seconds` property for easy conversion to local time:\n  ```typescript\n  const localTime = (ts: number) => new Date((ts + data.utc_offset_seconds) * 1000)\n  ```\n\n## Notes\n\n- The [flatbuffers](https://flatbuffers.dev/index.html#flatbuffers_overview) optimization idea was\n  borrowed from the [openmeteo](https://www.npmjs.com/package/openmeteo) package.\n  Flatbuffers indeed reduce the size of the transferred data but the absolute saving is rather small\n  unless you request a lot of variables for many intervals. Anyway, it was fun to learn flatbuffers,\n  and using a performant code just feels good 😁.\n- Uses [Bun](https://bun.sh/) for development and running tests.\n- If you want retries on network errors use something like [retry](https://www.npmjs.com/package/retry).\n\n## Publish\n\nUseful commands\n\n- `npm version <major|minor|patch>`\n- `git push --tags` starts the workflow for publishing an new package\n- `npm pack` creates a package, useful for local testing\n- `npm publish --dry-run` check package before publishing\n- `npm publish --access public`\n","readmeFilename":"README.md"}