Skip to content

@mostlyrightmd/core

Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new AuthenticationError(message, options): AuthenticationError

string = "Authentication required"

HttpErrorOptions = {}

AuthenticationError

HttpError.constructor

static defaultErrorCode: string = "HTTP_UNAUTHORIZED"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict


Read-only city index over the station registry.

Lookups normalize their argument, so get("new_york"), get("New York") and get("new-york") all resolve to the same record.

new CityCatalog(cities): CityCatalog

readonly CityRecord[] = CITY_RECORDS

CityCatalog

get size(): number

number

[iterator](): Iterator<City>

Iterator<City>

filterByCountry(country): City[]

Cities whose ISO 3166-1 alpha-2 country matches, sorted by key.

string

City[]

filterByVenue(venue): City[]

Cities with at least one station tagged venue, sorted by key.

string

City[]

get(key): City

Return the city for key (city key or display name).

string

City

if no city matches.

has(key): boolean

True iff key resolves to a city (key or display name).

string

boolean

venues(): ReadonlySet<string>

Union of all venue tags present in the catalog.

ReadonlySet<string>


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new ContractError(message, options): ContractError

string = ""

ContractErrorOptions = {}

ContractError

MostlyrightError.constructor

readonly actual: null | string

static defaultErrorCode: string = "CONTRACT_ERROR"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly docUrl: null | string

readonly errorCode: string

MostlyrightError.errorCode

readonly expected: null | string

readonly field: null | string

readonly location: null | string

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new DataAvailabilityError(options): DataAvailabilityError

DataAvailabilityErrorOptions

DataAvailabilityError

MostlyrightError.constructor

static defaultErrorCode: string = "DATA_AVAILABILITY"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly hint: string

readonly reason: "model_unavailable" | "out_of_window" | "cache_miss" | "source_404" | "source_5xx" | "rate_limited"

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new DeferredMarketError(message, options): DeferredMarketError

string = ""

MostlyrightErrorOptions = {}

DeferredMarketError

MostlyrightError.constructor

static defaultErrorCode: string = "DEFERRED_MARKET"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new ForbiddenError(message, options): ForbiddenError

string = "Access denied"

HttpErrorOptions = {}

ForbiddenError

HttpError.constructor

static defaultErrorCode: string = "HTTP_FORBIDDEN"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict


The requested window is older than the live route’s retention limit.

api.weather.gov/alerts and api.weather.gov/products both retain exactly 7 days: a start seven days back returns rows, eight days back returns zero features. Asking the live route for an older window is a caller contract violation caught before any request — it is not a data-availability failure, and it never degrades to an empty result that reads as “no hazards occurred”.

The fix the message carries is a source: pin, not a second verb name: source: "iem" routes the same call at the Iowa State VTEC/AFOS archive, which has no 7-day cliff. Keeping the fix on an option rather than on a separate archive verb is what lets this teaching error survive a rename.

Takes the ContractError options unchanged (field/expected/actual), so the structured teaching payload is the same one every other contract violation in the SDK emits. Mirrors Python HazardRetentionError.

new HazardRetentionError(message, options): HazardRetentionError

string = ""

ContractErrorOptions = {}

HazardRetentionError

ContractError.constructor

readonly actual: null | string

ContractError.actual

static defaultErrorCode: string = "HAZARD_RETENTION_EXCEEDED"

Subclass override — the stable string enum surfaced via errorCode.

ContractError.defaultErrorCode

readonly docUrl: null | string

ContractError.docUrl

readonly errorCode: string

ContractError.errorCode

readonly expected: null | string

ContractError.expected

readonly field: null | string

ContractError.field

readonly location: null | string

ContractError.location

readonly requestId: null | string

ContractError.requestId

readonly source: null | string

ContractError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

ContractError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new HttpError(message, options): HttpError

string

HttpErrorOptions = {}

HttpError

MostlyrightError.constructor

static defaultErrorCode: string = "HTTP_ERROR"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

readonly statusCode: null | number

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


A requested economic release is expected but has not been published yet.

Mirrors the Python class: errorCode === "INDICATOR_NOT_YET_RELEASED", carries indicator / period / expectedRelease, and the message reads "{indicator} for period '{period}' is not yet released" (plus " (expected {iso})" when a scheduled release is known).

import { IndicatorNotYetReleasedError } from "@mostlyrightmd/core";
try {
await history("cpi", from, to);
} catch (e) {
if (e instanceof IndicatorNotYetReleasedError) {
console.warn(`Come back at ${e.expectedRelease ?? "the next drop"}`);
} else {
throw e;
}
}

new IndicatorNotYetReleasedError(indicator, period, options): IndicatorNotYetReleasedError

string

string

IndicatorNotYetReleasedErrorOptions = {}

IndicatorNotYetReleasedError

MostlyrightError.constructor

static defaultErrorCode: string = "INDICATOR_NOT_YET_RELEASED"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly expectedRelease: null | string

ISO 8601 string when the scheduled release is known, else null.

readonly indicator: string

readonly period: string

readonly remedy: null | string

An actionable unlock hint (e.g. naming FRED_API_KEY) when known, else null.

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


A forecast row would land with issuedAt = null.

Rows without issuance times cannot be evaluated against a point-in-time cutoff and could introduce later model runs into training data.

new IssuedAtMissingError(message, options): IssuedAtMissingError

string

IssuedAtMissingErrorOptions = {}

IssuedAtMissingError

SchemaValidationError.constructor

static defaultErrorCode: string = "ISSUED_AT_MISSING"

Subclass override — the stable string enum surfaced via errorCode.

SchemaValidationError.defaultErrorCode

readonly errorCode: string

SchemaValidationError.errorCode

readonly quarantineCount: number

SchemaValidationError.quarantineCount

readonly requestId: null | string

SchemaValidationError.requestId

readonly sampleViolations: Record<string, unknown>[]

SchemaValidationError.sampleViolations

readonly schemaId: string

SchemaValidationError.schemaId

readonly source: null | string

SchemaValidationError.source

readonly violatingCountRows: number

readonly violations: Record<string, unknown>[]

SchemaValidationError.violations

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

SchemaValidationError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new LeakageError(message, options): LeakageError

string

LeakageErrorOptions

LeakageError

MostlyrightError.constructor

readonly asOf: string

readonly boundary: null | string

readonly column: null | string

readonly decisionTime: null | string

static defaultErrorCode: string = "LEAKAGE_DETECTED"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly docUrl: null | string

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly sampleViolations: Record<string, unknown>[]

readonly source: null | string

MostlyrightError.source

readonly violatingCount: number

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base class for mostlyright.live.stream / live.latest failures.

Mirrors Python LiveStreamError. Live-streaming errors are a separate sub-tree from SourceUnavailableError because the recovery path differs — stream() swallows empty-tick errors and waits for the next polite-floor cycle. Only latest() raises NoLiveDataError on empty responses.

new LiveStreamError(message, options): LiveStreamError

string = ""

NoDataErrorOptions = {}

LiveStreamError

NoDataError.constructor

static defaultErrorCode: string = "LIVE_STREAM_ERROR"

Subclass override — the stable string enum surfaced via errorCode.

NoDataError.defaultErrorCode

readonly errorCode: string

NoDataError.errorCode

readonly noDataCause: null | string

The actual cause the query returned nothing. Serialized as cause.

NoDataError.noDataCause

readonly requestId: null | string

NoDataError.requestId

readonly source: null | string

NoDataError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

NoDataError.toDict


The live source is rate-limiting us (HTTP 429) — the poll is refused.

Mirrors Python LiveThrottledError. Thrown by the live.latest / live.stream IEM leg when an upstream 429 just occurred (a cooldown was recorded) or a previously-recorded cooldown is still active — in which case the poll fails fast without touching the network. Subclass of NoLiveDataError so existing skip/catch paths keep working (stream() skips the tick); callers that want to branch catch this class and honor retryAfterSeconds.

new LiveThrottledError(message, options): LiveThrottledError

string

LiveThrottledErrorOptions

LiveThrottledError

NoLiveDataError.constructor

static defaultErrorCode: string = "LIVE_THROTTLED"

Subclass override — the stable string enum surfaced via errorCode.

NoLiveDataError.defaultErrorCode

readonly errorCode: string

NoLiveDataError.errorCode

readonly noDataCause: null | string

The actual cause the query returned nothing. Serialized as cause.

NoLiveDataError.noDataCause

readonly requestId: null | string

NoLiveDataError.requestId

readonly retryAfterSeconds: number

readonly source: null | string

NoLiveDataError.source

readonly station: string

NoLiveDataError.station

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

NoLiveDataError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

  • Error

new MostlyrightError(message, options): MostlyrightError

string = ""

MostlyrightErrorOptions = {}

MostlyrightError

Error.constructor

static defaultErrorCode: string = "MOSTLYRIGHT_ERROR"

Subclass override — the stable string enum surfaced via errorCode.

readonly errorCode: string

readonly requestId: null | string

readonly source: null | string

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new NoDataError(message, options): NoDataError

string = ""

NoDataErrorOptions = {}

NoDataError

MostlyrightError.constructor

static defaultErrorCode: string = "NO_DATA"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly noDataCause: null | string

The actual cause the query returned nothing. Serialized as cause.

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


A named hazard identity produced no rows.

Thrown by the identity verbs — the ones handed a specific storm id or product id (bestTrack(stormId), textProducts({ productId })) — instead of resolving to an empty result. Carries the identifier that was asked for and the reason.

Extends NoDataError, not NoLiveDataError: a valid finite query that returns zero rows is a zero-row answer, not a live-capture failure. Mirrors Python NoHazardDataError.

Enumeration verbs do not throw this. tropicalCyclones() in a quiet season resolves to an empty DataResult, because CurrentStorms.json serving {"activeStorms": []} is a correct answer about the world. A missing named identity is not.

new NoHazardDataError(identifier, reason, options): NoHazardDataError

string

string

NoHazardDataErrorOptions = {}

NoHazardDataError

NoDataError.constructor

static defaultErrorCode: string = "NO_HAZARD_DATA"

Subclass override — the stable string enum surfaced via errorCode.

NoDataError.defaultErrorCode

readonly errorCode: string

NoDataError.errorCode

readonly identifier: string

What was asked for — the storm id, product id, or zone.

readonly noDataCause: null | string

The actual cause the query returned nothing. Serialized as cause.

NoDataError.noDataCause

readonly reason: string

Why it produced nothing, in the words the verb used.

readonly requestId: null | string

NoDataError.requestId

readonly source: null | string

NoDataError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

NoDataError.toDict


mostlyright.live.latest returned no observations for the station.

Carries the resolved ICAO station and the canonical source identity tag ("awc.live" / "iem.live") so caller logs can branch by source without re-parsing the message.

new NoLiveDataError(message, options): NoLiveDataError

string

NoLiveDataErrorOptions

NoLiveDataError

LiveStreamError.constructor

static defaultErrorCode: string = "NO_LIVE_DATA"

Subclass override — the stable string enum surfaced via errorCode.

LiveStreamError.defaultErrorCode

readonly errorCode: string

LiveStreamError.errorCode

readonly noDataCause: null | string

The actual cause the query returned nothing. Serialized as cause.

LiveStreamError.noDataCause

readonly requestId: null | string

LiveStreamError.requestId

readonly source: null | string

LiveStreamError.source

readonly station: string

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

LiveStreamError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new NotFoundError(message, options): NotFoundError

string = "Resource not found"

HttpErrorOptions = {}

NotFoundError

HttpError.constructor

static defaultErrorCode: string = "HTTP_NOT_FOUND"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict


Raised when the TS forecastNwp() stub is called.

Why this exists: no production-ready browser GRIB2 decoder ships in v1.x (eccodes / cfgrib are C/Python only; WASM compile-time + bundle size make a browser implementation impractical).

Recommended catch pattern:

import { forecastNwp } from '@mostlyrightmd/weather';
import { NwpNotAvailableError } from '@mostlyrightmd/core';
try {
const grid = await forecastNwp('KNYC', 'gfs');
} catch (e) {
if (e instanceof NwpNotAvailableError) {
console.warn(`NWP unavailable in TypeScript; ${e.hint}`);
// Fall back to iemMosForecasts() when available, else Python SDK.
} else {
throw e;
}
}

See docs/nwp-forecasts.md for current availability and alternatives.

new NwpNotAvailableError(options): NwpNotAvailableError

NwpNotAvailableErrorOptions

NwpNotAvailableError

DataAvailabilityError.constructor

static defaultErrorCode: string = "NWP_NOT_AVAILABLE"

Subclass override — the stable string enum surfaced via errorCode.

DataAvailabilityError.defaultErrorCode

readonly errorCode: string

DataAvailabilityError.errorCode

readonly hint: string

DataAvailabilityError.hint

readonly model: string

readonly reason: "model_unavailable" | "out_of_window" | "cache_miss" | "source_404" | "source_5xx" | "rate_limited"

DataAvailabilityError.reason

readonly requestId: null | string

DataAvailabilityError.requestId

readonly source: null | string

DataAvailabilityError.source

readonly station: string

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

DataAvailabilityError.toDict


The Open-Meteo Historical Forecast (seamless) endpoint was used without allowLeakage: true.

The seamless endpoint stitches forecasts from multiple model cycles into a continuous timeseries; the cycle that produced each value is unrecoverable from the response. LeakageDetector rejects rows tagged source="open_meteo.seamless" whenever as_of is asserted.

new OpenMeteoSeamlessLeakageError(message, options): OpenMeteoSeamlessLeakageError

string

OpenMeteoSeamlessLeakageErrorOptions

OpenMeteoSeamlessLeakageError

LeakageError.constructor

readonly asOf: string

LeakageError.asOf

readonly boundary: null | string

LeakageError.boundary

readonly column: null | string

LeakageError.column

readonly decisionTime: null | string

LeakageError.decisionTime

static defaultErrorCode: string = "OPEN_METEO_SEAMLESS_LEAKAGE"

Subclass override — the stable string enum surfaced via errorCode.

LeakageError.defaultErrorCode

readonly docUrl: null | string

LeakageError.docUrl

readonly endpointUrl: string

readonly errorCode: string

LeakageError.errorCode

readonly model: string

readonly requestId: null | string

LeakageError.requestId

readonly sampleViolations: Record<string, unknown>[]

LeakageError.sampleViolations

readonly source: null | string

LeakageError.source

readonly violatingCount: number

LeakageError.violatingCount

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

LeakageError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new PayloadTooLargeError(message, options): PayloadTooLargeError

string

PayloadTooLargeErrorOptions = {}

PayloadTooLargeError

MostlyrightError.constructor

readonly acceptedModes: string[]

readonly declaredSize: number

static defaultErrorCode: string = "PAYLOAD_TOO_LARGE"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly limit: number

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new PolymarketEventError(message, options): PolymarketEventError

string = ""

MostlyrightErrorOptions = {}

PolymarketEventError

MostlyrightError.constructor

static defaultErrorCode: string = "POLYMARKET_EVENT_INVALID"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly source: null | string

MostlyrightError.source

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new RateLimitError(retryAfter, options): RateLimitError

null | number

RateLimitErrorOptions = {}

RateLimitError

HttpError.constructor

static defaultErrorCode: string = "HTTP_RATE_LIMITED"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly retryAfter: null | number

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict


A release-schedule source answered, but the body carried no usable schedule.

Thrown when a schedule leg returns a body that parses to zero usable events, or an event whose release-type token is outside the mapped vocabulary. An empty schedule is an explicit error, never a silently-empty return: a caller that receives an empty calendar reads it as “every future release is cancelled”, which is the wrong answer to a bot-wall page, an HTML landing page served at HTTP 200, or an unfolded line the parser dropped.

Extends SourceUnavailableError so an existing instanceof SourceUnavailableError branch still matches, and reuses that options object unchanged — source / url / httpStatus carry the same meaning. The distinct errorCode is what lets a caller that cares tell “the endpoint answered with nothing usable” apart from “the endpoint was unreachable”.

new ReleaseScheduleUnavailableError(message, options): ReleaseScheduleUnavailableError

string = ""

SourceUnavailableErrorOptions = {}

ReleaseScheduleUnavailableError

SourceUnavailableError.constructor

static defaultErrorCode: string = "RELEASE_SCHEDULE_UNAVAILABLE"

Subclass override — the stable string enum surfaced via errorCode.

SourceUnavailableError.defaultErrorCode

readonly errorCode: string

SourceUnavailableError.errorCode

readonly httpStatus: null | number

SourceUnavailableError.httpStatus

readonly requestId: null | string

SourceUnavailableError.requestId

readonly retryable: boolean

SourceUnavailableError.retryable

readonly retryAfterS: null | number

SourceUnavailableError.retryAfterS

readonly source: null | string

SourceUnavailableError.source

readonly underlying: string

SourceUnavailableError.underlying

readonly url: null | string

SourceUnavailableError.url

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

SourceUnavailableError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new SchemaValidationError(message, options): SchemaValidationError

string

SchemaValidationErrorOptions

SchemaValidationError

MostlyrightError.constructor

static defaultErrorCode: string = "SCHEMA_VALIDATION_FAILED"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly quarantineCount: number

readonly requestId: null | string

MostlyrightError.requestId

readonly sampleViolations: Record<string, unknown>[]

readonly schemaId: string

readonly source: null | string

MostlyrightError.source

readonly violations: Record<string, unknown>[]

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new ServerError(message, options): ServerError

string = "Server error"

HttpErrorOptions = {}

ServerError

HttpError.constructor

static defaultErrorCode: string = "HTTP_SERVER_ERROR"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new SourceMismatchError(message, options): SourceMismatchError

string

SourceMismatchErrorOptions

SourceMismatchError

MostlyrightError.constructor

readonly catalogWarning: null | string

readonly dataSource: string

static defaultErrorCode: string = "SOURCE_MISMATCH"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly role: null | SourceMismatchRole

readonly schemaSource: string

readonly source: null | string

MostlyrightError.source

readonly static VALID_ROLES: ReadonlySet<SourceMismatchRole>

Canonical role-name vocabulary for source mismatches.

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new SourceUnavailableError(message, options): SourceUnavailableError

string = ""

SourceUnavailableErrorOptions = {}

SourceUnavailableError

MostlyrightError.constructor

static defaultErrorCode: string = "SOURCE_UNAVAILABLE"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly httpStatus: null | number

readonly requestId: null | string

MostlyrightError.requestId

readonly retryable: boolean

readonly retryAfterS: null | number

readonly source: null | string

MostlyrightError.source

readonly underlying: string

readonly url: null | string

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Read-only view over the station registry with venue/country filters.

Lookups accept either the registry code (3-letter NWS code for US stations, ICAO for international) or the 4-letter ICAO directly, so get("NYC"), get("KNYC"), and get("EGLL") all resolve.

new StationCatalog(stations): StationCatalog

readonly StationInfo[] = STATIONS

StationCatalog

get size(): number

number

[iterator](): Iterator<StationInfo>

Iterator<StationInfo>

filterByCountry(country): StationInfo[]

Stations whose ISO 3166-1 alpha-2 country matches, sorted by ICAO.

string

StationInfo[]

filterByVenue(venue): StationInfo[]

Stations tagged with venue (e.g. “kalshi”), sorted by ICAO.

string

StationInfo[]

get(code): StationInfo

Return the station for code (registry code or ICAO).

string

StationInfo

if no station matches.

has(code): boolean

True iff code resolves to a station (by registry code or ICAO).

string

boolean

venues(): ReadonlySet<string>

Union of all venue tags present in the catalog.

ReadonlySet<string>


Base class for all mostlyright structured errors.

errorCode is a stable enum (e.g. “SOURCE_UNAVAILABLE”) used by callers / agents to branch on without parsing message text. source is the source id involved (e.g. “iem.archive”) when applicable, and requestId correlates a JSON-RPC / MCP request id when applicable.

new TemporalDriftError(message, options): TemporalDriftError

string

TemporalDriftErrorOptions

TemporalDriftError

MostlyrightError.constructor

readonly assertedRange: [string, string]

static defaultErrorCode: string = "TEMPORAL_DRIFT"

Subclass override — the stable string enum surfaced via errorCode.

MostlyrightError.defaultErrorCode

readonly errorCode: string

MostlyrightError.errorCode

readonly requestId: null | string

MostlyrightError.requestId

readonly sampleViolations: Record<string, unknown>[]

readonly schemaId: string

readonly source: null | string

MostlyrightError.source

readonly violatingRows: number

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

MostlyrightError.toDict


Base HTTP-layer marker. Subclass of MostlyrightError so callers that catch MostlyrightError also catch transport errors.

new ValidationError(message, options): ValidationError

string = "Invalid request"

HttpErrorOptions = {}

ValidationError

HttpError.constructor

static defaultErrorCode: string = "HTTP_BAD_REQUEST"

Subclass override — the stable string enum surfaced via errorCode.

HttpError.defaultErrorCode

readonly errorCode: string

HttpError.errorCode

readonly requestId: null | string

HttpError.requestId

readonly source: null | string

HttpError.source

readonly statusCode: null | number

HttpError.statusCode

toDict(): Record<string, unknown>

Return a JSON-safe dict suitable for MCP error.data.

Record<string, unknown>

HttpError.toDict

A city and the registry stations that observe it.

readonly country: null | string

ISO 3166-1 alpha-2 code, shared by all of the city’s stations.

readonly key: string

snake_case ASCII join key (e.g. “new_york”).

readonly name: string

Display name in its native spelling (e.g. “São Paulo”).

readonly stations: readonly string[]

ICAOs serving this city, sorted, at least one.

readonly venueStations: Readonly<Record<string, readonly string[]>>

venue -> ICAOs for the stations that venue settles against, derived from Station.venues. A venue with no station here is absent, so an empty object means no prediction-market venue settles against this city.


key: string

name: string

stations: readonly string[]


optional actual: null | string

What the caller actually supplied.

optional docUrl: null | string

Doc URL teaching the fix. Serialized as doc_url.

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional expected: null | string

What the contract required.

optional field: null | string

The offending contract/argument field name.

optional location: null | string

Where the violation was detected (call site / column / selector).

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


optional errorCode: string

MostlyrightErrorOptions.errorCode

hint: string

reason: "model_unavailable" | "out_of_window" | "cache_miss" | "source_404" | "source_5xx" | "rate_limited"

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


The single finite-verb return shape: the rows plus their provenance envelope. rows is a native readonly array (enumerable), never an array with hidden props.

Row

readonly provenance: Provenance

readonly rows: readonly Row[]


optional baseDelayMs: number

Base backoff delay in milliseconds (default 1000).

optional body: null | BodyInit

Optional request body (forwarded to fetch).

optional fetchImpl: (input, init?) => Promise<Response>(input, init?) => Promise<Response>

Inject fetch for tests or for a proxy wrapper. Defaults to global fetch.

MDN Reference

URL | RequestInfo

RequestInit

Promise<Response>

MDN Reference

string | URL | Request

RequestInit

Promise<Response>

optional headers: Record<string, string>

Request headers.

optional maxRetries: number

Total attempts (default 3).

optional method: string

HTTP method (default GET).

optional retryStatuses: ReadonlySet<number>

Statuses that trigger a retry. Default {429, 500, 502, 503, 504}.

optional signal: AbortSignal

Caller-supplied abort signal (composed with per-attempt timeout).

optional sourceTag: string

The ROUTE TAG to attribute a RateLimitError to, instead of the full URL.

Python’s _nwps_shared.raise_if_rate_limited sets error.source to the route tag — "nwps.gauge.live", "usgs.waterdata.live" — so a caller reading to_dict() learns WHICH upstream throttled them rather than which cursor URL happened to be in flight. Absent, the URL is used, which is what every caller that does not pass one keeps getting.

optional timeoutMs: number

Per-attempt timeout in milliseconds (default 60_000).

optional userAgent: string

Convenience: set the User-Agent header.


optional cloud_ceiling_m: null | number

units: m

optional cloud_cover_pct: null | number

units: percent

optional dewpoint_k_2m: null | number

units: K

forecast_hour: number

units: hours — lead time in hours (alias: fxx)

grid_dist_km: number

units: km — great-circle distance from station to nearest grid cell

grid_kind: string

grid-projection label (lambert_conformal_conus, regular_latlon_global_0p25, …)

issued_at: string

model run / cycle reference time

mirror: "aws_bdp" | "azure_bdp" | "ecmwf_aws" | "ecmwf_azure" | "ecmwf_data_portal" | "ecmwf_gcp" | "gcp_bdp" | "msc" | "nomads"

NOAA BDP mirror that served the underlying bytes

model: "cfs" | "ecmwf_aifs_ens" | "ecmwf_aifs_single" | "ecmwf_ifs_ens" | "ecmwf_ifs_hres" | "gdas" | "gdps" | "gefs" | "geps" | "gfs" | "hafs" | "hiresw" | "hrdps" | "href" | "hrrr" | "hrrrak" | "nam" | "nbm" | "rap" | "rdps" | "reps" | "rrfs" | "rtma" | "urma"

optional precipitation_mm_1h: null | number

units: mm

optional pressure_pa_surface: null | number

units: Pa

qc_status: "clean" | "flagged" | "suspect"

inline physics-bounds verdict; finer-grained QC is a later addition

optional relative_humidity_pct_2m: null | number

units: percent

retrieved_at: string

wall-clock UTC when the bytes were fetched

optional sea_level_pressure_pa: null | number

units: Pa

station: string

optional temp_k_2m: null | number

units: K

valid_at: string

forecast target time = issued_at + forecast_hour

optional visibility_m: null | number

units: m

optional wind_gust_ms: null | number

units: m/s

optional wind_u_ms_10m: null | number

units: m/s

optional wind_v_ms_10m: null | number

units: m/s


optional apparent_temp_c: null | number

units: celsius

optional cape_jkg: null | number

units: J/kg

optional cloud_cover_pct: null | number

units: percent

optional dewpoint_c: null | number

units: celsius

optional direct_radiation_wm2: null | number

units: W/m^2

forecast_hour: number

units: hours — (valid_at - issued_at).total_seconds() / 3600

optional freezing_level_m: null | number

units: meters

optional issued_at: null | string

model run time (knowledge_time). Nullable to accommodate open_meteo.seamless rows whose cycle is unrecoverable from the response. LeakageDetector + assert_issued_at_populated() are the runtime gates that reject null issued_at in training-data paths.

model: string

e.g. NBE, GFS, LAV, MET, gfs_global, ecmwf_ifs025

optional precip_probability: null | number

units: probability — bounded [0, 1]

optional precipitation_mm_1h: null | number

units: mm

retrieved_at: string

wall-clock time the row was fetched from upstream

optional sea_level_pressure_hpa: null | number

units: hPa

optional shortwave_radiation_wm2: null | number

units: W/m^2

optional sky_cover_pct: null | number

units: percent — bounded [0, 100]

optional snow_depth_m: null | number

units: meters

source: string

iem.archive | open_meteo.previous_runs | open_meteo.single_run | open_meteo.live

station: string

optional surface_pressure_hpa: null | number

units: hPa

optional temp_c: null | number

units: celsius

valid_at: string

forecast target time (event_time)

optional visibility_m: null | number

units: meters

optional weather_code: null | number

units: WMO 4677 — WMO weather code (clear, fog, rain, snow, etc.)

optional wind_direction_degrees: null | number

units: degrees

optional wind_gust_ms: null | number

units: m/s

optional wind_speed_ms: null | number

units: m/s


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional retryAfter: null | number

optional source: null | string

MostlyrightErrorOptions.source

optional statusCode: null | number


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional expectedRelease: string | Date

The scheduled release wall-clock when known, else omitted. Accepts a tz-aware ISO 8601 string or a Date; a Date is normalized to its ISO string (the TS analog of Python’s expected_release.isoformat()). The payload never fabricates a timestamp — an absent expectedRelease serializes to null.

optional remedy: string

An optional actionable hint for how to unlock the value (e.g. that the settlement-grade first print needs FRED_API_KEY). It has its own field, carried in both the message body and the payload, so period stays a true observation period and never doubles as a hint. Mirrors the Python IndicatorNotYetReleasedError.remedy field.

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional sampleViolations: Record<string, unknown>[]

optional source: null | string

MostlyrightErrorOptions.source

optional violatingCount: number


asOf: string

optional boundary: null | string

optional column: null | string

The offending column, leak boundary, and decision-time the row must respect, plus a doc URL.

optional decisionTime: null | string

optional docUrl: null | string

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional sampleViolations: Record<string, unknown>[]

optional source: null | string

MostlyrightErrorOptions.source

violatingCount: number


optional errorCode: string

NoLiveDataErrorOptions.errorCode

optional requestId: null | string

NoLiveDataErrorOptions.requestId

retryAfterSeconds: number

Seconds the caller should back off before the next live poll.

source: string

NoLiveDataErrorOptions.source

station: string

NoLiveDataErrorOptions.station


optional errorCode: string

optional requestId: null | string

optional source: null | string


optional cause: null | string

Names which fact failed: window-empty vs entity-unknown vs source-gap.

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


optional cause: null | string

Names which fact failed: window-empty vs entity-unknown vs source-gap.

NoDataErrorOptions.cause

optional errorCode: string

NoDataErrorOptions.errorCode

optional requestId: null | string

NoDataErrorOptions.requestId

optional source: null | string

The route that answered. Defaults to "hazards.cache", as in Python.

NoDataErrorOptions.source


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

source: string

MostlyrightErrorOptions.source

station: string


optional errorCode: string

MostlyrightErrorOptions.errorCode

hint: string

Operator-actionable hint. Required (matches DataAvailabilityError contract).

model: string

NWP model the caller asked for (e.g. "gfs", "hrrr").

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source

station: string

Station the caller asked for (echoed back for log/error attribution).


optional as_of_time: null | string

optional detector_metadata: null | string

JSON-serialized detector payload; shape per qc_system.

event_time_utc: string

field: string

Observation column the rule evaluated (e.g. temp_c).

flag: "clean" | "flagged" | "suspect"

optional ingestion_id: null | string

optional observation_type: null | "METAR" | "SPECI"

optional parser_name: null | string

qc_system: string

qc_version: string

rule_id: string

source: "awc" | "ghcnh" | "iem" | "ncei"

station: string


optional dewpoint_c: null | number

units: celsius — bounded

event_time_utc: string

observation valid time

observation_type: "METAR" | "SPECI"

METAR | SPECI; defaults METAR when source can’t distinguish (e.g. AWC JSON)

optional precipitation_mm_1h: null | number

units: mm — hourly precip (METAR p01i, converted from inches)

optional raw_metar: null | string

raw METAR text if source has it; null for AWC JSON (structured-only)

optional sea_level_pressure_hpa: null | number

units: hPa — sea-level pressure (canonical aviation unit, not converted across modes)

optional sky_base_1_m: null | number

units: meters — first cloud layer base height (converted from feet)

optional sky_base_2_m: null | number

units: meters

optional sky_base_3_m: null | number

units: meters

optional sky_base_4_m: null | number

units: meters

optional sky_cover_1: null | "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV"

first cloud layer cover code

optional sky_cover_2: null | "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV"

second layer; null if not present

optional sky_cover_3: null | "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV"

third layer; null if not present

optional sky_cover_4: null | "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV"

fourth layer; null if not present

station: string

ICAO/ASOS station ID (e.g. KORD)

optional temp_c: null | number

units: celsius — bounded TEMP_MIN_C..TEMP_MAX_C

optional visibility_m: null | number

units: meters — converted from statute miles

optional wind_direction_degrees: null | number

units: degrees — 0-360, bounded

optional wind_gust_ms: null | number

units: m/s — converted from kt

optional wind_speed_ms: null | number

units: m/s — converted from kt


optional asOf: null | string

endpointUrl: string

optional errorCode: string

MostlyrightErrorOptions.errorCode

model: string

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


optional acceptedModes: string[]

optional declaredSize: number

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional limit: number

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional source: null | string

MostlyrightErrorOptions.source


The provenance envelope carried by every DataResult. Keys are snake_case to serialize identically to the Python attrs vocabulary.

readonly data_version: null | string

The data/vintage version when applicable, else null.

readonly quality_control: null | string

The quality-control disposition when applicable, else null.

readonly retrieved_at: string

ISO-8601 UTC instant the data was retrieved.

readonly schema_id: string

The wire schema id (mirrors Python mostlyright_schema_id).

readonly source: string

The source identity tag (e.g. "merged.live_v1", "cli.archive").


bit_position: number

description: string

field: string

rule_id: string


optional errorCode: string

HttpErrorOptions.errorCode

optional requestId: null | string

HttpErrorOptions.requestId

optional retryAfter: null | number

HttpErrorOptions.retryAfter

optional source: null | string

HttpErrorOptions.source

optional statusCode: null | number

HttpErrorOptions.statusCode


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional quarantineCount: number

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional sampleViolations: Record<string, unknown>[]

schemaId: string

optional source: null | string

MostlyrightErrorOptions.source

optional violations: Record<string, unknown>[]


cli_data_quality: "clean" | "flagged_instrument" | "flagged_late" | "flagged_other" | "missing"

NWS CLI data-quality marker. Allows downstream code to filter or weight settlement rows by issuer quality without re-parsing the product header.

event_time_utc: string

00:00 local time on local_standard_date converted to UTC; for sort/join only

local_standard_date: string

local climate day per NWS convention (no timezone applied to the date itself)

optional precipitation_in: null | number

units: inches

product_release_time: string

parsed from CLI product header (_climate.py::_parse_product_timestamp)

report_type: "correction" | "final" | "preliminary"

preliminary | final | correction; dedup priority preliminary < final < correction

settlement_finality: "final" | "provisional" | "superseded"

provisional | final | superseded. Kalshi NHIGH/NLOW settlement contractually requires ‘final’; ‘provisional’ values are kept for early-look research only.

optional snowfall_in: null | number

units: inches

station: string

ICAO/ASOS station ID

station_tz: string

IANA timezone for the station (e.g. America/Chicago for KORD). Required for local-climate-day semantics.

optional temp_high_f: null | number

units: fahrenheit — daily high

optional temp_low_f: null | number

units: fahrenheit — daily low


optional catalogWarning: null | string

dataSource: string

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional role: null | SourceMismatchRole

schemaSource: string

optional source: null | string

MostlyrightErrorOptions.source


optional errorCode: string

MostlyrightErrorOptions.errorCode

optional httpStatus: null | number

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional retryable: boolean

optional retryAfterS: null | number

optional source: null | string

MostlyrightErrorOptions.source

optional underlying: string

optional url: null | string


code: null | string

country: null | string

ghcnh_id: null | string

icao: string

latitude: null | number

longitude: null | number

name: null | string

tz: string

venues: readonly string[]


assertedRange: [string, string]

optional errorCode: string

MostlyrightErrorOptions.errorCode

optional requestId: null | string

MostlyrightErrorOptions.requestId

optional sampleViolations: Record<string, unknown>[]

schemaId: string

optional source: null | string

MostlyrightErrorOptions.source

violatingRows: number

Availability: "python" | "typescript"

discover() availability selector — mirrors Python discover Availability.


DataAvailabilityReason: typeof DATA_AVAILABILITY_REASONS[number]


DiscoverKind: "source" | "label" | "dataset"

discover() kind discriminant — mirrors Python discover Kind.


Label: "cli" | "daily_extremes"

Settlement label recipe — mirrors Python weather.training_table Label.


QcStatus: "clean" | "flagged" | "dropped" | "unknown"

CWOP QC verdict — mirrors Python weather.cwop.history QCStatus.


Source: "iem" | "ghcnh" | "awc"

Observation source selector — mirrors Python weather.observations Source.


SourceMismatchRole: "observations" | "forecasts" | "settlement"


Station: StationInfo

const CATALOG: StationCatalog

Process-wide default catalog over the codegen station registry.


const CITIES: CityCatalog

Process-wide default city index over the codegen station registry.


const CITY_RECORDS: ReadonlyArray<CityRecord>


const CLIMATE_REPORT_TYPE_PRIORITY: Readonly<Record<string, number>>


const DATA_AVAILABILITY_REASONS: readonly ["model_unavailable", "out_of_window", "cache_miss", "source_404", "source_5xx", "rate_limited"]

Shared reason enum — must match Python exactly.


const DATA_RESULT_KEYS: readonly keyof DataResult<unknown>[]

The exact enumerable key set of a DataResult envelope.


const FORECAST_NWP_V1_SCHEMA_ID: "schema.forecast.nwp.v1"


const FORECAST_NWP_V1_SCHEMA_VERSION: "1"


const FORECAST_STATION_V1_SCHEMA_ID: "schema.forecast.station.v1"


const FORECAST_STATION_V1_SCHEMA_VERSION: "1"


const LIVE_V1_POLICY: object

name: string

secondaryKey: ReadonlyArray<string>

sourcePriority: Readonly<Record<string, number>>


const OBSERVATION_QC_V1_SCHEMA_ID: "schema.observation.qc.v1"


const OBSERVATION_QC_V1_SCHEMA_VERSION: "1"


const OBSERVATION_SOURCE_PRIORITY: Readonly<Record<string, number>>


const OBSERVATION_V1_SCHEMA_ID: "schema.observation.v1"


const OBSERVATION_V1_SCHEMA_VERSION: "1"


const PROVENANCE_KEYS: readonly keyof Provenance[]

The exact enumerable key set of a Provenance — pinned by the runtime parity tests.


const QC_ALPHA_RULES: ReadonlyArray<QcAlphaRule>


const QC_ALPHA_RULES_BY_ID: ReadonlyMap<string, QcAlphaRule>


const SETTLEMENT_CLI_V1_SCHEMA_ID: "schema.settlement.cli.v1"


const SETTLEMENT_CLI_V1_SCHEMA_VERSION: "1"


const STATION_BY_CODE: ReadonlyMap<string, StationInfo>


const STATION_BY_ICAO: ReadonlyMap<string, StationInfo>


const STATIONS: ReadonlyArray<StationInfo>


const USER_AGENT_REPO: "https://github.com/mostlyrightmd/mostlyright-sdk" = "https://github.com/mostlyrightmd/mostlyright-sdk"

The canonical SDK repository URL embedded in the User-Agent.


const version: "4.1.0" = "4.1.0"

Public package version; kept in lockstep with package.json (and the six-package fixed group).

cliAvailableAt(dateStr, station, delayHours, tzOverride?): Date

Return the UTC time at which the NWS CLI for a date is expected to be available. Default delay is 10 h after midnight LST on the next day.

string

string

number = _CLI_PUBLICATION_DELAY_HOURS

string

Date


fetchWithRetry(url, opts): Promise<Response>

GET (or other) a URL with exponential-backoff retry semantics.

Behaviour:

  • signal is composed with a per-attempt timeout via AbortController.
  • On retryable status (default: 429/500/502/503/504), wait baseDelayMs * 2^attempt (with ≤25% jitter) and retry, up to maxRetries total attempts.
  • On 404 → NotFoundError. On 400/401/403 → ValidationError / AuthenticationError / ForbiddenError. After retry exhaustion on 429 → RateLimitError (with retryAfter honoured). After retry exhaustion on 5xx → ServerError.
  • On network/transport failure: retried under the same budget, last error rethrown as a HttpError if it isn’t one already.

string

FetchWithRetryOptions = {}

Promise<Response>


localStandardDateFor(asOf, station, tzOverride?): string

Return the local standard date (YYYY-MM-DD LST) for a UTC moment.

Kalshi NHIGH/NLOW contracts cover midnight to midnight LOCAL STANDARD TIME. DST is ignored: the window is always fixed to the standard UTC offset.

string | Date

string

string

string


localStandardDateWindowUtc(dateStr, station, tzOverride?): [Date, Date]

Return UTC start/end of the local standard date window for a date. The window is midnight-midnight LST, expressed in UTC.

string

string

string

[Date, Date]


makeDataResult<Row>(rows, provenance): DataResult<Row>

Assemble a DataResult. Every verb builds its return value here, so all of them emit an identical enumerable shape.

Row

readonly Row[]

Provenance

DataResult<Row>


marketCloseUtc(dateStr, station, tzOverride?): Date

Return the UTC time of the Kalshi market close for a settlement date. Kalshi NHIGH/NLOW markets close at 4:30 PM LST on the day of settlement.

string

string

string

Date


toJsonSafe(value, seen?): unknown

Recursively coerce value into a JSON-serializable structure.

Coercion rules (mirrors Python’s to_json_safe):

  • null / undefined / NaN / Infinity / -Infinitynull
  • Date → ISO 8601 UTC string ending in Z
  • Numeric / boolean / string scalars pass through (non-finite numbers → null)
  • Arrays + plain objects → recursive (cycles → { _cycle: true, value: String(obj) })
  • Dict keys MUST be strings; non-string keys throw TypeError.
  • Anything else (Symbol, function, class instance without toJSON) → { _repr_only: true, value: String(value) }.

unknown

WeakSet<object>

unknown


userAgent(v): string

Build the SDK User-Agent from release metadata: mostlyright-ts/<version> (+<repo>).

string = version

the release version (defaults to the lockstep core version).

string

Re-exports CalendarDate

Re-exports DateLike

Re-exports UtcInstant