@azohra/meteo.station 0.3.0 → 0.3.1

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.
package/README.md CHANGED
@@ -10,9 +10,9 @@ that render it natively, in your design system, with no vendor iframe.
10
10
 
11
11
  | Entry point | What it is |
12
12
  |---|---|
13
- | `@azohra/meteo.station` | The isomorphic root: the wire contract (zod), pure derivations (period stats, compass, freshness, unit and threshold conversion), framework-free chart and instrument geometry, and the shared display rules (strings, formatting, air sentences, display resolution, merge policy) every binding renders from. |
13
+ | `@azohra/meteo.station` | The isomorphic root: the wire contract (zod), the standalone connectivity contract (`StationConnectivity` — cellular backhaul health for the operator's own routes, never the public feed), pure derivations (period stats, compass, freshness, unit and threshold conversion), framework-free chart and instrument geometry, and the shared display rules (strings, formatting, air sentences, display resolution, merge policy) every binding renders from. |
14
14
  | `@azohra/meteo.station/client` | The framework-free client data layer: `createJsonPoller` and the station stores (`createStationFeedStore`, `createStationCurrentStore`, `createStationStore`) every binding subscribes to. Client-only at runtime, import-safe anywhere. |
15
- | `@azohra/meteo.station/server` | Vendor adapters plus the custom-adapter interface and `defineStationAdapter`, data-level `loadStationFeed()` / `loadStationCurrent()`, and the mountable feed handler. Server-only, so it can never leak into a client bundle. |
15
+ | `@azohra/meteo.station/server` | Vendor adapters plus the custom-adapter interface and `defineStationAdapter`, data-level `loadStationFeed()` / `loadStationCurrent()`, the Hologram connectivity loader (`loadHologramConnectivity`), and the mountable feed handler. Server-only, so it can never leak into a client bundle. |
16
16
  | `@azohra/meteo.station/react` | `StationFeedProvider`, polling hooks (`useStation`, `useStationFeed`, `useStationCurrent`), the component set (`StationCard`, `CurrentConditions`, `WindHistoryChart`, `WindSampleStrip`, `TrendChart`, `WindRose`, `DailyPattern`, `StationTable`, `StationStrip`, `AirMatrix`, `FreshnessBadge`), and an atoms layer of inline primitives (`Speed`, `Gust`, `Lull`, `Temperature`, `Pressure`, `Direction`, `UpdatedAt`, `BandChip`, `Dial`, `Sparkline`, `Readout`) for composing your own layouts. |
17
17
  | `@azohra/meteo.station/elements` | The same surface as light-DOM custom elements (`<meteo-station-feed>`, `<meteo-station-card>`, `<meteo-station-table>`, the charts, the atoms…), a full peer of the react binding, framework-free, held byte-identical by a parity suite. `/register` is the auto-defining one-liner. |
18
18
  | `@azohra/meteo.station/styles.css` | The default skin (an intentional side effect), shared by both bindings. |
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ //#region src/connectivity.d.ts
3
+ declare const CONNECTIVITY_SERVICE_STATES: readonly ["active", "paused", "inactive", "retired", "unknown"];
4
+ type ConnectivityServiceState = (typeof CONNECTIVITY_SERVICE_STATES)[number];
5
+ declare const connectivitySessionSchema: z.ZodObject<{
6
+ beganAt: z.ZodString;
7
+ endedAt: z.ZodNullable<z.ZodString>;
8
+ bytes: z.ZodNullable<z.ZodNumber>;
9
+ }, z.core.$strip>;
10
+ type ConnectivitySession = z.infer<typeof connectivitySessionSchema>;
11
+ declare const stationConnectivitySchema: z.ZodObject<{
12
+ sourceLabel: z.ZodString;
13
+ checkedAt: z.ZodString;
14
+ deviceName: z.ZodNullable<z.ZodString>;
15
+ online: z.ZodNullable<z.ZodBoolean>;
16
+ lastConnectedAt: z.ZodNullable<z.ZodString>;
17
+ carrier: z.ZodNullable<z.ZodString>;
18
+ radioTechnology: z.ZodNullable<z.ZodString>;
19
+ sim: z.ZodObject<{
20
+ service: z.ZodEnum<{
21
+ unknown: "unknown";
22
+ active: "active";
23
+ paused: "paused";
24
+ inactive: "inactive";
25
+ retired: "retired";
26
+ }>;
27
+ vendorState: z.ZodNullable<z.ZodString>;
28
+ expiresAt: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ usage: z.ZodObject<{
31
+ currentPeriodBytes: z.ZodNullable<z.ZodNumber>;
32
+ previousPeriodBytes: z.ZodNullable<z.ZodNumber>;
33
+ planName: z.ZodNullable<z.ZodString>;
34
+ planIncludedBytes: z.ZodNullable<z.ZodNumber>;
35
+ overageLimitBytes: z.ZodNullable<z.ZodNumber>;
36
+ }, z.core.$strip>;
37
+ lastSession: z.ZodNullable<z.ZodObject<{
38
+ beganAt: z.ZodString;
39
+ endedAt: z.ZodNullable<z.ZodString>;
40
+ bytes: z.ZodNullable<z.ZodNumber>;
41
+ }, z.core.$strip>>;
42
+ }, z.core.$strip>;
43
+ type StationConnectivity = z.infer<typeof stationConnectivitySchema>;
44
+ declare function parseStationConnectivity(value: unknown): StationConnectivity | null;
45
+ //#endregion
46
+ export { CONNECTIVITY_SERVICE_STATES, ConnectivityServiceState, ConnectivitySession, StationConnectivity, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema };
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ //#region src/connectivity.ts
3
+ const isoTime = z.string().refine((value) => Number.isFinite(Date.parse(value)), { message: "not an ISO timestamp" }).meta({ format: "date-time" });
4
+ const dataBytes = z.number().int().min(0);
5
+ const CONNECTIVITY_SERVICE_STATES = [
6
+ "active",
7
+ "paused",
8
+ "inactive",
9
+ "retired",
10
+ "unknown"
11
+ ];
12
+ const connectivitySessionSchema = z.object({
13
+ beganAt: isoTime,
14
+ endedAt: isoTime.nullable().describe("null exactly while the session is still open — an open session has no end."),
15
+ bytes: dataBytes.nullable().describe("Bytes moved in this session. null means 'not reported', never zero traffic.")
16
+ }).meta({ id: "ConnectivitySession" });
17
+ const stationConnectivitySchema = z.object({
18
+ sourceLabel: z.string().describe("The backhaul provider, e.g. 'Hologram'."),
19
+ checkedAt: isoTime.describe("When this snapshot was taken from the provider, to within the loader's cache lifetime — never when the device last answered."),
20
+ deviceName: z.string().nullable(),
21
+ online: z.boolean().nullable().describe("In a data session right now. null when the provider does not say — never inferred from usage recency."),
22
+ lastConnectedAt: isoTime.nullable().describe("When the current or most recent data session began."),
23
+ carrier: z.string().nullable().describe("Network name the device last attached to, as the provider spells it."),
24
+ radioTechnology: z.string().nullable().describe("Radio access technology of the last session, e.g. 'LTE'. Cellular providers do not expose signal strength through their clouds — RSSI lives modem-side — so technology plus session recency is the honest connection-quality signal, and this contract carries no signal field that would have to be invented."),
25
+ sim: z.object({
26
+ service: z.enum(CONNECTIVITY_SERVICE_STATES).describe("The SIM lifecycle, normalized across providers."),
27
+ vendorState: z.string().nullable().describe("The provider's own lifecycle word, e.g. 'LIVE' or 'PAUSED-USER'."),
28
+ expiresAt: isoTime.nullable().describe("When the SIM's current term ends, in the provider's meaning of expiry — rolling plans renew through this boundary.")
29
+ }),
30
+ usage: z.object({
31
+ currentPeriodBytes: dataBytes.nullable().describe("Data used in the current billing period. null means 'not reported'."),
32
+ previousPeriodBytes: dataBytes.nullable(),
33
+ planName: z.string().nullable(),
34
+ planIncludedBytes: dataBytes.min(1).nullable().describe("Bytes the plan includes per period. null when the plan declares no allotment (flat-rate or pay-per-byte) — never zero."),
35
+ overageLimitBytes: dataBytes.min(1).nullable().describe("The operator-set usage cap. null means uncapped — never zero.")
36
+ }),
37
+ lastSession: connectivitySessionSchema.nullable()
38
+ }).meta({ id: "StationConnectivity" });
39
+ function parseStationConnectivity(value) {
40
+ const result = stationConnectivitySchema.safeParse(value);
41
+ return result.success ? result.data : null;
42
+ }
43
+ //#endregion
44
+ export { CONNECTIVITY_SERVICE_STATES, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { AirConditions, History, HistoryPoint, LiveSample, LiveSamples, Reading,
2
2
  import { CALM_THRESHOLD_MPS, COMPASS_POINTS, CompassPoint, FreshnessStatus, FreshnessThresholds, PeriodSummary, PressureTendency, SpeedThresholds, SpeedUnit, compassDirection, freshness, isCalm, normalizeDegrees, periodSummary, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps } from "./derive.js";
3
3
  import { FormatTime, StationStringOverrides, StationStrings, defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings } from "./strings.js";
4
4
  import { DirectionCellData, SummaryEntry, directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
5
+ import { CONNECTIVITY_SERVICE_STATES, ConnectivityServiceState, ConnectivitySession, StationConnectivity, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema } from "./connectivity.js";
5
6
  import { DisplayDefaults, DisplayProps, ResolvedDisplay, requireResolved, resolveDisplay, resolveStation } from "./display.js";
6
7
  import { currentEndpoint, feedEndpoint, liveEndpoint } from "./endpoints.js";
7
8
  import { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
@@ -10,4 +11,4 @@ import { MergeResult, foldCurrent, mergeCurrent } from "./merge-current.js";
10
11
  import { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
11
12
  import { AirRow, airRows, airSummary, lastStrikeWords } from "./air.js";
12
13
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
13
- export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type CompassPoint, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, type Reading, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationCurrent, type StationFeed, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
14
+ export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type CompassPoint, type ConnectivityServiceState, type ConnectivitySession, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, type Reading, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationConnectivity, type StationCurrent, type StationFeed, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, capabilitiesSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, stationCurrentSchema, stationFeedSchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation } from "./contract.js";
2
+ import { CONNECTIVITY_SERVICE_STATES, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema } from "./connectivity.js";
2
3
  import { CALM_THRESHOLD_MPS, COMPASS_POINTS, compassDirection, freshness, isCalm, normalizeDegrees, periodSummary, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps } from "./derive.js";
3
4
  import { defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings } from "./strings.js";
4
5
  import { requireResolved, resolveDisplay, resolveStation } from "./display.js";
@@ -10,4 +11,4 @@ import { foldCurrent, mergeCurrent } from "./merge-current.js";
10
11
  import { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
11
12
  import { airRows, airSummary, lastStrikeWords } from "./air.js";
12
13
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
13
- export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, METEOROLOGICAL_SEASON_MONTHS, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
14
+ export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, METEOROLOGICAL_SEASON_MONTHS, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
@@ -0,0 +1,22 @@
1
+ import { ConnectivityServiceState, StationConnectivity } from "../connectivity.js";
2
+ import { ServerEnvironment } from "./environment.js";
3
+ import { z } from "zod";
4
+ //#region src/server/hologram.d.ts
5
+ declare const HOLOGRAM_API_BASE = "https://dashboard.hologram.io/api/1";
6
+ declare const TRIAL_HOLOGRAM_CACHE_TTL_SECONDS = 300;
7
+ declare const hologramConnectivityConfigSchema: z.ZodObject<{
8
+ apiKey: z.ZodString;
9
+ deviceId: z.ZodNumber;
10
+ }, z.core.$strict>;
11
+ type HologramConnectivityConfig = z.output<typeof hologramConnectivityConfigSchema>;
12
+ type HologramConnectivityOptions = {
13
+ environment?: ServerEnvironment;
14
+ cacheTtlSeconds?: number;
15
+ apiBase?: string;
16
+ };
17
+ declare function hologramTimeToIso(value: string | null | undefined): string | null;
18
+ declare function hologramServiceState(state: string | null | undefined): ConnectivityServiceState;
19
+ declare function parseHologramConnectivity(value: string, expectedDeviceId: number, checkedAt: string): StationConnectivity;
20
+ declare function loadHologramConnectivity(config: HologramConnectivityConfig, options?: HologramConnectivityOptions): Promise<StationConnectivity>;
21
+ //#endregion
22
+ export { HOLOGRAM_API_BASE, HologramConnectivityConfig, HologramConnectivityOptions, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity };
@@ -0,0 +1,113 @@
1
+ import { fetchUpstreamText, resolveEnvironment } from "./environment.js";
2
+ import { z } from "zod";
3
+ import { UpstreamError } from "@azohra/meteo.core";
4
+ //#region src/server/hologram.ts
5
+ const HOLOGRAM_API_BASE = "https://dashboard.hologram.io/api/1";
6
+ const TRIAL_HOLOGRAM_CACHE_TTL_SECONDS = 300;
7
+ const hologramConnectivityConfigSchema = z.strictObject({
8
+ apiKey: z.string().min(1),
9
+ deviceId: z.number().int().positive()
10
+ });
11
+ function hologramTimeToIso(value) {
12
+ if (!value || value.startsWith("0000-00-00")) return null;
13
+ const iso = `${value.replace(" ", "T")}Z`;
14
+ return Number.isFinite(Date.parse(iso)) ? iso : null;
15
+ }
16
+ const nonEmpty = (value) => value ? value : null;
17
+ const hologramLastSessionSchema = z.object({
18
+ active: z.boolean().nullish(),
19
+ bytes: z.coerce.number().int().min(0).nullish(),
20
+ network_name: z.string().nullish(),
21
+ radio_access_technology: z.string().nullish(),
22
+ session_begin: z.string().nullish(),
23
+ session_end: z.string().nullish()
24
+ });
25
+ const hologramPlanSchema = z.object({
26
+ name: z.string().nullish(),
27
+ data: z.coerce.number().int().min(0).nullish()
28
+ });
29
+ const hologramLinkSchema = z.object({
30
+ state: z.string().nullish(),
31
+ cur_billing_data_used: z.number().int().min(0).nullish(),
32
+ last_billing_data_used: z.number().int().min(0).nullish(),
33
+ last_connect_time: z.string().nullish(),
34
+ last_network_used: z.string().nullish(),
35
+ overagelimit: z.number().int().nullish(),
36
+ plan: hologramPlanSchema.nullish(),
37
+ whenexpires: z.string().nullish()
38
+ });
39
+ const hologramDeviceSchema = z.object({
40
+ id: z.number().int(),
41
+ name: z.string().nullish(),
42
+ lastsession: hologramLastSessionSchema.nullish(),
43
+ links: z.object({ cellular: z.array(hologramLinkSchema) }).nullish()
44
+ });
45
+ const hologramEnvelopeSchema = z.object({
46
+ success: z.boolean(),
47
+ data: z.unknown().nullish(),
48
+ error: z.string().nullish()
49
+ });
50
+ function hologramServiceState(state) {
51
+ if (!state) return "unknown";
52
+ if (state.startsWith("LIVE")) return "active";
53
+ if (state.startsWith("PAUSED")) return "paused";
54
+ if (state.startsWith("DEAD")) return "retired";
55
+ if (state.startsWith("INACTIVE") || state.startsWith("FACTORY") || state.startsWith("TEST")) return "inactive";
56
+ return "unknown";
57
+ }
58
+ function parseHologramConnectivity(value, expectedDeviceId, checkedAt) {
59
+ let json;
60
+ try {
61
+ json = JSON.parse(value);
62
+ } catch {
63
+ throw new UpstreamError("Hologram returned malformed JSON");
64
+ }
65
+ const envelope = hologramEnvelopeSchema.safeParse(json);
66
+ if (!envelope.success) throw new UpstreamError("Hologram returned an unrecognized envelope");
67
+ if (!envelope.data.success) throw new UpstreamError(`Hologram refused the request: ${envelope.data.error ?? "no reason"}`);
68
+ const device = hologramDeviceSchema.safeParse(envelope.data.data);
69
+ if (!device.success || device.data.id !== expectedDeviceId) throw new UpstreamError("Hologram returned the wrong device");
70
+ const session = device.data.lastsession ?? null;
71
+ const link = device.data.links?.cellular[0] ?? null;
72
+ const sessionBeganAt = hologramTimeToIso(session?.session_begin);
73
+ const planIncludedBytes = link?.plan?.data || null;
74
+ const overageLimitBytes = link?.overagelimit != null && link.overagelimit > 0 ? link.overagelimit : null;
75
+ return {
76
+ sourceLabel: "Hologram",
77
+ checkedAt,
78
+ deviceName: nonEmpty(device.data.name),
79
+ online: session?.active ?? null,
80
+ lastConnectedAt: hologramTimeToIso(link?.last_connect_time) ?? sessionBeganAt,
81
+ carrier: nonEmpty(link?.last_network_used) ?? nonEmpty(session?.network_name),
82
+ radioTechnology: nonEmpty(session?.radio_access_technology),
83
+ sim: {
84
+ service: hologramServiceState(link?.state),
85
+ vendorState: link?.state ?? null,
86
+ expiresAt: hologramTimeToIso(link?.whenexpires)
87
+ },
88
+ usage: {
89
+ currentPeriodBytes: link?.cur_billing_data_used ?? null,
90
+ previousPeriodBytes: link?.last_billing_data_used ?? null,
91
+ planName: nonEmpty(link?.plan?.name),
92
+ planIncludedBytes,
93
+ overageLimitBytes
94
+ },
95
+ lastSession: sessionBeganAt ? {
96
+ beganAt: sessionBeganAt,
97
+ endedAt: hologramTimeToIso(session?.session_end),
98
+ bytes: session?.bytes ?? null
99
+ } : null
100
+ };
101
+ }
102
+ async function loadHologramConnectivity(config, options = {}) {
103
+ const environment = resolveEnvironment(options.environment);
104
+ return parseHologramConnectivity(await fetchUpstreamText(environment, {
105
+ url: `${options.apiBase ?? "https://dashboard.hologram.io/api/1"}/devices/${config.deviceId}`,
106
+ cacheKey: `hologram/device/${config.deviceId}`,
107
+ cacheTtlSeconds: options.cacheTtlSeconds ?? 300,
108
+ subject: `Hologram device ${config.deviceId}`,
109
+ headers: { Authorization: `Basic ${btoa(`apikey:${config.apiKey}`)}` }
110
+ }), config.deviceId, environment.now().toISOString());
111
+ }
112
+ //#endregion
113
+ export { HOLOGRAM_API_BASE, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity };
@@ -7,7 +7,8 @@ import { StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute,
7
7
  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
+ import { HOLOGRAM_API_BASE, HologramConnectivityConfig, HologramConnectivityOptions, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity } from "./hologram.js";
10
11
  import { TempestAdapterOptions, TempestObservation, loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
11
12
  import { EcowittAdapterOptions, EcowittObservation, loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";
12
13
  import { CAMPBELL_FIELD_CONTRACTS, CampbellAdapterOptions, CampbellTable, CampbellTableExpectation, loadCampbellCurrent, loadCampbellStation, naiveLocalToIso, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable } from "./adapters/campbell.js";
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 };
14
+ 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, HOLOGRAM_API_BASE, type HologramConnectivityConfig, type HologramConnectivityOptions, 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, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, 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, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadCampbellCurrent, loadCampbellStation, loadEcowittStation, loadHologramConnectivity, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseEcowittRealTime, parseHologramConnectivity, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl, workersCache };
@@ -10,4 +10,5 @@ import { DEFAULT_HISTORY_HOURS, StationLiveUnsupportedError, UnknownStationError
10
10
  import { defineStationAdapter } from "./adapter.js";
11
11
  import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
12
12
  import { createStationFeedHandler } from "./handler.js";
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 };
13
+ import { HOLOGRAM_API_BASE, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity } from "./hologram.js";
14
+ export { CAMPBELL_FIELD_CONTRACTS, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, HOLOGRAM_API_BASE, STATION_LIVE_SSE_HEADERS, StationLiveUnsupportedError, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, 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, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadCampbellCurrent, loadCampbellStation, loadEcowittStation, loadHologramConnectivity, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseEcowittRealTime, parseHologramConnectivity, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl, workersCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azohra/meteo.station",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "The station capability of meteo by Azohra: live weather-station reading, derivation, and display - the wire contract, provider adapters, a polling client, a Node server, and React and custom-element display bindings.",
5
5
  "keywords": [
6
6
  "weather-station",