@azohra/meteo.station 0.7.0 → 0.7.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/dist/air.d.ts +4 -7
- package/dist/air.js +1 -2
- package/dist/client/climatology.d.ts +4 -7
- package/dist/client/climatology.js +1 -2
- package/dist/client/history.d.ts +14 -17
- package/dist/client/history.js +1 -2
- package/dist/client/live.d.ts +9 -11
- package/dist/client/live.js +1 -2
- package/dist/client/poll.d.ts +9 -12
- package/dist/client/poll.js +1 -2
- package/dist/client/stores.d.ts +8 -10
- package/dist/client/stores.js +1 -2
- package/dist/client/ticker.d.ts +1 -4
- package/dist/client/ticker.js +1 -2
- package/dist/climatology.d.ts +13 -15
- package/dist/climatology.js +1 -2
- package/dist/connectivity.d.ts +7 -10
- package/dist/connectivity.js +1 -2
- package/dist/contract-climatology.d.ts +11 -14
- package/dist/contract-climatology.js +1 -2
- package/dist/contract.d.ts +45 -48
- package/dist/contract.js +1 -2
- package/dist/derive.d.ts +24 -26
- package/dist/derive.js +1 -2
- package/dist/display.d.ts +6 -9
- package/dist/display.js +1 -2
- package/dist/elements/elements/AirExtremesElement.d.ts +2 -5
- package/dist/elements/elements/AirExtremesElement.js +1 -2
- package/dist/elements/elements/AirMatrixElement.d.ts +2 -5
- package/dist/elements/elements/AirMatrixElement.js +1 -2
- package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +2 -5
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +1 -2
- package/dist/elements/elements/ClimatologyRoseElement.d.ts +2 -5
- package/dist/elements/elements/ClimatologyRoseElement.js +1 -2
- package/dist/elements/elements/CompassFanElement.d.ts +2 -5
- package/dist/elements/elements/CompassFanElement.js +1 -2
- package/dist/elements/elements/CurrentConditionsElement.d.ts +2 -5
- package/dist/elements/elements/CurrentConditionsElement.js +1 -2
- package/dist/elements/elements/DailyPatternElement.d.ts +2 -5
- package/dist/elements/elements/DailyPatternElement.js +1 -2
- package/dist/elements/elements/DialElement.d.ts +2 -5
- package/dist/elements/elements/DialElement.js +1 -2
- package/dist/elements/elements/FavorableShareElement.d.ts +2 -5
- package/dist/elements/elements/FavorableShareElement.js +1 -2
- package/dist/elements/elements/FreshnessBadgeElement.d.ts +2 -5
- package/dist/elements/elements/FreshnessBadgeElement.js +1 -2
- package/dist/elements/elements/RecentSummariesElement.d.ts +2 -5
- package/dist/elements/elements/RecentSummariesElement.js +1 -2
- package/dist/elements/elements/SparklineElement.d.ts +2 -5
- package/dist/elements/elements/SparklineElement.js +1 -2
- package/dist/elements/elements/StationCardElement.d.ts +6 -8
- package/dist/elements/elements/StationCardElement.js +1 -2
- package/dist/elements/elements/StationFeedElement.d.ts +2 -5
- package/dist/elements/elements/StationFeedElement.js +1 -2
- package/dist/elements/elements/StationStripElement.d.ts +2 -5
- package/dist/elements/elements/StationStripElement.js +1 -2
- package/dist/elements/elements/StationTableElement.d.ts +3 -6
- package/dist/elements/elements/StationTableElement.js +1 -2
- package/dist/elements/elements/TrendChartElement.d.ts +2 -5
- package/dist/elements/elements/TrendChartElement.js +1 -2
- package/dist/elements/elements/WindArrowElement.d.ts +2 -5
- package/dist/elements/elements/WindArrowElement.js +1 -2
- package/dist/elements/elements/WindHistoryChartElement.d.ts +2 -5
- package/dist/elements/elements/WindHistoryChartElement.js +1 -2
- package/dist/elements/elements/WindRoseElement.d.ts +2 -5
- package/dist/elements/elements/WindRoseElement.js +1 -2
- package/dist/elements/elements/atoms.d.ts +9 -11
- package/dist/elements/elements/atoms.js +1 -2
- package/dist/elements/index.d.ts +3 -5
- package/dist/elements/index.js +1 -2
- package/dist/elements/lib/ambient.d.ts +2 -5
- package/dist/elements/lib/ambient.js +1 -2
- package/dist/elements/lib/attributes.js +1 -2
- package/dist/elements/lib/base.d.ts +3 -6
- package/dist/elements/lib/base.js +1 -2
- package/dist/elements/lib/context.js +1 -2
- package/dist/elements/lib/fragments.js +1 -2
- package/dist/elements/lib/h.js +1 -2
- package/dist/elements/lib/pinned-cursor.js +1 -2
- package/dist/elements/lib/render.js +1 -2
- package/dist/elements/register.js +1 -2
- package/dist/endpoints.d.ts +6 -9
- package/dist/endpoints.js +1 -2
- package/dist/fixtures.d.ts +7 -10
- package/dist/fixtures.js +1 -2
- package/dist/format.d.ts +11 -14
- package/dist/format.js +1 -2
- package/dist/geometry.d.ts +36 -38
- package/dist/geometry.js +1 -2
- package/dist/instruments.d.ts +37 -40
- package/dist/instruments.js +1 -2
- package/dist/merge-current.d.ts +4 -7
- package/dist/merge-current.js +1 -2
- package/dist/react/components/AirExtremes.d.ts +2 -5
- package/dist/react/components/AirExtremes.js +1 -2
- package/dist/react/components/AirMatrix.d.ts +2 -5
- package/dist/react/components/AirMatrix.js +1 -2
- package/dist/react/components/ClimatologyDailyPattern.d.ts +2 -5
- package/dist/react/components/ClimatologyDailyPattern.js +1 -2
- package/dist/react/components/ClimatologyRose.d.ts +2 -5
- package/dist/react/components/ClimatologyRose.js +1 -2
- package/dist/react/components/CompassFan.d.ts +2 -5
- package/dist/react/components/CompassFan.js +1 -2
- package/dist/react/components/CurrentConditions.d.ts +2 -5
- package/dist/react/components/CurrentConditions.js +1 -2
- package/dist/react/components/DailyPattern.d.ts +2 -5
- package/dist/react/components/DailyPattern.js +1 -2
- package/dist/react/components/Dial.d.ts +2 -5
- package/dist/react/components/Dial.js +1 -2
- package/dist/react/components/FavorableShare.d.ts +2 -5
- package/dist/react/components/FavorableShare.js +1 -2
- package/dist/react/components/FreshnessBadge.d.ts +2 -5
- package/dist/react/components/FreshnessBadge.js +1 -2
- package/dist/react/components/Readout.d.ts +2 -5
- package/dist/react/components/Readout.js +1 -2
- package/dist/react/components/RecentSummaries.d.ts +2 -5
- package/dist/react/components/RecentSummaries.js +1 -2
- package/dist/react/components/SceneTree.js +1 -2
- package/dist/react/components/Sparkline.d.ts +2 -5
- package/dist/react/components/Sparkline.js +1 -2
- package/dist/react/components/StationCard.d.ts +6 -8
- package/dist/react/components/StationCard.js +1 -2
- package/dist/react/components/StationFeedProvider.d.ts +3 -6
- package/dist/react/components/StationFeedProvider.js +1 -2
- package/dist/react/components/StationStrip.d.ts +2 -5
- package/dist/react/components/StationStrip.js +1 -2
- package/dist/react/components/StationTable.d.ts +3 -6
- package/dist/react/components/StationTable.js +1 -2
- package/dist/react/components/TrendChart.d.ts +2 -5
- package/dist/react/components/TrendChart.js +1 -2
- package/dist/react/components/WindArrow.d.ts +2 -5
- package/dist/react/components/WindArrow.js +1 -2
- package/dist/react/components/WindHistoryChart.d.ts +2 -5
- package/dist/react/components/WindHistoryChart.js +1 -2
- package/dist/react/components/WindRose.d.ts +2 -5
- package/dist/react/components/WindRose.js +1 -2
- package/dist/react/components/WindSampleStrip.d.ts +2 -5
- package/dist/react/components/WindSampleStrip.js +1 -2
- package/dist/react/components/atoms.d.ts +9 -11
- package/dist/react/components/atoms.js +1 -2
- package/dist/react/hooks/useFreshness.d.ts +1 -4
- package/dist/react/hooks/useFreshness.js +1 -2
- package/dist/react/hooks/useMeasuredChartWidth.d.ts +2 -5
- package/dist/react/hooks/useMeasuredChartWidth.js +1 -2
- package/dist/react/hooks/usePolledJson.js +1 -2
- package/dist/react/hooks/useStation.d.ts +2 -5
- package/dist/react/hooks/useStation.js +1 -2
- package/dist/react/hooks/useStationClimatology.d.ts +2 -5
- package/dist/react/hooks/useStationClimatology.js +1 -2
- package/dist/react/hooks/useStationCurrent.d.ts +2 -5
- package/dist/react/hooks/useStationCurrent.js +1 -2
- package/dist/react/hooks/useStationFeed.d.ts +2 -5
- package/dist/react/hooks/useStationFeed.js +1 -2
- package/dist/react/hooks/useStationLive.d.ts +2 -5
- package/dist/react/hooks/useStationLive.js +1 -2
- package/dist/react/lib/cells.js +1 -2
- package/dist/react/lib/use-pinned-cursor.js +1 -2
- package/dist/samples.d.ts +8 -11
- package/dist/samples.js +1 -2
- package/dist/scene/air-extremes.js +1 -2
- package/dist/scene/air-matrix.js +1 -2
- package/dist/scene/atoms.js +1 -2
- package/dist/scene/card.js +1 -2
- package/dist/scene/cells.js +1 -2
- package/dist/scene/chart.d.ts +2 -5
- package/dist/scene/chart.js +1 -2
- package/dist/scene/climatology-pattern.js +1 -2
- package/dist/scene/climatology-rose.js +1 -2
- package/dist/scene/compass-fan.js +1 -2
- package/dist/scene/current.js +1 -2
- package/dist/scene/daily-pattern.js +1 -2
- package/dist/scene/dial-parts.js +1 -2
- package/dist/scene/dial.js +1 -2
- package/dist/scene/favorable-share.js +1 -2
- package/dist/scene/glyphs.js +1 -2
- package/dist/scene/node.js +1 -2
- package/dist/scene/recent-summaries.js +1 -2
- package/dist/scene/rose.js +1 -2
- package/dist/scene/sample-strip.js +1 -2
- package/dist/scene/sparkline.js +1 -2
- package/dist/scene/strip.js +1 -2
- package/dist/scene/table.js +1 -2
- package/dist/scene/trend.js +1 -2
- package/dist/scene/wind-history.js +1 -2
- package/dist/scene/wind-plot.js +1 -2
- package/dist/server/adapter.d.ts +7 -10
- package/dist/server/adapter.js +1 -2
- package/dist/server/adapters/campbell.d.ts +11 -13
- package/dist/server/adapters/campbell.js +1 -2
- package/dist/server/adapters/ecowitt.d.ts +4 -7
- package/dist/server/adapters/ecowitt.js +1 -2
- package/dist/server/adapters/tempest.d.ts +4 -7
- package/dist/server/adapters/tempest.js +1 -2
- package/dist/server/adapters/windnerd-climatology.d.ts +5 -8
- package/dist/server/adapters/windnerd-climatology.js +1 -2
- package/dist/server/adapters/windnerd-live.d.ts +2 -5
- package/dist/server/adapters/windnerd-live.js +1 -2
- package/dist/server/adapters/windnerd.d.ts +22 -25
- package/dist/server/adapters/windnerd.js +1 -2
- package/dist/server/config.d.ts +18 -20
- package/dist/server/config.js +1 -2
- package/dist/server/environment.d.ts +20 -22
- package/dist/server/environment.js +1 -2
- package/dist/server/feed.d.ts +19 -21
- package/dist/server/feed.js +1 -2
- package/dist/server/handler.d.ts +4 -7
- package/dist/server/handler.js +1 -2
- package/dist/server/hologram.d.ts +9 -12
- package/dist/server/hologram.js +1 -2
- package/dist/server/live.d.ts +2 -5
- package/dist/server/live.js +1 -2
- package/dist/sse.js +1 -2
- package/dist/strings.d.ts +8 -11
- package/dist/strings.js +1 -2
- package/dist/windnerd.d.ts +4 -7
- package/dist/windnerd.js +1 -2
- package/package.json +9 -9
package/dist/server/config.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { Station } from "../contract.js";
|
|
|
2
2
|
import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
3
3
|
import { ResolvedEnvironment } from "./environment.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
declare const windnerdStationConfigSchema: z.ZodObject<{
|
|
5
|
+
export declare const windnerdStationConfigSchema: z.ZodObject<{
|
|
7
6
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
8
7
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
9
8
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -18,8 +17,8 @@ declare const windnerdStationConfigSchema: z.ZodObject<{
|
|
|
18
17
|
hasPressure: z.ZodDefault<z.ZodBoolean>;
|
|
19
18
|
hasBattery: z.ZodDefault<z.ZodBoolean>;
|
|
20
19
|
}, z.core.$strict>;
|
|
21
|
-
type WindnerdStationConfig = z.output<typeof windnerdStationConfigSchema>;
|
|
22
|
-
declare const tempestStationConfigSchema: z.ZodObject<{
|
|
20
|
+
export type WindnerdStationConfig = z.output<typeof windnerdStationConfigSchema>;
|
|
21
|
+
export declare const tempestStationConfigSchema: z.ZodObject<{
|
|
23
22
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
23
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
24
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -31,8 +30,8 @@ declare const tempestStationConfigSchema: z.ZodObject<{
|
|
|
31
30
|
stationId: z.ZodNumber;
|
|
32
31
|
token: z.ZodString;
|
|
33
32
|
}, z.core.$strict>;
|
|
34
|
-
type TempestStationConfig = z.output<typeof tempestStationConfigSchema>;
|
|
35
|
-
declare const ecowittStationConfigSchema: z.ZodObject<{
|
|
33
|
+
export type TempestStationConfig = z.output<typeof tempestStationConfigSchema>;
|
|
34
|
+
export declare const ecowittStationConfigSchema: z.ZodObject<{
|
|
36
35
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
37
36
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
38
37
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -46,8 +45,8 @@ declare const ecowittStationConfigSchema: z.ZodObject<{
|
|
|
46
45
|
mac: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
47
46
|
hasBattery: z.ZodDefault<z.ZodBoolean>;
|
|
48
47
|
}, z.core.$strict>;
|
|
49
|
-
type EcowittStationConfig = z.output<typeof ecowittStationConfigSchema>;
|
|
50
|
-
declare const campbellStationConfigSchema: z.ZodObject<{
|
|
48
|
+
export type EcowittStationConfig = z.output<typeof ecowittStationConfigSchema>;
|
|
49
|
+
export declare const campbellStationConfigSchema: z.ZodObject<{
|
|
51
50
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
51
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
53
52
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -64,8 +63,8 @@ declare const campbellStationConfigSchema: z.ZodObject<{
|
|
|
64
63
|
historyPeriodMinutes: z.ZodDefault<z.ZodNumber>;
|
|
65
64
|
currentCacheTtlSeconds: z.ZodDefault<z.ZodNumber>;
|
|
66
65
|
}, z.core.$strict>;
|
|
67
|
-
type CampbellStationConfig = z.output<typeof campbellStationConfigSchema>;
|
|
68
|
-
type CustomStationIdentity = {
|
|
66
|
+
export type CampbellStationConfig = z.output<typeof campbellStationConfigSchema>;
|
|
67
|
+
export type CustomStationIdentity = {
|
|
69
68
|
readonly id: string;
|
|
70
69
|
readonly name: string;
|
|
71
70
|
readonly elevationM: number | null;
|
|
@@ -74,14 +73,14 @@ type CustomStationIdentity = {
|
|
|
74
73
|
readonly timeZone: string | null;
|
|
75
74
|
readonly pageUrl: string | null;
|
|
76
75
|
};
|
|
77
|
-
type CustomStationContext = {
|
|
76
|
+
export type CustomStationContext = {
|
|
78
77
|
environment: ResolvedEnvironment;
|
|
79
78
|
historyHours: number;
|
|
80
79
|
mode: "full" | "current";
|
|
81
80
|
station: CustomStationIdentity;
|
|
82
81
|
};
|
|
83
|
-
type CustomStationLoader = (context: CustomStationContext) => Promise<Station>;
|
|
84
|
-
declare const customStationConfigSchema: z.ZodObject<{
|
|
82
|
+
export type CustomStationLoader = (context: CustomStationContext) => Promise<Station>;
|
|
83
|
+
export declare const customStationConfigSchema: z.ZodObject<{
|
|
85
84
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
86
85
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
87
86
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -92,8 +91,8 @@ declare const customStationConfigSchema: z.ZodObject<{
|
|
|
92
91
|
vendor: z.ZodLiteral<"custom">;
|
|
93
92
|
load: z.ZodCustom<CustomStationLoader, CustomStationLoader>;
|
|
94
93
|
}, z.core.$strict>;
|
|
95
|
-
type CustomStationConfig = z.output<typeof customStationConfigSchema>;
|
|
96
|
-
declare const stationConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
94
|
+
export type CustomStationConfig = z.output<typeof customStationConfigSchema>;
|
|
95
|
+
export declare const stationConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
97
96
|
elevationM: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
98
97
|
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
99
98
|
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -158,8 +157,7 @@ declare const stationConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
158
157
|
vendor: z.ZodLiteral<"custom">;
|
|
159
158
|
load: z.ZodCustom<CustomStationLoader, CustomStationLoader>;
|
|
160
159
|
}, z.core.$strict>], "vendor">;
|
|
161
|
-
type StationConfig = z.output<typeof stationConfigSchema>;
|
|
162
|
-
type StationConfigInput = z.input<typeof stationConfigSchema>;
|
|
163
|
-
declare function parseStationConfig(value: unknown): StationConfig;
|
|
164
|
-
|
|
165
|
-
export { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, EcowittStationConfig, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
|
|
160
|
+
export type StationConfig = z.output<typeof stationConfigSchema>;
|
|
161
|
+
export type StationConfigInput = z.input<typeof stationConfigSchema>;
|
|
162
|
+
export declare function parseStationConfig(value: unknown): StationConfig;
|
|
163
|
+
export { normalizeWindnerdStationKey, windnerdStationUrl };
|
package/dist/server/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { httpUrl, ianaTimeZone, positionFields } from "@azohra/meteo.core";
|
|
4
|
-
|
|
4
|
+
// src/server/config.ts
|
|
5
5
|
const windnerdStationKey = z.string().refine((value) => normalizeWindnerdStationKey(value) != null, { message: "not a WindNerd station key or windnerd.net station URL" }).transform((value) => normalizeWindnerdStationKey(value));
|
|
6
6
|
const stationIdentity = {
|
|
7
7
|
id: z.string().min(1),
|
|
@@ -67,5 +67,4 @@ const stationConfigSchema = z.discriminatedUnion("vendor", [
|
|
|
67
67
|
function parseStationConfig(value) {
|
|
68
68
|
return stationConfigSchema.parse(value);
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, normalizeWindnerdStationKey, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema, windnerdStationUrl };
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { UPSTREAM_FAILURE_REASONS as UPSTREAM_FAILURE_REASONS$1, UpstreamError as UpstreamError$1, UpstreamErrorReason, UpstreamFailureReason, unavailableReasonForError } from "@azohra/meteo.core";
|
|
2
|
-
|
|
3
|
-
type FeedCache = {
|
|
2
|
+
export type FeedCache = {
|
|
4
3
|
get(key: string): Promise<string | null>;
|
|
5
4
|
put(key: string, value: string, ttlSeconds: number): Promise<void>;
|
|
6
5
|
};
|
|
7
|
-
type LogEventCode = "config_invalid" | "duplicate_station" | "upstream_failure" | "adapter_threw" | "custom_contract_break" | "clock_skew" | "resolver_invalid";
|
|
8
|
-
type LogEvent = {
|
|
6
|
+
export type LogEventCode = "config_invalid" | "duplicate_station" | "upstream_failure" | "adapter_threw" | "custom_contract_break" | "clock_skew" | "resolver_invalid";
|
|
7
|
+
export type LogEvent = {
|
|
9
8
|
level: "warn" | "error";
|
|
10
9
|
code: LogEventCode;
|
|
11
10
|
message: string;
|
|
12
11
|
detail?: unknown;
|
|
13
12
|
};
|
|
14
|
-
type ServerEnvironment = {
|
|
13
|
+
export type ServerEnvironment = {
|
|
15
14
|
fetch?: typeof fetch;
|
|
16
15
|
cache?: FeedCache;
|
|
17
16
|
logger?: (event: LogEvent) => void;
|
|
18
17
|
userAgent?: string;
|
|
19
18
|
now?: () => Date;
|
|
20
19
|
};
|
|
21
|
-
type ResolvedEnvironment = Required<ServerEnvironment>;
|
|
22
|
-
declare const UPSTREAM_FETCH_TIMEOUT_MS = 4000;
|
|
23
|
-
declare const UPSTREAM_RESPONSE_LIMIT_BYTES = 524288;
|
|
24
|
-
declare function memoryCache(): FeedCache;
|
|
20
|
+
export type ResolvedEnvironment = Required<ServerEnvironment>;
|
|
21
|
+
export declare const UPSTREAM_FETCH_TIMEOUT_MS = 4000;
|
|
22
|
+
export declare const UPSTREAM_RESPONSE_LIMIT_BYTES = 524288;
|
|
23
|
+
export declare function memoryCache(): FeedCache;
|
|
25
24
|
/**
|
|
26
25
|
* A FeedCache over the ambient Cloudflare Workers cache (`caches.default`),
|
|
27
26
|
* shared across the isolates of a deployment. Returns undefined where no
|
|
28
27
|
* ambient cache exists (node, vitest), so `cache: workersCache()` falls
|
|
29
28
|
* through to the memory-cache default.
|
|
30
29
|
*/
|
|
31
|
-
declare function workersCache(): FeedCache | undefined;
|
|
32
|
-
declare const DEFAULT_USER_AGENT = "azohra-meteo/0.1 (+https://meteo.azohra.com)";
|
|
33
|
-
declare function resolveEnvironment(environment?: ServerEnvironment): ResolvedEnvironment;
|
|
34
|
-
type UpstreamTextRequest = {
|
|
30
|
+
export declare function workersCache(): FeedCache | undefined;
|
|
31
|
+
export declare const DEFAULT_USER_AGENT = "azohra-meteo/0.1 (+https://meteo.azohra.com)";
|
|
32
|
+
export declare function resolveEnvironment(environment?: ServerEnvironment): ResolvedEnvironment;
|
|
33
|
+
export type UpstreamTextRequest = {
|
|
35
34
|
url: string | URL;
|
|
36
35
|
cacheKey: string;
|
|
37
36
|
cacheTtlSeconds: number;
|
|
@@ -47,11 +46,11 @@ type UpstreamTextRequest = {
|
|
|
47
46
|
* Coalesces concurrent misses on the same (cache instance, key) onto a single
|
|
48
47
|
* in-flight load. The load owns its own cache fill; this only deduplicates.
|
|
49
48
|
*/
|
|
50
|
-
declare function coalesceUpstreamLoad(cache: FeedCache, key: string, load: () => Promise<string>): Promise<string>;
|
|
49
|
+
export declare function coalesceUpstreamLoad(cache: FeedCache, key: string, load: () => Promise<string>): Promise<string>;
|
|
51
50
|
/** Cache lookup, bounded fetch under a timeout, cache fill. Concurrent
|
|
52
51
|
* misses on one (cache instance, cacheKey) coalesce onto a single load. */
|
|
53
|
-
declare function fetchUpstreamText(environment: ResolvedEnvironment, request: UpstreamTextRequest): Promise<string>;
|
|
54
|
-
type UpstreamStreamRequest = {
|
|
52
|
+
export declare function fetchUpstreamText(environment: ResolvedEnvironment, request: UpstreamTextRequest): Promise<string>;
|
|
53
|
+
export type UpstreamStreamRequest = {
|
|
55
54
|
url: string | URL;
|
|
56
55
|
subject: string;
|
|
57
56
|
accept?: string;
|
|
@@ -59,11 +58,10 @@ type UpstreamStreamRequest = {
|
|
|
59
58
|
connectTimeoutMs?: number;
|
|
60
59
|
signal?: AbortSignal;
|
|
61
60
|
};
|
|
62
|
-
declare const UPSTREAM_CONNECT_TIMEOUT_MS = 10000;
|
|
61
|
+
export declare const UPSTREAM_CONNECT_TIMEOUT_MS = 10000;
|
|
63
62
|
/** Long-lived upstream body: no cache, no byte cap, never coalesced —
|
|
64
63
|
* the caller owns the connection and tears it down through its signal. */
|
|
65
|
-
declare function fetchUpstreamStream(environment: ResolvedEnvironment, request: UpstreamStreamRequest): Promise<Response>;
|
|
66
|
-
declare function boundedResponseText(response: Response, limitBytes: number, subject: string): Promise<string>;
|
|
67
|
-
declare function logUpstreamFailure(environment: ResolvedEnvironment, message: string, error: unknown, detail?: Record<string, unknown>): void;
|
|
68
|
-
|
|
69
|
-
export { DEFAULT_USER_AGENT, FeedCache, LogEvent, LogEventCode, ResolvedEnvironment, ServerEnvironment, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError$1 as UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache };
|
|
64
|
+
export declare function fetchUpstreamStream(environment: ResolvedEnvironment, request: UpstreamStreamRequest): Promise<Response>;
|
|
65
|
+
export declare function boundedResponseText(response: Response, limitBytes: number, subject: string): Promise<string>;
|
|
66
|
+
export declare function logUpstreamFailure(environment: ResolvedEnvironment, message: string, error: unknown, detail?: Record<string, unknown>): void;
|
|
67
|
+
export { UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UpstreamError$1 as UpstreamError, type UpstreamErrorReason, type UpstreamFailureReason, unavailableReasonForError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UPSTREAM_FAILURE_REASONS as UPSTREAM_FAILURE_REASONS$1, UpstreamError as UpstreamError$1, unavailableReasonForError } from "@azohra/meteo.core";
|
|
2
|
-
|
|
2
|
+
// src/server/environment.ts
|
|
3
3
|
const UPSTREAM_FETCH_TIMEOUT_MS = 4e3;
|
|
4
4
|
const UPSTREAM_RESPONSE_LIMIT_BYTES = 524288;
|
|
5
5
|
const MEMORY_CACHE_MAX_ENTRIES = 500;
|
|
@@ -184,5 +184,4 @@ function logUpstreamFailure(environment, message, error, detail = {}) {
|
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
//#endregion
|
|
188
187
|
export { DEFAULT_USER_AGENT, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS$1 as UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError$1 as UpstreamError, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache };
|
package/dist/server/feed.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ import { StationClimatology } from "../contract-climatology.js";
|
|
|
3
3
|
import { SpeedThresholds } from "../derive.js";
|
|
4
4
|
import { ResolvedEnvironment, ServerEnvironment } from "./environment.js";
|
|
5
5
|
import { StationConfig, StationConfigInput } from "./config.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type LoadStationFeedOptions = {
|
|
6
|
+
export declare const DEFAULT_HISTORY_HOURS = 6;
|
|
7
|
+
export type StationsResolver = (request?: Request) => Promise<StationConfigInput[]> | StationConfigInput[];
|
|
8
|
+
export type StationsInput = StationConfigInput[] | StationsResolver;
|
|
9
|
+
export type LoadStationFeedOptions = {
|
|
11
10
|
stations: StationsInput;
|
|
12
11
|
primaryStationId?: string;
|
|
13
12
|
historyHours?: number;
|
|
@@ -15,16 +14,16 @@ type LoadStationFeedOptions = {
|
|
|
15
14
|
environment?: ServerEnvironment;
|
|
16
15
|
request?: Request;
|
|
17
16
|
};
|
|
18
|
-
type LoadStationCurrentOptions = LoadStationFeedOptions & {
|
|
17
|
+
export type LoadStationCurrentOptions = LoadStationFeedOptions & {
|
|
19
18
|
stationId: string;
|
|
20
19
|
};
|
|
21
|
-
declare class UnknownStationError extends Error {
|
|
20
|
+
export declare class UnknownStationError extends Error {
|
|
22
21
|
constructor(stationId: string);
|
|
23
22
|
}
|
|
24
|
-
declare class StationLiveUnsupportedError extends Error {
|
|
23
|
+
export declare class StationLiveUnsupportedError extends Error {
|
|
25
24
|
constructor(stationId: string);
|
|
26
25
|
}
|
|
27
|
-
type OpenStationLiveOptions = {
|
|
26
|
+
export type OpenStationLiveOptions = {
|
|
28
27
|
stations: StationsInput;
|
|
29
28
|
stationId: string;
|
|
30
29
|
environment?: ServerEnvironment;
|
|
@@ -38,11 +37,11 @@ type OpenStationLiveOptions = {
|
|
|
38
37
|
* failures reject with the upstream error. One call is one upstream
|
|
39
38
|
* connection.
|
|
40
39
|
*/
|
|
41
|
-
declare function openStationLive(options: OpenStationLiveOptions): Promise<ReadableStream<StationLiveFrame>>;
|
|
42
|
-
declare class StationHistoryUnsupportedError extends Error {
|
|
40
|
+
export declare function openStationLive(options: OpenStationLiveOptions): Promise<ReadableStream<StationLiveFrame>>;
|
|
41
|
+
export declare class StationHistoryUnsupportedError extends Error {
|
|
43
42
|
constructor(stationId: string);
|
|
44
43
|
}
|
|
45
|
-
type LoadStationHistoryOptions = {
|
|
44
|
+
export type LoadStationHistoryOptions = {
|
|
46
45
|
stations: StationsInput;
|
|
47
46
|
stationId: string;
|
|
48
47
|
fromMs: number;
|
|
@@ -57,11 +56,11 @@ type LoadStationHistoryOptions = {
|
|
|
57
56
|
* vendor keeps no reachable archive — and stations whose config failed
|
|
58
57
|
* validation — throw StationHistoryUnsupportedError.
|
|
59
58
|
*/
|
|
60
|
-
declare function loadStationHistory(options: LoadStationHistoryOptions): Promise<StationHistory>;
|
|
61
|
-
declare class StationClimatologyUnsupportedError extends Error {
|
|
59
|
+
export declare function loadStationHistory(options: LoadStationHistoryOptions): Promise<StationHistory>;
|
|
60
|
+
export declare class StationClimatologyUnsupportedError extends Error {
|
|
62
61
|
constructor(stationId: string);
|
|
63
62
|
}
|
|
64
|
-
type LoadStationClimatologyOptions = {
|
|
63
|
+
export type LoadStationClimatologyOptions = {
|
|
65
64
|
stations: StationsInput;
|
|
66
65
|
stationId: string;
|
|
67
66
|
/** The consumer's speed-band bounds — a judgment parameter, no default. */
|
|
@@ -78,14 +77,13 @@ type LoadStationClimatologyOptions = {
|
|
|
78
77
|
* archive — and stations whose config failed validation — throw
|
|
79
78
|
* StationClimatologyUnsupportedError.
|
|
80
79
|
*/
|
|
81
|
-
declare function loadStationClimatology(options: LoadStationClimatologyOptions): Promise<StationClimatology>;
|
|
82
|
-
declare function loadStationFeed(options: LoadStationFeedOptions): Promise<StationFeed>;
|
|
83
|
-
declare function loadStationCurrent(options: LoadStationCurrentOptions): Promise<StationCurrent>;
|
|
80
|
+
export declare function loadStationClimatology(options: LoadStationClimatologyOptions): Promise<StationClimatology>;
|
|
81
|
+
export declare function loadStationFeed(options: LoadStationFeedOptions): Promise<StationFeed>;
|
|
82
|
+
export declare function loadStationCurrent(options: LoadStationCurrentOptions): Promise<StationCurrent>;
|
|
84
83
|
type AssembledStation = {
|
|
85
84
|
config: StationConfig;
|
|
86
85
|
} | {
|
|
87
86
|
degraded: Station;
|
|
88
87
|
};
|
|
89
|
-
declare function assembleStations(candidates: StationConfigInput[], environment: ResolvedEnvironment): AssembledStation[];
|
|
90
|
-
|
|
91
|
-
export { DEFAULT_HISTORY_HOURS, LoadStationClimatologyOptions, LoadStationCurrentOptions, LoadStationFeedOptions, LoadStationHistoryOptions, OpenStationLiveOptions, StationClimatologyUnsupportedError, StationHistoryUnsupportedError, StationLiveUnsupportedError, StationsInput, StationsResolver, UnknownStationError, assembleStations, loadStationClimatology, loadStationCurrent, loadStationFeed, loadStationHistory, openStationLive };
|
|
88
|
+
export declare function assembleStations(candidates: StationConfigInput[], environment: ResolvedEnvironment): AssembledStation[];
|
|
89
|
+
export {};
|
package/dist/server/feed.js
CHANGED
|
@@ -7,7 +7,7 @@ import { loadTempestStation } from "./adapters/tempest.js";
|
|
|
7
7
|
import { loadWindnerdHistory, loadWindnerdStation } from "./adapters/windnerd.js";
|
|
8
8
|
import { loadWindnerdClimatology } from "./adapters/windnerd-climatology.js";
|
|
9
9
|
import { openWindnerdLive } from "./adapters/windnerd-live.js";
|
|
10
|
-
|
|
10
|
+
// src/server/feed.ts
|
|
11
11
|
const DEFAULT_HISTORY_HOURS = 6;
|
|
12
12
|
var UnknownStationError = class extends Error {
|
|
13
13
|
constructor(stationId) {
|
|
@@ -306,5 +306,4 @@ function neverThrewButDid(config, environment, error) {
|
|
|
306
306
|
});
|
|
307
307
|
return unavailableStation(configFallbackMeta(config), "contract_break");
|
|
308
308
|
}
|
|
309
|
-
//#endregion
|
|
310
309
|
export { DEFAULT_HISTORY_HOURS, StationClimatologyUnsupportedError, StationHistoryUnsupportedError, StationLiveUnsupportedError, UnknownStationError, assembleStations, loadStationClimatology, loadStationCurrent, loadStationFeed, loadStationHistory, openStationLive };
|
package/dist/server/handler.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SpeedThresholds } from "../derive.js";
|
|
2
2
|
import { ServerEnvironment } from "./environment.js";
|
|
3
3
|
import { StationsInput } from "./feed.js";
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
type StationFeedHandlerOptions = {
|
|
4
|
+
export type StationFeedHandlerRoute = "feed" | "current" | "live" | "climatology" | "history";
|
|
5
|
+
export type StationFeedHandlerOptions = {
|
|
7
6
|
stations: StationsInput;
|
|
8
7
|
primaryStationId?: string;
|
|
9
8
|
maxHistoryHours?: number;
|
|
@@ -21,7 +20,5 @@ type StationFeedHandlerOptions = {
|
|
|
21
20
|
};
|
|
22
21
|
environment?: ServerEnvironment;
|
|
23
22
|
};
|
|
24
|
-
type StationFeedHandler = (request: Request) => Promise<Response>;
|
|
25
|
-
declare function createStationFeedHandler(options: StationFeedHandlerOptions): StationFeedHandler;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute, createStationFeedHandler };
|
|
23
|
+
export type StationFeedHandler = (request: Request) => Promise<Response>;
|
|
24
|
+
export declare function createStationFeedHandler(options: StationFeedHandlerOptions): StationFeedHandler;
|
package/dist/server/handler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveEnvironment, unavailableReasonForError } from "./environment.js";
|
|
2
2
|
import { StationClimatologyUnsupportedError, StationHistoryUnsupportedError, StationLiveUnsupportedError, UnknownStationError, assembleStations, loadStationClimatology, loadStationCurrent, loadStationFeed, loadStationHistory, openStationLive } from "./feed.js";
|
|
3
3
|
import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
|
|
4
|
-
|
|
4
|
+
// src/server/handler.ts
|
|
5
5
|
const CLIMATOLOGY_CACHE_SECONDS = 21600;
|
|
6
6
|
const HISTORY_PAST_CACHE_SECONDS = 86400;
|
|
7
7
|
const HISTORY_LIVE_CACHE_SECONDS = 60;
|
|
@@ -244,5 +244,4 @@ function etagMatches(ifNoneMatch, etag) {
|
|
|
244
244
|
const bare = (tag) => tag.startsWith("W/") ? tag.slice(2) : tag;
|
|
245
245
|
return ifNoneMatch.split(",").some((candidate) => bare(candidate.trim()) === bare(etag));
|
|
246
246
|
}
|
|
247
|
-
//#endregion
|
|
248
247
|
export { createStationFeedHandler };
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { ConnectivityServiceState, StationConnectivity } from "../connectivity.js";
|
|
2
2
|
import { ServerEnvironment } from "./environment.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const hologramConnectivityConfigSchema: z.ZodObject<{
|
|
4
|
+
export declare const HOLOGRAM_API_BASE = "https://dashboard.hologram.io/api/1";
|
|
5
|
+
export declare const TRIAL_HOLOGRAM_CACHE_TTL_SECONDS = 300;
|
|
6
|
+
export declare const hologramConnectivityConfigSchema: z.ZodObject<{
|
|
8
7
|
apiKey: z.ZodString;
|
|
9
8
|
deviceId: z.ZodNumber;
|
|
10
9
|
}, z.core.$strict>;
|
|
11
|
-
type HologramConnectivityConfig = z.output<typeof hologramConnectivityConfigSchema>;
|
|
12
|
-
type HologramConnectivityOptions = {
|
|
10
|
+
export type HologramConnectivityConfig = z.output<typeof hologramConnectivityConfigSchema>;
|
|
11
|
+
export type HologramConnectivityOptions = {
|
|
13
12
|
environment?: ServerEnvironment;
|
|
14
13
|
cacheTtlSeconds?: number;
|
|
15
14
|
apiBase?: string;
|
|
16
15
|
};
|
|
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 };
|
|
16
|
+
export declare function hologramTimeToIso(value: string | null | undefined): string | null;
|
|
17
|
+
export declare function hologramServiceState(state: string | null | undefined): ConnectivityServiceState;
|
|
18
|
+
export declare function parseHologramConnectivity(value: string, expectedDeviceId: number, checkedAt: string): StationConnectivity;
|
|
19
|
+
export declare function loadHologramConnectivity(config: HologramConnectivityConfig, options?: HologramConnectivityOptions): Promise<StationConnectivity>;
|
package/dist/server/hologram.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fetchUpstreamText, resolveEnvironment } from "./environment.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { UpstreamError } from "@azohra/meteo.core";
|
|
4
|
-
|
|
4
|
+
// src/server/hologram.ts
|
|
5
5
|
const HOLOGRAM_API_BASE = "https://dashboard.hologram.io/api/1";
|
|
6
6
|
const TRIAL_HOLOGRAM_CACHE_TTL_SECONDS = 300;
|
|
7
7
|
const hologramConnectivityConfigSchema = z.strictObject({
|
|
@@ -110,5 +110,4 @@ async function loadHologramConnectivity(config, options = {}) {
|
|
|
110
110
|
headers: { Authorization: `Basic ${btoa(`apikey:${config.apiKey}`)}` }
|
|
111
111
|
}), config.deviceId, environment.now().toISOString());
|
|
112
112
|
}
|
|
113
|
-
//#endregion
|
|
114
113
|
export { HOLOGRAM_API_BASE, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity };
|
package/dist/server/live.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StationLiveFrame } from "../contract.js";
|
|
2
|
-
|
|
3
|
-
declare const STATION_LIVE_SSE_HEADERS: {
|
|
2
|
+
export declare const STATION_LIVE_SSE_HEADERS: {
|
|
4
3
|
readonly "Content-Type": "text/event-stream; charset=utf-8";
|
|
5
4
|
readonly "Cache-Control": "no-cache, no-store";
|
|
6
5
|
readonly "X-Accel-Buffering": "no";
|
|
@@ -10,6 +9,4 @@ declare const STATION_LIVE_SSE_HEADERS: {
|
|
|
10
9
|
* vendor open call (openWindnerdLive) is the seam a host uses to serve live
|
|
11
10
|
* data through its own route or fan-out infrastructure.
|
|
12
11
|
*/
|
|
13
|
-
declare function encodeStationLiveSse(frames: ReadableStream<StationLiveFrame>): ReadableStream<Uint8Array>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse };
|
|
12
|
+
export declare function encodeStationLiveSse(frames: ReadableStream<StationLiveFrame>): ReadableStream<Uint8Array>;
|
package/dist/server/live.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/server/live.ts
|
|
2
2
|
const STATION_LIVE_SSE_HEADERS = {
|
|
3
3
|
"Content-Type": "text/event-stream; charset=utf-8",
|
|
4
4
|
"Cache-Control": "no-cache, no-store",
|
|
@@ -15,5 +15,4 @@ function encodeStationLiveSse(frames) {
|
|
|
15
15
|
controller.enqueue(encoder.encode(`data: ${JSON.stringify(frame)}\n\n`));
|
|
16
16
|
} }));
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse };
|
package/dist/sse.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/sse.ts
|
|
2
2
|
const DEFAULT_MAX_EVENT_BYTES = 262144;
|
|
3
3
|
async function* sseEvents(body, options = {}) {
|
|
4
4
|
const maxEventBytes = options.maxEventBytes ?? 262144;
|
|
@@ -52,5 +52,4 @@ async function* sseEvents(body, options = {}) {
|
|
|
52
52
|
await reader.cancel().catch(() => void 0);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { DEFAULT_MAX_EVENT_BYTES, sseEvents };
|
package/dist/strings.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { UnavailableReason } from "./contract.js";
|
|
2
2
|
import { CompassPoint, FreshnessStatus, SpeedUnit } from "./derive.js";
|
|
3
|
-
|
|
4
|
-
type StationStrings = {
|
|
3
|
+
export type StationStrings = {
|
|
5
4
|
averageLabel: string;
|
|
6
5
|
avgLabel: string;
|
|
7
6
|
calm: string;
|
|
@@ -112,8 +111,8 @@ type StationStrings = {
|
|
|
112
111
|
trend: (stationName: string, seriesName: string) => string;
|
|
113
112
|
};
|
|
114
113
|
};
|
|
115
|
-
declare const defaultStrings: StationStrings;
|
|
116
|
-
type StationStringOverrides = Partial<Omit<StationStrings, "compassSpoken" | "updated" | "freshness" | "reasons" | "speedUnits" | "table" | "air" | "aria"> & {
|
|
114
|
+
export declare const defaultStrings: StationStrings;
|
|
115
|
+
export type StationStringOverrides = Partial<Omit<StationStrings, "compassSpoken" | "updated" | "freshness" | "reasons" | "speedUnits" | "table" | "air" | "aria"> & {
|
|
117
116
|
compassSpoken: Partial<StationStrings["compassSpoken"]>;
|
|
118
117
|
updated: Partial<StationStrings["updated"]>;
|
|
119
118
|
freshness: Partial<StationStrings["freshness"]>;
|
|
@@ -123,10 +122,8 @@ type StationStringOverrides = Partial<Omit<StationStrings, "compassSpoken" | "up
|
|
|
123
122
|
air: Partial<StationStrings["air"]>;
|
|
124
123
|
aria: Partial<StationStrings["aria"]>;
|
|
125
124
|
}>;
|
|
126
|
-
declare function resolveStrings(overrides?: StationStringOverrides): StationStrings;
|
|
127
|
-
declare function mergeStringOverrides(outer: StationStringOverrides | undefined, inner: StationStringOverrides | undefined): StationStringOverrides | undefined;
|
|
128
|
-
type FormatTime = (date: Date) => string;
|
|
129
|
-
declare function defaultFormatTime(date: Date): string;
|
|
130
|
-
declare function localeFormatTime(locale: string): FormatTime;
|
|
131
|
-
//#endregion
|
|
132
|
-
export { FormatTime, StationStringOverrides, StationStrings, defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings };
|
|
125
|
+
export declare function resolveStrings(overrides?: StationStringOverrides): StationStrings;
|
|
126
|
+
export declare function mergeStringOverrides(outer: StationStringOverrides | undefined, inner: StationStringOverrides | undefined): StationStringOverrides | undefined;
|
|
127
|
+
export type FormatTime = (date: Date) => string;
|
|
128
|
+
export declare function defaultFormatTime(date: Date): string;
|
|
129
|
+
export declare function localeFormatTime(locale: string): FormatTime;
|
package/dist/strings.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { speedUnitLabel } from "./derive.js";
|
|
2
|
-
|
|
2
|
+
// src/strings.ts
|
|
3
3
|
const defaultStrings = {
|
|
4
4
|
averageLabel: "Average",
|
|
5
5
|
avgLabel: "avg",
|
|
@@ -247,5 +247,4 @@ function localeFormatTime(locale) {
|
|
|
247
247
|
}
|
|
248
248
|
return format;
|
|
249
249
|
}
|
|
250
|
-
//#endregion
|
|
251
250
|
export { defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings };
|
package/dist/windnerd.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function
|
|
5
|
-
declare function windnerdStationUrl(stationKey: string): string;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { WINDNERD_RECORD_PERIODS_MINUTES, WindnerdRecordPeriodMinutes, normalizeWindnerdStationKey, windnerdStationUrl };
|
|
1
|
+
export declare const WINDNERD_RECORD_PERIODS_MINUTES: readonly [1, 5, 10, 15, 30, 60, 180, 360];
|
|
2
|
+
export type WindnerdRecordPeriodMinutes = (typeof WINDNERD_RECORD_PERIODS_MINUTES)[number];
|
|
3
|
+
export declare function normalizeWindnerdStationKey(value: string | null | undefined): string | null;
|
|
4
|
+
export declare function windnerdStationUrl(stationKey: string): string;
|
package/dist/windnerd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/windnerd.ts
|
|
2
2
|
const WINDNERD_HOST = "windnerd.net";
|
|
3
3
|
const WINDNERD_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
4
4
|
const WINDNERD_RECORD_PERIODS_MINUTES = [
|
|
@@ -31,5 +31,4 @@ function windnerdStationUrl(stationKey) {
|
|
|
31
31
|
if (!WINDNERD_KEY.test(stationKey)) throw new Error("Invalid WindNerd station key.");
|
|
32
32
|
return `https://${WINDNERD_HOST}/en/${stationKey}`;
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { WINDNERD_RECORD_PERIODS_MINUTES, normalizeWindnerdStationKey, windnerdStationUrl };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azohra/meteo.station",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Live weather-station reading and display. A wire contract, provider adapters, a polling client, a Node server, and byte-identical React and custom-element display bindings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"weather-station",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"./package.json": "./package.json"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@azohra/meteo.core": "0.3.
|
|
66
|
+
"@azohra/meteo.core": "0.3.2",
|
|
67
67
|
"zod": "^4.6.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -75,15 +75,15 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@testing-library/react": "^16.
|
|
79
|
-
"@types/node": "^22.
|
|
80
|
-
"@types/react": "^19.
|
|
81
|
-
"@types/react-dom": "^19.
|
|
78
|
+
"@testing-library/react": "^16.3.3",
|
|
79
|
+
"@types/node": "^22.20.5",
|
|
80
|
+
"@types/react": "^19.3.0",
|
|
81
|
+
"@types/react-dom": "^19.3.0",
|
|
82
82
|
"jsdom": "^26.0.0",
|
|
83
|
-
"react": "^19.
|
|
84
|
-
"react-dom": "^19.
|
|
83
|
+
"react": "^19.3.1",
|
|
84
|
+
"react-dom": "^19.3.1",
|
|
85
85
|
"typescript": "^7.0.2",
|
|
86
|
-
"vitest": "^
|
|
86
|
+
"vitest": "^5.0.5"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=22"
|