@azohra/meteo.station 0.1.3 → 0.3.0

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 (53) hide show
  1. package/README.md +4 -4
  2. package/dist/elements/elements/DailyPatternElement.js +1 -2
  3. package/dist/elements/elements/TrendChartElement.js +2 -1
  4. package/dist/elements/elements/WindHistoryChartElement.js +2 -1
  5. package/dist/geometry.d.ts +6 -1
  6. package/dist/geometry.js +8 -1
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +3 -3
  9. package/dist/react/components/DailyPattern.js +1 -2
  10. package/dist/react/components/Readout.d.ts +12 -0
  11. package/dist/react/components/Readout.js +14 -0
  12. package/dist/react/components/TrendChart.js +2 -1
  13. package/dist/react/components/WindHistoryChart.js +10 -24
  14. package/dist/react/components/WindSampleStrip.d.ts +15 -0
  15. package/dist/react/components/WindSampleStrip.js +192 -0
  16. package/dist/react/hooks/useMeasuredChartWidth.d.ts +8 -0
  17. package/dist/react/hooks/useMeasuredChartWidth.js +26 -0
  18. package/dist/react/index.d.ts +6 -1
  19. package/dist/react/index.js +4 -1
  20. package/dist/scene/air-matrix.d.ts +2 -0
  21. package/dist/scene/atoms.d.ts +4 -0
  22. package/dist/scene/card.d.ts +3 -0
  23. package/dist/scene/chart.d.ts +11 -0
  24. package/dist/scene/chart.js +1 -7
  25. package/dist/scene/current.d.ts +3 -0
  26. package/dist/scene/daily-pattern.d.ts +6 -0
  27. package/dist/scene/dial.d.ts +4 -0
  28. package/dist/scene/glyphs.d.ts +2 -0
  29. package/dist/scene/index.d.ts +18 -0
  30. package/dist/scene/rose.d.ts +4 -0
  31. package/dist/scene/sample-strip.d.ts +6 -0
  32. package/dist/scene/sample-strip.js +130 -0
  33. package/dist/scene/sparkline.d.ts +3 -0
  34. package/dist/scene/strip.d.ts +3 -0
  35. package/dist/scene/table.d.ts +3 -0
  36. package/dist/scene/trend.d.ts +4 -0
  37. package/dist/scene/trend.js +1 -2
  38. package/dist/scene/wind-history.d.ts +6 -0
  39. package/dist/scene/wind-plot.d.ts +5 -0
  40. package/dist/scene/wind-plot.js +1 -2
  41. package/dist/server/adapters/ecowitt.d.ts +28 -0
  42. package/dist/server/adapters/ecowitt.js +150 -0
  43. package/dist/server/config.d.ts +29 -1
  44. package/dist/server/config.js +14 -1
  45. package/dist/server/environment.d.ts +8 -1
  46. package/dist/server/environment.js +23 -1
  47. package/dist/server/feed.js +6 -0
  48. package/dist/server/index.d.ts +4 -3
  49. package/dist/server/index.js +4 -3
  50. package/dist/strings.d.ts +2 -0
  51. package/dist/strings.js +2 -0
  52. package/package.json +1 -1
  53. package/styles.css +24 -0
@@ -0,0 +1,2 @@
1
+ import "../derive.js";
2
+ import "../strings.js";
@@ -0,0 +1,18 @@
1
+ import { TickAnchor, measuredChartWidth, tickAnchor } from "../geometry.js";
2
+ import "./air-matrix.js";
3
+ import "./atoms.js";
4
+ import "./card.js";
5
+ import { ReadoutPart } from "./chart.js";
6
+ import "./current.js";
7
+ import "./wind-plot.js";
8
+ import "./dial.js";
9
+ import "./glyphs.js";
10
+ import "./daily-pattern.js";
11
+ import "./rose.js";
12
+ import "./sample-strip.js";
13
+ import "./sparkline.js";
14
+ import "./strip.js";
15
+ import "./table.js";
16
+ import "./trend.js";
17
+ import "./wind-history.js";
18
+ export { ReadoutPart };
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../instruments.js";
@@ -0,0 +1,6 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
6
+ import "./wind-plot.js";
@@ -0,0 +1,130 @@
1
+ import { compassDirection, isCalm, speedToMps } from "../derive.js";
2
+ import { roundSpeed } from "../format.js";
3
+ import { samplePoints, sampleRuns, sampleScales, thinSampleVanes } from "../samples.js";
4
+ import { calmNoteText, speedGridLines, stretchedChartFrame, vaneCells, vaneGuideLines, vaneTickTexts, windRowLabels } from "./wind-plot.js";
5
+ //#region src/scene/sample-strip.ts
6
+ const SAMPLE_STRIP_CLASS = "meteo-sample-strip";
7
+ function sampleStripGate(samples, words) {
8
+ if (samples == null || samples.points.length < 2) return {
9
+ kind: "note",
10
+ className: `${SAMPLE_STRIP_CLASS} meteo-sample-strip-na`,
11
+ text: words.noSamples
12
+ };
13
+ return {
14
+ kind: "draw",
15
+ samples
16
+ };
17
+ }
18
+ function sampleStripScene(input) {
19
+ const { formatTime, plotHeight, samples, stationName, unit, width, words } = input;
20
+ const points = samples.points;
21
+ const shown = (speedMps) => roundSpeed(speedMps, unit);
22
+ const frame = stretchedChartFrame(width, plotHeight);
23
+ const scales = sampleScales(samples, frame, {
24
+ niceStepMps: speedToMps(5, unit),
25
+ floorMps: speedToMps(10, unit)
26
+ });
27
+ const runs = sampleRuns(samples);
28
+ const vanes = thinSampleVanes(points);
29
+ return {
30
+ frame,
31
+ scales,
32
+ points,
33
+ readout: {
34
+ ariaLabel: words.aria.readout(stationName),
35
+ className: "meteo-sample-strip-readout"
36
+ },
37
+ svg: {
38
+ ariaLabel: words.aria.sampleStrip(stationName),
39
+ className: "meteo-sample-strip-svg",
40
+ height: frame.height,
41
+ viewBox: `0 0 ${frame.width} ${frame.height}`,
42
+ width: frame.width
43
+ },
44
+ grid: speedGridLines(frame, scales, shown),
45
+ vaneGuides: vaneGuideLines(vanes, frame, scales),
46
+ trace: runs.map((run) => run.length === 1 ? {
47
+ kind: "dot",
48
+ key: run[0].observedAt,
49
+ className: "meteo-sample-dot",
50
+ cx: scales.xAt(run[0].observedAt),
51
+ cy: scales.yAt(run[0].windMps),
52
+ r: 2
53
+ } : {
54
+ kind: "polyline",
55
+ key: run[0].observedAt,
56
+ className: "meteo-sample-trace",
57
+ points: samplePoints(run, scales)
58
+ }),
59
+ calmNote: points.every((sample) => isCalm(sample.windMps)) ? calmNoteText(frame, words) : null,
60
+ rowLabels: windRowLabels(frame, words),
61
+ vanes: vaneCells(vanes, frame, scales, (vane) => String(shown(vane.windAvgMps))),
62
+ ticks: vaneTickTexts(vanes, frame, scales, (timeMs) => formatTime(new Date(timeMs))),
63
+ hit: {
64
+ className: "meteo-hit",
65
+ fill: "transparent",
66
+ height: frame.height,
67
+ width: frame.width,
68
+ x: 0,
69
+ y: 0
70
+ },
71
+ inspect: (activeIndex) => {
72
+ const active = activeIndex == null ? void 0 : points[activeIndex];
73
+ if (active == null) return {
74
+ readout: {
75
+ strong: `${formatTime(new Date(scales.startMs))}–${formatTime(new Date(scales.endMs))}`,
76
+ span: [{
77
+ kind: "text",
78
+ text: words.inspectHint
79
+ }]
80
+ },
81
+ cursor: null
82
+ };
83
+ const lead = `${shown(active.windMps)} ${words.speedUnits[unit]} · `;
84
+ const span = isCalm(active.windMps) ? [{
85
+ kind: "text",
86
+ text: `${lead}${words.calm}`
87
+ }] : active.windDirectionDeg == null ? [{
88
+ kind: "text",
89
+ text: `${lead}—`
90
+ }] : [
91
+ {
92
+ kind: "text",
93
+ text: `${lead}${words.fromLabel} `
94
+ },
95
+ {
96
+ kind: "arrow",
97
+ deg: active.windDirectionDeg
98
+ },
99
+ {
100
+ kind: "text",
101
+ text: ` ${compassDirection(active.windDirectionDeg)} ${Math.round(active.windDirectionDeg)}°`
102
+ }
103
+ ];
104
+ const x = scales.xAt(active.observedAt);
105
+ return {
106
+ readout: {
107
+ strong: formatTime(new Date(active.observedAt)),
108
+ span
109
+ },
110
+ cursor: {
111
+ line: {
112
+ className: "meteo-cursor",
113
+ x1: x,
114
+ x2: x,
115
+ y1: frame.plotTop,
116
+ y2: frame.vaneRow + 9
117
+ },
118
+ dot: {
119
+ className: "meteo-cursor-dot",
120
+ cx: x,
121
+ cy: scales.yAt(active.windMps),
122
+ r: 3
123
+ }
124
+ }
125
+ };
126
+ }
127
+ };
128
+ }
129
+ //#endregion
130
+ export { SAMPLE_STRIP_CLASS, sampleStripGate, sampleStripScene };
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
3
+ import "../geometry.js";
4
+ import "./chart.js";
@@ -1,5 +1,4 @@
1
- import { chartFrame, chartScales, trendRuns, trendSeriesPad, trendValueOf, valueScale } from "../geometry.js";
2
- import { tickAnchor } from "./chart.js";
1
+ import { chartFrame, chartScales, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale } from "../geometry.js";
3
2
  //#region src/scene/trend.ts
4
3
  const TREND_CLASS = "meteo-trend";
5
4
  function trendGate(station, series, words) {
@@ -0,0 +1,6 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
6
+ import "./wind-plot.js";
@@ -0,0 +1,5 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
@@ -1,6 +1,5 @@
1
1
  import { compassDirection, speedToMps } from "../derive.js";
2
- import { averagePoints, chartFrame, chartScales, speedBand, stretchFrame, vanePath, vaneTicks } from "../geometry.js";
3
- import { tickAnchor } from "./chart.js";
2
+ import { averagePoints, chartFrame, chartScales, speedBand, stretchFrame, tickAnchor, vanePath, vaneTicks } from "../geometry.js";
4
3
  //#region src/scene/wind-plot.ts
5
4
  function stretchedChartFrame(width, plotHeight) {
6
5
  const core = chartFrame(width);
@@ -0,0 +1,28 @@
1
+ import { Reading, StationTelemetry } from "../../contract.js";
2
+ import { EcowittStationConfig } from "../config.js";
3
+ import { StationAdapter, StationAdapterOptions } from "../adapter.js";
4
+ //#region src/server/adapters/ecowitt.d.ts
5
+ type EcowittAdapterOptions = StationAdapterOptions & {
6
+ realTimeUrl?: string;
7
+ };
8
+ type EcowittObservation = {
9
+ reading: Reading;
10
+ telemetry: StationTelemetry | null;
11
+ };
12
+ declare const loadEcowittStation: StationAdapter<{
13
+ applicationKey: string;
14
+ apiKey: string;
15
+ mac: string;
16
+ hasBattery: boolean;
17
+ id: string;
18
+ name: string;
19
+ vendor: "ecowitt";
20
+ timeZone?: string | null | undefined;
21
+ pageUrl?: string | null | undefined;
22
+ elevationM?: number | null | undefined;
23
+ latitude?: number | null | undefined;
24
+ longitude?: number | null | undefined;
25
+ }, EcowittAdapterOptions>;
26
+ declare function parseEcowittRealTime(value: string, config: Pick<EcowittStationConfig, "mac" | "elevationM">): EcowittObservation;
27
+ //#endregion
28
+ export { EcowittAdapterOptions, EcowittObservation, loadEcowittStation, parseEcowittRealTime };
@@ -0,0 +1,150 @@
1
+ import { emptyConditions } from "../../contract.js";
2
+ import { isCalm, normalizeDegrees, seaLevelPressureHpa } from "../../derive.js";
3
+ import { fetchUpstreamText } from "../environment.js";
4
+ import { defineStationAdapter } from "../adapter.js";
5
+ import { UpstreamError, plausibleWindMps } from "@azohra/meteo.core";
6
+ //#region src/server/adapters/ecowitt.ts
7
+ const ECOWITT_REAL_TIME_URL = "https://api.ecowitt.net/api/v3/device/real_time";
8
+ const CACHE_TTL_SECONDS = 60;
9
+ const ECOWITT_CALL_BACK = "outdoor,wind,pressure,rainfall,rainfall_piezo,solar_and_uvi,battery";
10
+ const ECOWITT_UNIT_PARAMS = {
11
+ temp_unitid: "1",
12
+ pressure_unitid: "3",
13
+ wind_speed_unitid: "6",
14
+ rainfall_unitid: "12",
15
+ solar_irradiance_unitid: "16"
16
+ };
17
+ const loadEcowittStation = defineStationAdapter({
18
+ meta: (config) => ({
19
+ id: config.id,
20
+ name: config.name,
21
+ sourceLabel: "Ecowitt",
22
+ pageUrl: config.pageUrl ?? null,
23
+ latitude: config.latitude ?? null,
24
+ longitude: config.longitude ?? null,
25
+ timeZone: config.timeZone ?? null,
26
+ elevationM: config.elevationM ?? null,
27
+ capabilities: {
28
+ gustLull: true,
29
+ temperature: true,
30
+ conditions: true,
31
+ history: false,
32
+ battery: config.hasBattery
33
+ },
34
+ samplingWindowSeconds: null,
35
+ recommendedPollSeconds: 60
36
+ }),
37
+ load: async (config, { environment, options }) => {
38
+ const url = new URL(options.realTimeUrl ?? ECOWITT_REAL_TIME_URL);
39
+ url.searchParams.set("application_key", config.applicationKey);
40
+ url.searchParams.set("api_key", config.apiKey);
41
+ url.searchParams.set("mac", config.mac);
42
+ url.searchParams.set("call_back", ECOWITT_CALL_BACK);
43
+ for (const [name, value] of Object.entries(ECOWITT_UNIT_PARAMS)) url.searchParams.set(name, value);
44
+ const observation = parseEcowittRealTime(await fetchUpstreamText(environment, {
45
+ url,
46
+ cacheKey: `ecowitt/${config.mac}`,
47
+ cacheTtlSeconds: CACHE_TTL_SECONDS,
48
+ subject: `Ecowitt device ${config.mac}`
49
+ }), config);
50
+ return {
51
+ reading: observation.reading,
52
+ history: null,
53
+ telemetry: config.hasBattery ? observation.telemetry : null
54
+ };
55
+ }
56
+ });
57
+ function parseEcowittRealTime(value, config) {
58
+ const envelope = JSON.parse(value);
59
+ if (!isRecord(envelope) || typeof envelope.code !== "number") throw new Error("Ecowitt returned no response envelope");
60
+ if (envelope.code !== 0) {
61
+ const message = `Ecowitt refused the request: ${String(envelope.msg)} (code ${envelope.code})`;
62
+ throw envelope.code === -1 || envelope.code === 45001 ? new UpstreamError(message, "rate_limited") : new UpstreamError(message);
63
+ }
64
+ const data = isRecord(envelope.data) ? envelope.data : {};
65
+ const wind = section(data, "wind");
66
+ if (!wind) throw new UpstreamError(`Ecowitt device ${config.mac} has not reported recently`);
67
+ const observedAtSeconds = leafTime(wind, "wind_speed");
68
+ const windAvgMps = windSpeedMps(numberLeaf(wind, "wind_speed"));
69
+ const windDirectionDeg = directionDegrees(numberLeaf(wind, "wind_direction"));
70
+ const outdoor = section(data, "outdoor");
71
+ const pressure = section(data, "pressure");
72
+ const solar = section(data, "solar_and_uvi");
73
+ const rain = section(data, "rainfall_piezo") ?? section(data, "rainfall");
74
+ const temperatureC = outdoor ? nullableNumberLeaf(outdoor, "temperature") : null;
75
+ const stationPressureHpa = pressure ? nullableNumberLeaf(pressure, "absolute", positiveNumber) : null;
76
+ const conditions = emptyConditions({
77
+ dewPointC: outdoor ? nullableNumberLeaf(outdoor, "dew_point") : null,
78
+ relativeHumidityPercent: outdoor ? nullableNumberLeaf(outdoor, "humidity", percentage) : null,
79
+ seaLevelPressureHpa: stationPressureHpa != null && config.elevationM != null ? seaLevelPressureHpa(stationPressureHpa, config.elevationM, temperatureC) : null,
80
+ precipitationRateMmPerHour: rain ? nullableNumberLeaf(rain, "rain_rate", nonnegativeNumber) : null,
81
+ precipitationTodayMm: rain ? nullableNumberLeaf(rain, "daily", nonnegativeNumber) : null,
82
+ solarRadiationWm2: solar ? nullableNumberLeaf(solar, "solar", nonnegativeNumber) : null,
83
+ uvIndex: solar ? nullableNumberLeaf(solar, "uvi", nonnegativeNumber) : null
84
+ });
85
+ const battery = section(data, "battery");
86
+ return {
87
+ telemetry: battery ? { batteryVoltage: nullableNumberLeaf(battery, "haptic_array_battery", positiveNumber) } : null,
88
+ reading: {
89
+ observedAt: (/* @__PURE__ */ new Date(observedAtSeconds * 1e3)).toISOString(),
90
+ windAvgMps,
91
+ windDirectionDeg: isCalm(windAvgMps) ? null : normalizeDegrees(windDirectionDeg),
92
+ windGustMps: nullableNumberLeaf(wind, "wind_gust", windSpeedMps),
93
+ windLullMps: null,
94
+ temperatureC,
95
+ windChillC: null,
96
+ conditions
97
+ }
98
+ };
99
+ }
100
+ function isRecord(value) {
101
+ return typeof value === "object" && value !== null && !Array.isArray(value);
102
+ }
103
+ function section(data, name) {
104
+ const parsed = data[name];
105
+ return isRecord(parsed) && Object.keys(parsed).length > 0 ? parsed : null;
106
+ }
107
+ function leaf(group, name) {
108
+ const parsed = group[name];
109
+ return isRecord(parsed) ? parsed : null;
110
+ }
111
+ function leafNumber(entry, name, field) {
112
+ const raw = entry[field];
113
+ const parsed = typeof raw === "number" ? raw : typeof raw === "string" && raw !== "" ? Number(raw) : NaN;
114
+ if (!Number.isFinite(parsed)) throw new Error(`Ecowitt sent a non-numeric ${name}.${field}`);
115
+ return parsed;
116
+ }
117
+ function numberLeaf(group, name, transform = (parsed) => parsed) {
118
+ const entry = leaf(group, name);
119
+ if (!entry) throw new Error(`Ecowitt is missing ${name}`);
120
+ return transform(leafNumber(entry, name, "value"));
121
+ }
122
+ function nullableNumberLeaf(group, name, transform = (parsed) => parsed) {
123
+ return leaf(group, name) == null ? null : numberLeaf(group, name, transform);
124
+ }
125
+ function leafTime(group, name) {
126
+ const entry = leaf(group, name);
127
+ if (!entry) throw new Error(`Ecowitt is missing ${name}`);
128
+ return nonnegativeNumber(leafNumber(entry, name, "time"));
129
+ }
130
+ function nonnegativeNumber(value) {
131
+ if (value < 0) throw new Error("Ecowitt returned a negative value");
132
+ return value;
133
+ }
134
+ function positiveNumber(value) {
135
+ if (value <= 0) throw new Error("Ecowitt returned a non-positive value");
136
+ return value;
137
+ }
138
+ function percentage(value) {
139
+ if (value < 0 || value > 100) throw new Error("Ecowitt returned an invalid percentage");
140
+ return value;
141
+ }
142
+ function windSpeedMps(value) {
143
+ return plausibleWindMps(value, "Ecowitt");
144
+ }
145
+ function directionDegrees(value) {
146
+ if (value < 0 || value > 360) throw new Error("Ecowitt returned an invalid wind direction");
147
+ return value;
148
+ }
149
+ //#endregion
150
+ export { loadEcowittStation, parseEcowittRealTime };
@@ -32,6 +32,21 @@ declare const tempestStationConfigSchema: z.ZodObject<{
32
32
  vendor: z.ZodLiteral<"tempest">;
33
33
  }, z.core.$strict>;
34
34
  type TempestStationConfig = z.output<typeof tempestStationConfigSchema>;
35
+ declare const ecowittStationConfigSchema: z.ZodObject<{
36
+ applicationKey: z.ZodString;
37
+ apiKey: z.ZodString;
38
+ mac: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
39
+ hasBattery: z.ZodDefault<z.ZodBoolean>;
40
+ timeZone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ pageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
43
+ latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
44
+ longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
45
+ id: z.ZodString;
46
+ name: z.ZodString;
47
+ vendor: z.ZodLiteral<"ecowitt">;
48
+ }, z.core.$strict>;
49
+ type EcowittStationConfig = z.output<typeof ecowittStationConfigSchema>;
35
50
  declare const campbellStationConfigSchema: z.ZodObject<{
36
51
  baseUrl: z.ZodString;
37
52
  source: z.ZodString;
@@ -119,6 +134,19 @@ declare const stationConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
119
134
  id: z.ZodString;
120
135
  name: z.ZodString;
121
136
  vendor: z.ZodLiteral<"campbell">;
137
+ }, z.core.$strict>, z.ZodObject<{
138
+ applicationKey: z.ZodString;
139
+ apiKey: z.ZodString;
140
+ mac: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
141
+ hasBattery: z.ZodDefault<z.ZodBoolean>;
142
+ timeZone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ pageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
145
+ latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
146
+ longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
147
+ id: z.ZodString;
148
+ name: z.ZodString;
149
+ vendor: z.ZodLiteral<"ecowitt">;
122
150
  }, z.core.$strict>, z.ZodObject<{
123
151
  load: z.ZodCustom<CustomStationLoader, CustomStationLoader>;
124
152
  timeZone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -134,4 +162,4 @@ type StationConfig = z.output<typeof stationConfigSchema>;
134
162
  type StationConfigInput = z.input<typeof stationConfigSchema>;
135
163
  declare function parseStationConfig(value: unknown): StationConfig;
136
164
  //#endregion
137
- export { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
165
+ export { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, EcowittStationConfig, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
@@ -28,6 +28,18 @@ const tempestStationConfigSchema = z.strictObject({
28
28
  stationId: z.number().int().positive(),
29
29
  token: z.string().min(1)
30
30
  });
31
+ const ecowittMac = z.string().regex(/^[0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5}$/, { message: "not a colon-separated MAC address (FF:FF:FF:FF:FF:FF)" }).transform((value) => value.toUpperCase());
32
+ const ecowittStationConfigSchema = z.strictObject({
33
+ vendor: z.literal("ecowitt"),
34
+ ...stationIdentity,
35
+ applicationKey: z.string().min(1),
36
+ apiKey: z.string().min(1),
37
+ mac: ecowittMac,
38
+ hasBattery: z.boolean().default(true)
39
+ }).refine((config) => config.elevationM != null, {
40
+ message: "pressure needs the barometer's elevation to reduce to sea level — set elevationM to the gateway's elevation (the barometer lives in the gateway, not the outdoor array)",
41
+ path: ["elevationM"]
42
+ });
31
43
  const campbellStationConfigSchema = z.strictObject({
32
44
  vendor: z.literal("campbell"),
33
45
  ...stationIdentity,
@@ -49,10 +61,11 @@ const stationConfigSchema = z.discriminatedUnion("vendor", [
49
61
  windnerdStationConfigSchema,
50
62
  tempestStationConfigSchema,
51
63
  campbellStationConfigSchema,
64
+ ecowittStationConfigSchema,
52
65
  customStationConfigSchema
53
66
  ]);
54
67
  function parseStationConfig(value) {
55
68
  return stationConfigSchema.parse(value);
56
69
  }
57
70
  //#endregion
58
- export { campbellStationConfigSchema, customStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
71
+ export { campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
@@ -22,6 +22,13 @@ type ResolvedEnvironment = Required<ServerEnvironment>;
22
22
  declare const UPSTREAM_FETCH_TIMEOUT_MS = 4000;
23
23
  declare const UPSTREAM_RESPONSE_LIMIT_BYTES = 524288;
24
24
  declare function memoryCache(): FeedCache;
25
+ /**
26
+ * A FeedCache over the ambient Cloudflare Workers cache (`caches.default`),
27
+ * shared across the isolates of a deployment. Returns undefined where no
28
+ * ambient cache exists (node, vitest), so `cache: workersCache()` falls
29
+ * through to the memory-cache default.
30
+ */
31
+ declare function workersCache(): FeedCache | undefined;
25
32
  declare const DEFAULT_USER_AGENT = "azohra-meteo/0.1 (+https://meteo.azohra.com)";
26
33
  declare function resolveEnvironment(environment?: ServerEnvironment): ResolvedEnvironment;
27
34
  type UpstreamTextRequest = {
@@ -65,4 +72,4 @@ declare function fetchUpstreamStream(environment: ResolvedEnvironment, request:
65
72
  declare function boundedResponseText(response: Response, limitBytes: number, subject: string): Promise<string>;
66
73
  declare function logUpstreamFailure(environment: ResolvedEnvironment, message: string, error: unknown, detail?: Record<string, unknown>): void;
67
74
  //#endregion
68
- export { DEFAULT_USER_AGENT, FeedCache, LogEvent, LogEventCode, ResolvedEnvironment, ServerEnvironment, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError$1 as UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError };
75
+ export { DEFAULT_USER_AGENT, FeedCache, LogEvent, LogEventCode, ResolvedEnvironment, ServerEnvironment, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError$1 as UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache };
@@ -29,6 +29,28 @@ function memoryCache() {
29
29
  }
30
30
  };
31
31
  }
32
+ /**
33
+ * A FeedCache over the ambient Cloudflare Workers cache (`caches.default`),
34
+ * shared across the isolates of a deployment. Returns undefined where no
35
+ * ambient cache exists (node, vitest), so `cache: workersCache()` falls
36
+ * through to the memory-cache default.
37
+ */
38
+ function workersCache() {
39
+ const cache = globalThis.caches?.default;
40
+ if (!cache) return void 0;
41
+ return {
42
+ async get(key) {
43
+ const hit = await cache.match(workersCacheRequest(key));
44
+ return hit ? hit.text() : null;
45
+ },
46
+ async put(key, value, ttlSeconds) {
47
+ await cache.put(workersCacheRequest(key), new Response(value, { headers: { "Cache-Control": `max-age=${ttlSeconds}` } }));
48
+ }
49
+ };
50
+ }
51
+ function workersCacheRequest(key) {
52
+ return new Request(`https://meteo-cache.internal/${encodeURIComponent(key)}`);
53
+ }
32
54
  const sharedDefaultCache = memoryCache();
33
55
  function consoleLogger(event) {
34
56
  const log = event.level === "warn" ? console.warn : console.error;
@@ -169,4 +191,4 @@ function logUpstreamFailure(environment, message, error, detail = {}) {
169
191
  });
170
192
  }
171
193
  //#endregion
172
- 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 };
194
+ 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 };
@@ -2,6 +2,7 @@ import { stationSchema, unavailableStation } from "../contract.js";
2
2
  import { logUpstreamFailure, resolveEnvironment, unavailableReasonForError } from "./environment.js";
3
3
  import { stationConfigSchema } from "./config.js";
4
4
  import { loadCampbellStation } from "./adapters/campbell.js";
5
+ import { loadEcowittStation } from "./adapters/ecowitt.js";
5
6
  import { loadTempestStation } from "./adapters/tempest.js";
6
7
  import { loadWindnerdStation } from "./adapters/windnerd.js";
7
8
  import { openWindnerdLive } from "./adapters/windnerd-live.js";
@@ -182,6 +183,11 @@ async function loadStation(config, environment, historyHours, mode) {
182
183
  mode,
183
184
  environment
184
185
  });
186
+ case "ecowitt": return loadEcowittStation(config, {
187
+ historyHours,
188
+ mode,
189
+ environment
190
+ });
185
191
  case "custom": return loadCustomStation(config, environment, historyHours, mode);
186
192
  }
187
193
  }
@@ -1,6 +1,6 @@
1
1
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
2
- 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 } from "./environment.js";
3
- import { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
2
+ 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
+ import { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, EcowittStationConfig, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
4
4
  import { StationAdapter, StationAdapterContext, StationAdapterDefinition, StationAdapterMode, StationAdapterOptions, StationAdapterResult, defineStationAdapter } from "./adapter.js";
5
5
  import { DEFAULT_HISTORY_HOURS, LoadStationCurrentOptions, LoadStationFeedOptions, OpenStationLiveOptions, StationLiveUnsupportedError, StationsInput, StationsResolver, UnknownStationError, assembleStations, loadStationCurrent, loadStationFeed, openStationLive } from "./feed.js";
6
6
  import { StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute, createStationFeedHandler } from "./handler.js";
@@ -8,5 +8,6 @@ import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
8
8
  import { WindnerdLiveOptions, openWindnerdLive } from "./adapters/windnerd-live.js";
9
9
  import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WindnerdAdapterOptions, WindnerdLiveDigest, WindnerdLiveInit, WindnerdLiveSampleRecord, WindnerdRecords, loadWindnerdStation, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
10
10
  import { TempestAdapterOptions, TempestObservation, loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
11
+ import { EcowittAdapterOptions, EcowittObservation, loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";
11
12
  import { CAMPBELL_FIELD_CONTRACTS, CampbellAdapterOptions, CampbellTable, CampbellTableExpectation, loadCampbellCurrent, loadCampbellStation, naiveLocalToIso, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable } from "./adapters/campbell.js";
12
- export { CAMPBELL_FIELD_CONTRACTS, type CampbellAdapterOptions, CampbellStationConfig, type CampbellTable, type CampbellTableExpectation, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, FeedCache, LoadStationCurrentOptions, LoadStationFeedOptions, LogEvent, LogEventCode, OpenStationLiveOptions, ResolvedEnvironment, STATION_LIVE_SSE_HEADERS, ServerEnvironment, StationAdapter, StationAdapterContext, StationAdapterDefinition, StationAdapterMode, StationAdapterOptions, StationAdapterResult, StationConfig, StationConfigInput, StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute, StationLiveUnsupportedError, StationsInput, StationsResolver, type TempestAdapterOptions, type TempestObservation, TempestStationConfig, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, type WindnerdAdapterOptions, type WindnerdLiveDigest, type WindnerdLiveInit, type WindnerdLiveOptions, type WindnerdLiveSampleRecord, type WindnerdRecords, WindnerdStationConfig, assembleStations, boundedResponseText, campbellStationConfigSchema, coalesceUpstreamLoad, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, encodeStationLiveSse, fetchUpstreamStream, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl };
13
+ export { CAMPBELL_FIELD_CONTRACTS, type CampbellAdapterOptions, CampbellStationConfig, type CampbellTable, type CampbellTableExpectation, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, type EcowittAdapterOptions, type EcowittObservation, EcowittStationConfig, FeedCache, LoadStationCurrentOptions, LoadStationFeedOptions, LogEvent, LogEventCode, OpenStationLiveOptions, ResolvedEnvironment, STATION_LIVE_SSE_HEADERS, ServerEnvironment, StationAdapter, StationAdapterContext, StationAdapterDefinition, StationAdapterMode, StationAdapterOptions, StationAdapterResult, StationConfig, StationConfigInput, StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute, StationLiveUnsupportedError, StationsInput, StationsResolver, type TempestAdapterOptions, type TempestObservation, TempestStationConfig, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, type WindnerdAdapterOptions, type WindnerdLiveDigest, type WindnerdLiveInit, type WindnerdLiveOptions, type WindnerdLiveSampleRecord, type WindnerdRecords, WindnerdStationConfig, assembleStations, boundedResponseText, campbellStationConfigSchema, coalesceUpstreamLoad, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, ecowittStationConfigSchema, encodeStationLiveSse, fetchUpstreamStream, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadEcowittStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseEcowittRealTime, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl, workersCache };
@@ -1,7 +1,8 @@
1
1
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
2
- import { 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 } from "./environment.js";
3
- import { campbellStationConfigSchema, customStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
2
+ import { 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 } from "./environment.js";
3
+ import { campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
4
4
  import { CAMPBELL_FIELD_CONTRACTS, loadCampbellCurrent, loadCampbellStation, naiveLocalToIso, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable } from "./adapters/campbell.js";
5
+ import { loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";
5
6
  import { loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
6
7
  import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, loadWindnerdStation, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
7
8
  import { openWindnerdLive } from "./adapters/windnerd-live.js";
@@ -9,4 +10,4 @@ import { DEFAULT_HISTORY_HOURS, StationLiveUnsupportedError, UnknownStationError
9
10
  import { defineStationAdapter } from "./adapter.js";
10
11
  import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
11
12
  import { createStationFeedHandler } from "./handler.js";
12
- export { CAMPBELL_FIELD_CONTRACTS, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, STATION_LIVE_SSE_HEADERS, StationLiveUnsupportedError, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, assembleStations, boundedResponseText, campbellStationConfigSchema, coalesceUpstreamLoad, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, encodeStationLiveSse, fetchUpstreamStream, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl };
13
+ export { CAMPBELL_FIELD_CONTRACTS, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, STATION_LIVE_SSE_HEADERS, StationLiveUnsupportedError, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, assembleStations, boundedResponseText, campbellStationConfigSchema, coalesceUpstreamLoad, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, ecowittStationConfigSchema, encodeStationLiveSse, fetchUpstreamStream, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadEcowittStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseEcowittRealTime, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl, workersCache };
package/dist/strings.d.ts CHANGED
@@ -15,6 +15,7 @@ type StationStrings = {
15
15
  lullLabel: string;
16
16
  minLabel: string;
17
17
  noHistory: string;
18
+ noSamples: string;
18
19
  notMeasured: string;
19
20
  notReporting: string;
20
21
  peakLabel: string;
@@ -92,6 +93,7 @@ type StationStrings = {
92
93
  rose: (stationName: string) => string;
93
94
  roseFavorable: (sectors: string) => string;
94
95
  roseGeneric: string;
96
+ sampleStrip: (stationName: string) => string;
95
97
  sparkline: (stationName: string) => string;
96
98
  strip: (stationName: string) => string;
97
99
  summary: (endedAtFormatted: string) => string;
package/dist/strings.js CHANGED
@@ -14,6 +14,7 @@ const defaultStrings = {
14
14
  lullLabel: "lull",
15
15
  minLabel: "Min",
16
16
  noHistory: "No history available",
17
+ noSamples: "No live samples",
17
18
  notMeasured: "Not measured here",
18
19
  notReporting: "Not reporting",
19
20
  peakLabel: "Peak",
@@ -123,6 +124,7 @@ const defaultStrings = {
123
124
  rose: (stationName) => `Wind direction distribution at ${stationName}`,
124
125
  roseFavorable: (sectors) => `The outer ring marks favorable directions: from ${sectors}.`,
125
126
  roseGeneric: "Wind direction distribution",
127
+ sampleStrip: (stationName) => `Live wind at ${stationName}: each point is a single sample, and the vanes below point where the wind blew to.`,
126
128
  sparkline: (stationName) => `six hours of wind at ${stationName}`,
127
129
  strip: (stationName) => `Latest reading at ${stationName}`,
128
130
  summary: (endedAtFormatted) => `Summary of the period ending ${endedAtFormatted}`,