{"_id":"@bdking71/nws-weather-wrapper","_rev":"4-71cb8412041e89f4e97d297df072c011","name":"@bdking71/nws-weather-wrapper","dist-tags":{"latest":"2025.822.1328"},"versions":{"2025.731.1037":{"name":"@bdking71/nws-weather-wrapper","version":"2025.731.1037","keywords":["weather","nws","national weather service","typescript","api","wrapper","node"],"author":{"url":"https://bdking71.wordpress.com","name":"Bryan King"},"license":"MIT","_id":"@bdking71/nws-weather-wrapper@2025.731.1037","maintainers":[{"name":"bdking71","email":"bdking71+npm@gmail.com"}],"homepage":"https://bdking71.wordpress.com","bugs":{"url":"https://github.com/bdking71/nws-weather-wrapper/issues"},"dist":{"shasum":"eb7d077d4bc4fbfdbac7f4198c620cde2c56c387","tarball":"https://registry.npmjs.org/@bdking71/nws-weather-wrapper/-/nws-weather-wrapper-2025.731.1037.tgz","fileCount":4,"integrity":"sha512-bvSUJaNuqvkaug/DUsbwhKhDCnSH2uvWNnR/AZjlFYEOfYJyAOcd188BdDRg0kmHUSYSh6s0lsvDP6gVX4uXgg==","signatures":[{"sig":"MEUCIQDQKYbna4PKr4mYDpHpcH8klBsl9Q6I+5z0yAMj39sOLAIgGm0qCwYTzepbEtn8/3W+85y6sR7Gvm5QCRRaqOreXao=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8821},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=14"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"gitHead":"dc40b2aced883df3b83651a6b51721084e764440","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"bdking71","email":"bdking71+npm@gmail.com"},"repository":{"url":"git+https://github.com/bdking71/nws-weather-wrapper.git","type":"git"},"_npmVersion":"10.8.2","description":"A TypeScript wrapper for the National Weather Service (NWS) API.","directories":{},"_nodeVersion":"18.19.1","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.6","ts-jest":"^27.0.3","typescript":"^4.3.5","@types/jest":"^27.0.0","@types/node":"^16.0.0","axios-mock-adapter":"^1.19.0"},"_npmOperationalInternal":{"tmp":"tmp/nws-weather-wrapper_2025.731.1037_1753977684520_0.5491277696627659","host":"s3://npm-registry-packages-npm-production"}},"2025.731.1446":{"name":"@bdking71/nws-weather-wrapper","version":"2025.731.1446","keywords":["weather","nws","national weather service","typescript","api","wrapper","node"],"author":{"url":"https://bdking71.wordpress.com","name":"Bryan King"},"license":"MIT","_id":"@bdking71/nws-weather-wrapper@2025.731.1446","maintainers":[{"name":"bdking71","email":"bdking71+npm@gmail.com"}],"homepage":"https://bdking71.wordpress.com","bugs":{"url":"https://github.com/bdking71/nws-weather-wrapper/issues"},"dist":{"shasum":"8eda21970e76f7244843247621000dc0331bc2e8","tarball":"https://registry.npmjs.org/@bdking71/nws-weather-wrapper/-/nws-weather-wrapper-2025.731.1446.tgz","fileCount":4,"integrity":"sha512-SqViNXQOVLLQEBx6PrhyRJGQNtN7ubjRE5RLjj2ykqtzUNNbnhsiG9TEG1umNUoN5Bt1Bib0JCTrq3Q1xxqZ/Q==","signatures":[{"sig":"MEUCIAsVrdQhshLUKWyGRlskQb2OTh1EFpYq3P6dA3A4ncCHAiEA2RW6uikEG/PHzxwhM7S3kWHAczYhyAW7fTc2hUx0rCw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10233},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=14"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"gitHead":"d68f29f70c798be07b7ad440d048f5aa433a12fd","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"bdking71","email":"bdking71+npm@gmail.com"},"repository":{"url":"git+https://github.com/bdking71/nws-weather-wrapper.git","type":"git"},"_npmVersion":"10.8.2","description":"A TypeScript wrapper for the National Weather Service (NWS) API.","directories":{},"_nodeVersion":"18.19.1","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.6","ts-jest":"^27.0.3","typescript":"^4.3.5","@types/jest":"^27.0.0","@types/node":"^16.0.0","axios-mock-adapter":"^1.19.0"},"_npmOperationalInternal":{"tmp":"tmp/nws-weather-wrapper_2025.731.1446_1753992078831_0.25082288488014304","host":"s3://npm-registry-packages-npm-production"}},"2025.731.1539":{"name":"@bdking71/nws-weather-wrapper","version":"2025.731.1539","keywords":["weather","nws","national weather service","typescript","api","wrapper","node"],"author":{"url":"https://bdking71.wordpress.com","name":"Bryan King"},"license":"MIT","_id":"@bdking71/nws-weather-wrapper@2025.731.1539","maintainers":[{"name":"bdking71","email":"bdking71+npm@gmail.com"}],"homepage":"https://bdking71.wordpress.com","bugs":{"url":"https://github.com/bdking71/nws-weather-wrapper/issues"},"dist":{"shasum":"d5b2ee303f2a401e995d687aa8f06e608e0825b8","tarball":"https://registry.npmjs.org/@bdking71/nws-weather-wrapper/-/nws-weather-wrapper-2025.731.1539.tgz","fileCount":4,"integrity":"sha512-yh0bTCIooP461VG7j7pgoT+Mkicr9mgQKtgA3mjAwBVvLjr+p/Sz1iqem84nHIzl7X7nsQysVg0tchwZxl3LiQ==","signatures":[{"sig":"MEUCIQDLO0oUPWY4YJIbCuPMM3anTAYkgzSu2a4YJac518abkwIgPcMH1LOW+T+H1HHrRL4+IUaJmHNPjfEzPXCTCiG8660=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10289},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"46d29fdb055e54e65ffce43f396755e86c7c07f0","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"bdking71","email":"bdking71+npm@gmail.com"},"repository":{"url":"git+https://github.com/bdking71/nws-weather-wrapper.git","type":"git"},"_npmVersion":"10.8.2","description":"A TypeScript wrapper for the National Weather Service (NWS) API.","directories":{},"_nodeVersion":"18.19.1","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.6","ts-jest":"^27.0.3","typescript":"^4.3.5","@types/jest":"^27.0.0","@types/node":"^16.0.0","axios-mock-adapter":"^1.19.0"},"_npmOperationalInternal":{"tmp":"tmp/nws-weather-wrapper_2025.731.1539_1753995667096_0.22304627218832462","host":"s3://npm-registry-packages-npm-production"}},"2025.822.1328":{"name":"@bdking71/nws-weather-wrapper","version":"2025.822.1328","description":"A TypeScript wrapper for the National Weather Service (NWS) API.","type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","test":"jest"},"engines":{"node":">=14"},"author":{"name":"Bryan King","url":"https://bdking71.wordpress.com"},"homepage":"https://bdking71.wordpress.com","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bdking71/nws-weather-wrapper.git"},"bugs":{"url":"https://github.com/bdking71/nws-weather-wrapper/issues"},"keywords":["weather","nws","national weather service","typescript","api","wrapper","node"],"dependencies":{"axios":"^1.6.0"},"devDependencies":{"@types/jest":"^27.0.0","@types/node":"^16.0.0","axios-mock-adapter":"^1.19.0","jest":"^27.0.6","ts-jest":"^27.0.3","typescript":"^4.3.5"},"_id":"@bdking71/nws-weather-wrapper@2025.822.1328","gitHead":"2208faa282776c290abd61c3ccf1769e66dc1984","_nodeVersion":"18.19.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-V8+64+a+DeKUfnNPG3kcaB1cl+E0Nudo9o9ucPqcK+trpf8T99Gznp5FJTHPMqT027oPs6V/Hz+xldYkEcApaA==","shasum":"eb6f9cdd4d09fb91da387613c79543c6785a03aa","tarball":"https://registry.npmjs.org/@bdking71/nws-weather-wrapper/-/nws-weather-wrapper-2025.822.1328.tgz","fileCount":4,"unpackedSize":10302,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBwJEssCUmgc4BvuBpmUOLkaFsc6hFMoU1VYBtni4eqLAiEA7DCYARW8o8i/v14C/ZyNYYkiEwatc7X98blnyrY7br4="}]},"_npmUser":{"name":"bdking71","email":"bdking71+npm@gmail.com"},"directories":{},"maintainers":[{"name":"bdking71","email":"bdking71+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nws-weather-wrapper_2025.822.1328_1755887405827_0.7029462849563222"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-31T16:01:24.387Z","modified":"2025-08-22T18:30:06.550Z","2025.731.1037":"2025-07-31T16:01:24.702Z","2025.731.1446":"2025-07-31T20:01:19.077Z","2025.731.1539":"2025-07-31T21:01:07.281Z","2025.822.1328":"2025-08-22T18:30:06.028Z"},"bugs":{"url":"https://github.com/bdking71/nws-weather-wrapper/issues"},"author":{"name":"Bryan King","url":"https://bdking71.wordpress.com"},"license":"MIT","homepage":"https://bdking71.wordpress.com","keywords":["weather","nws","national weather service","typescript","api","wrapper","node"],"repository":{"type":"git","url":"git+https://github.com/bdking71/nws-weather-wrapper.git"},"description":"A TypeScript wrapper for the National Weather Service (NWS) API.","maintainers":[{"name":"bdking71","email":"bdking71+npm@gmail.com"}],"readme":"# NWS Weather Wrapper\r\n\r\nA simple TypeScript wrapper for the National Weather Service (NWS) API.\r\n\r\n## Description\r\n\r\nThis library provides a convenient way to interact with the NWS API to retrieve weather forecasts. It handles the API endpoints for getting grid data from latitude and longitude, and then fetching the forecast for that grid.\r\n\r\n## Version\r\n\r\n  2025.0822.1630 Beta\r\n\r\n## Features\r\n\r\n-   Simple, promise-based API.\r\n-   Typed interfaces for API responses.\r\n-   Lightweight, with `axios` as the only dependency.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @bdking71/nws-weather-wrapper\r\n```\r\n\r\n## Quick Start\r\n\r\nHere's a basic example of how to use the library:\r\n\r\n```typescript\r\n// Import necessary types and the NWS API wrapper class from the 'nws-api-wrapper' package\r\n  import { NwsWeatherWrapper } from '@bdking71/nws-weather-wrapper';\r\n  import type { ForecastResponse, PointsResponse } from '@bdking71/nws-weather-wrapper';\r\n\r\n// Define a user agent string, which is **required by NWS API** per their usage policy\r\n// Replace 'my-contact-email@example.com' with your actual email or website\r\nconst userAgent = 'My Weather App, my-contact-email@example.com';\r\n\r\n// Create an instance of the NWS API wrapper using your user agent\r\nconst nwsAPI = new NwsWeatherWrapper(userAgent);\r\n\r\n// Define the coordinates for which you want to retrieve the forecast\r\nconst latitude: string | undefined = '39.7456';\r\nconst longitude: string | undefined = '-97.0892';\r\n\r\n// Define an asynchronous function that fetches the forecast for a single location\r\nconst fetchSingleForecastFromNWS = async (): Promise<ForecastResponse> => {\r\n  // Ensure both latitude and longitude are defined before continuing\r\n  if (!latitude || !longitude) {\r\n    throw new Error('Latitude and longitude are required.');\r\n  }\r\n\r\n  // Step 1: Use the NWS API to get the \"gridpoint\" information for this location\r\n  // This provides the grid ID and coordinates (gridX, gridY) for the forecast query\r\n  const points: PointsResponse = await nwsAPI.getPoints(latitude, longitude);\r\n\r\n  // Step 2: Use the gridpoint data to get the full forecast from the NWS API\r\n  const forecast: ForecastResponse = await nwsAPI.getForecast(\r\n    points.properties.gridId,\r\n    points.properties.gridX,\r\n    points.properties.gridY\r\n  );\r\n\r\n  // Step 3: Return the full forecast object to the caller\r\n  return forecast;\r\n};\r\n\r\n// Call the function and handle the result using .then()/.catch()\r\n// This is your app's entry point for outputting the forecast\r\nfetchSingleForecastFromNWS()\r\n  .then((forecast) => {\r\n    // Log the timestamp of the forecast update\r\n    console.log(`Forecast for ${forecast.properties.updated}:`);\r\n\r\n    // Loop through each forecast period (e.g., Today, Tonight, Tomorrow) and log its details\r\n    forecast.properties.periods.forEach((period) => {\r\n      console.log(`${period.name}: ${period.detailedForecast}`);\r\n    });\r\n  })\r\n  .catch((error) => {\r\n    // If anything goes wrong (bad coordinates, network issue, API error), log it here\r\n    console.error('Failed to fetch forecast:', error);\r\n  });\r\n```\r\n\r\n\r\n## Documentation\r\n\r\nFor more detailed documentation, please see the following files:\r\n\r\n-   **[Usage in SPFx](./docs/usage-in-spfx.md):** A guide for using this library in SharePoint Framework (SPFx) projects.\r\n-   **[Testing](./docs/testing.md):** Instructions on how to run the tests for this project.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n","readmeFilename":"README.md"}