@azohra/meteo.station 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/client/climatology.d.ts +27 -0
  2. package/dist/client/climatology.js +83 -0
  3. package/dist/client/history.d.ts +53 -0
  4. package/dist/client/history.js +114 -0
  5. package/dist/client/index.d.ts +3 -1
  6. package/dist/client/index.js +3 -1
  7. package/dist/client/live.js +15 -0
  8. package/dist/climatology.d.ts +61 -0
  9. package/dist/climatology.js +208 -0
  10. package/dist/contract-climatology.d.ts +69 -0
  11. package/dist/contract-climatology.js +50 -0
  12. package/dist/contract.d.ts +234 -1
  13. package/dist/contract.js +52 -4
  14. package/dist/derive.d.ts +23 -1
  15. package/dist/derive.js +43 -4
  16. package/dist/display.d.ts +4 -0
  17. package/dist/display.js +2 -1
  18. package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
  19. package/dist/elements/elements/AirExtremesElement.js +33 -0
  20. package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
  21. package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
  22. package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
  23. package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
  24. package/dist/elements/elements/CompassFanElement.d.ts +14 -0
  25. package/dist/elements/elements/CompassFanElement.js +92 -0
  26. package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
  27. package/dist/elements/elements/DailyPatternElement.js +20 -12
  28. package/dist/elements/elements/DialElement.js +14 -3
  29. package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
  30. package/dist/elements/elements/FavorableShareElement.js +47 -0
  31. package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
  32. package/dist/elements/elements/RecentSummariesElement.js +54 -0
  33. package/dist/elements/elements/StationFeedElement.d.ts +3 -0
  34. package/dist/elements/elements/StationFeedElement.js +13 -2
  35. package/dist/elements/elements/WindHistoryChartElement.js +16 -3
  36. package/dist/elements/elements/WindRoseElement.d.ts +1 -3
  37. package/dist/elements/elements/WindRoseElement.js +60 -62
  38. package/dist/elements/elements/atoms.js +3 -3
  39. package/dist/elements/index.d.ts +13 -1
  40. package/dist/elements/index.js +15 -3
  41. package/dist/elements/lib/ambient.d.ts +2 -0
  42. package/dist/elements/lib/attributes.js +24 -1
  43. package/dist/elements/lib/base.d.ts +3 -0
  44. package/dist/elements/lib/base.js +14 -2
  45. package/dist/endpoints.d.ts +7 -1
  46. package/dist/endpoints.js +13 -1
  47. package/dist/geometry.d.ts +22 -3
  48. package/dist/geometry.js +41 -5
  49. package/dist/index.d.ts +8 -6
  50. package/dist/index.js +8 -6
  51. package/dist/instruments.d.ts +7 -5
  52. package/dist/instruments.js +20 -7
  53. package/dist/merge-current.js +2 -1
  54. package/dist/react/components/AirExtremes.d.ts +16 -0
  55. package/dist/react/components/AirExtremes.js +38 -0
  56. package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
  57. package/dist/react/components/ClimatologyDailyPattern.js +59 -0
  58. package/dist/react/components/ClimatologyRose.d.ts +18 -0
  59. package/dist/react/components/ClimatologyRose.js +45 -0
  60. package/dist/react/components/CompassFan.d.ts +17 -0
  61. package/dist/react/components/CompassFan.js +93 -0
  62. package/dist/react/components/DailyPattern.d.ts +4 -1
  63. package/dist/react/components/DailyPattern.js +13 -6
  64. package/dist/react/components/Dial.d.ts +3 -1
  65. package/dist/react/components/Dial.js +13 -2
  66. package/dist/react/components/FavorableShare.d.ts +14 -0
  67. package/dist/react/components/FavorableShare.js +43 -0
  68. package/dist/react/components/RecentSummaries.d.ts +19 -0
  69. package/dist/react/components/RecentSummaries.js +65 -0
  70. package/dist/react/components/StationFeedProvider.d.ts +4 -1
  71. package/dist/react/components/StationFeedProvider.js +5 -3
  72. package/dist/react/components/WindHistoryChart.d.ts +6 -1
  73. package/dist/react/components/WindHistoryChart.js +18 -3
  74. package/dist/react/components/WindRose.d.ts +4 -2
  75. package/dist/react/components/WindRose.js +80 -71
  76. package/dist/react/components/WindSampleStrip.d.ts +3 -1
  77. package/dist/react/components/WindSampleStrip.js +6 -3
  78. package/dist/react/components/atoms.d.ts +4 -1
  79. package/dist/react/components/atoms.js +6 -3
  80. package/dist/react/hooks/useStationClimatology.d.ts +18 -0
  81. package/dist/react/hooks/useStationClimatology.js +25 -0
  82. package/dist/react/index.d.ts +10 -3
  83. package/dist/react/index.js +9 -2
  84. package/dist/scene/air-extremes.d.ts +2 -0
  85. package/dist/scene/air-extremes.js +42 -0
  86. package/dist/scene/atoms.d.ts +2 -1
  87. package/dist/scene/atoms.js +6 -4
  88. package/dist/scene/climatology-pattern.d.ts +6 -0
  89. package/dist/scene/climatology-pattern.js +35 -0
  90. package/dist/scene/climatology-rose.d.ts +5 -0
  91. package/dist/scene/climatology-rose.js +49 -0
  92. package/dist/scene/compass-fan.d.ts +3 -0
  93. package/dist/scene/compass-fan.js +115 -0
  94. package/dist/scene/daily-pattern.d.ts +1 -0
  95. package/dist/scene/daily-pattern.js +20 -6
  96. package/dist/scene/dial.d.ts +1 -0
  97. package/dist/scene/dial.js +16 -3
  98. package/dist/scene/favorable-share.d.ts +3 -0
  99. package/dist/scene/favorable-share.js +41 -0
  100. package/dist/scene/index.d.ts +9 -3
  101. package/dist/scene/recent-summaries.d.ts +4 -0
  102. package/dist/scene/recent-summaries.js +75 -0
  103. package/dist/scene/rose.d.ts +2 -1
  104. package/dist/scene/rose.js +18 -3
  105. package/dist/scene/sample-strip.d.ts +1 -0
  106. package/dist/scene/sample-strip.js +1 -1
  107. package/dist/scene/wind-history.d.ts +1 -0
  108. package/dist/scene/wind-history.js +4 -3
  109. package/dist/scene/wind-plot.d.ts +1 -0
  110. package/dist/scene/wind-plot.js +30 -3
  111. package/dist/server/adapter.d.ts +2 -1
  112. package/dist/server/adapter.js +2 -1
  113. package/dist/server/adapters/windnerd-climatology.d.ts +33 -0
  114. package/dist/server/adapters/windnerd-climatology.js +81 -0
  115. package/dist/server/adapters/windnerd-live.js +21 -13
  116. package/dist/server/adapters/windnerd.d.ts +31 -4
  117. package/dist/server/adapters/windnerd.js +197 -19
  118. package/dist/server/feed.d.ts +44 -2
  119. package/dist/server/feed.js +63 -2
  120. package/dist/server/handler.d.ts +11 -1
  121. package/dist/server/handler.js +83 -2
  122. package/dist/server/index.d.ts +4 -3
  123. package/dist/server/index.js +4 -3
  124. package/dist/strings.d.ts +12 -0
  125. package/dist/strings.js +12 -0
  126. package/package.json +2 -2
  127. package/schema/example-climatology.json +86 -0
  128. package/schema/example-history.json +38 -0
  129. package/schema/stationclimatology.schema.json +195 -0
  130. package/schema/stationcurrent.schema.json +173 -0
  131. package/schema/stationfeed.schema.json +173 -0
  132. package/schema/stationhistory.schema.json +186 -0
  133. package/schema/stationlive.schema.json +202 -0
  134. package/styles.css +215 -0
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ //#region src/contract-climatology.ts
3
+ const STATION_CLIMATOLOGY_SCHEMA_VERSION = 1;
4
+ const count = z.number().int().min(0);
5
+ const climatologySectorSchema = z.object({
6
+ sector: z.number().int().min(0).describe("Sector index; bearing = sector × (360 / sectorCount)."),
7
+ count: count.describe("Non-calm records whose direction fell in this sector."),
8
+ uSum: z.number().finite().describe("Sum of zonal components, m/s — core's wind sign."),
9
+ vSum: z.number().finite().describe("Sum of meridional components, m/s."),
10
+ speedSumMps: z.number().finite().min(0).describe("Sum of scalar mean speeds, m/s."),
11
+ bandCounts: z.array(count).describe("Records per speed band against the document's thresholdsMps — length thresholdsMps.length + 1."),
12
+ maxGustMps: z.number().finite().min(0).nullable()
13
+ }).meta({ id: "ClimatologySector" });
14
+ const climatologyCellSchema = z.object({
15
+ month: z.number().int().min(1).max(12),
16
+ slot: z.number().int().min(0).describe("Slot of day: floor(standard-time minute / slotMinutes)."),
17
+ sampleCount: count.describe("All records in the bucket, calm included."),
18
+ calmCount: count,
19
+ sectors: z.array(climatologySectorSchema)
20
+ }).meta({ id: "ClimatologyCell" });
21
+ const climatologyYearSchema = z.object({
22
+ year: z.number().int(),
23
+ sampleCount: count,
24
+ expectedCount: count.describe("Records a gapless station would have produced over the requested window — the honesty denominator; a leading dropout lowers the ratio instead of hiding.")
25
+ }).meta({ id: "ClimatologyYear" });
26
+ const isoTime = z.string().refine((value) => Number.isFinite(Date.parse(value)), { message: "not an ISO timestamp" }).meta({ format: "date-time" });
27
+ const stationClimatologySchema = z.object({
28
+ schemaVersion: z.literal(1),
29
+ servedAt: isoTime,
30
+ stationId: z.string().min(1),
31
+ sectorCount: z.number().int().min(4),
32
+ slotMinutes: z.number().int().positive().describe("Minutes per slot of day; must divide 1440."),
33
+ thresholdsMps: z.array(z.number().finite().min(0)).describe("The consumer's speed-band bounds the cube was binned with, m/s, ascending. A judgment parameter echoed so a reader knows which opinion shaped bandCounts."),
34
+ utcOffsetMinutes: z.number().finite().describe("The station's STANDARD utc offset used for month and slot bucketing — no DST, so a slot means the same solar hours in January and July."),
35
+ years: z.array(climatologyYearSchema).describe("Oldest first; the coverage ledger."),
36
+ cells: z.array(climatologyCellSchema)
37
+ }).meta({ id: "StationClimatology" });
38
+ function parseStationClimatology(value) {
39
+ const result = stationClimatologySchema.safeParse(value);
40
+ return result.success ? result.data : null;
41
+ }
42
+ function parseStationClimatologyJson(text) {
43
+ try {
44
+ return parseStationClimatology(JSON.parse(text));
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+ //#endregion
50
+ export { STATION_CLIMATOLOGY_SCHEMA_VERSION, climatologyCellSchema, climatologySectorSchema, climatologyYearSchema, parseStationClimatology, parseStationClimatologyJson, stationClimatologySchema };
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { DirectionArc } from "@azohra/meteo.core";
2
3
  //#region src/contract.d.ts
3
4
  declare const STATION_SCHEMA_VERSION = 2;
4
5
  declare const UNAVAILABLE_REASONS: readonly ["upstream_error", "timeout", "rate_limited", "contract_break", "not_configured"];
@@ -64,6 +65,11 @@ declare const historyPointSchema: z.ZodObject<{
64
65
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
65
66
  temperatureC: z.ZodNullable<z.ZodNumber>;
66
67
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
68
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
69
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
70
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
71
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
72
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
67
73
  }, z.core.$strip>;
68
74
  type HistoryPoint = z.infer<typeof historyPointSchema>;
69
75
  declare const historySchema: z.ZodObject<{
@@ -76,9 +82,33 @@ declare const historySchema: z.ZodObject<{
76
82
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
77
83
  temperatureC: z.ZodNullable<z.ZodNumber>;
78
84
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
85
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
86
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
87
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
88
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
89
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
79
90
  }, z.core.$strip>>;
80
91
  }, z.core.$strip>;
81
92
  type History = z.infer<typeof historySchema>;
93
+ declare const recentSummarySchema: z.ZodObject<{
94
+ windowMinutes: z.ZodNumber;
95
+ stepMinutes: z.ZodNumber;
96
+ points: z.ZodArray<z.ZodObject<{
97
+ observedAt: z.ZodString;
98
+ windAvgMps: z.ZodNumber;
99
+ windGustMps: z.ZodNullable<z.ZodNumber>;
100
+ windLullMps: z.ZodNullable<z.ZodNumber>;
101
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
102
+ temperatureC: z.ZodNullable<z.ZodNumber>;
103
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
104
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
105
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
106
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
107
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
108
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>;
111
+ type RecentSummary = z.infer<typeof recentSummarySchema>;
82
112
  declare const liveSampleSchema: z.ZodObject<{
83
113
  observedAt: z.ZodString;
84
114
  windMps: z.ZodNumber;
@@ -101,8 +131,13 @@ declare const capabilitiesSchema: z.ZodObject<{
101
131
  history: z.ZodBoolean;
102
132
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
103
133
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
134
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
104
135
  }, z.core.$strip>;
105
136
  type StationCapabilities = z.infer<typeof capabilitiesSchema>;
137
+ declare const directionArcSchema: z.ZodObject<{
138
+ fromDeg: z.ZodNumber;
139
+ toDeg: z.ZodNumber;
140
+ }, z.core.$strip>;
106
141
  declare const stationMetaSchema: z.ZodObject<{
107
142
  id: z.ZodString;
108
143
  name: z.ZodString;
@@ -112,6 +147,11 @@ declare const stationMetaSchema: z.ZodObject<{
112
147
  longitude: z.ZodNullable<z.ZodNumber>;
113
148
  timeZone: z.ZodNullable<z.ZodString>;
114
149
  elevationM: z.ZodNullable<z.ZodNumber>;
150
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
151
+ fromDeg: z.ZodNumber;
152
+ toDeg: z.ZodNumber;
153
+ }, z.core.$strip>>>>;
154
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
115
155
  capabilities: z.ZodObject<{
116
156
  gustLull: z.ZodBoolean;
117
157
  temperature: z.ZodBoolean;
@@ -119,6 +159,7 @@ declare const stationMetaSchema: z.ZodObject<{
119
159
  history: z.ZodBoolean;
120
160
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
121
161
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
162
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
122
163
  }, z.core.$strip>;
123
164
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
124
165
  recommendedPollSeconds: z.ZodNumber;
@@ -164,6 +205,11 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
205
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
165
206
  temperatureC: z.ZodNullable<z.ZodNumber>;
166
207
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
208
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
209
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
210
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
211
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
212
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
167
213
  }, z.core.$strip>>;
168
214
  }, z.core.$strip>>;
169
215
  telemetry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -177,6 +223,24 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
177
223
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
178
224
  }, z.core.$strip>>;
179
225
  }, z.core.$strip>>>;
226
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
227
+ windowMinutes: z.ZodNumber;
228
+ stepMinutes: z.ZodNumber;
229
+ points: z.ZodArray<z.ZodObject<{
230
+ observedAt: z.ZodString;
231
+ windAvgMps: z.ZodNumber;
232
+ windGustMps: z.ZodNullable<z.ZodNumber>;
233
+ windLullMps: z.ZodNullable<z.ZodNumber>;
234
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
235
+ temperatureC: z.ZodNullable<z.ZodNumber>;
236
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
237
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
238
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
239
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
240
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
241
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
242
+ }, z.core.$strip>>;
243
+ }, z.core.$strip>>>>;
180
244
  id: z.ZodString;
181
245
  name: z.ZodString;
182
246
  sourceLabel: z.ZodString;
@@ -185,6 +249,11 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
185
249
  longitude: z.ZodNullable<z.ZodNumber>;
186
250
  timeZone: z.ZodNullable<z.ZodString>;
187
251
  elevationM: z.ZodNullable<z.ZodNumber>;
252
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
253
+ fromDeg: z.ZodNumber;
254
+ toDeg: z.ZodNumber;
255
+ }, z.core.$strip>>>>;
256
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
188
257
  capabilities: z.ZodObject<{
189
258
  gustLull: z.ZodBoolean;
190
259
  temperature: z.ZodBoolean;
@@ -192,6 +261,7 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
192
261
  history: z.ZodBoolean;
193
262
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
194
263
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
264
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
195
265
  }, z.core.$strip>;
196
266
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
197
267
  recommendedPollSeconds: z.ZodNumber;
@@ -214,6 +284,11 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
214
284
  longitude: z.ZodNullable<z.ZodNumber>;
215
285
  timeZone: z.ZodNullable<z.ZodString>;
216
286
  elevationM: z.ZodNullable<z.ZodNumber>;
287
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
288
+ fromDeg: z.ZodNumber;
289
+ toDeg: z.ZodNumber;
290
+ }, z.core.$strip>>>>;
291
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
217
292
  capabilities: z.ZodObject<{
218
293
  gustLull: z.ZodBoolean;
219
294
  temperature: z.ZodBoolean;
@@ -221,6 +296,7 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
221
296
  history: z.ZodBoolean;
222
297
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
223
298
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
299
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
224
300
  }, z.core.$strip>;
225
301
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
226
302
  recommendedPollSeconds: z.ZodNumber;
@@ -270,6 +346,11 @@ declare const stationFeedSchema: z.ZodObject<{
270
346
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
271
347
  temperatureC: z.ZodNullable<z.ZodNumber>;
272
348
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
349
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
350
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
351
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
352
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
353
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
273
354
  }, z.core.$strip>>;
274
355
  }, z.core.$strip>>;
275
356
  telemetry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -283,6 +364,24 @@ declare const stationFeedSchema: z.ZodObject<{
283
364
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
284
365
  }, z.core.$strip>>;
285
366
  }, z.core.$strip>>>;
367
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
368
+ windowMinutes: z.ZodNumber;
369
+ stepMinutes: z.ZodNumber;
370
+ points: z.ZodArray<z.ZodObject<{
371
+ observedAt: z.ZodString;
372
+ windAvgMps: z.ZodNumber;
373
+ windGustMps: z.ZodNullable<z.ZodNumber>;
374
+ windLullMps: z.ZodNullable<z.ZodNumber>;
375
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
376
+ temperatureC: z.ZodNullable<z.ZodNumber>;
377
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
378
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
379
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
380
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
381
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
382
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
383
+ }, z.core.$strip>>;
384
+ }, z.core.$strip>>>>;
286
385
  id: z.ZodString;
287
386
  name: z.ZodString;
288
387
  sourceLabel: z.ZodString;
@@ -291,6 +390,11 @@ declare const stationFeedSchema: z.ZodObject<{
291
390
  longitude: z.ZodNullable<z.ZodNumber>;
292
391
  timeZone: z.ZodNullable<z.ZodString>;
293
392
  elevationM: z.ZodNullable<z.ZodNumber>;
393
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
394
+ fromDeg: z.ZodNumber;
395
+ toDeg: z.ZodNumber;
396
+ }, z.core.$strip>>>>;
397
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
294
398
  capabilities: z.ZodObject<{
295
399
  gustLull: z.ZodBoolean;
296
400
  temperature: z.ZodBoolean;
@@ -298,6 +402,7 @@ declare const stationFeedSchema: z.ZodObject<{
298
402
  history: z.ZodBoolean;
299
403
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
300
404
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
405
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
301
406
  }, z.core.$strip>;
302
407
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
303
408
  recommendedPollSeconds: z.ZodNumber;
@@ -320,6 +425,11 @@ declare const stationFeedSchema: z.ZodObject<{
320
425
  longitude: z.ZodNullable<z.ZodNumber>;
321
426
  timeZone: z.ZodNullable<z.ZodString>;
322
427
  elevationM: z.ZodNullable<z.ZodNumber>;
428
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
429
+ fromDeg: z.ZodNumber;
430
+ toDeg: z.ZodNumber;
431
+ }, z.core.$strip>>>>;
432
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
323
433
  capabilities: z.ZodObject<{
324
434
  gustLull: z.ZodBoolean;
325
435
  temperature: z.ZodBoolean;
@@ -327,6 +437,7 @@ declare const stationFeedSchema: z.ZodObject<{
327
437
  history: z.ZodBoolean;
328
438
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
329
439
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
440
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
330
441
  }, z.core.$strip>;
331
442
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
332
443
  recommendedPollSeconds: z.ZodNumber;
@@ -376,6 +487,11 @@ declare const stationCurrentSchema: z.ZodObject<{
376
487
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
377
488
  temperatureC: z.ZodNullable<z.ZodNumber>;
378
489
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
490
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
491
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
492
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
493
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
494
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
379
495
  }, z.core.$strip>>;
380
496
  }, z.core.$strip>>;
381
497
  telemetry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -389,6 +505,24 @@ declare const stationCurrentSchema: z.ZodObject<{
389
505
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
390
506
  }, z.core.$strip>>;
391
507
  }, z.core.$strip>>>;
508
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
509
+ windowMinutes: z.ZodNumber;
510
+ stepMinutes: z.ZodNumber;
511
+ points: z.ZodArray<z.ZodObject<{
512
+ observedAt: z.ZodString;
513
+ windAvgMps: z.ZodNumber;
514
+ windGustMps: z.ZodNullable<z.ZodNumber>;
515
+ windLullMps: z.ZodNullable<z.ZodNumber>;
516
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
517
+ temperatureC: z.ZodNullable<z.ZodNumber>;
518
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
519
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
520
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
521
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
522
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
523
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
524
+ }, z.core.$strip>>;
525
+ }, z.core.$strip>>>>;
392
526
  id: z.ZodString;
393
527
  name: z.ZodString;
394
528
  sourceLabel: z.ZodString;
@@ -397,6 +531,11 @@ declare const stationCurrentSchema: z.ZodObject<{
397
531
  longitude: z.ZodNullable<z.ZodNumber>;
398
532
  timeZone: z.ZodNullable<z.ZodString>;
399
533
  elevationM: z.ZodNullable<z.ZodNumber>;
534
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
535
+ fromDeg: z.ZodNumber;
536
+ toDeg: z.ZodNumber;
537
+ }, z.core.$strip>>>>;
538
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
400
539
  capabilities: z.ZodObject<{
401
540
  gustLull: z.ZodBoolean;
402
541
  temperature: z.ZodBoolean;
@@ -404,6 +543,7 @@ declare const stationCurrentSchema: z.ZodObject<{
404
543
  history: z.ZodBoolean;
405
544
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
406
545
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
546
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
407
547
  }, z.core.$strip>;
408
548
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
409
549
  recommendedPollSeconds: z.ZodNumber;
@@ -426,6 +566,11 @@ declare const stationCurrentSchema: z.ZodObject<{
426
566
  longitude: z.ZodNullable<z.ZodNumber>;
427
567
  timeZone: z.ZodNullable<z.ZodString>;
428
568
  elevationM: z.ZodNullable<z.ZodNumber>;
569
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
570
+ fromDeg: z.ZodNumber;
571
+ toDeg: z.ZodNumber;
572
+ }, z.core.$strip>>>>;
573
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
429
574
  capabilities: z.ZodObject<{
430
575
  gustLull: z.ZodBoolean;
431
576
  temperature: z.ZodBoolean;
@@ -433,12 +578,38 @@ declare const stationCurrentSchema: z.ZodObject<{
433
578
  history: z.ZodBoolean;
434
579
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
435
580
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
581
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
436
582
  }, z.core.$strip>;
437
583
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
438
584
  recommendedPollSeconds: z.ZodNumber;
439
585
  }, z.core.$strip>], "status">;
440
586
  }, z.core.$strip>;
441
587
  type StationCurrent = z.infer<typeof stationCurrentSchema>;
588
+ declare const stationHistorySchema: z.ZodObject<{
589
+ schemaVersion: z.ZodLiteral<2>;
590
+ servedAt: z.ZodString;
591
+ stationId: z.ZodString;
592
+ history: z.ZodObject<{
593
+ periodMinutes: z.ZodNumber;
594
+ points: z.ZodArray<z.ZodObject<{
595
+ observedAt: z.ZodString;
596
+ windAvgMps: z.ZodNumber;
597
+ windGustMps: z.ZodNullable<z.ZodNumber>;
598
+ windLullMps: z.ZodNullable<z.ZodNumber>;
599
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
600
+ temperatureC: z.ZodNullable<z.ZodNumber>;
601
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
602
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
603
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
604
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
605
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
606
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
607
+ }, z.core.$strip>>;
608
+ }, z.core.$strip>;
609
+ }, z.core.$strip>;
610
+ type StationHistory = z.infer<typeof stationHistorySchema>;
611
+ declare function parseStationHistory(value: unknown): StationHistory | null;
612
+ declare function parseStationHistoryJson(text: string): StationHistory | null;
442
613
  declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
443
614
  type: z.ZodLiteral<"init">;
444
615
  schemaVersion: z.ZodLiteral<2>;
@@ -483,6 +654,11 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
483
654
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
484
655
  temperatureC: z.ZodNullable<z.ZodNumber>;
485
656
  seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
657
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
658
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
659
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
660
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
661
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
486
662
  }, z.core.$strip>>;
487
663
  }, z.core.$strip>>;
488
664
  telemetry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -496,6 +672,24 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
496
672
  windDirectionDeg: z.ZodNullable<z.ZodNumber>;
497
673
  }, z.core.$strip>>;
498
674
  }, z.core.$strip>>>;
675
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
676
+ windowMinutes: z.ZodNumber;
677
+ stepMinutes: z.ZodNumber;
678
+ points: z.ZodArray<z.ZodObject<{
679
+ observedAt: z.ZodString;
680
+ windAvgMps: z.ZodNumber;
681
+ windGustMps: z.ZodNullable<z.ZodNumber>;
682
+ windLullMps: z.ZodNullable<z.ZodNumber>;
683
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
684
+ temperatureC: z.ZodNullable<z.ZodNumber>;
685
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
686
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
687
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
688
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
689
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
690
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
691
+ }, z.core.$strip>>;
692
+ }, z.core.$strip>>>>;
499
693
  id: z.ZodString;
500
694
  name: z.ZodString;
501
695
  sourceLabel: z.ZodString;
@@ -504,6 +698,11 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
504
698
  longitude: z.ZodNullable<z.ZodNumber>;
505
699
  timeZone: z.ZodNullable<z.ZodString>;
506
700
  elevationM: z.ZodNullable<z.ZodNumber>;
701
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
702
+ fromDeg: z.ZodNumber;
703
+ toDeg: z.ZodNumber;
704
+ }, z.core.$strip>>>>;
705
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
507
706
  capabilities: z.ZodObject<{
508
707
  gustLull: z.ZodBoolean;
509
708
  temperature: z.ZodBoolean;
@@ -511,6 +710,7 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
511
710
  history: z.ZodBoolean;
512
711
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
513
712
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
713
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
514
714
  }, z.core.$strip>;
515
715
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
516
716
  recommendedPollSeconds: z.ZodNumber;
@@ -533,6 +733,11 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
533
733
  longitude: z.ZodNullable<z.ZodNumber>;
534
734
  timeZone: z.ZodNullable<z.ZodString>;
535
735
  elevationM: z.ZodNullable<z.ZodNumber>;
736
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
737
+ fromDeg: z.ZodNumber;
738
+ toDeg: z.ZodNumber;
739
+ }, z.core.$strip>>>>;
740
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
536
741
  capabilities: z.ZodObject<{
537
742
  gustLull: z.ZodBoolean;
538
743
  temperature: z.ZodBoolean;
@@ -540,6 +745,7 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
540
745
  history: z.ZodBoolean;
541
746
  live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
542
747
  battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
748
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
543
749
  }, z.core.$strip>;
544
750
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
545
751
  recommendedPollSeconds: z.ZodNumber;
@@ -590,6 +796,28 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
590
796
  telemetry: z.ZodNullable<z.ZodObject<{
591
797
  batteryVoltage: z.ZodNullable<z.ZodNumber>;
592
798
  }, z.core.$strip>>;
799
+ }, z.core.$strip>, z.ZodObject<{
800
+ type: z.ZodLiteral<"summaries">;
801
+ stationId: z.ZodString;
802
+ servedAt: z.ZodString;
803
+ summaries: z.ZodArray<z.ZodObject<{
804
+ windowMinutes: z.ZodNumber;
805
+ stepMinutes: z.ZodNumber;
806
+ points: z.ZodArray<z.ZodObject<{
807
+ observedAt: z.ZodString;
808
+ windAvgMps: z.ZodNumber;
809
+ windGustMps: z.ZodNullable<z.ZodNumber>;
810
+ windLullMps: z.ZodNullable<z.ZodNumber>;
811
+ windDirectionDeg: z.ZodNullable<z.ZodNumber>;
812
+ temperatureC: z.ZodNullable<z.ZodNumber>;
813
+ seaLevelPressureHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
814
+ windVectorAvgMps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
815
+ temperatureMinC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
816
+ temperatureMaxC: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
817
+ seaLevelPressureMinHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
818
+ seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
819
+ }, z.core.$strip>>;
820
+ }, z.core.$strip>>;
593
821
  }, z.core.$strip>, z.ZodObject<{
594
822
  type: z.ZodLiteral<"ping">;
595
823
  servedAt: z.ZodString;
@@ -613,5 +841,10 @@ declare function parseStationLiveFrame(value: unknown): StationLiveFrame | null;
613
841
  declare function parseStationLiveFrameJson(text: string): StationLiveFrame | null;
614
842
  declare function emptyConditions(overrides?: Partial<AirConditions>): AirConditions;
615
843
  declare function unavailableStation(meta: StationMeta, reason: UnavailableReason): Station;
844
+ /** The source's declared favorable sectors, or null when it declares nothing
845
+ * knowable. Data, not judgment: no component reads the meta field itself —
846
+ * a consumer opts in, e.g.
847
+ * `favorableDirections={declaredFavorableDirections(station) ?? ownArcs}`. */
848
+ declare function declaredFavorableDirections(station: StationMeta): DirectionArc[] | null;
616
849
  //#endregion
617
- export { AirConditions, History, HistoryPoint, LiveSample, LiveSamples, Reading, STATION_SCHEMA_VERSION, Station, StationCapabilities, StationCurrent, StationFeed, StationLiveFrame, StationMeta, StationTelemetry, UNAVAILABLE_REASONS, UnavailableReason, airConditionsSchema, capabilitiesSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, stationCurrentSchema, stationFeedSchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation };
850
+ export { AirConditions, History, HistoryPoint, LiveSample, LiveSamples, Reading, RecentSummary, STATION_SCHEMA_VERSION, Station, StationCapabilities, StationCurrent, StationFeed, StationHistory, StationLiveFrame, StationMeta, StationTelemetry, UNAVAILABLE_REASONS, UnavailableReason, airConditionsSchema, capabilitiesSchema, declaredFavorableDirections, directionArcSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, recentSummarySchema, stationCurrentSchema, stationFeedSchema, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation };
package/dist/contract.js CHANGED
@@ -43,12 +43,22 @@ const historyPointSchema = z.object({
43
43
  windLullMps: speedMps.nullable(),
44
44
  windDirectionDeg: windDirectionDeg.nullable().describe("Degrees FROM; null exactly when the period was calm (below 0.5 m/s)."),
45
45
  temperatureC: z.number().finite().nullable(),
46
- seaLevelPressureHpa: z.number().finite().positive().nullish()
46
+ seaLevelPressureHpa: z.number().finite().positive().nullish(),
47
+ windVectorAvgMps: speedMps.nullish().describe("Vector-mean m/s over the period — the honest input for further vector re-aggregation; at most windAvgMps. Absent or null reads as 'not published here'."),
48
+ temperatureMinC: z.number().finite().nullish(),
49
+ temperatureMaxC: z.number().finite().nullish(),
50
+ seaLevelPressureMinHpa: z.number().finite().positive().nullish(),
51
+ seaLevelPressureMaxHpa: z.number().finite().positive().nullish()
47
52
  }).meta({ id: "HistoryPoint" });
48
53
  const historySchema = z.object({
49
54
  periodMinutes: z.number().finite().positive().describe("Minutes each point covers. Wind run, vane thinning, and dropout detection are functions of it."),
50
55
  points: z.array(historyPointSchema).describe("A dropout is an ABSENT record, never a zeroed one — gaps carry no points.")
51
56
  }).meta({ id: "History" });
57
+ const recentSummarySchema = z.object({
58
+ windowMinutes: z.number().finite().positive().describe("The rolling window this summarises."),
59
+ stepMinutes: z.number().finite().positive().describe("Minutes each point covers."),
60
+ points: z.array(historyPointSchema).describe("Oldest first, one per filled step; a step the source left empty is ABSENT.")
61
+ }).meta({ id: "RecentSummary" });
52
62
  const liveSampleSchema = z.object({
53
63
  observedAt: isoTime,
54
64
  windMps: speedMps.describe("Instantaneous m/s — a single anemometer sample, not a period mean."),
@@ -64,8 +74,13 @@ const capabilitiesSchema = z.object({
64
74
  conditions: z.boolean(),
65
75
  history: z.boolean(),
66
76
  live: z.boolean().nullish().describe("The station has a live sample stream; absent or null reads as false."),
67
- battery: z.boolean().nullish().describe("The station reports battery telemetry; absent or null reads as false.")
77
+ battery: z.boolean().nullish().describe("The station reports battery telemetry; absent or null reads as false."),
78
+ recentSummaries: z.boolean().nullish().describe("The source maintains pre-digested rolling step summaries; absent or null reads as false.")
68
79
  }).describe("Declared from what the hardware carries, never inferred from data. Capabilities gate client UI structure; a dark sensor keeps its structure and reports null.").meta({ id: "StationCapabilities" });
80
+ const directionArcSchema = z.object({
81
+ fromDeg: z.number().finite().describe("Degrees FROM, clockwise from north."),
82
+ toDeg: z.number().finite().describe("Degrees FROM; fromDeg > toDeg wraps through north, boundaries inclusive.")
83
+ }).describe("One arc of favorable FROM bearings — core's DirectionArc shape on the wire.").meta({ id: "DirectionArc" });
69
84
  const stationMetaShape = {
70
85
  id: z.string().min(1),
71
86
  name: z.string().min(1),
@@ -75,6 +90,8 @@ const stationMetaShape = {
75
90
  longitude: z.number().finite().min(-180).lt(180).nullable(),
76
91
  timeZone: z.string().min(1).nullable(),
77
92
  elevationM: z.number().finite().nullable(),
93
+ declaredFavorableDirections: z.array(directionArcSchema).nullish(),
94
+ broadcastDelaySeconds: z.number().finite().min(0).nullish().describe("The source's own live-playback delay, seconds; absent or null when the vendor states none."),
78
95
  capabilities: capabilitiesSchema,
79
96
  samplingWindowSeconds: z.number().finite().positive().nullable(),
80
97
  recommendedPollSeconds: z.number().finite().positive()
@@ -86,7 +103,8 @@ const stationSchema = z.discriminatedUnion("status", [z.object({
86
103
  reading: readingSchema,
87
104
  history: historySchema.nullable(),
88
105
  telemetry: telemetrySchema.nullish(),
89
- samples: liveSamplesSchema.nullish()
106
+ samples: liveSamplesSchema.nullish(),
107
+ recentSummaries: z.array(recentSummarySchema).nullish()
90
108
  }), z.object({
91
109
  ...stationMetaShape,
92
110
  status: z.literal("unavailable"),
@@ -105,6 +123,23 @@ const stationCurrentSchema = z.object({
105
123
  servedAt: isoTime,
106
124
  station: stationSchema
107
125
  });
126
+ const stationHistorySchema = z.object({
127
+ schemaVersion: z.literal(2),
128
+ servedAt: isoTime,
129
+ stationId: z.string().min(1),
130
+ history: historySchema.describe("The window's records at the served resolution; periodMinutes echoes what the source actually supplied, which may differ from the request when the vendor snapped it.")
131
+ }).meta({ id: "StationHistory" });
132
+ function parseStationHistory(value) {
133
+ const result = stationHistorySchema.safeParse(value);
134
+ return result.success ? result.data : null;
135
+ }
136
+ function parseStationHistoryJson(text) {
137
+ try {
138
+ return parseStationHistory(JSON.parse(text));
139
+ } catch {
140
+ return null;
141
+ }
142
+ }
108
143
  const stationLiveFrameSchema = z.discriminatedUnion("type", [
109
144
  z.object({
110
145
  type: z.literal("init"),
@@ -124,6 +159,12 @@ const stationLiveFrameSchema = z.discriminatedUnion("type", [
124
159
  reading: readingSchema,
125
160
  telemetry: telemetrySchema.nullable()
126
161
  }),
162
+ z.object({
163
+ type: z.literal("summaries"),
164
+ stationId: z.string().min(1),
165
+ servedAt: isoTime,
166
+ summaries: z.array(recentSummarySchema)
167
+ }),
127
168
  z.object({
128
169
  type: z.literal("ping"),
129
170
  servedAt: isoTime
@@ -193,5 +234,12 @@ function unavailableStation(meta, reason) {
193
234
  history: null
194
235
  };
195
236
  }
237
+ /** The source's declared favorable sectors, or null when it declares nothing
238
+ * knowable. Data, not judgment: no component reads the meta field itself —
239
+ * a consumer opts in, e.g.
240
+ * `favorableDirections={declaredFavorableDirections(station) ?? ownArcs}`. */
241
+ function declaredFavorableDirections(station) {
242
+ return station.declaredFavorableDirections ?? null;
243
+ }
196
244
  //#endregion
197
- export { 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 };
245
+ export { STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, capabilitiesSchema, declaredFavorableDirections, directionArcSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, recentSummarySchema, stationCurrentSchema, stationFeedSchema, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation };
package/dist/derive.d.ts CHANGED
@@ -31,6 +31,16 @@ type PeriodSummary = {
31
31
  declare function periodSummary(history: History): PeriodSummary | null;
32
32
  declare function seaLevelPressureHpa(stationPressureHpa: number, elevationM: number, temperatureC?: number | null): number;
33
33
  type PressureTendency = "falling" | "rising" | "steady";
34
+ /** The signed sea-level pressure change over the trailing window, hPa —
35
+ * the number behind the tendency word. The reference is the carried point
36
+ * nearest the window's start, and a record covering under 60% of the
37
+ * window returns null rather than a delta over a shorter span. */
38
+ declare function pressureDeltaHpa(points: ReadonlyArray<{
39
+ observedAt: string;
40
+ seaLevelPressureHpa?: number | null;
41
+ }>, { windowHours }?: {
42
+ windowHours?: number;
43
+ }): number | null;
34
44
  declare function pressureTendency(points: ReadonlyArray<{
35
45
  observedAt: string;
36
46
  seaLevelPressureHpa?: number | null;
@@ -38,6 +48,18 @@ declare function pressureTendency(points: ReadonlyArray<{
38
48
  windowHours?: number;
39
49
  thresholdHpa?: number;
40
50
  }): PressureTendency | null;
51
+ /** The lowest temperature of the most recent completed night — the previous
52
+ * sunset to the latest sunrise, from real astronomy. Null without
53
+ * coordinates (never a guessed night), under a polar sky, or when no
54
+ * carried temperature falls inside the window. */
55
+ declare function lastNightLowC(points: ReadonlyArray<{
56
+ observedAt: string;
57
+ temperatureC?: number | null;
58
+ }>, latitude: number | null, longitude: number | null, nowMs: number): {
59
+ lowC: number;
60
+ fromMs: number;
61
+ toMs: number;
62
+ } | null;
41
63
  type FreshnessStatus = "live" | "aging" | "stale";
42
64
  type FreshnessThresholds = {
43
65
  currentForMs: number;
@@ -51,4 +73,4 @@ declare function freshness(input: {
51
73
  nowMs: number;
52
74
  }, thresholds?: FreshnessThresholds): FreshnessStatus;
53
75
  //#endregion
54
- export { CALM_THRESHOLD_MPS, COMPASS_POINTS, CompassPoint, FreshnessStatus, FreshnessThresholds, PeriodSummary, PressureTendency, SPEED_UNITS, SpeedThresholds, SpeedUnit, compassDirection, freshness, isCalm, normalizeDegrees, periodSummary, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps };
76
+ export { CALM_THRESHOLD_MPS, COMPASS_POINTS, CompassPoint, FreshnessStatus, FreshnessThresholds, PeriodSummary, PressureTendency, SPEED_UNITS, SpeedThresholds, SpeedUnit, compassDirection, freshness, isCalm, lastNightLowC, normalizeDegrees, periodSummary, pressureDeltaHpa, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps };