Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@paxperscientiam/national-weather-service-api.ts

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paxperscientiam/national-weather-service-api.ts - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0-beta.0

9

bin/generate-services.ts

@@ -93,6 +93,3 @@ // tslint:disable:no-console

// file.write(`import {NationalWeatherServicePublicDataAPI} from "../types/nwsapi/index"
// `)
file.write(`export class NationalWeatherServicePublicDataAPIServices {
file.write(`export class NWS {
private domain: string = "https://api.weather.gov"

@@ -107,3 +104,3 @@ private query: any

const typePrefix = "NationalWeatherServicePublicDataAPI"
const typePrefix = "NWSDataAPI"

@@ -140,3 +137,3 @@ // const arrayOfTypes: string[] = []

chunk.funcName.replace("Service", "") +
".IQueryParameters"
".IQuery"

@@ -143,0 +140,0 @@ queryPair.push(queryInterface)

@@ -25,8 +25,9 @@ // tslint:disable:no-console

const lastIndex = names.length - 1
names[lastIndex] = "I" + names[lastIndex]
names[lastIndex] = `I${names[lastIndex]}`.replace("Parameters", "")
// get rid of '$'
names.forEach((element, index, arr) => arr[index] = element.replace(/\$/g, ""))
names.forEach((element, index, arr) => element === "Paths"
? arr[index] = "NationalWeatherServicePublicDataAPI" : false)
? arr[index] = "NWSDataAPI" : false)
names.forEach((element, index, arr) => element === "Get" ? arr.splice(index, 1) : true)

@@ -33,0 +34,0 @@ }

/// <reference path="../src/@types/nwsapi/index.d.ts" />
export declare class NationalWeatherServicePublicDataAPIServices {
export declare class NWS {
private domain;

@@ -7,4 +7,4 @@ private query;

constructor();
AlertsService(query?: NationalWeatherServicePublicDataAPI.Alerts.IQueryParameters): this;
AlertsActiveService(query?: NationalWeatherServicePublicDataAPI.AlertsActive.IQueryParameters): this;
AlertsService(query?: NWSDataAPI.Alerts.IQuery): this;
AlertsActiveService(query?: NWSDataAPI.AlertsActive.IQuery): this;
AlertsIdService(id: string): this;

@@ -18,13 +18,13 @@ AlertsTypesService(): this;

GridpointsWfoXYService(wfo: string, x: number, y: number): this;
GridpointsWfoXYForecastService(wfo: string, x: number, y: number, query?: NationalWeatherServicePublicDataAPI.GridpointsWfoXYForecast.IQueryParameters): this;
GridpointsWfoXYForecastHourlyService(wfo: string, x: number, y: number, query?: NationalWeatherServicePublicDataAPI.GridpointsWfoXYForecastHourly.IQueryParameters): this;
GridpointsWfoXYForecastService(wfo: string, x: number, y: number, query?: NWSDataAPI.GridpointsWfoXYForecast.IQuery): this;
GridpointsWfoXYForecastHourlyService(wfo: string, x: number, y: number, query?: NWSDataAPI.GridpointsWfoXYForecastHourly.IQuery): this;
GridpointsWfoXYStationsService(wfo: string, x: number, y: number): this;
IconsSetTimeOfDayFirstSecondService(set: string, timeOfDay: string, first: string, second: string, query?: NationalWeatherServicePublicDataAPI.IconsSetTimeOfDayFirstSecond.IQueryParameters): this;
IconsSetTimeOfDayFirstSecondService(set: string, timeOfDay: string, first: string, second: string, query?: NWSDataAPI.IconsSetTimeOfDayFirstSecond.IQuery): this;
IconsService(): this;
ThumbnailsSatelliteAreaService(area: string): this;
StationsStationIdObservationsService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservations.IQueryParameters): this;
StationsStationIdObservationsLatestService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservationsLatest.IQueryParameters): this;
StationsStationIdObservationsCurrentService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservationsCurrent.IQueryParameters): this;
StationsStationIdObservationsService(stationId: string, query?: NWSDataAPI.StationsStationIdObservations.IQuery): this;
StationsStationIdObservationsLatestService(stationId: string, query?: NWSDataAPI.StationsStationIdObservationsLatest.IQuery): this;
StationsStationIdObservationsCurrentService(stationId: string, query?: NWSDataAPI.StationsStationIdObservationsCurrent.IQuery): this;
StationsStationIdObservationsTimeService(stationId: string, time: string): this;
StationsService(query?: NationalWeatherServicePublicDataAPI.Stations.IQueryParameters): this;
StationsService(query?: NWSDataAPI.Stations.IQuery): this;
StationsRadarService(): this;

@@ -40,3 +40,3 @@ StationsRadarStationIdService(stationId: string): this;

PointsPointForecastHourlyService(point: string): this;
ProductsService(query?: NationalWeatherServicePublicDataAPI.Products.IQueryParameters): this;
ProductsService(query?: NWSDataAPI.Products.IQuery): this;
ProductsLocationsService(): this;

@@ -49,9 +49,9 @@ ProductsTypesService(): this;

ProductsTypesTypeIdLocationsLocationIdService(typeId: string, locationId: string): this;
ZonesService(query?: NationalWeatherServicePublicDataAPI.Zones.IQueryParameters): this;
ZonesTypeService(type: "land" | "marine" | "forecast" | "public" | "coastal" | "offshore" | "fire" | "county", query?: NationalWeatherServicePublicDataAPI.ZonesType.IQueryParameters): this;
ZonesTypeZoneIdService(type: "forecast" | "county" | "fire" | "cg", zoneId: string, query?: NationalWeatherServicePublicDataAPI.ZonesTypeZoneId.IQueryParameters): this;
ZonesService(query?: NWSDataAPI.Zones.IQuery): this;
ZonesTypeService(type: "land" | "marine" | "forecast" | "public" | "coastal" | "offshore" | "fire" | "county", query?: NWSDataAPI.ZonesType.IQuery): this;
ZonesTypeZoneIdService(type: "forecast" | "county" | "fire" | "cg", zoneId: string, query?: NWSDataAPI.ZonesTypeZoneId.IQuery): this;
ZonesTypeZoneIdForecastService(type: string, zoneId: string): this;
ZonesForecastZoneIdObservationsService(zoneId: string, query?: NationalWeatherServicePublicDataAPI.ZonesForecastZoneIdObservations.IQueryParameters): this;
ZonesForecastZoneIdObservationsService(zoneId: string, query?: NWSDataAPI.ZonesForecastZoneIdObservations.IQuery): this;
ZonesForecastZoneIdStationsService(zoneId: string): this;
buildURI(): string;
}

@@ -5,3 +5,3 @@ "use strict";

const URL = require("url");
class NationalWeatherServicePublicDataAPIServices {
class NWS {
constructor() {

@@ -241,2 +241,2 @@ this.domain = "https://api.weather.gov";

}
exports.NationalWeatherServicePublicDataAPIServices = NationalWeatherServicePublicDataAPIServices;
exports.NWS = NWS;
{
"name": "@paxperscientiam/national-weather-service-api.ts",
"version": "0.2.1",
"version": "0.3.0-beta.0",
"description": "Provides types for the US National Weather Service's forecast API and a helpful URI builder.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/paxperscientiam/national-weather-service-types",

Provides types for the [US National Weather Service](https://www.weather.gov/ "homepage")'s forecast API and a helpful URI builder.
![](demo.gif)
Relevant websites:

@@ -33,7 +36,7 @@ * https://www.weather.gov/documentation/services-web-api

import {
NationalWeatherServicePublicDataAPIServices as NWS
NWS
} from "@paxperscientiam/national-weather-service-api.ts"
const {
NationalWeatherServicePublicDataAPIServices
NWS
} = require("@paxperscientiam/national-weather-service-api.ts")

@@ -50,5 +53,5 @@

```ts
declare namespace NationalWeatherServicePublicDataAPI {
declare namespace NWSDataAPI {
namespace Alerts {
export interface IQueryParameters {
export interface IQuery {
active?: Parameters.IActive;

@@ -97,7 +100,7 @@ start?: Parameters.IStart; // date-time

The exposed class is `NationalWeatherServicePublicDataAPIServices`. The method corresponding to the https://api.weather.gov/alerts endpoint looks like this:
The exposed class is `NWS`. The method corresponding to the https://api.weather.gov/alerts endpoint looks like this:
``` ts
export class NationalWeatherServicePublicDataAPIServices {
export class NWS {
private domain: string = "https://api.weather.gov"

@@ -111,3 +114,3 @@ private query: any

// Returns all alerts
AlertsService(query?: NationalWeatherServicePublicDataAPI.Alerts.IQueryParameters) {
AlertsService(query?: NWSDataAPI.Alerts.IQuery) {
if (query) {

@@ -127,7 +130,7 @@ this.query = query

``` ts
import { NationalWeatherServicePublicDataAPIServices } from "@paxperscientiam/national-weather-service-api.ts"
import { NWS } from "@paxperscientiam/national-weather-service-api.ts"
const NWS = new NationalWeatherServicePublicDataAPIServices()
const nws = new NWS()
const alerts = NWS.AlertsService({
const alerts = nws.AlertsService({
active: true,

@@ -144,1 +147,2 @@ })

* US National Weather Service
* Folks at freenode/##javascript

@@ -47,5 +47,5 @@ declare namespace Components {

}
declare namespace NationalWeatherServicePublicDataAPI {
declare namespace NWSDataAPI {
namespace Alerts {
export interface IQueryParameters {
export interface IQuery {
active?: Parameters.IActive;

@@ -93,3 +93,3 @@ start?: Parameters.IStart; // date-time

namespace AlertsActive {
export interface IQueryParameters {
export interface IQuery {
status?: Parameters.IStatus;

@@ -129,3 +129,3 @@ message_type?: Parameters.IMessageType;

namespace AlertsActiveAreaArea {
export interface IPathParameters {
export interface IPath {
area: Parameters.IArea;

@@ -146,3 +146,3 @@ }

namespace AlertsActiveRegionRegion {
export interface IPathParameters {
export interface IPath {
region: Parameters.IRegion;

@@ -158,3 +158,3 @@ }

namespace AlertsActiveZoneZoneId {
export interface IPathParameters {
export interface IPath {
zoneId: Parameters.IZoneId; // ^\w{2}[CZ]\d{3}$

@@ -170,3 +170,3 @@ }

namespace AlertsId {
export interface IPathParameters {
export interface IPath {
id: Parameters.IId; // ^(?:\w+-)+(?:\d+-?)+$

@@ -192,3 +192,3 @@ }

namespace GridpointsWfoXY {
export interface IPathParameters {
export interface IPath {
wfo: Parameters.IWfo; // ^\w{3}$

@@ -208,3 +208,3 @@ x: Parameters.IX;

namespace GridpointsWfoXYForecast {
export interface IPathParameters {
export interface IPath {
wfo: Parameters.IWfo; // ^\w{3}$

@@ -214,3 +214,3 @@ x: Parameters.IX;

}
export interface IQueryParameters {
export interface IQuery {
units?: Parameters.IUnits;

@@ -229,3 +229,3 @@ }

namespace GridpointsWfoXYForecastHourly {
export interface IPathParameters {
export interface IPath {
wfo: Parameters.IWfo; // ^\w{3}$

@@ -235,3 +235,3 @@ x: Parameters.IX;

}
export interface IQueryParameters {
export interface IQuery {
units?: Parameters.IUnits;

@@ -250,3 +250,3 @@ }

namespace GridpointsWfoXYStations {
export interface IPathParameters {
export interface IPath {
wfo: Parameters.IWfo; // ^\w{3}$

@@ -271,3 +271,3 @@ x: Parameters.IX;

namespace IconsSetTimeOfDayFirstSecond {
export interface IPathParameters {
export interface IPath {
set: Parameters.ISet;

@@ -278,3 +278,3 @@ timeOfDay: Parameters.ITimeOfDay;

}
export interface IQueryParameters {
export interface IQuery {
size?: Parameters.ISize;

@@ -296,3 +296,3 @@ fontsize?: Parameters.IFontsize;

namespace OfficesOfficeId {
export interface IPathParameters {
export interface IPath {
officeId: Parameters.IOfficeId;

@@ -308,3 +308,3 @@ }

namespace OfficesOfficeIdHeadlines {
export interface IPathParameters {
export interface IPath {
officeId: Parameters.IOfficeId;

@@ -320,3 +320,3 @@ }

namespace OfficesOfficeIdHeadlinesHeadlineId {
export interface IPathParameters {
export interface IPath {
officeId: Parameters.IOfficeId;

@@ -334,3 +334,3 @@ headlineId: Parameters.IHeadlineId;

namespace PointsPoint {
export interface IPathParameters {
export interface IPath {
point: Parameters.IPoint; // ^(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$

@@ -346,3 +346,3 @@ }

namespace PointsPointForecast {
export interface IPathParameters {
export interface IPath {
point: Parameters.IPoint; // ^(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$

@@ -358,3 +358,3 @@ }

namespace PointsPointForecastHourly {
export interface IPathParameters {
export interface IPath {
point: Parameters.IPoint; // ^(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$

@@ -370,3 +370,3 @@ }

namespace PointsPointStations {
export interface IPathParameters {
export interface IPath {
point: Parameters.IPoint; // ^(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$

@@ -382,3 +382,3 @@ }

namespace Products {
export interface IQueryParameters {
export interface IQuery {
location?: Parameters.ILocation;

@@ -411,3 +411,3 @@ start?: Parameters.IStart; // date-time

namespace ProductsLocationsLocationIdTypes {
export interface IPathParameters {
export interface IPath {
locationId: Parameters.ILocationId;

@@ -423,3 +423,3 @@ }

namespace ProductsProductId {
export interface IPathParameters {
export interface IPath {
productId: Parameters.IProductId;

@@ -440,3 +440,3 @@ }

namespace ProductsTypesTypeId {
export interface IPathParameters {
export interface IPath {
typeId: Parameters.ITypeId;

@@ -452,3 +452,3 @@ }

namespace ProductsTypesTypeIdLocations {
export interface IPathParameters {
export interface IPath {
typeId: Parameters.ITypeId;

@@ -464,3 +464,3 @@ }

namespace ProductsTypesTypeIdLocationsLocationId {
export interface IPathParameters {
export interface IPath {
typeId: Parameters.ITypeId;

@@ -478,3 +478,3 @@ locationId: Parameters.ILocationId;

namespace Stations {
export interface IQueryParameters {
export interface IQuery {
id?: Parameters.IId;

@@ -499,3 +499,3 @@ state?: Parameters.IState;

namespace StationsRadarStationId {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;

@@ -511,3 +511,3 @@ }

namespace StationsStationId {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;

@@ -523,6 +523,6 @@ }

namespace StationsStationIdObservations {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;
}
export interface IQueryParameters {
export interface IQuery {
station?: Parameters.IStation;

@@ -545,6 +545,6 @@ start?: Parameters.IStart; // date-time

namespace StationsStationIdObservationsCurrent {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;
}
export interface IQueryParameters {
export interface IQuery {
require_qc?: Parameters.IRequireQc;

@@ -561,6 +561,6 @@ }

namespace StationsStationIdObservationsLatest {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;
}
export interface IQueryParameters {
export interface IQuery {
require_qc?: Parameters.IRequireQc;

@@ -577,3 +577,3 @@ }

namespace StationsStationIdObservationsTime {
export interface IPathParameters {
export interface IPath {
stationId: Parameters.IStationId;

@@ -591,3 +591,3 @@ time: Parameters.ITime; // date-time

namespace ThumbnailsSatelliteArea {
export interface IPathParameters {
export interface IPath {
area: Parameters.IArea;

@@ -603,3 +603,3 @@ }

namespace Zones {
export interface IQueryParameters {
export interface IQuery {
id?: Parameters.IId;

@@ -627,6 +627,6 @@ area?: Parameters.IArea;

namespace ZonesForecastZoneIdObservations {
export interface IPathParameters {
export interface IPath {
zoneId: Parameters.IZoneId;
}
export interface IQueryParameters {
export interface IQuery {
start?: Parameters.IStart; // date-time

@@ -647,3 +647,3 @@ end?: Parameters.IEnd; // date-time

namespace ZonesForecastZoneIdStations {
export interface IPathParameters {
export interface IPath {
zoneId: Parameters.IZoneId;

@@ -659,6 +659,6 @@ }

namespace ZonesType {
export interface IPathParameters {
export interface IPath {
type: Parameters.IType;
}
export interface IQueryParameters {
export interface IQuery {
id?: Parameters.IId;

@@ -686,7 +686,7 @@ area?: Parameters.IArea;

namespace ZonesTypeZoneId {
export interface IPathParameters {
export interface IPath {
type: Parameters.IType;
zoneId: Parameters.IZoneId;
}
export interface IQueryParameters {
export interface IQuery {
effective?: Parameters.IEffective; // date-time

@@ -704,3 +704,3 @@ }

namespace ZonesTypeZoneIdForecast {
export interface IPathParameters {
export interface IPath {
type: Parameters.IType;

@@ -707,0 +707,0 @@ zoneId: Parameters.IZoneId;

@@ -5,3 +5,3 @@ /// <reference path="./@types/nwsapi/index.d.ts" />

import * as URL from "url"
export class NationalWeatherServicePublicDataAPIServices {
export class NWS {
private domain: string = "https://api.weather.gov"

@@ -15,3 +15,3 @@ private query: any

// Returns all alerts
AlertsService(query?: NationalWeatherServicePublicDataAPI.Alerts.IQueryParameters) {
AlertsService(query?: NWSDataAPI.Alerts.IQuery) {
if (query) {

@@ -24,3 +24,3 @@ this.query = query

// Returns all currently active alerts
AlertsActiveService(query?: NationalWeatherServicePublicDataAPI.AlertsActive.IQueryParameters) {
AlertsActiveService(query?: NWSDataAPI.AlertsActive.IQuery) {
if (query) {

@@ -81,3 +81,3 @@ this.query = query

// Returns a textual forecast for a 2.5km grid area
GridpointsWfoXYForecastService(wfo: string, x: number,y: number,query?: NationalWeatherServicePublicDataAPI.GridpointsWfoXYForecast.IQueryParameters) {
GridpointsWfoXYForecastService(wfo: string, x: number,y: number,query?: NWSDataAPI.GridpointsWfoXYForecast.IQuery) {
if (query) {

@@ -90,3 +90,3 @@ this.query = query

// Returns a textual hourly forecast for a 2.5km grid area
GridpointsWfoXYForecastHourlyService(wfo: string, x: number,y: number,query?: NationalWeatherServicePublicDataAPI.GridpointsWfoXYForecastHourly.IQueryParameters) {
GridpointsWfoXYForecastHourlyService(wfo: string, x: number,y: number,query?: NWSDataAPI.GridpointsWfoXYForecastHourly.IQuery) {
if (query) {

@@ -105,3 +105,3 @@ this.query = query

// Returns a forecast icon
IconsSetTimeOfDayFirstSecondService(set: string, timeOfDay: string,first: string,second: string,query?: NationalWeatherServicePublicDataAPI.IconsSetTimeOfDayFirstSecond.IQueryParameters) {
IconsSetTimeOfDayFirstSecondService(set: string, timeOfDay: string,first: string,second: string,query?: NWSDataAPI.IconsSetTimeOfDayFirstSecond.IQuery) {
if (query) {

@@ -126,3 +126,3 @@ this.query = query

// Returns a list of observations for a given station
StationsStationIdObservationsService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservations.IQueryParameters) {
StationsStationIdObservationsService(stationId: string, query?: NWSDataAPI.StationsStationIdObservations.IQuery) {
if (query) {

@@ -135,3 +135,3 @@ this.query = query

// Returns the latest observation for a station
StationsStationIdObservationsLatestService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservationsLatest.IQueryParameters) {
StationsStationIdObservationsLatestService(stationId: string, query?: NWSDataAPI.StationsStationIdObservationsLatest.IQuery) {
if (query) {

@@ -144,3 +144,3 @@ this.query = query

// Returns the latest observation for a station (use '/latest' instead)
StationsStationIdObservationsCurrentService(stationId: string, query?: NationalWeatherServicePublicDataAPI.StationsStationIdObservationsCurrent.IQueryParameters) {
StationsStationIdObservationsCurrentService(stationId: string, query?: NWSDataAPI.StationsStationIdObservationsCurrent.IQuery) {
if (query) {

@@ -159,3 +159,3 @@ this.query = query

// Returns a list of observation stations
StationsService(query?: NationalWeatherServicePublicDataAPI.Stations.IQueryParameters) {
StationsService(query?: NWSDataAPI.Stations.IQuery) {
if (query) {

@@ -228,3 +228,3 @@ this.query = query

// Returns a list of text products
ProductsService(query?: NationalWeatherServicePublicDataAPI.Products.IQueryParameters) {
ProductsService(query?: NWSDataAPI.Products.IQuery) {
if (query) {

@@ -279,3 +279,3 @@ this.query = query

// Returns a list of zones
ZonesService(query?: NationalWeatherServicePublicDataAPI.Zones.IQueryParameters) {
ZonesService(query?: NWSDataAPI.Zones.IQuery) {
if (query) {

@@ -288,3 +288,3 @@ this.query = query

// Returns a list of zones of a given type
ZonesTypeService(type: "land"|"marine"|"forecast"|"public"|"coastal"|"offshore"|"fire"|"county", query?: NationalWeatherServicePublicDataAPI.ZonesType.IQueryParameters) {
ZonesTypeService(type: "land"|"marine"|"forecast"|"public"|"coastal"|"offshore"|"fire"|"county", query?: NWSDataAPI.ZonesType.IQuery) {
if (query) {

@@ -297,3 +297,3 @@ this.query = query

// Returns metadata about a given zone
ZonesTypeZoneIdService(type: "forecast"|"county"|"fire"|"cg", zoneId: string,query?: NationalWeatherServicePublicDataAPI.ZonesTypeZoneId.IQueryParameters) {
ZonesTypeZoneIdService(type: "forecast"|"county"|"fire"|"cg", zoneId: string,query?: NWSDataAPI.ZonesTypeZoneId.IQuery) {
if (query) {

@@ -312,3 +312,3 @@ this.query = query

// Returns a list of observations for a given zone
ZonesForecastZoneIdObservationsService(zoneId: string, query?: NationalWeatherServicePublicDataAPI.ZonesForecastZoneIdObservations.IQueryParameters) {
ZonesForecastZoneIdObservationsService(zoneId: string, query?: NWSDataAPI.ZonesForecastZoneIdObservations.IQuery) {
if (query) {

@@ -315,0 +315,0 @@ this.query = query

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc