@azohra/meteo.station 0.1.1 → 0.1.3

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 (47) hide show
  1. package/dist/client/index.d.ts +2 -1
  2. package/dist/client/index.js +2 -1
  3. package/dist/client/live.d.ts +37 -0
  4. package/dist/client/live.js +241 -0
  5. package/dist/client/stores.d.ts +1 -0
  6. package/dist/client/stores.js +41 -6
  7. package/dist/contract.d.ts +237 -1
  8. package/dist/contract.js +57 -3
  9. package/dist/endpoints.d.ts +2 -1
  10. package/dist/endpoints.js +4 -1
  11. package/dist/geometry.d.ts +4 -1
  12. package/dist/index.d.ts +5 -4
  13. package/dist/index.js +5 -4
  14. package/dist/react/hooks/useStation.d.ts +1 -0
  15. package/dist/react/hooks/useStation.js +25 -5
  16. package/dist/react/hooks/useStationLive.d.ts +20 -0
  17. package/dist/react/hooks/useStationLive.js +33 -0
  18. package/dist/react/index.d.ts +2 -1
  19. package/dist/react/index.js +2 -1
  20. package/dist/samples.d.ts +20 -0
  21. package/dist/samples.js +88 -0
  22. package/dist/server/adapter.d.ts +3 -1
  23. package/dist/server/adapter.js +3 -1
  24. package/dist/server/adapters/windnerd-live.d.ts +21 -0
  25. package/dist/server/adapters/windnerd-live.js +179 -0
  26. package/dist/server/adapters/windnerd.d.ts +36 -5
  27. package/dist/server/adapters/windnerd.js +177 -15
  28. package/dist/server/config.d.ts +2 -0
  29. package/dist/server/config.js +2 -1
  30. package/dist/server/environment.d.ts +25 -5
  31. package/dist/server/environment.js +65 -21
  32. package/dist/server/feed.d.ts +20 -2
  33. package/dist/server/feed.js +28 -1
  34. package/dist/server/handler.d.ts +1 -1
  35. package/dist/server/handler.js +37 -3
  36. package/dist/server/index.d.ts +6 -4
  37. package/dist/server/index.js +6 -4
  38. package/dist/server/live.d.ts +15 -0
  39. package/dist/server/live.js +19 -0
  40. package/dist/sse.js +56 -0
  41. package/package.json +1 -1
  42. package/schema/README.md +1 -1
  43. package/schema/example-feed.json +26 -1
  44. package/schema/example-live.json +74 -0
  45. package/schema/stationcurrent.schema.json +115 -0
  46. package/schema/stationfeed.schema.json +115 -0
  47. package/schema/stationlive.schema.json +868 -0
@@ -17,4 +17,5 @@ import { useFreshness } from "./hooks/useFreshness.js";
17
17
  import { useStation } from "./hooks/useStation.js";
18
18
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
19
19
  import { useStationFeed } from "./hooks/useStationFeed.js";
20
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext };
20
+ import { useStationLive } from "./hooks/useStationLive.js";
21
+ export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -17,5 +17,6 @@ import { WindRose } from "./components/WindRose.js";
17
17
  import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
18
18
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
19
19
  import { useStationFeed } from "./hooks/useStationFeed.js";
20
+ import { useStationLive } from "./hooks/useStationLive.js";
20
21
  import { useStation } from "./hooks/useStation.js";
21
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext };
22
+ export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -0,0 +1,20 @@
1
+ import { LiveSample, LiveSamples } from "./contract.js";
2
+ import { ChartFrame, ChartScaleOptions, ChartScales, Vane } from "./geometry.js";
3
+ //#region src/samples.d.ts
4
+ declare const SAMPLE_GAP_TOLERANCE_FACTOR = 2.5;
5
+ declare function sampleRuns(samples: LiveSamples, toleranceFactor?: number): LiveSample[][];
6
+ declare function sampleScales(samples: LiveSamples, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
7
+ declare function samplePoints(run: ReadonlyArray<LiveSample>, scales: ChartScales): string;
8
+ declare function sampleMeanDirectionDeg(samples: ReadonlyArray<LiveSample>): number | null;
9
+ declare function thinSampleVanes(samples: ReadonlyArray<LiveSample>, target?: number): Vane[];
10
+ type SamplesSummary = {
11
+ latest: LiveSample;
12
+ peakMps: number;
13
+ peakAt: string;
14
+ meanMps: number;
15
+ meanDirectionDeg: number | null;
16
+ spanSeconds: number;
17
+ };
18
+ declare function samplesSummary(samples: LiveSamples): SamplesSummary | null;
19
+ //#endregion
20
+ export { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
@@ -0,0 +1,88 @@
1
+ import { KMH_PER_MPS, isCalm } from "./derive.js";
2
+ import { HISTORY_GAP_TOLERANCE_FACTOR } from "./geometry.js";
3
+ import { meanDirectionDeg } from "@azohra/meteo.core";
4
+ //#region src/samples.ts
5
+ const SAMPLE_GAP_TOLERANCE_FACTOR = HISTORY_GAP_TOLERANCE_FACTOR;
6
+ const DEFAULT_NICE_STEP_MPS = 5 / KMH_PER_MPS;
7
+ const DEFAULT_FLOOR_MPS = 10 / KMH_PER_MPS;
8
+ function sampleRuns(samples, toleranceFactor = SAMPLE_GAP_TOLERANCE_FACTOR) {
9
+ const limitMs = samples.intervalSeconds * 1e3 * toleranceFactor;
10
+ const runs = [];
11
+ let previousMs = Number.NEGATIVE_INFINITY;
12
+ for (const sample of samples.points) {
13
+ const ms = Date.parse(sample.observedAt);
14
+ const run = runs[runs.length - 1];
15
+ if (run && ms - previousMs <= limitMs) run.push(sample);
16
+ else runs.push([sample]);
17
+ previousMs = ms;
18
+ }
19
+ return runs;
20
+ }
21
+ function sampleScales(samples, frame, options = {}) {
22
+ const niceStepMps = options.niceStepMps ?? DEFAULT_NICE_STEP_MPS;
23
+ const floorMps = options.floorMps ?? DEFAULT_FLOOR_MPS;
24
+ const points = samples.points;
25
+ const first = points[0];
26
+ const startMs = first ? Date.parse(first.observedAt) : 0;
27
+ const last = points[points.length - 1];
28
+ const endMs = last ? Date.parse(last.observedAt) : startMs;
29
+ const durationMs = Math.max(1, endMs - startMs);
30
+ const top = points.reduce((max, sample) => Math.max(max, sample.windMps), 0);
31
+ const scaleMax = Math.max(floorMps, Math.ceil(top / niceStepMps) * niceStepMps);
32
+ const xAtMs = (ms) => frame.left + (ms - startMs) / durationMs * (frame.right - frame.left);
33
+ return {
34
+ startMs,
35
+ endMs,
36
+ durationMs,
37
+ scaleMax,
38
+ xAtMs,
39
+ xAt: (observedAt) => xAtMs(Date.parse(observedAt)),
40
+ yAt: (speedMps) => frame.plotBottom - speedMps / scaleMax * (frame.plotBottom - frame.plotTop)
41
+ };
42
+ }
43
+ function samplePoints(run, scales) {
44
+ return run.map((sample) => `${scales.xAt(sample.observedAt).toFixed(1)},${scales.yAt(sample.windMps).toFixed(1)}`).join(" ");
45
+ }
46
+ function sampleMeanDirectionDeg(samples) {
47
+ return meanDirectionDeg(samples.filter((sample) => !isCalm(sample.windMps) && sample.windDirectionDeg != null).map((sample) => sample.windDirectionDeg));
48
+ }
49
+ function thinSampleVanes(samples, target = 13) {
50
+ if (samples.length === 0) return [];
51
+ const step = Math.max(1, Math.round(samples.length / target));
52
+ return Array.from({ length: Math.ceil(samples.length / step) }, (_, index) => {
53
+ const startIndex = index * step;
54
+ const endIndex = startIndex + step;
55
+ const window = samples.slice(startIndex, endIndex);
56
+ const first = Date.parse(window[0].observedAt);
57
+ const last = Date.parse(window[window.length - 1].observedAt);
58
+ return {
59
+ windAvgMps: window.reduce((sum, sample) => sum + sample.windMps, 0) / window.length,
60
+ windDirectionDeg: sampleMeanDirectionDeg(window),
61
+ endIndex,
62
+ midMs: first + (last - first) / 2,
63
+ startIndex
64
+ };
65
+ });
66
+ }
67
+ function samplesSummary(samples) {
68
+ const points = samples.points;
69
+ const latest = points[points.length - 1];
70
+ const first = points[0];
71
+ if (latest == null || first == null) return null;
72
+ let peak = first;
73
+ let sum = 0;
74
+ for (const sample of points) {
75
+ sum += sample.windMps;
76
+ if (sample.windMps > peak.windMps) peak = sample;
77
+ }
78
+ return {
79
+ latest,
80
+ peakMps: peak.windMps,
81
+ peakAt: peak.observedAt,
82
+ meanMps: sum / points.length,
83
+ meanDirectionDeg: sampleMeanDirectionDeg(points),
84
+ spanSeconds: (Date.parse(latest.observedAt) - Date.parse(first.observedAt)) / 1e3
85
+ };
86
+ }
87
+ //#endregion
88
+ export { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
@@ -1,4 +1,4 @@
1
- import { History, Reading, Station, StationMeta } from "../contract.js";
1
+ import { History, LiveSamples, Reading, Station, StationMeta, StationTelemetry } from "../contract.js";
2
2
  import { ResolvedEnvironment, ServerEnvironment } from "./environment.js";
3
3
  //#region src/server/adapter.d.ts
4
4
  type StationAdapterMode = "full" | "current";
@@ -16,6 +16,8 @@ type StationAdapterContext<O extends StationAdapterOptions = StationAdapterOptio
16
16
  type StationAdapterResult = {
17
17
  readonly reading: Reading;
18
18
  readonly history: History | null;
19
+ readonly telemetry?: StationTelemetry | null;
20
+ readonly samples?: LiveSamples | null;
19
21
  readonly meta?: Partial<StationMeta>;
20
22
  };
21
23
  type StationAdapterDefinition<C, O extends StationAdapterOptions = StationAdapterOptions> = {
@@ -20,7 +20,9 @@ function defineStationAdapter(definition) {
20
20
  ...result.meta,
21
21
  status: "ok",
22
22
  reading: result.reading,
23
- history: mode === "current" ? null : result.history
23
+ history: mode === "current" ? null : result.history,
24
+ telemetry: result.telemetry ?? null,
25
+ samples: result.samples ?? null
24
26
  };
25
27
  } catch (error) {
26
28
  logUpstreamFailure(environment, `${meta.name} live wind unavailable`, error, { station: meta.id });
@@ -0,0 +1,21 @@
1
+ import { StationLiveFrame } from "../../contract.js";
2
+ import { ServerEnvironment } from "../environment.js";
3
+ import { WindnerdStationConfig } from "../config.js";
4
+ //#region src/server/adapters/windnerd-live.d.ts
5
+ type WindnerdLiveOptions = {
6
+ environment?: ServerEnvironment;
7
+ signal?: AbortSignal;
8
+ liveUrl?: string;
9
+ idleTimeoutMs?: number;
10
+ };
11
+ /**
12
+ * Opens the station's live stream and returns our frames: one init, then
13
+ * samples/reading/ping as the upstream serves them. The connect phase —
14
+ * headers plus the upstream init frame — rejects on failure; once resolved,
15
+ * failures degrade to a terminal unavailable frame instead of throwing.
16
+ * One call is one upstream connection: reconnect and fan-out belong to the
17
+ * caller, and a reconnect's fresh init frame is the resume story.
18
+ */
19
+ declare function openWindnerdLive(config: WindnerdStationConfig, options?: WindnerdLiveOptions): Promise<ReadableStream<StationLiveFrame>>;
20
+ //#endregion
21
+ export { WindnerdLiveOptions, openWindnerdLive };
@@ -0,0 +1,179 @@
1
+ import "../../contract.js";
2
+ import { sseEvents } from "../../sse.js";
3
+ import { UpstreamError, fetchUpstreamStream, logUpstreamFailure, resolveEnvironment, unavailableReasonForError } from "../environment.js";
4
+ import { WINDNERD_LIVE_INIT_TIMEOUT_MS, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationMeta } from "./windnerd.js";
5
+ //#region src/server/adapters/windnerd-live.ts
6
+ const LIVE_IDLE_TIMEOUT_MS = 75e3;
7
+ /**
8
+ * Opens the station's live stream and returns our frames: one init, then
9
+ * samples/reading/ping as the upstream serves them. The connect phase —
10
+ * headers plus the upstream init frame — rejects on failure; once resolved,
11
+ * failures degrade to a terminal unavailable frame instead of throwing.
12
+ * One call is one upstream connection: reconnect and fan-out belong to the
13
+ * caller, and a reconnect's fresh init frame is the resume story.
14
+ */
15
+ async function openWindnerdLive(config, options = {}) {
16
+ const environment = resolveEnvironment(options.environment);
17
+ const subject = `WindNerd location ${config.locationId} live stream`;
18
+ const upstream = new AbortController();
19
+ const abortFromCaller = () => upstream.abort();
20
+ options.signal?.addEventListener("abort", abortFromCaller, { once: true });
21
+ if (options.signal?.aborted) upstream.abort();
22
+ const releaseCaller = () => options.signal?.removeEventListener("abort", abortFromCaller);
23
+ let events;
24
+ let initFrame;
25
+ try {
26
+ events = sseEvents((await fetchUpstreamStream(environment, {
27
+ url: windnerdLiveStreamUrl(config, options.liveUrl),
28
+ subject,
29
+ signal: upstream.signal
30
+ })).body, { signal: upstream.signal });
31
+ initFrame = await readInitFrame(events, config, environment, upstream, options, subject);
32
+ } catch (error) {
33
+ upstream.abort();
34
+ releaseCaller();
35
+ throw error;
36
+ }
37
+ let closed = false;
38
+ let watchdogFired = false;
39
+ let idleTimer = null;
40
+ return new ReadableStream({
41
+ start: (controller) => {
42
+ const enqueue = (frame) => {
43
+ if (closed) return;
44
+ try {
45
+ controller.enqueue(frame);
46
+ } catch {
47
+ closed = true;
48
+ }
49
+ };
50
+ const finish = (reason) => {
51
+ if (reason) enqueue({
52
+ type: "unavailable",
53
+ stationId: config.id,
54
+ reason
55
+ });
56
+ if (!closed) {
57
+ closed = true;
58
+ try {
59
+ controller.close();
60
+ } catch {}
61
+ }
62
+ };
63
+ const resetIdle = () => {
64
+ if (idleTimer) clearTimeout(idleTimer);
65
+ idleTimer = setTimeout(() => {
66
+ watchdogFired = true;
67
+ upstream.abort();
68
+ }, options.idleTimeoutMs ?? LIVE_IDLE_TIMEOUT_MS);
69
+ };
70
+ enqueue(initFrame);
71
+ (async () => {
72
+ resetIdle();
73
+ try {
74
+ for await (const event of events) {
75
+ resetIdle();
76
+ const frame = mapLiveEvent(event, config, environment);
77
+ if (frame) enqueue(frame);
78
+ }
79
+ finish("upstream_error");
80
+ } catch (error) {
81
+ if (options.signal?.aborted || closed) finish();
82
+ else if (watchdogFired) {
83
+ logUpstreamFailure(environment, `${config.name} live stream went quiet`, error, { station: config.id });
84
+ finish("timeout");
85
+ } else {
86
+ logUpstreamFailure(environment, `${config.name} live stream failed`, error, { station: config.id });
87
+ finish(unavailableReasonForError(error));
88
+ }
89
+ } finally {
90
+ if (idleTimer) clearTimeout(idleTimer);
91
+ upstream.abort();
92
+ releaseCaller();
93
+ }
94
+ })();
95
+ },
96
+ cancel: () => {
97
+ closed = true;
98
+ upstream.abort();
99
+ }
100
+ });
101
+ }
102
+ async function readInitFrame(events, config, environment, upstream, options, subject) {
103
+ const timer = setTimeout(() => upstream.abort(), WINDNERD_LIVE_INIT_TIMEOUT_MS);
104
+ try {
105
+ while (true) {
106
+ const result = await events.next();
107
+ if (result.done) throw new UpstreamError(`${subject} ended before its init frame`);
108
+ const event = result.value;
109
+ if (event.event !== "message") continue;
110
+ let type;
111
+ try {
112
+ const frame = JSON.parse(event.data);
113
+ type = isRecord(frame) ? frame.type : void 0;
114
+ } catch {
115
+ continue;
116
+ }
117
+ if (type !== "INIT") continue;
118
+ const init = parseWindnerdLiveInit(event.data, config.locationId);
119
+ const { reading, telemetry } = windnerdLiveReading(init.digest, config);
120
+ const station = {
121
+ ...windnerdStationMeta(config),
122
+ recommendedPollSeconds: 15,
123
+ status: "ok",
124
+ reading,
125
+ history: null,
126
+ telemetry,
127
+ samples: windnerdLiveSamples(init.samples)
128
+ };
129
+ return {
130
+ type: "init",
131
+ schemaVersion: 2,
132
+ servedAt: environment.now().toISOString(),
133
+ station
134
+ };
135
+ }
136
+ } catch (error) {
137
+ if (upstream.signal.aborted && options.signal?.aborted !== true && !(error instanceof UpstreamError)) throw new UpstreamError(`${subject} timed out`, "timeout");
138
+ throw error;
139
+ } finally {
140
+ clearTimeout(timer);
141
+ }
142
+ }
143
+ function mapLiveEvent(event, config, environment) {
144
+ if (event.event === "ping") return {
145
+ type: "ping",
146
+ servedAt: environment.now().toISOString()
147
+ };
148
+ if (event.event !== "message") return null;
149
+ let frame;
150
+ try {
151
+ frame = JSON.parse(event.data);
152
+ } catch {
153
+ throw new Error(`WindNerd location ${config.locationId} sent an unparseable live frame`);
154
+ }
155
+ if (!isRecord(frame)) throw new Error(`WindNerd location ${config.locationId} sent an invalid live frame`);
156
+ switch (frame.type) {
157
+ case "WIND_SAMPLES": return {
158
+ type: "samples",
159
+ stationId: config.id,
160
+ samples: windnerdLiveSamples(parseWindnerdLiveSampleRecords(frame.samples, config.locationId))
161
+ };
162
+ case "LAST_DIGEST": {
163
+ const { reading, telemetry } = windnerdLiveReading(parseWindnerdLiveDigest(frame, config.locationId), config);
164
+ return {
165
+ type: "reading",
166
+ stationId: config.id,
167
+ servedAt: environment.now().toISOString(),
168
+ reading,
169
+ telemetry
170
+ };
171
+ }
172
+ default: return null;
173
+ }
174
+ }
175
+ function isRecord(value) {
176
+ return typeof value === "object" && value !== null;
177
+ }
178
+ //#endregion
179
+ export { openWindnerdLive };
@@ -1,19 +1,21 @@
1
- import { HistoryPoint } from "../../contract.js";
1
+ import { HistoryPoint, LiveSamples, Reading, StationTelemetry } from "../../contract.js";
2
2
  import { WindnerdStationConfig } from "../config.js";
3
3
  import { StationAdapter, StationAdapterOptions } from "../adapter.js";
4
4
  //#region src/server/adapters/windnerd.d.ts
5
5
  declare const WINDNERD_RECORD_PERIODS_MINUTES: readonly [1, 15, 60, 180];
6
6
  type WindnerdRecordPeriodMinutes = (typeof WINDNERD_RECORD_PERIODS_MINUTES)[number];
7
+ declare const WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS = 3;
7
8
  type WindnerdAdapterOptions = StationAdapterOptions & {
8
9
  recordsUrl?: string;
10
+ liveUrl?: string;
9
11
  recordPeriodMinutes?: WindnerdRecordPeriodMinutes;
10
12
  cacheTtlSeconds?: number;
11
13
  };
12
14
  type WindnerdRecords = {
13
- averageSpeedKmh: number[];
15
+ averageSpeedMps: number[];
14
16
  windDirectionDeg: number[];
15
- gustSpeedKmh: number[];
16
- lullSpeedKmh: number[];
17
+ gustSpeedMps: number[];
18
+ lullSpeedMps: number[];
17
19
  observedAt: string[];
18
20
  temperatureC: Array<number | null>;
19
21
  stationPressureHpa: Array<number | null>;
@@ -24,6 +26,7 @@ declare const loadWindnerdStation: StationAdapter<{
24
26
  locationId: number;
25
27
  hasTemperature: boolean;
26
28
  hasPressure: boolean;
29
+ hasBattery: boolean;
27
30
  id: string;
28
31
  name: string;
29
32
  vendor: "windnerd";
@@ -34,6 +37,34 @@ declare const loadWindnerdStation: StationAdapter<{
34
37
  longitude?: number | null | undefined;
35
38
  }, WindnerdAdapterOptions>;
36
39
  declare function windnerdHistoryPoints(records: WindnerdRecords, config: Pick<WindnerdStationConfig, "hasTemperature" | "hasPressure" | "elevationM">): HistoryPoint[];
40
+ type WindnerdLiveDigest = {
41
+ observedAt: string;
42
+ windAvgMps: number;
43
+ gustMps: number | null;
44
+ lullMps: number | null;
45
+ windDirectionDeg: number;
46
+ temperatureC: number | null;
47
+ stationPressureHpa: number | null;
48
+ batteryVoltage: number | null;
49
+ };
50
+ type WindnerdLiveSampleRecord = {
51
+ observedAt: string;
52
+ speedMps: number;
53
+ directionDeg: number;
54
+ };
55
+ type WindnerdLiveInit = {
56
+ digest: WindnerdLiveDigest;
57
+ samples: WindnerdLiveSampleRecord[];
58
+ };
59
+ declare function windnerdLiveStreamUrl(config: Pick<WindnerdStationConfig, "stationKey">, base?: string): URL;
60
+ declare function parseWindnerdLiveInit(value: string, locationId: number): WindnerdLiveInit;
61
+ declare function parseWindnerdLiveDigest(value: unknown, locationId: number): WindnerdLiveDigest;
62
+ declare function parseWindnerdLiveSampleRecords(value: unknown, locationId: number): WindnerdLiveSampleRecord[];
63
+ declare function windnerdLiveReading(digest: WindnerdLiveDigest, config: Pick<WindnerdStationConfig, "hasTemperature" | "hasPressure" | "hasBattery" | "elevationM">): {
64
+ reading: Reading;
65
+ telemetry: StationTelemetry | null;
66
+ };
67
+ declare function windnerdLiveSamples(records: WindnerdLiveSampleRecord[]): LiveSamples;
37
68
  declare function parseWindnerdRecords(value: string, locationId: number, hasPressure?: boolean): WindnerdRecords;
38
69
  //#endregion
39
- export { WINDNERD_RECORD_PERIODS_MINUTES, WindnerdAdapterOptions, WindnerdRecordPeriodMinutes, WindnerdRecords, loadWindnerdStation, parseWindnerdRecords, windnerdHistoryPoints };
70
+ export { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WINDNERD_RECORD_PERIODS_MINUTES, WindnerdAdapterOptions, WindnerdLiveDigest, WindnerdLiveInit, WindnerdLiveSampleRecord, WindnerdRecordPeriodMinutes, WindnerdRecords, loadWindnerdStation, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl };