@azohra/meteo.station 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/client/climatology.d.ts +1 -1
  2. package/dist/client/history.js +1 -1
  3. package/dist/client/index.js +1 -1
  4. package/dist/client/live.d.ts +1 -1
  5. package/dist/client/stores.d.ts +1 -1
  6. package/dist/client/stores.js +1 -1
  7. package/dist/display.d.ts +1 -1
  8. package/dist/elements/elements/ClimatologyDailyPatternElement.js +1 -1
  9. package/dist/elements/elements/ClimatologyRoseElement.js +1 -1
  10. package/dist/elements/elements/DailyPatternElement.js +1 -1
  11. package/dist/elements/elements/StationCardElement.js +3 -3
  12. package/dist/elements/elements/StationFeedElement.js +2 -2
  13. package/dist/elements/elements/StationTableElement.js +1 -1
  14. package/dist/elements/elements/TrendChartElement.js +1 -1
  15. package/dist/elements/elements/WindHistoryChartElement.js +3 -3
  16. package/dist/elements/elements/atoms.js +1 -1
  17. package/dist/elements/index.d.ts +1 -1
  18. package/dist/elements/lib/base.js +1 -1
  19. package/dist/elements/lib/fragments.js +1 -1
  20. package/dist/endpoints.js +5 -1
  21. package/dist/geometry.d.ts +2 -3
  22. package/dist/geometry.js +6 -6
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.js +2 -2
  25. package/dist/react/components/CurrentConditions.js +2 -2
  26. package/dist/react/components/DailyPattern.js +1 -1
  27. package/dist/react/components/Dial.js +2 -2
  28. package/dist/react/components/Sparkline.js +1 -1
  29. package/dist/react/components/StationCard.js +3 -3
  30. package/dist/react/components/StationFeedProvider.js +1 -1
  31. package/dist/react/components/StationStrip.js +2 -2
  32. package/dist/react/components/StationTable.js +3 -3
  33. package/dist/react/components/TrendChart.d.ts +1 -1
  34. package/dist/react/components/TrendChart.js +2 -2
  35. package/dist/react/components/WindHistoryChart.js +3 -3
  36. package/dist/react/components/WindSampleStrip.js +3 -3
  37. package/dist/react/components/atoms.js +2 -2
  38. package/dist/react/hooks/useFreshness.js +1 -1
  39. package/dist/react/hooks/useStationClimatology.js +1 -1
  40. package/dist/react/index.d.ts +1 -1
  41. package/dist/react/index.js +3 -3
  42. package/dist/scene/atoms.d.ts +2 -2
  43. package/dist/scene/atoms.js +1 -1
  44. package/dist/scene/card.js +1 -1
  45. package/dist/scene/cells.d.ts +2 -2
  46. package/dist/scene/cells.js +1 -1
  47. package/dist/scene/climatology-pattern.d.ts +2 -2
  48. package/dist/scene/climatology-pattern.js +1 -1
  49. package/dist/scene/climatology-rose.d.ts +2 -2
  50. package/dist/scene/climatology-rose.js +1 -1
  51. package/dist/scene/compass-fan.d.ts +2 -2
  52. package/dist/scene/compass-fan.js +1 -1
  53. package/dist/scene/current.d.ts +2 -2
  54. package/dist/scene/current.js +2 -2
  55. package/dist/scene/daily-pattern.d.ts +2 -2
  56. package/dist/scene/daily-pattern.js +1 -1
  57. package/dist/scene/dial.d.ts +2 -2
  58. package/dist/scene/dial.js +2 -2
  59. package/dist/scene/favorable-share.d.ts +2 -2
  60. package/dist/scene/recent-summaries.d.ts +2 -2
  61. package/dist/scene/recent-summaries.js +1 -1
  62. package/dist/scene/rose.d.ts +2 -2
  63. package/dist/scene/sample-strip.d.ts +2 -2
  64. package/dist/scene/sample-strip.js +1 -1
  65. package/dist/scene/sparkline.js +1 -1
  66. package/dist/scene/strip.js +2 -2
  67. package/dist/scene/table.js +2 -2
  68. package/dist/scene/trend.d.ts +2 -2
  69. package/dist/scene/wind-history.d.ts +2 -2
  70. package/dist/scene/wind-history.js +2 -2
  71. package/dist/scene/wind-plot.d.ts +1 -1
  72. package/dist/scene/wind-plot.js +1 -1
  73. package/dist/server/adapters/campbell.d.ts +1 -1
  74. package/dist/server/adapters/campbell.js +1 -1
  75. package/dist/server/adapters/ecowitt.d.ts +1 -1
  76. package/dist/server/adapters/ecowitt.js +1 -1
  77. package/dist/server/adapters/tempest.d.ts +1 -1
  78. package/dist/server/adapters/tempest.js +1 -1
  79. package/dist/server/adapters/windnerd-climatology.d.ts +1 -1
  80. package/dist/server/adapters/windnerd-climatology.js +2 -2
  81. package/dist/server/adapters/windnerd-live.d.ts +1 -1
  82. package/dist/server/adapters/windnerd.d.ts +2 -2
  83. package/dist/server/adapters/windnerd.js +6 -6
  84. package/dist/server/environment.d.ts +2 -2
  85. package/dist/server/environment.js +13 -13
  86. package/dist/server/feed.d.ts +1 -1
  87. package/dist/server/feed.js +2 -2
  88. package/dist/server/handler.d.ts +1 -1
  89. package/dist/server/handler.js +2 -2
  90. package/dist/server/index.d.ts +1 -1
  91. package/dist/server/index.js +9 -9
  92. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { compassDirection, isCalm, thresholdsToMps } from "../derive.js";
2
- import { speedBand } from "../geometry.js";
3
2
  import { readingAgeMs, roundSpeed, speedMpsOf, temperatureValue, updatedAtText } from "../format.js";
3
+ import { speedBand } from "../geometry.js";
4
4
  import { inDirectionArcs } from "@azohra/meteo.core";
5
5
  // src/scene/atoms.ts
6
6
  const valueContent = (value, shown, unitWord) => value == null ? {
@@ -1,6 +1,6 @@
1
1
  import { summaryEntries } from "../format.js";
2
- import { el, keyed } from "./node.js";
3
2
  import { freshnessBadgeNode } from "./glyphs.js";
3
+ import { el, keyed } from "./node.js";
4
4
  // src/scene/card.ts
5
5
  const STATION_CARD_CLASS = "meteo-station-card";
6
6
  function cardPartThresholds(own, card) {
@@ -1,4 +1,4 @@
1
1
  import "../contract.js";
2
2
  import "../strings.js";
3
- import "../instruments.js";
4
- import "./atoms.js";
3
+ import "./atoms.js";
4
+ import "../instruments.js";
@@ -1,7 +1,7 @@
1
1
  import { directionCell } from "../format.js";
2
+ import { windArrowNode } from "./glyphs.js";
2
3
  import { el } from "./node.js";
3
4
  import { bandChipScene, directionAtomScene, updatedAtScene } from "./atoms.js";
4
- import { windArrowNode } from "./glyphs.js";
5
5
  // src/scene/cells.ts
6
6
  /** The direction reading: an arrow plus its compass point, or the word for
7
7
  * calm, or a dash — one spelling for both display bindings. */
@@ -1,5 +1,5 @@
1
+ import "../climatology.js";
1
2
  import "../contract-climatology.js";
2
3
  import "../derive.js";
3
- import "../strings.js";
4
4
  import "../instruments.js";
5
- import "../climatology.js";
5
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import { climatologyCoverage, climatologyPattern } from "../climatology.js";
2
- import { el } from "./node.js";
3
2
  import { dailyPatternSlotsScene } from "./daily-pattern.js";
3
+ import { el } from "./node.js";
4
4
  // src/scene/climatology-pattern.ts
5
5
  const CLIMATOLOGY_PATTERN_CLASS = "meteo-climatology-daily-pattern";
6
6
  /** Whether the cube has anything to draw — the bindings consult it to
@@ -1,4 +1,4 @@
1
+ import "../climatology.js";
1
2
  import "../contract-climatology.js";
2
- import "../strings.js";
3
3
  import "../instruments.js";
4
- import "../climatology.js";
4
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import { climatologyCoverage, climatologyFavorableShare, climatologyRose } from "../climatology.js";
2
- import { el, keyed } from "./node.js";
3
2
  import { windRoseScene } from "./rose.js";
3
+ import { el, keyed } from "./node.js";
4
4
  // src/scene/climatology-rose.ts
5
5
  const CLIMATOLOGY_ROSE_CLASS = "meteo-climatology-rose";
6
6
  function climatologyRoseScene(input) {
@@ -1,3 +1,3 @@
1
1
  import "../contract.js";
2
- import "../strings.js";
3
- import "../instruments.js";
2
+ import "../instruments.js";
3
+ import "../strings.js";
@@ -1,8 +1,8 @@
1
1
  import { isCalm } from "../derive.js";
2
2
  import { vanePath } from "../geometry.js";
3
3
  import { dialPolar } from "../instruments.js";
4
- import { el, keyed } from "./node.js";
5
4
  import { dialHub, dialLetters, dialNeedle, dialRing, dialTicks, dialVerdictRing } from "./dial-parts.js";
5
+ import { el, keyed } from "./node.js";
6
6
  // src/scene/compass-fan.ts
7
7
  const FAN_RADIUS = 58;
8
8
  const FAN_GHOST_STEPS = 10;
@@ -1,4 +1,4 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
- import "../instruments.js";
3
+ import "../instruments.js";
4
+ import "../strings.js";
@@ -1,9 +1,9 @@
1
1
  import { compassDirection, isCalm } from "../derive.js";
2
2
  import { roundSpeed, temperatureText, temperatureValue } from "../format.js";
3
3
  import "../instruments.js";
4
- import { el } from "./node.js";
5
- import { freshnessBadgeNode, windArrowNode } from "./glyphs.js";
6
4
  import { dialScene } from "./dial.js";
5
+ import { freshnessBadgeNode, windArrowNode } from "./glyphs.js";
6
+ import { el } from "./node.js";
7
7
  // src/scene/current.ts
8
8
  function currentConditionsScene(input) {
9
9
  const { bezelId, favorableDirections, formatTime, freshness, station, thresholds, unit, words } = input;
@@ -1,5 +1,5 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
3
+ import "../geometry.js";
4
4
  import "../instruments.js";
5
- import "../geometry.js";
5
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import { isCalm, thresholdsToMps } from "../derive.js";
2
- import { dailyPattern, thinVanes } from "../geometry.js";
3
2
  import { roundSpeed } from "../format.js";
3
+ import { dailyPattern, thinVanes } from "../geometry.js";
4
4
  import { el } from "./node.js";
5
5
  import { calmNoteText, displaySpeedScales, gapHatchPattern, gapHatchRect, gradedMeanTrace, speedGridLines, stretchedChartFrame, vaneCells, vaneGuideLines, vaneTickTexts, windRowLabels, windThresholdGuides, windZoneRects } from "./wind-plot.js";
6
6
  // src/scene/daily-pattern.ts
@@ -1,4 +1,4 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
- import "../instruments.js";
3
+ import "../instruments.js";
4
+ import "../strings.js";
@@ -1,9 +1,9 @@
1
1
  import { isCalm, thresholdsToMps } from "../derive.js";
2
- import { speedBand } from "../geometry.js";
3
2
  import { roundSpeed } from "../format.js";
3
+ import { speedBand } from "../geometry.js";
4
4
  import { dialScaleMaxMps, dialSpeedArcPath } from "../instruments.js";
5
- import { el, keyed } from "./node.js";
6
5
  import { dialHub, dialLetters, dialNeedle, dialRing, dialTicks, dialVerdictRing } from "./dial-parts.js";
6
+ import { el, keyed } from "./node.js";
7
7
  // src/scene/dial.ts
8
8
  function dialScene(input) {
9
9
  const { bezelId, calmWord, favorableDirections, size, station, thresholds, unit, words } = input;
@@ -1,3 +1,3 @@
1
1
  import "../contract.js";
2
- import "../strings.js";
3
- import "../instruments.js";
2
+ import "../instruments.js";
3
+ import "../strings.js";
@@ -1,4 +1,4 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
- import "../instruments.js";
3
+ import "../instruments.js";
4
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import { optionalSpeed, roundSpeed } from "../format.js";
2
- import { el, keyed } from "./node.js";
3
2
  import { windArrowNode } from "./glyphs.js";
3
+ import { el, keyed } from "./node.js";
4
4
  import { inDirectionArcs } from "@azohra/meteo.core";
5
5
  // src/scene/recent-summaries.ts
6
6
  const RECENT_SUMMARIES_CLASS = "meteo-recent-summaries";
@@ -1,5 +1,5 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
3
+ import "../geometry.js";
4
4
  import "../instruments.js";
5
- import "../geometry.js";
5
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
- import "../instruments.js";
5
3
  import "../geometry.js";
4
+ import "../instruments.js";
5
+ import "../strings.js";
6
6
  import "./chart.js";
@@ -1,8 +1,8 @@
1
1
  import { compassDirection, isCalm, speedToMps } from "../derive.js";
2
2
  import { roundSpeed } from "../format.js";
3
3
  import { samplePoints, sampleRuns, sampleScales, thinSampleVanes } from "../samples.js";
4
- import { el, keyed } from "./node.js";
5
4
  import { calmNoteText, plotLine, speedGridLines, stretchedChartFrame, vaneCells, vaneGuideLines, vaneTickTexts, windRowLabels } from "./wind-plot.js";
5
+ import { el, keyed } from "./node.js";
6
6
  // src/scene/sample-strip.ts
7
7
  const SAMPLE_STRIP_CLASS = "meteo-sample-strip";
8
8
  function sampleStripGate(samples, words) {
@@ -1,7 +1,7 @@
1
+ import { el, keyed } from "./node.js";
1
2
  import { thresholdsToMps } from "../derive.js";
2
3
  import { speedBand } from "../geometry.js";
3
4
  import { bandStrips, historyRuns, sparklineScale } from "../instruments.js";
4
- import { el, keyed } from "./node.js";
5
5
  // src/scene/sparkline.ts
6
6
  const coordinate = (x, y) => `${x.toFixed(1)},${y.toFixed(1)}`;
7
7
  function sparklineScene(input) {
@@ -1,7 +1,7 @@
1
1
  import { optionalSpeed, roundSpeed, temperatureText } from "../format.js";
2
- import { el } from "./node.js";
3
- import { freshnessBadgeNode } from "./glyphs.js";
4
2
  import { directionCellNodes, stationNameNode } from "./cells.js";
3
+ import { freshnessBadgeNode } from "./glyphs.js";
4
+ import { el } from "./node.js";
5
5
  // src/scene/strip.ts
6
6
  function stationStripScene(input) {
7
7
  const { formatTime, freshness, station, unit, words } = input;
@@ -1,7 +1,7 @@
1
1
  import { optionalSpeed, roundSpeed, temperatureText } from "../format.js";
2
- import { el, keyed } from "./node.js";
3
- import { freshnessBadgeNode } from "./glyphs.js";
4
2
  import { directionCellNodes } from "./cells.js";
3
+ import { freshnessBadgeNode } from "./glyphs.js";
4
+ import { el, keyed } from "./node.js";
5
5
  // src/scene/table.ts
6
6
  const TABLE_ROW_CLASS = "meteo-station-table-row";
7
7
  const TABLE_STATION_CELL_CLASS = "meteo-station-table-station";
@@ -1,3 +1,3 @@
1
1
  import "../contract.js";
2
- import "../strings.js";
3
- import "../geometry.js";
2
+ import "../geometry.js";
3
+ import "../strings.js";
@@ -1,6 +1,6 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
- import "../instruments.js";
5
3
  import "../geometry.js";
4
+ import "../instruments.js";
5
+ import "../strings.js";
6
6
  import "./chart.js";
@@ -1,8 +1,8 @@
1
1
  import { compassDirection, isCalm, thresholdsToMps } from "../derive.js";
2
- import { bandPoints, compareTracePoints, compareWindow, historyGaps, isCalmHistory, thinVanes, windowPoints } from "../geometry.js";
3
2
  import { roundSpeed } from "../format.js";
4
- import { el } from "./node.js";
3
+ import { bandPoints, compareTracePoints, compareWindow, historyGaps, isCalmHistory, thinVanes, windowPoints } from "../geometry.js";
5
4
  import { calmNoteText, displaySpeedScales, gapHatchPattern, gapHatchRect, gradedMeanTrace, nightRects, plotLine, speedGridLines, stretchedChartFrame, vaneCells, vaneGuideLines, vaneTickTexts, windRowLabels, windThresholdGuides, windZoneRects } from "./wind-plot.js";
5
+ import { el } from "./node.js";
6
6
  // src/scene/wind-history.ts
7
7
  const WIND_CHART_CLASS = "meteo-wind-chart";
8
8
  function windChartGate(station, words) {
@@ -1,6 +1,6 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
4
3
  import "../instruments.js";
5
4
  import "../geometry.js";
5
+ import "../strings.js";
6
6
  import "./chart.js";
@@ -152,7 +152,7 @@ const VALUE_LABEL_PX = 24;
152
152
  const TIME_LABEL_PX = 76;
153
153
  function vaneCells(vanes, frame, scales, valueText, favorableDirections) {
154
154
  const verdict = (directionDeg) => favorableDirections == null || favorableDirections.length === 0 ? "" : inDirectionArcs(directionDeg, favorableDirections) ? " meteo-wind-vane-favorable" : " meteo-wind-vane-unfavorable";
155
- const pitch = vanes.length === 0 ? Infinity : (frame.right - frame.left) / vanes.length;
155
+ const pitch = vanes.length === 0 ? 1e400 : (frame.right - frame.left) / vanes.length;
156
156
  const step = (needPx) => Math.max(1, Math.ceil(needPx / pitch));
157
157
  const labelStep = step(COMPASS_LABEL_PX);
158
158
  const valueStep = step(VALUE_LABEL_PX);
@@ -1,6 +1,6 @@
1
+ import { StationAdapter, StationAdapterOptions } from "../adapter.js";
1
2
  import { HistoryPoint, Reading, Station } from "../../contract.js";
2
3
  import { CampbellStationConfig } from "../config.js";
3
- import { StationAdapter, StationAdapterOptions } from "../adapter.js";
4
4
  export type CampbellAdapterOptions = StationAdapterOptions;
5
5
  type CampbellField = {
6
6
  name: string;
@@ -1,6 +1,6 @@
1
1
  import { isCalm, normalizeDegrees } from "../../derive.js";
2
- import { fetchUpstreamText, logUpstreamFailure } from "../environment.js";
3
2
  import { defineStationAdapter } from "../adapter.js";
3
+ import { fetchUpstreamText, logUpstreamFailure } from "../environment.js";
4
4
  import { kmhToMps } from "@azohra/meteo.core";
5
5
  // src/server/adapters/campbell.ts
6
6
  const HISTORY_CACHE_TTL_SECONDS = 120;
@@ -1,6 +1,6 @@
1
+ import { StationAdapter, StationAdapterOptions } from "../adapter.js";
1
2
  import { Reading, StationTelemetry } from "../../contract.js";
2
3
  import { EcowittStationConfig } from "../config.js";
3
- import { StationAdapter, StationAdapterOptions } from "../adapter.js";
4
4
  export type EcowittAdapterOptions = StationAdapterOptions & {
5
5
  realTimeUrl?: string;
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import { emptyConditions } from "../../contract.js";
2
2
  import { isCalm, normalizeDegrees, seaLevelPressureHpa } from "../../derive.js";
3
- import { fetchUpstreamText } from "../environment.js";
4
3
  import { defineStationAdapter } from "../adapter.js";
4
+ import { fetchUpstreamText } from "../environment.js";
5
5
  import { UpstreamError, plausibleWindMps } from "@azohra/meteo.core";
6
6
  // src/server/adapters/ecowitt.ts
7
7
  const ECOWITT_REAL_TIME_URL = "https://api.ecowitt.net/api/v3/device/real_time";
@@ -1,5 +1,5 @@
1
- import { Reading } from "../../contract.js";
2
1
  import { StationAdapter, StationAdapterOptions } from "../adapter.js";
2
+ import { Reading } from "../../contract.js";
3
3
  export type TempestAdapterOptions = StationAdapterOptions & {
4
4
  observationsUrl?: string;
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { isCalm, normalizeDegrees } from "../../derive.js";
2
- import { fetchUpstreamText } from "../environment.js";
3
2
  import { defineStationAdapter } from "../adapter.js";
3
+ import { fetchUpstreamText } from "../environment.js";
4
4
  import { plausibleWindMps } from "@azohra/meteo.core";
5
5
  // src/server/adapters/tempest.ts
6
6
  const TEMPEST_OBSERVATIONS_URL = "https://swd.weatherflow.com/swd/rest/observations/station";
@@ -1,7 +1,7 @@
1
1
  import { StationClimatology } from "../../contract-climatology.js";
2
2
  import { SpeedThresholds } from "../../derive.js";
3
- import { ServerEnvironment } from "../environment.js";
4
3
  import { WindnerdStationConfig } from "../config.js";
4
+ import { ServerEnvironment } from "../environment.js";
5
5
  export declare const CLIMATOLOGY_RECORD_PERIOD_MINUTES = 180;
6
6
  export declare const CLIMATOLOGY_DEFAULT_YEARS = 8;
7
7
  export declare const CLIMATOLOGY_DEFAULT_SECTOR_COUNT = 16;
@@ -1,6 +1,6 @@
1
- import { thresholdsToMps } from "../../derive.js";
2
- import "../../contract-climatology.js";
3
1
  import { accumulatedCells, coveredSlotCountByYear, createClimatologyAccumulator, foldClimatologyPoints } from "../../climatology.js";
2
+ import "../../contract-climatology.js";
3
+ import { thresholdsToMps } from "../../derive.js";
4
4
  import { fetchUpstreamText, logUpstreamFailure, resolveEnvironment } from "../environment.js";
5
5
  import { loadWindnerdLocation, parseWindnerdRecords, windnerdHistoryPoints } from "./windnerd.js";
6
6
  // src/server/adapters/windnerd-climatology.ts
@@ -1,6 +1,6 @@
1
1
  import { StationLiveFrame } from "../../contract.js";
2
- import { ServerEnvironment } from "../environment.js";
3
2
  import { WindnerdStationConfig } from "../config.js";
3
+ import { ServerEnvironment } from "../environment.js";
4
4
  export type WindnerdLiveOptions = {
5
5
  environment?: ServerEnvironment;
6
6
  signal?: AbortSignal;
@@ -1,8 +1,8 @@
1
+ import { StationAdapter, StationAdapterOptions } from "../adapter.js";
1
2
  import { History, HistoryPoint, LiveSamples, Reading, RecentSummary, StationMeta, StationTelemetry } from "../../contract.js";
2
3
  import { WindnerdRecordPeriodMinutes } from "../../windnerd.js";
3
- import "../environment.js";
4
4
  import { WindnerdStationConfig } from "../config.js";
5
- import { StationAdapter, StationAdapterOptions } from "../adapter.js";
5
+ import "../environment.js";
6
6
  import { DirectionArc } from "@azohra/meteo.core";
7
7
  export declare const WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS = 3;
8
8
  export type WindnerdAdapterOptions = StationAdapterOptions & {
@@ -1,9 +1,9 @@
1
1
  import { emptyConditions } from "../../contract.js";
2
2
  import { isCalm, normalizeDegrees, pressureTendency, seaLevelPressureHpa } from "../../derive.js";
3
- import { WINDNERD_RECORD_PERIODS_MINUTES, windnerdStationUrl } from "../../windnerd.js";
4
3
  import { sseEvents } from "../../sse.js";
5
- import { coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, resolveEnvironment } from "../environment.js";
4
+ import { WINDNERD_RECORD_PERIODS_MINUTES, windnerdStationUrl } from "../../windnerd.js";
6
5
  import { defineStationAdapter } from "../adapter.js";
6
+ import { coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, resolveEnvironment } from "../environment.js";
7
7
  import { UpstreamError } from "@azohra/meteo.core";
8
8
  // src/server/adapters/windnerd.ts
9
9
  const WINDNERD_RECORDS_URL = "https://windnerd.net/api/records";
@@ -280,7 +280,7 @@ function parseWindnerdLiveDigest(value, locationId) {
280
280
  gustMps: rangeOrNull(wind.wind_max, 0, MAX_WIND_MPS, "wind_max"),
281
281
  lullMps: rangeOrNull(wind.wind_min, 0, MAX_WIND_MPS, "wind_min"),
282
282
  windDirectionDeg,
283
- temperatureC: rangeOrNull(recent.temperature, -Infinity, Infinity, "temperature"),
283
+ temperatureC: rangeOrNull(recent.temperature, -1e400, 1e400, "temperature"),
284
284
  stationPressureHpa: rangeOrNull(recent.pressure_hpa, STATION_PRESSURE_MIN_HPA, STATION_PRESSURE_MAX_HPA, "pressure_hpa"),
285
285
  batteryVoltage: rangeOrNull(recent.voltage, BATTERY_VOLTAGE_MIN, BATTERY_VOLTAGE_MAX, "voltage")
286
286
  };
@@ -440,8 +440,8 @@ function parseWindnerdRecords(value, locationId, hasPressure = false) {
440
440
  throw new Error(`WindNerd location ${locationId} returned an invalid ${name}`);
441
441
  };
442
442
  const speeds = (name) => numberSeries(records[name], dates.length, 0, MAX_WIND_MPS, name, fail);
443
- const optionalSeries = (name, minimum = -Infinity, maximum = Infinity) => records[name] == null ? dates.map(() => null) : nullableSeries(records[name], dates.length, name, fail, minimum, maximum);
444
- const requiredSeries = (name, minimum = -Infinity, maximum = Infinity) => dates.length === 0 ? [] : nullableSeries(records[name], dates.length, name, fail, minimum, maximum);
443
+ const optionalSeries = (name, minimum = -1e400, maximum = 1e400) => records[name] == null ? dates.map(() => null) : nullableSeries(records[name], dates.length, name, fail, minimum, maximum);
444
+ const requiredSeries = (name, minimum = -1e400, maximum = 1e400) => dates.length === 0 ? [] : nullableSeries(records[name], dates.length, name, fail, minimum, maximum);
445
445
  return {
446
446
  averageSpeedMps: speeds("wind_avg_1D"),
447
447
  vectorAverageSpeedMps: optionalSeries("wind_avg_2D", 0, MAX_WIND_MPS),
@@ -472,7 +472,7 @@ function numberSeries(value, length, minimum, maximum, name, fail) {
472
472
  if (!Array.isArray(value) || value.length !== length || value.some((entry) => typeof entry !== "number" || !Number.isFinite(entry) || entry < minimum || entry > maximum)) fail(name);
473
473
  return value;
474
474
  }
475
- function nullableSeries(value, length, name, fail, minimum = -Infinity, maximum = Infinity) {
475
+ function nullableSeries(value, length, name, fail, minimum = -1e400, maximum = 1e400) {
476
476
  if (!Array.isArray(value) || value.length !== length || value.some((entry) => entry != null && (typeof entry !== "number" || !Number.isFinite(entry) || entry < minimum || entry > maximum))) fail(name);
477
477
  return value;
478
478
  }
@@ -1,4 +1,4 @@
1
- import { UPSTREAM_FAILURE_REASONS as UPSTREAM_FAILURE_REASONS$1, UpstreamError as UpstreamError$1, UpstreamErrorReason, UpstreamFailureReason, unavailableReasonForError } from "@azohra/meteo.core";
1
+ import { UPSTREAM_FAILURE_REASONS, UpstreamError, UpstreamErrorReason, UpstreamFailureReason, unavailableReasonForError } from "@azohra/meteo.core";
2
2
  export type FeedCache = {
3
3
  get(key: string): Promise<string | null>;
4
4
  put(key: string, value: string, ttlSeconds: number): Promise<void>;
@@ -64,4 +64,4 @@ export declare const UPSTREAM_CONNECT_TIMEOUT_MS = 10000;
64
64
  export declare function fetchUpstreamStream(environment: ResolvedEnvironment, request: UpstreamStreamRequest): Promise<Response>;
65
65
  export declare function boundedResponseText(response: Response, limitBytes: number, subject: string): Promise<string>;
66
66
  export declare function logUpstreamFailure(environment: ResolvedEnvironment, message: string, error: unknown, detail?: Record<string, unknown>): void;
67
- export { UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UpstreamError$1 as UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, unavailableReasonForError };
67
+ export { UPSTREAM_FAILURE_REASONS, UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, unavailableReasonForError };
@@ -1,4 +1,4 @@
1
- import { UPSTREAM_FAILURE_REASONS as UPSTREAM_FAILURE_REASONS$1, UpstreamError as UpstreamError$1, unavailableReasonForError } from "@azohra/meteo.core";
1
+ import { UPSTREAM_FAILURE_REASONS, UpstreamError, unavailableReasonForError } from "@azohra/meteo.core";
2
2
  // src/server/environment.ts
3
3
  const UPSTREAM_FETCH_TIMEOUT_MS = 4e3;
4
4
  const UPSTREAM_RESPONSE_LIMIT_BYTES = 524288;
@@ -108,15 +108,15 @@ async function loadUpstreamText(environment, request) {
108
108
  signal: AbortSignal.timeout(request.timeoutMs ?? 4e3)
109
109
  });
110
110
  } catch (error) {
111
- if (error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError")) throw new UpstreamError$1(`${request.subject} timed out`, "timeout");
112
- throw new UpstreamError$1(`${request.subject} could not be reached: ${error instanceof Error ? error.message : String(error)}`);
111
+ if (error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError")) throw new UpstreamError(`${request.subject} timed out`, "timeout");
112
+ throw new UpstreamError(`${request.subject} could not be reached: ${error instanceof Error ? error.message : String(error)}`);
113
113
  }
114
114
  if (!response.ok) {
115
115
  try {
116
116
  await response.body?.cancel();
117
117
  } catch {}
118
- if (response.status === 429) throw new UpstreamError$1(`${request.subject} is rate limiting requests`, "rate_limited");
119
- throw new UpstreamError$1(`${request.subject} returned ${response.status}`);
118
+ if (response.status === 429) throw new UpstreamError(`${request.subject} is rate limiting requests`, "rate_limited");
119
+ throw new UpstreamError(`${request.subject} returned ${response.status}`);
120
120
  }
121
121
  const text = await boundedResponseText(response, request.limitBytes ?? 524288, request.subject);
122
122
  await environment.cache.put(request.cacheKey, text, request.cacheTtlSeconds);
@@ -141,8 +141,8 @@ async function fetchUpstreamStream(environment, request) {
141
141
  });
142
142
  } catch (error) {
143
143
  if (request.signal?.aborted) throw error;
144
- if (error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError")) throw new UpstreamError$1(`${request.subject} timed out`, "timeout");
145
- throw new UpstreamError$1(`${request.subject} could not be reached: ${error instanceof Error ? error.message : String(error)}`);
144
+ if (error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError")) throw new UpstreamError(`${request.subject} timed out`, "timeout");
145
+ throw new UpstreamError(`${request.subject} could not be reached: ${error instanceof Error ? error.message : String(error)}`);
146
146
  } finally {
147
147
  clearTimeout(connectTimer);
148
148
  }
@@ -150,15 +150,15 @@ async function fetchUpstreamStream(environment, request) {
150
150
  try {
151
151
  await response.body?.cancel();
152
152
  } catch {}
153
- if (response.status === 429) throw new UpstreamError$1(`${request.subject} is rate limiting requests`, "rate_limited");
154
- throw new UpstreamError$1(`${request.subject} returned ${response.status}`);
153
+ if (response.status === 429) throw new UpstreamError(`${request.subject} is rate limiting requests`, "rate_limited");
154
+ throw new UpstreamError(`${request.subject} returned ${response.status}`);
155
155
  }
156
- if (!response.body) throw new UpstreamError$1(`${request.subject} returned no body`);
156
+ if (!response.body) throw new UpstreamError(`${request.subject} returned no body`);
157
157
  return response;
158
158
  }
159
159
  async function boundedResponseText(response, limitBytes, subject) {
160
160
  const reader = response.body?.getReader();
161
- if (!reader) throw new UpstreamError$1(`${subject} returned no body`);
161
+ if (!reader) throw new UpstreamError(`${subject} returned no body`);
162
162
  const decoder = new TextDecoder();
163
163
  let result = "";
164
164
  let totalBytes = 0;
@@ -168,7 +168,7 @@ async function boundedResponseText(response, limitBytes, subject) {
168
168
  totalBytes += value.byteLength;
169
169
  if (totalBytes > limitBytes) {
170
170
  await reader.cancel();
171
- throw new UpstreamError$1(`${subject} exceeded the response limit`);
171
+ throw new UpstreamError(`${subject} exceeded the response limit`);
172
172
  }
173
173
  result += decoder.decode(value, { stream: true });
174
174
  }
@@ -184,4 +184,4 @@ function logUpstreamFailure(environment, message, error, detail = {}) {
184
184
  }
185
185
  });
186
186
  }
187
- export { DEFAULT_USER_AGENT, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError$1 as UpstreamError, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache };
187
+ export { DEFAULT_USER_AGENT, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache };
@@ -1,8 +1,8 @@
1
1
  import { Station, StationCurrent, StationFeed, StationHistory, StationLiveFrame } from "../contract.js";
2
2
  import { StationClimatology } from "../contract-climatology.js";
3
3
  import { SpeedThresholds } from "../derive.js";
4
- import { ResolvedEnvironment, ServerEnvironment } from "./environment.js";
5
4
  import { StationConfig, StationConfigInput } from "./config.js";
5
+ import { ResolvedEnvironment, ServerEnvironment } from "./environment.js";
6
6
  export declare const DEFAULT_HISTORY_HOURS = 6;
7
7
  export type StationsResolver = (request?: Request) => Promise<StationConfigInput[]> | StationConfigInput[];
8
8
  export type StationsInput = StationConfigInput[] | StationsResolver;
@@ -1,12 +1,12 @@
1
1
  import { stationSchema, unavailableStation } from "../contract.js";
2
- import { logUpstreamFailure, resolveEnvironment, unavailableReasonForError } from "./environment.js";
3
- import { stationConfigSchema } from "./config.js";
4
2
  import { loadCampbellStation } from "./adapters/campbell.js";
5
3
  import { loadEcowittStation } from "./adapters/ecowitt.js";
6
4
  import { loadTempestStation } from "./adapters/tempest.js";
7
5
  import { loadWindnerdHistory, loadWindnerdStation } from "./adapters/windnerd.js";
8
6
  import { loadWindnerdClimatology } from "./adapters/windnerd-climatology.js";
9
7
  import { openWindnerdLive } from "./adapters/windnerd-live.js";
8
+ import { stationConfigSchema } from "./config.js";
9
+ import { logUpstreamFailure, resolveEnvironment, unavailableReasonForError } from "./environment.js";
10
10
  // src/server/feed.ts
11
11
  const DEFAULT_HISTORY_HOURS = 6;
12
12
  var UnknownStationError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import { SpeedThresholds } from "../derive.js";
2
- import { ServerEnvironment } from "./environment.js";
3
2
  import { StationsInput } from "./feed.js";
3
+ import { ServerEnvironment } from "./environment.js";
4
4
  export type StationFeedHandlerRoute = "feed" | "current" | "live" | "climatology" | "history";
5
5
  export type StationFeedHandlerOptions = {
6
6
  stations: StationsInput;
@@ -1,5 +1,5 @@
1
- import { resolveEnvironment, unavailableReasonForError } from "./environment.js";
2
1
  import { StationClimatologyUnsupportedError, StationHistoryUnsupportedError, StationLiveUnsupportedError, UnknownStationError, assembleStations, loadStationClimatology, loadStationCurrent, loadStationFeed, loadStationHistory, openStationLive } from "./feed.js";
2
+ import { resolveEnvironment, unavailableReasonForError } from "./environment.js";
3
3
  import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
4
4
  // src/server/handler.ts
5
5
  const CLIMATOLOGY_CACHE_SECONDS = 21600;
@@ -182,7 +182,7 @@ function createStationFeedHandler(options) {
182
182
  };
183
183
  if (route === "feed") {
184
184
  const feed = await loadStationFeed(loadOptions);
185
- const maxAge = feed.stations.length === 0 ? 60 : feed.stations.reduce((least, station) => Math.min(least, station.recommendedPollSeconds), Infinity);
185
+ const maxAge = feed.stations.length === 0 ? 60 : feed.stations.reduce((least, station) => Math.min(least, station.recommendedPollSeconds), 1e400);
186
186
  const headers = {
187
187
  "Cache-Control": cacheControlFor("feed", maxAge),
188
188
  ETag: weakEtag({
@@ -1,4 +1,3 @@
1
- import { WINDNERD_RECORD_PERIODS_MINUTES, WindnerdRecordPeriodMinutes, normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
2
1
  import { DEFAULT_USER_AGENT, FeedCache, LogEvent, LogEventCode, ResolvedEnvironment, ServerEnvironment, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, UpstreamErrorReason, UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache } from "./environment.js";
3
2
  import { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, EcowittStationConfig, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
4
3
  import { StationAdapter, StationAdapterContext, StationAdapterDefinition, StationAdapterMode, StationAdapterOptions, StationAdapterResult, defineStationAdapter } from "./adapter.js";
@@ -8,6 +7,7 @@ import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
8
7
  import { WindnerdLiveOptions, openWindnerdLive } from "./adapters/windnerd-live.js";
9
8
  import { CLIMATOLOGY_DEFAULT_SECTOR_COUNT, CLIMATOLOGY_DEFAULT_YEARS, CLIMATOLOGY_RECORD_PERIOD_MINUTES, WindnerdClimatologyOptions, loadWindnerdClimatology } from "./adapters/windnerd-climatology.js";
10
9
  import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WindnerdAdapterOptions, WindnerdHistoryQuery, WindnerdLiveDigest, WindnerdLiveInit, WindnerdLiveLocation, WindnerdLiveSampleRecord, WindnerdRecords, loadWindnerdHistory, loadWindnerdStation, parseStandardTimeOffset, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveLocation, parseWindnerdLiveSampleRecords, parseWindnerdRecentSummaries, parseWindnerdRecords, windnerdEnrichedMeta, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
10
+ import { WINDNERD_RECORD_PERIODS_MINUTES, WindnerdRecordPeriodMinutes, normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
11
11
  import { HOLOGRAM_API_BASE, HologramConnectivityConfig, HologramConnectivityOptions, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity } from "./hologram.js";
12
12
  import { TempestAdapterOptions, TempestObservation, loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
13
13
  import { EcowittAdapterOptions, EcowittObservation, loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";