npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@identafly/hatch-forecast-client

v1.1.1

Published

HTTP client for the IdentaFly hatch forecast public API

Readme

@identafly/hatch-forecast-client

TypeScript/JavaScript client for IdentaFly’s Hatch Forecast HTTP API (createClient, exported types).

Requirements

  • Node.js 18+ (global fetch) or modern browsers.
  • ESM only ("type": "module"): use import / import(), not require.

Authentication: Authorization: Bearer <uuid> with your Widget API Key id on every method except getUsgsStation, which does not send a key. Obtain a key from the IdentaFly portal.

Locations: Pass externalId — your property id (widget_locations.external_id), not our internal UUID.

Thumbnails in responses may be data:image/…;base64,… or https:// URLs (safe to use as img src).

Errors: Failed requests throw Error; where the API returns JSON, err.status and err.body may be set. Shapes mirror ApiErrorBody exported from this package (error.code, error.message, requestId).

Install

yarn add @identafly/hatch-forecast-client

Methods (return value of createClient)

| Kind | Method | Purpose | | ---------- | -------------------------- | ----------------------------------------------------------------------------- | | Read | getHatchForecast | Hatch forecast for externalId. | | Read | getUsgsForWidgetLocation | USGS gage for that location (authenticated). | | Read | getUsgsStation | USGS by NWIS site id (no API key — server proxies NWIS). | | Create | registerLocations | Batch-register locations (property_id, coords, optional usgs_station_id). | | Update | updateLocation | PATCH name / usgs_station_id for a propertyId. | | Delete | deleteLocation | Delete by propertyId. |

Exported types include LocationRegistrationInput, LocationRegistrationResult, RegisterLocationsResponse, UpdateLocationInput, HatchForecastResponse, ForecastGroup, UsgsStationResponse, and parseUsgsSiteIdFromLocationColumn for parsing stored usgs_station_id values.

Usage

Reads

import {
  createClient,
  parseUsgsSiteIdFromLocationColumn
} from '@identafly/hatch-forecast-client';

const client = createClient({
  apiKey: '<your-widget-api-key-uuid>'
});

const hatch = await client.getHatchForecast({ externalId: 'my-property-123' });
const gage = await client.getUsgsForWidgetLocation({
  externalId: 'my-property-123'
});

await client.getUsgsStation({ stationId: '09085000' });

const siteId = parseUsgsSiteIdFromLocationColumn(row.usgs_station_id);
if (siteId) await client.getUsgsStation({ stationId: siteId });

In browsers, call USGS only through getUsgsStation / getUsgsForWidgetLocation on your configured baseUrl — direct requests to NWIS commonly fail (CORS).

Locations

await client.registerLocations({
  locations: [
    {
      property_id: 'site-a',
      name: 'Upper River',
      latitude: 39.81,
      longitude: -79.36,
      usgs_station_id: '03081000'
    }
  ]
});

await client.updateLocation({
  propertyId: 'site-a',
  updates: { name: 'Upper River (updated)' }
});

await client.deleteLocation({ propertyId: 'site-a' });

registerLocations: on success (200) check results, successCount, failureCount; some rows can fail while others succeed. On total batch failure you may get 400 with the same results shape instead of thrown errors—see runtime behavior on your baseUrl.

Other methods throw Error on non-OK responses when no batch body applies.

Reuse

Create one createClient({ apiKey, baseUrl? }) per key/environment and reuse it (thin wrapper around fetch).

export const client = createClient({
  apiKey: process.env.MY_WIDGET_API_KEY_ID!
});