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

@stormgeo/advisor-core

v1.3.0

Published

SDK to access the advisor core API.

Readme

Node SDK

Advisor Software Development Kit for nodeJS.

Contents


Installation

To install this package, use the following command:

npm i @stormgeo/advisor-core

Make sure you're using node v18.17 or higher.

Routes

First you need to import the SDK on your application and instancy the AdvisorCore class setting up your access token and needed configurations:

import { AdvisorCore } from '@stormgeo/advisor-core'

const advisor = new AdvisorCore({
  token: '<your-token>',
  retries: 2,
  delay: 500,
})

Examples

Chart:

const payload = {
  variables: ['temperature', 'precipitation'],
  localeId: 1234,
}

// requesting daily forecast chart image
let response = await advisor.chart.getForecastDaily(payload)

// requesting hourly forecast chart image
let response = await advisor.chart.getForecastHourly(payload)

// requesting daily observed chart image
let response = await advisor.chart.getObservedDaily(payload)

// requesting hourly observed chart image
let response = await advisor.chart.getObservedHourly(payload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  writeFileSync('test.png', response.data)
}

Climatology:

const payload = {
  variables: ['temperature', 'precipitation'],
  localeId: 1234,
}

// requesting daily climatology data
let response = await advisor.climatology.getDaily(payload)

// requesting monthly climatology data
let response = await advisor.climatology.getMonthly(payload)


if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Current Weather:

const payload = {
  localeId: 1234,
}

let response = await advisor.currentWeather.get(payload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Forecast:

const payload = {
  variables: ['temperature', 'precipitation'],
  localeId: 1234,
}

// requesting daily forecast data
let response = await advisor.forecast.getDaily(payload)

// requesting hourly forecast data
let response = await advisor.forecast.getHourly(payload)

// requesting period forecast data
let response = await advisor.forecast.getPeriod(payload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Monitoring:

let response = await advisor.monitoring.getAlerts()

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Observed:

const payload = {
  localeId: 1234,
}

// requesting daily observed data
let response = await advisor.observed.getDaily(payload)

// requesting hourly observed data
let response = await advisor.observed.getHourly(payload)

// requesting period observed data
let response = await advisor.observed.getPeriod(payload)

const stationPayload = {
  stationId: "ABC123abc321CBA",
}

// requesting station observed data
let response = await advisor.observed.getStationData(stationPayload)

const radiusPayload = {
  localeId: 1234,
  radius: 100,
}

// requesting fire-focus observed data
let response = await advisor.observed.getFireFocus(radiusPayload)

// requesting lightning observed data
let response = await advisor.observed.getLightning(radiusPayload)

const geometryPayload = {
  geometry: "{\"type\": \"MultiPoint\", \"coordinates\": [[-41.88, -22.74]]}",
  radius: 10000
}

// requesting fire-focus observed data by geometry
let response = await advisor.observed.getFireFocusByGeometry(geometryPayload)

// requesting lightning observed data by geometry
let response = await advisor.observed.getLightningByGeometry(geometryPayload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Storage:

  const payload = {
    page: 1,
    pageSize: 2,
    fileTypes: ['pdf', 'csv'],
  }

  // Requesting the files list
  let response = await advisor.storage.listFiles(payload)

  if (response.error) {
    console.log(response.error)
    console.log('Error trying to list files!')
  } else {
    console.log(response.data)
  }
  const fileName = 'Example.pdf'
  const payload = {
    fileName,
    accessKey: 'a1b2c3d4-0010',
  }

  // Download de file as a Buffer
  let response = await advisor.storage.downloadFile(payload)

  if (response.data) {
    writeFileSync(fileName, response.data)
  } else {
    console.log(response.error)
    console.log('Error trying to get data!')
  }
  
  // Downloading the file by stream
  let response = await advisor.storage.downloadFileByStream(payload)
  
  if (!response.error && response.data) {
    response.data.pipe(createWriteStream(fileName))
  } else {
    console.log(response.error)
    console.log('Error trying to get data!')
  }

Plan Information:

  // Requesting plan information
  const planInfoResponse = await advisor.plan.getInfo({ timezone: -3 })

  if (planInfoResponse.error) {
    console.log(planInfoResponse.error)
    console.log('Error trying to get plan information!')
  } else {
    console.log(planInfoResponse.data)
  }

  // Requesting locale details from plan
  const localePayload = {
    localeId: 1234,
    // You can also set Latitude/Longitude or StationId instead of LocaleId
  }
  const localeResponse = await advisor.plan.getLocale(localePayload)

  if (localeResponse.error) {
    console.log(localeResponse.error)
    console.log('Error trying to get locale data!')
  } else {
    console.log(localeResponse.data)
  }

  const requestDetailsPayload = {
    page: 1,
    pageSize: 10,
  }
  // Requesting access history
  const requestDetailsResponse = await advisor.plan.getRequestDetails(requestDetailsPayload)

  if (requestDetailsResponse.error) {
    console.log(requestDetailsResponse.error)
    console.log('Error trying to get data!')
  } else {
    console.log(requestDetailsResponse.data)
  }

Schema/Parameter:

// Arbitrary example on how to define a schema
const schemaPayload = {
  "identifier": "arbitraryIdentifier",
  "arbitraryField1": {
      "type": "boolean",
      "required": true,
      "length": 125,
  },
}

// Arbitrary example on how to upload data to parameters from schema 
parametersPayload = {
  "identifier": "arbitraryIdentifier",
  "arbitraryField1": true,
}

// requesting all schemas from token
let response = await advisor.schema.getDefinition()

// requesting to upload a new schema
let response = await advisor.schema.postDefinition(schemaPayload)

// requesting to upload data to parameters from schema
let response = await advisor.schema.postParameters(parametersPayload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  console.log(response.data)
}

Static Map:

const payload = {
    type: 'periods',
    category: 'observed',
    variable: 'temperature',
    aggregation: 'max',
    startDate: '2025-07-01 00:00:00',
    endDate: '2025-07-05 23:59:59',
    dpi: 50,
    title: true,
    titlevariable: 'temperature',
  }

let response = await advisor.staticMap.get(payload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  writeFileSync('test.png', response.data)
}

Tms (Tiles Map Server):

const payload = {
  istep: "2024-12-25 10:00:00",
  fstep: "2024-12-25 12:00:00",
  server: "a",
  mode: "forecast",
  variable: "precipitation",
  aggregation: "sum",
  x: 2,
  y: 3,
  z: 4
}

let response = await advisor.tms.get(payload)

if (response.error) {
  console.log(response.error)
  console.log('Error trying to get data!')
} else {
  writeFileSync('test.png', response.data)
}

Headers Configuration

You can also set headers to translate the error descriptions or to receive the response in a different format type. This functionality is only available for some routes, consult the API documentation to find out which routes have this functionality.

Available languages:

  • en-US (default)
  • pt-BR
  • es-ES

Available response types:

  • application/json (default)
  • application/xml
  • text/csv

Example:

const advisor = new AdvisorCore({
  token: 'invalid-token',
})

advisor.setHeaderAccept('application/xml')
advisor.setHeaderAcceptLanguage('es-ES')

let response = await advisor.plan.getInfo()

console.log(response.error)

// <response>
//   <error>
//     <type>UNAUTHORIZED_ACCESS</type>
//     <message>UNAUTHORIZED_REQUEST</message>
//     <description>La solicitud no está autorizada.</description>
//   </error>
// </response>

Response Format

All the methods returns the same pattern:

{
  "data": Any | null,
  "error": Any | null,
}

Payload Types

WeatherPayload

  • localeId: string
  • stationId: string
  • latitude: number
  • longitude: number
  • timezone: number
  • variables: string[]
  • startDate: string
  • endDate: string

StationPayload

  • stationId: string
  • layer: string
  • variables: string[]
  • startDate: string
  • endDate: string

ClimatologyPayload

  • localeId: string
  • stationId: string
  • latitude: number
  • longitude: number
  • variables: string[]

RequestDetailsPayload

  • page: number
  • pageSize: number
  • path: string
  • status: string
  • startDate: string
  • endDate: string

PlanInfoPayload

  • timezone: number

PlanLocalePayload

  • localeId: string
  • stationId: string
  • latitude: string
  • longitude: string

CurrentWeatherPayload

  • localeId: string
  • stationId: string
  • latitude: number
  • longitude: number
  • timezone: number
  • variables: string[]

RadiusPayload

  • localeId: string
  • stationId: string
  • latitude: number
  • longitude: number
  • startDate: string
  • endDate: string
  • radius: number

GeometryPayload

  • startDate: string
  • endDate: string
  • radius: number
  • geometry: string

StaticMapPayload

  • startDate: string
  • endDate: string
  • aggregation: string
  • model: string
  • lonmin: number
  • lonmax: number
  • latmin: number
  • latmax: number
  • dpi: number
  • title: boolean
  • titlevariable: string
  • hours: number
  • type: string
  • category: string
  • variable: string

TmsPayload

  • server: string
  • mode: string
  • variable: string
  • aggregation: string
  • x: number
  • y: number
  • z: number
  • istep: string
  • fstep: string
  • timezone: number

StorageListPayload

  • page: number
  • pageSize: number
  • startDate: string
  • endDate: string
  • fileName: string
  • fileExtension: string
  • fileTypes: string[]

StorageDownloadPayload

  • fileName: string
  • accessKey: string