{"_id":"@bencevans/weatherkit","_rev":"3-0ccc0a9d20b082002aaeb5f59b085331","name":"@bencevans/weatherkit","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@bencevans/weatherkit","version":"1.0.0","keywords":["weather","apple","weatherkit"],"author":{"url":"https://bencevans.io","name":"Ben Evans"},"license":"MIT","_id":"@bencevans/weatherkit@1.0.0","maintainers":[{"name":"bencevans","email":"ben@bluechimp.io"}],"homepage":"https://github.com/bencevans/weatherkit#readme","bugs":{"url":"https://github.com/bencevans/weatherkit/issues"},"dist":{"shasum":"147642aea4709a13ba4ae5fd3b9f0e52b9b947c0","tarball":"https://registry.npmjs.org/@bencevans/weatherkit/-/weatherkit-1.0.0.tgz","fileCount":11,"integrity":"sha512-2YtO8uQbXggWniYi5ax70XmXkOrCm+ilPjEUiEROau48Ph2hs0Wp5SSG/JQVczhJhypdf9sRb/TBy5gkmcLpdQ==","signatures":[{"sig":"MEYCIQCFIKVt8RNmqSsRiSLRwdlsu5Yt3/bXjd/zWe6FVDOrGwIhAOSHi/a7o/6rZFf/10vyyb578ZwU4QJgWBfN6ByBSj0W","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":75959},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e7bd9f56b55ad7e3cb7db96fd4fd4312c600cfb8","scripts":{"test":"vitest run","build":"rm -rf dist && tsc -p tsconfig.json","prepublishOnly":"npm test && npm run build"},"_npmUser":{"name":"bencevans","email":"ben@bluechimp.io"},"repository":{"url":"git+https://github.com/bencevans/weatherkit.git","type":"git"},"_npmVersion":"11.12.1","description":"WeatherKit API","directories":{},"_nodeVersion":"24.14.0","dependencies":{"zod":"^4.3.6"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.4","typescript":"^6.0.2","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/weatherkit_1.0.0_1776273541935_0.7284174743288725","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@bencevans/weatherkit","version":"1.1.0","keywords":["weather","apple","weatherkit"],"author":{"url":"https://bencevans.io","name":"Ben Evans"},"license":"MIT","_id":"@bencevans/weatherkit@1.1.0","maintainers":[{"name":"bencevans","email":"ben@bluechimp.io"}],"homepage":"https://github.com/bencevans/weatherkit#readme","bugs":{"url":"https://github.com/bencevans/weatherkit/issues"},"dist":{"shasum":"19deda5ef3a6a499ce30b6cce8cbac7871b75b7e","tarball":"https://registry.npmjs.org/@bencevans/weatherkit/-/weatherkit-1.1.0.tgz","fileCount":11,"integrity":"sha512-BVJfCUqtDm/dU+UQePfokxr4UbqveWxhX9mZddJZ/yt+jxFzZzYNK51UH4BJKBA48IzUc4aO8lcxLoP1b4P7pA==","signatures":[{"sig":"MEYCIQCPVs52MBE2N2oRpoynFixRKnjSad+uXxAD8/myNtPuhwIhAI/VlTjyWZAk8zLBGeZ0whKmHBCtOTkHwDEfmSPOp45C","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109953},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"70d7a2c7422e8c66f55e3416da83d4564ee049b2","scripts":{"test":"vitest run","build":"rm -rf dist && tsc -p tsconfig.json","prepublishOnly":"npm test && npm run build"},"_npmUser":{"name":"bencevans","email":"ben@bluechimp.io"},"repository":{"url":"git+https://github.com/bencevans/weatherkit.git","type":"git"},"_npmVersion":"11.12.1","description":"WeatherKit API","directories":{},"_nodeVersion":"24.14.0","dependencies":{"zod":"^4.3.6"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.4","typescript":"^6.0.2","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/weatherkit_1.1.0_1776274718319_0.2875979941532283","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@bencevans/weatherkit","version":"1.2.0","description":"WeatherKit API","keywords":["weather","apple","weatherkit"],"homepage":"https://github.com/bencevans/weatherkit#readme","bugs":{"url":"https://github.com/bencevans/weatherkit/issues"},"repository":{"type":"git","url":"git+https://github.com/bencevans/weatherkit.git"},"license":"MIT","author":{"name":"Ben Evans","url":"https://bencevans.io"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"rm -rf dist && tsc -p tsconfig.json","test":"vitest run","prepublishOnly":"npm test && npm run build"},"dependencies":{"zod":"^4.3.6"},"devDependencies":{"@types/node":"^25.6.0","typescript":"^6.0.2","vitest":"^4.1.4"},"gitHead":"dbe968a1201e00fceda7bc604513f3a6822337e4","_id":"@bencevans/weatherkit@1.2.0","_nodeVersion":"24.14.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-a4CP+78PmDIo8GRFy9+WH/ASnNHj5Xk/fHHsA7lNphpqgRX+PBXHyj5YC7D6KnGlmNRaZVORZN1fqCcpZyF+PQ==","shasum":"2499ee23ede6ec44290e9747bd8a6f5e82329aaf","tarball":"https://registry.npmjs.org/@bencevans/weatherkit/-/weatherkit-1.2.0.tgz","fileCount":11,"unpackedSize":110092,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF6SaePOceHf9LHSnwwgpY8877QZ8c3CzZgNJewGXPrkAiEA7mRTc88mI/kw+cFpenjWIoy01WcLFBjW9kxyUg+sFwE="}]},"_npmUser":{"name":"bencevans","email":"ben@bluechimp.io"},"directories":{},"maintainers":[{"name":"bencevans","email":"ben@bluechimp.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/weatherkit_1.2.0_1776275082435_0.9730956914957505"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-15T17:19:01.825Z","modified":"2026-04-15T17:44:42.695Z","1.0.0":"2026-04-15T17:19:02.094Z","1.1.0":"2026-04-15T17:38:38.447Z","1.2.0":"2026-04-15T17:44:42.567Z"},"bugs":{"url":"https://github.com/bencevans/weatherkit/issues"},"author":{"name":"Ben Evans","url":"https://bencevans.io"},"license":"MIT","homepage":"https://github.com/bencevans/weatherkit#readme","keywords":["weather","apple","weatherkit"],"repository":{"type":"git","url":"git+https://github.com/bencevans/weatherkit.git"},"description":"WeatherKit API","maintainers":[{"name":"bencevans","email":"ben@bluechimp.io"}],"readme":"# WeatherKit\n\nA lightweight TypeScript client for the Apple WeatherKit REST API, with Zod-powered request and response models.\n\n## Features\n\n- Typed client for live weather and availability endpoints\n- Built-in request validation with Zod schemas\n- Rich response schemas for:\n  - current weather\n  - daily forecast\n  - hourly forecast\n  - next-hour forecast\n- Integration tests against the real WeatherKit API\n\n## Installation\n\n~~~bash\nnpm install @bencevans/weatherkit\n~~~\n\nIf you are developing this repository locally:\n\n~~~bash\nnpm install\n~~~\n\n## Authentication\n\nCreate a valid Apple WeatherKit JWT and pass it to the client:\n\nNote: The `apiKey` in this library is your encoded JWT token.\nInstructions for creating it are in Apple's WeatherKit REST API docs:\nhttps://developer.apple.com/documentation/weatherkitrestapi/request-authentication-for-weatherkit-rest-api\n\n~~~ts\nimport { WeatherKit } from \"@bencevans/weatherkit\";\n\nconst apiKey = process.env.APPLE_WEATHERKIT_API_KEY;\nif (!apiKey) {\n  throw new Error(\"APPLE_WEATHERKIT_API_KEY is required\");\n}\n\nconst client = new WeatherKit(apiKey);\n~~~\n\n## Quick Start\n\n### Get available datasets for a location\n\n~~~ts\nconst available = await client.getAvailability({\n  latitude: 37.7749,\n  longitude: -122.4194,\n  country: \"US\",\n});\n\nconsole.log(available);\n// Example: [\"currentWeather\", \"forecastDaily\", \"forecastHourly\", \"forecastNextHour\", \"weatherAlerts\"]\n~~~\n\n### Fetch weather data\n\n~~~ts\nconst weather = await client.getWeather({\n  language: \"en\",\n  latitude: 37.7749,\n  longitude: -122.4194,\n  countryCode: \"US\",\n  timezone: \"America/Los_Angeles\",\n  dataSets: [\"currentWeather\", \"forecastDaily\"],\n});\n\nconsole.log(weather);\n~~~\n\n## API\n\n### new WeatherKit(apiKey, options?)\n\n- apiKey: string\n- options.validateParameters: boolean (default: true)\n\nWhen validateParameters is true, input payloads are validated with Zod before requests are sent.\n\n### getAvailability(request)\n\nReturns available datasets for a location.\n\nRequest fields:\n\n- latitude (required)\n- longitude (required)\n- country (optional, ISO Alpha-2)\n\n### getWeather(request)\n\nFetches weather payloads for one or more datasets.\n\nRequest fields:\n\n- language (required)\n- latitude (required)\n- longitude (required)\n- timezone (required)\n- dataSets (required)\n- countryCode (optional)\n- currentAsOf (optional)\n- dailyStart (optional)\n- dailyEnd (optional)\n- hourlyStart (optional)\n- hourlyEnd (optional)\n\nSupported dataSets values:\n\n- currentWeather\n- forecastDaily\n- forecastHourly\n- forecastNextHour\n- weatherAlerts\n\n## Validation Models\n\nZod schemas and inferred types are available in src/models.ts, including:\n\n- request schemas\n- dataset enums\n- weather response models\n- forecast metadata and nested forecast structures\n\n## Testing\n\nRun tests:\n\n~~~bash\nnpm test\n~~~\n\nIntegration tests use APPLE_WEATHERKIT_API_KEY.\nIf the variable is not set, integration tests are skipped.\n\nSet the variable and run:\n\n~~~bash\nexport APPLE_WEATHERKIT_API_KEY=\"your_jwt_here\"\nnpm test\n~~~\n\n## Notes\n\n- This package uses the global fetch API available in modern Node.js runtimes.\n- API responses can vary by geography and provider.\n","readmeFilename":"README.md"}