meteo-lt-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +280 -0
- package/dist/__tests__/test-utils.d.ts +240 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +278 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/api/hydro-stations.d.ts +133 -0
- package/dist/api/hydro-stations.d.ts.map +1 -0
- package/dist/api/hydro-stations.js +148 -0
- package/dist/api/hydro-stations.js.map +1 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/places.d.ts +78 -0
- package/dist/api/places.d.ts.map +1 -0
- package/dist/api/places.js +87 -0
- package/dist/api/places.js.map +1 -0
- package/dist/api/stations.d.ts +80 -0
- package/dist/api/stations.d.ts.map +1 -0
- package/dist/api/stations.js +89 -0
- package/dist/api/stations.js.map +1 -0
- package/dist/client/MeteoClient.d.ts +85 -0
- package/dist/client/MeteoClient.d.ts.map +1 -0
- package/dist/client/MeteoClient.js +92 -0
- package/dist/client/MeteoClient.js.map +1 -0
- package/dist/client/config.d.ts +57 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/config.js +29 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/http.d.ts +36 -0
- package/dist/client/http.d.ts.map +1 -0
- package/dist/client/http.js +115 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/rate-limiter.d.ts +64 -0
- package/dist/client/rate-limiter.d.ts.map +1 -0
- package/dist/client/rate-limiter.js +150 -0
- package/dist/client/rate-limiter.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/coordinates.d.ts +26 -0
- package/dist/schemas/coordinates.d.ts.map +1 -0
- package/dist/schemas/coordinates.js +32 -0
- package/dist/schemas/coordinates.js.map +1 -0
- package/dist/schemas/forecasts.d.ts +93 -0
- package/dist/schemas/forecasts.d.ts.map +1 -0
- package/dist/schemas/forecasts.js +38 -0
- package/dist/schemas/forecasts.js.map +1 -0
- package/dist/schemas/hydro-stations.d.ts +172 -0
- package/dist/schemas/hydro-stations.d.ts.map +1 -0
- package/dist/schemas/hydro-stations.js +99 -0
- package/dist/schemas/hydro-stations.js.map +1 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +15 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/places.d.ts +77 -0
- package/dist/schemas/places.d.ts.map +1 -0
- package/dist/schemas/places.js +45 -0
- package/dist/schemas/places.js.map +1 -0
- package/dist/schemas/stations.d.ts +167 -0
- package/dist/schemas/stations.d.ts.map +1 -0
- package/dist/schemas/stations.js +69 -0
- package/dist/schemas/stations.js.map +1 -0
- package/dist/types/conditions.d.ts +47 -0
- package/dist/types/conditions.d.ts.map +1 -0
- package/dist/types/conditions.js +132 -0
- package/dist/types/conditions.js.map +1 -0
- package/dist/types/coordinates.d.ts +63 -0
- package/dist/types/coordinates.d.ts.map +1 -0
- package/dist/types/coordinates.js +58 -0
- package/dist/types/coordinates.js.map +1 -0
- package/dist/types/errors.d.ts +94 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +116 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/forecasts.d.ts +49 -0
- package/dist/types/forecasts.d.ts.map +1 -0
- package/dist/types/forecasts.js +6 -0
- package/dist/types/forecasts.js.map +1 -0
- package/dist/types/hydro-stations.d.ts +143 -0
- package/dist/types/hydro-stations.d.ts.map +1 -0
- package/dist/types/hydro-stations.js +6 -0
- package/dist/types/hydro-stations.js.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/places.d.ts +54 -0
- package/dist/types/places.d.ts.map +1 -0
- package/dist/types/places.js +6 -0
- package/dist/types/places.js.map +1 -0
- package/dist/types/stations.d.ts +90 -0
- package/dist/types/stations.d.ts.map +1 -0
- package/dist/types/stations.js +6 -0
- package/dist/types/stations.js.map +1 -0
- package/package.json +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Giedrius Macevičius
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# meteo-lt-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [Meteo.lt API](https://api.meteo.lt/) - Lithuanian Hydrometeorological Service (LHMT).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **Full Type Safety** - Strict TypeScript types with branded types for coordinates
|
|
8
|
+
- ✅ **Runtime Validation** - Zod schemas validate all API responses
|
|
9
|
+
- 🌳 **Tree-shakeable** - Modular design for optimal bundle size
|
|
10
|
+
- 📚 **Comprehensive TSDoc** - IntelliSense-friendly documentation
|
|
11
|
+
- ⚡ **Zero Dependencies** - Only Zod for runtime validation
|
|
12
|
+
- 🔒 **Error Handling** - Custom error classes for different failure modes
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install meteo-lt-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { MeteoClient } from "meteo-lt-sdk";
|
|
24
|
+
|
|
25
|
+
const client = new MeteoClient();
|
|
26
|
+
|
|
27
|
+
// Get weather forecast for Vilnius
|
|
28
|
+
const forecast = await client.places.getForecast("vilnius", "long-term");
|
|
29
|
+
console.log(`Temperature: ${forecast.forecastTimestamps[0]?.airTemperature}°C`);
|
|
30
|
+
|
|
31
|
+
// Get latest observations from a weather station
|
|
32
|
+
const observations = await client.stations.getObservations(
|
|
33
|
+
"vilniaus-ams",
|
|
34
|
+
"latest"
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// Get water level data
|
|
38
|
+
const hydroData = await client.hydroStations.getMeasuredObservations(
|
|
39
|
+
"nemajunu-vms",
|
|
40
|
+
"latest"
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
### MeteoClient
|
|
47
|
+
|
|
48
|
+
Main entry point for the SDK.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const client = new MeteoClient({
|
|
52
|
+
timeout: 10000, // Optional: request timeout in ms (default: 30000)
|
|
53
|
+
throttle: true, // Optional: enable rate limiting (default: false)
|
|
54
|
+
headers: { "X-Custom-Header": "value" }, // Optional: custom headers
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Rate Limiting
|
|
59
|
+
|
|
60
|
+
The API limits requests to **180 per minute** per IP. Enable automatic rate limiting to prevent hitting this limit:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const client = new MeteoClient({ throttle: true });
|
|
64
|
+
|
|
65
|
+
// Multiple client instances share the same global rate limiter
|
|
66
|
+
const client1 = new MeteoClient({ throttle: true });
|
|
67
|
+
const client2 = new MeteoClient({ throttle: true });
|
|
68
|
+
// Both clients share the same 180 req/min budget
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**How it works:**
|
|
72
|
+
|
|
73
|
+
- Uses a **60-second sliding window** - each request "reserves" a slot for 60 seconds
|
|
74
|
+
- **Time-based, not completion-based** - slots are used when requests _start_, not when they finish
|
|
75
|
+
- **Queuing, not dropping** - excess requests wait in a queue until slots are available
|
|
76
|
+
|
|
77
|
+
**Example:** If you fire 200 requests at once at `t=0`:
|
|
78
|
+
|
|
79
|
+
- 180 start immediately (parallel execution)
|
|
80
|
+
- 20 queue and wait for slots to expire
|
|
81
|
+
- At `t=60s`, all 180 slots expire → 20 queued requests proceed
|
|
82
|
+
|
|
83
|
+
### Places API
|
|
84
|
+
|
|
85
|
+
Access weather forecasts for Lithuanian cities and towns.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// List all available places
|
|
89
|
+
const places = await client.places.getAll();
|
|
90
|
+
|
|
91
|
+
// Get place details
|
|
92
|
+
const place = await client.places.get("vilnius");
|
|
93
|
+
|
|
94
|
+
// Get available forecast types
|
|
95
|
+
const forecastTypes = await client.places.getForecastTypes("vilnius");
|
|
96
|
+
|
|
97
|
+
// Get weather forecast
|
|
98
|
+
const forecast = await client.places.getForecast("vilnius", "long-term");
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Forecast Data
|
|
102
|
+
|
|
103
|
+
Each forecast timestamp includes:
|
|
104
|
+
|
|
105
|
+
- `airTemperature` - Air temperature (°C)
|
|
106
|
+
- `feelsLikeTemperature` - Feels-like temperature (°C)
|
|
107
|
+
- `windSpeed` - Wind speed (m/s)
|
|
108
|
+
- `windGust` - Wind gust (m/s)
|
|
109
|
+
- `windDirection` - Wind direction (0° = north, 180° = south)
|
|
110
|
+
- `cloudCover` - Cloud cover (0-100%)
|
|
111
|
+
- `seaLevelPressure` - Pressure at sea level (hPa)
|
|
112
|
+
- `relativeHumidity` - Relative humidity (%)
|
|
113
|
+
- `totalPrecipitation` - Precipitation amount (mm)
|
|
114
|
+
- `conditionCode` - Weather condition code
|
|
115
|
+
|
|
116
|
+
### Stations API
|
|
117
|
+
|
|
118
|
+
Access meteorological observation data from weather stations.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// List all stations
|
|
122
|
+
const stations = await client.stations.getAll();
|
|
123
|
+
|
|
124
|
+
// Get station details
|
|
125
|
+
const station = await client.stations.get("vilniaus-ams");
|
|
126
|
+
|
|
127
|
+
// Get data availability info
|
|
128
|
+
const info = await client.stations.getObservationsInfo("vilniaus-ams");
|
|
129
|
+
|
|
130
|
+
// Get observations for a specific date
|
|
131
|
+
const observations = await client.stations.getObservations(
|
|
132
|
+
"vilniaus-ams",
|
|
133
|
+
"2024-01-15"
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// Get latest 24-hour observations
|
|
137
|
+
const latest = await client.stations.getObservations("vilniaus-ams", "latest");
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Hydro Stations API
|
|
141
|
+
|
|
142
|
+
Access hydrological observation data from water monitoring stations.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// List all hydro stations
|
|
146
|
+
const stations = await client.hydroStations.getAll();
|
|
147
|
+
|
|
148
|
+
// Get station details
|
|
149
|
+
const station = await client.hydroStations.get("nemajunu-vms");
|
|
150
|
+
|
|
151
|
+
// Get current year (measured) observations
|
|
152
|
+
const measured = await client.hydroStations.getMeasuredObservations(
|
|
153
|
+
"nemajunu-vms",
|
|
154
|
+
"latest"
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Get historical observations
|
|
158
|
+
const historical = await client.hydroStations.getHistoricalObservations(
|
|
159
|
+
"nemajunu-vms",
|
|
160
|
+
"2024-06"
|
|
161
|
+
);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Error Handling
|
|
165
|
+
|
|
166
|
+
The SDK provides specific error classes for different failure scenarios:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import {
|
|
170
|
+
MeteoNotFoundError,
|
|
171
|
+
MeteoRateLimitError,
|
|
172
|
+
MeteoNetworkError,
|
|
173
|
+
MeteoTimeoutError,
|
|
174
|
+
MeteoValidationError,
|
|
175
|
+
} from "meteo-lt-sdk";
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
const forecast = await client.places.getForecast(
|
|
179
|
+
"invalid-place",
|
|
180
|
+
"long-term"
|
|
181
|
+
);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if (error instanceof MeteoNotFoundError) {
|
|
184
|
+
console.log("Place not found:", error.resource);
|
|
185
|
+
} else if (error instanceof MeteoRateLimitError) {
|
|
186
|
+
console.log("Rate limited, retry after:", error.retryAfterSeconds);
|
|
187
|
+
} else if (error instanceof MeteoNetworkError) {
|
|
188
|
+
console.log("Network error:", error.message);
|
|
189
|
+
} else if (error instanceof MeteoTimeoutError) {
|
|
190
|
+
console.log("Request timed out after:", error.timeoutMs, "ms");
|
|
191
|
+
} else if (error instanceof MeteoValidationError) {
|
|
192
|
+
console.log("Invalid response:", error.validationErrors);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Weather Condition Codes
|
|
198
|
+
|
|
199
|
+
The SDK exports condition code utilities:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import {
|
|
203
|
+
FORECAST_CONDITION_CODES,
|
|
204
|
+
OBSERVATION_CONDITION_CODES,
|
|
205
|
+
getConditionDescription,
|
|
206
|
+
isForecastConditionCode,
|
|
207
|
+
} from "meteo-lt-sdk";
|
|
208
|
+
|
|
209
|
+
// Get human-readable description
|
|
210
|
+
const description = getConditionDescription("partly-cloudy"); // 'Partly cloudy'
|
|
211
|
+
|
|
212
|
+
// Type guard
|
|
213
|
+
if (isForecastConditionCode(value)) {
|
|
214
|
+
// value is ForecastConditionCode
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Types
|
|
219
|
+
|
|
220
|
+
All types are exported for use in your application:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import type {
|
|
224
|
+
PlaceSummary,
|
|
225
|
+
PlaceDetails,
|
|
226
|
+
Forecast,
|
|
227
|
+
ForecastTimestamp,
|
|
228
|
+
StationSummary,
|
|
229
|
+
Observation,
|
|
230
|
+
HydroStationSummary,
|
|
231
|
+
MeasuredHydroObservation,
|
|
232
|
+
Coordinates,
|
|
233
|
+
} from "meteo-lt-sdk";
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Advanced Usage
|
|
237
|
+
|
|
238
|
+
### Custom Fetch Implementation
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const client = new MeteoClient({
|
|
242
|
+
fetch: customFetch, // Custom fetch function
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Direct Schema Access
|
|
247
|
+
|
|
248
|
+
For advanced validation needs, schemas are exported:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { schemas } from "meteo-lt-sdk";
|
|
252
|
+
|
|
253
|
+
const result = schemas.forecastSchema.safeParse(data);
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Subpath Imports
|
|
257
|
+
|
|
258
|
+
For tree-shaking, you can import from subpaths:
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { MeteoClient } from "meteo-lt-sdk/client";
|
|
262
|
+
import type { Forecast } from "meteo-lt-sdk/types";
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Rate Limits
|
|
266
|
+
|
|
267
|
+
The API has the following limits:
|
|
268
|
+
|
|
269
|
+
- **180 requests per minute** per IP address
|
|
270
|
+
- **20,000 requests per day** recommended maximum per IP
|
|
271
|
+
|
|
272
|
+
Exceeding these limits may result in temporary IP blocking. **Enable `throttle: true`** to stay within the per-minute limit. The daily limit is not enforced by the SDK.
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
MIT
|
|
277
|
+
|
|
278
|
+
## Credits
|
|
279
|
+
|
|
280
|
+
Data provided by the [Lithuanian Hydrometeorological Service (LHMT)](https://www.meteo.lt/) under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities and mock helpers for Meteo.lt SDK tests.
|
|
3
|
+
*/
|
|
4
|
+
import type { ResolvedMeteoClientConfig } from '../client/config.js';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a mock fetch function that returns the specified response.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMockFetch(response: unknown, options?: {
|
|
9
|
+
status?: number;
|
|
10
|
+
statusText?: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}): typeof globalThis.fetch;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a mock fetch that throws a network error.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createNetworkErrorFetch(message?: string): typeof globalThis.fetch;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a mock fetch that times out via AbortController.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTimeoutFetch(): typeof globalThis.fetch;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a resolved config with a mock fetch.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createMockConfig(mockFetch: typeof globalThis.fetch, overrides?: Partial<ResolvedMeteoClientConfig>): ResolvedMeteoClientConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Sample data for testing places API.
|
|
27
|
+
*/
|
|
28
|
+
export declare const MOCK_PLACES: {
|
|
29
|
+
code: string;
|
|
30
|
+
name: string;
|
|
31
|
+
administrativeDivision: string;
|
|
32
|
+
countryCode: string;
|
|
33
|
+
coordinates: {
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
};
|
|
37
|
+
}[];
|
|
38
|
+
export declare const MOCK_PLACE_DETAILS: {
|
|
39
|
+
code: string;
|
|
40
|
+
name: string;
|
|
41
|
+
administrativeDivision: string;
|
|
42
|
+
country: string;
|
|
43
|
+
countryCode: string;
|
|
44
|
+
coordinates: {
|
|
45
|
+
latitude: number;
|
|
46
|
+
longitude: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const MOCK_FORECAST_TYPES: {
|
|
50
|
+
place: {
|
|
51
|
+
code: string;
|
|
52
|
+
name: string;
|
|
53
|
+
administrativeDivision: string;
|
|
54
|
+
country: string;
|
|
55
|
+
countryCode: string;
|
|
56
|
+
coordinates: {
|
|
57
|
+
latitude: number;
|
|
58
|
+
longitude: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
forecastTypes: {
|
|
62
|
+
type: string;
|
|
63
|
+
description: string;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
export declare const MOCK_FORECAST: {
|
|
67
|
+
place: {
|
|
68
|
+
code: string;
|
|
69
|
+
name: string;
|
|
70
|
+
administrativeDivision: string;
|
|
71
|
+
country: string;
|
|
72
|
+
countryCode: string;
|
|
73
|
+
coordinates: {
|
|
74
|
+
latitude: number;
|
|
75
|
+
longitude: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
forecastType: string;
|
|
79
|
+
forecastCreationTimeUtc: string;
|
|
80
|
+
forecastTimestamps: {
|
|
81
|
+
forecastTimeUtc: string;
|
|
82
|
+
airTemperature: number;
|
|
83
|
+
feelsLikeTemperature: number;
|
|
84
|
+
windSpeed: number;
|
|
85
|
+
windGust: number;
|
|
86
|
+
windDirection: number;
|
|
87
|
+
cloudCover: number;
|
|
88
|
+
seaLevelPressure: number;
|
|
89
|
+
relativeHumidity: number;
|
|
90
|
+
totalPrecipitation: number;
|
|
91
|
+
conditionCode: string;
|
|
92
|
+
}[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Sample data for testing stations API.
|
|
96
|
+
*/
|
|
97
|
+
export declare const MOCK_STATIONS: {
|
|
98
|
+
code: string;
|
|
99
|
+
name: string;
|
|
100
|
+
coordinates: {
|
|
101
|
+
latitude: number;
|
|
102
|
+
longitude: number;
|
|
103
|
+
};
|
|
104
|
+
}[];
|
|
105
|
+
export declare const MOCK_STATION_DETAILS: {
|
|
106
|
+
code: string;
|
|
107
|
+
name: string;
|
|
108
|
+
type: string;
|
|
109
|
+
coordinates: {
|
|
110
|
+
latitude: number;
|
|
111
|
+
longitude: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export declare const MOCK_STATION_OBS_INFO: {
|
|
115
|
+
station: {
|
|
116
|
+
code: string;
|
|
117
|
+
name: string;
|
|
118
|
+
coordinates: {
|
|
119
|
+
latitude: number;
|
|
120
|
+
longitude: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
observationsDataRange: {
|
|
124
|
+
startTimeUtc: string;
|
|
125
|
+
endTimeUtc: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export declare const MOCK_OBSERVATIONS: {
|
|
129
|
+
station: {
|
|
130
|
+
code: string;
|
|
131
|
+
name: string;
|
|
132
|
+
coordinates: {
|
|
133
|
+
latitude: number;
|
|
134
|
+
longitude: number;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
observations: {
|
|
138
|
+
observationTimeUtc: string;
|
|
139
|
+
airTemperature: number;
|
|
140
|
+
feelsLikeTemperature: number;
|
|
141
|
+
windSpeed: number;
|
|
142
|
+
windGust: number;
|
|
143
|
+
windDirection: number;
|
|
144
|
+
cloudCover: number;
|
|
145
|
+
seaLevelPressure: number;
|
|
146
|
+
relativeHumidity: number;
|
|
147
|
+
precipitation: number;
|
|
148
|
+
conditionCode: string;
|
|
149
|
+
}[];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Sample data for testing hydro stations API.
|
|
153
|
+
*/
|
|
154
|
+
export declare const MOCK_HYDRO_STATIONS: {
|
|
155
|
+
code: string;
|
|
156
|
+
name: string;
|
|
157
|
+
waterBody: string;
|
|
158
|
+
coordinates: {
|
|
159
|
+
latitude: number;
|
|
160
|
+
longitude: number;
|
|
161
|
+
};
|
|
162
|
+
}[];
|
|
163
|
+
export declare const MOCK_HYDRO_OBS_TYPES: {
|
|
164
|
+
station: {
|
|
165
|
+
code: string;
|
|
166
|
+
name: string;
|
|
167
|
+
waterBody: string;
|
|
168
|
+
coordinates: {
|
|
169
|
+
latitude: number;
|
|
170
|
+
longitude: number;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
observationTypes: {
|
|
174
|
+
type: string;
|
|
175
|
+
description: string;
|
|
176
|
+
}[];
|
|
177
|
+
};
|
|
178
|
+
export declare const MOCK_HYDRO_MEASURED_INFO: {
|
|
179
|
+
station: {
|
|
180
|
+
code: string;
|
|
181
|
+
name: string;
|
|
182
|
+
waterBody: string;
|
|
183
|
+
coordinates: {
|
|
184
|
+
latitude: number;
|
|
185
|
+
longitude: number;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
observationsDataRange: {
|
|
189
|
+
startTimeUtc: string;
|
|
190
|
+
endTimeUtc: string;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
export declare const MOCK_HYDRO_HISTORICAL_INFO: {
|
|
194
|
+
station: {
|
|
195
|
+
code: string;
|
|
196
|
+
name: string;
|
|
197
|
+
waterBody: string;
|
|
198
|
+
coordinates: {
|
|
199
|
+
latitude: number;
|
|
200
|
+
longitude: number;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
observationsDataRange: {
|
|
204
|
+
startDateUtc: string;
|
|
205
|
+
endDateUtc: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export declare const MOCK_HYDRO_MEASURED_OBS: {
|
|
209
|
+
station: {
|
|
210
|
+
code: string;
|
|
211
|
+
name: string;
|
|
212
|
+
waterBody: string;
|
|
213
|
+
coordinates: {
|
|
214
|
+
latitude: number;
|
|
215
|
+
longitude: number;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
observations: {
|
|
219
|
+
observationTimeUtc: string;
|
|
220
|
+
waterLevel: number;
|
|
221
|
+
waterTemperature: number;
|
|
222
|
+
}[];
|
|
223
|
+
};
|
|
224
|
+
export declare const MOCK_HYDRO_HISTORICAL_OBS: {
|
|
225
|
+
station: {
|
|
226
|
+
code: string;
|
|
227
|
+
name: string;
|
|
228
|
+
waterBody: string;
|
|
229
|
+
coordinates: {
|
|
230
|
+
latitude: number;
|
|
231
|
+
longitude: number;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
observations: {
|
|
235
|
+
observationDateUtc: string;
|
|
236
|
+
waterLevel: number;
|
|
237
|
+
waterDischarge: number;
|
|
238
|
+
}[];
|
|
239
|
+
};
|
|
240
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAO,GACvF,OAAO,UAAU,CAAC,KAAK,CAWzB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,SAAkB,GAAG,OAAO,UAAU,CAAC,KAAK,CAI1F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,UAAU,CAAC,KAAK,CAS5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,OAAO,UAAU,CAAC,KAAK,EAClC,SAAS,GAAE,OAAO,CAAC,yBAAyB,CAAM,GACjD,yBAAyB,CAS3B;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;GAevB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAO9B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAK/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;GAWzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;CAKhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAkC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;GAa/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;CAWhC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;CAWtC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;CAmBnC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;CAmBrC,CAAC"}
|