@selinac887/weather-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,11 +8,17 @@ export interface CurrentWeather {
8
8
  interval: number;
9
9
  [key: string]: number | string;
10
10
  }
11
+ export interface CurrentWeatherUnits {
12
+ time: string;
13
+ interval: string;
14
+ [key: string]: string;
15
+ }
11
16
  export interface GetCurrentWeatherInput extends BaseLocationInput {
12
17
  current: string[];
13
18
  }
14
19
  export interface GetCurrentWeatherResponse {
15
20
  current: CurrentWeather;
21
+ current_units: CurrentWeatherUnits;
16
22
  }
17
23
  export declare function getCurrentWeather(input: GetCurrentWeatherInput): Promise<GetCurrentWeatherResponse>;
18
24
  export interface HourlyForecast {
package/dist/index.js CHANGED
@@ -12,7 +12,11 @@ export async function getCurrentWeather(input) {
12
12
  if (!res.ok) {
13
13
  throw new Error(`Open-Meteo API error: ${res.status}`);
14
14
  }
15
- return res.json();
15
+ const raw = await res.json();
16
+ return {
17
+ current: raw.current,
18
+ current_units: raw.current_units, // include units exactly as API returns
19
+ };
16
20
  }
17
21
  export async function getForecast(input) {
18
22
  const { latitude, longitude, timezone = "auto", hourly, daily, forecastHours, forecastDays, } = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selinac887/weather-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -18,12 +18,19 @@ export interface CurrentWeather {
18
18
  [key: string]: number | string;
19
19
  }
20
20
 
21
+ export interface CurrentWeatherUnits {
22
+ time: string;
23
+ interval: string;
24
+ [key: string]: string;
25
+ }
26
+
21
27
  export interface GetCurrentWeatherInput extends BaseLocationInput {
22
28
  current: string[];
23
29
  }
24
30
 
25
31
  export interface GetCurrentWeatherResponse {
26
32
  current: CurrentWeather;
33
+ current_units: CurrentWeatherUnits;
27
34
  }
28
35
 
29
36
  export async function getCurrentWeather(
@@ -47,7 +54,12 @@ export async function getCurrentWeather(
47
54
  throw new Error(`Open-Meteo API error: ${res.status}`);
48
55
  }
49
56
 
50
- return res.json();
57
+ const raw: any = await res.json();
58
+
59
+ return {
60
+ current: raw.current,
61
+ current_units: raw.current_units, // include units exactly as API returns
62
+ };
51
63
  }
52
64
 
53
65
  /*