@apiverve/weatherforecast 1.1.13 → 1.2.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.
Files changed (4) hide show
  1. package/README.md +12 -12
  2. package/index.d.ts +28 -16
  3. package/index.js +3 -9
  4. package/package.json +5 -6
package/README.md CHANGED
@@ -122,22 +122,22 @@ async function makeRequest() {
122
122
  "status": "ok",
123
123
  "error": null,
124
124
  "data": {
125
- "tempC": 15.6,
126
- "tempF": 60.1,
127
- "windMph": 4.9,
128
- "windKph": 7.9,
129
- "windDegree": 315,
130
- "windDir": "NW",
131
- "pressureMb": 1021,
132
- "pressureIn": 30.16,
125
+ "tempC": 13.3,
126
+ "tempF": 55.9,
127
+ "windMph": 4.7,
128
+ "windKph": 7.6,
129
+ "windDegree": 273,
130
+ "windDir": "W",
131
+ "pressureMb": 1022,
132
+ "pressureIn": 30.17,
133
133
  "precipMm": 0,
134
134
  "precipIn": 0,
135
- "feelslikeC": 15.6,
136
- "feelslikeF": 60.1,
135
+ "feelslikeC": 13,
136
+ "feelslikeF": 55.3,
137
137
  "visKm": 16,
138
138
  "visMiles": 9,
139
- "gustMph": 6.6,
140
- "gustKph": 10.5
139
+ "gustMph": 7.2,
140
+ "gustKph": 11.6
141
141
  }
142
142
  }
143
143
  ```
package/index.d.ts CHANGED
@@ -4,31 +4,43 @@ declare module '@apiverve/weatherforecast' {
4
4
  secure?: boolean;
5
5
  }
6
6
 
7
+ /**
8
+ * Describes fields the current plan does not unlock. Locked fields arrive as null
9
+ * in `data`; `locked_fields` names them, using dot paths for nested fields.
10
+ * Absent when the plan unlocks everything.
11
+ */
12
+ export interface PremiumInfo {
13
+ message: string;
14
+ upgrade_url: string;
15
+ locked_fields: string[];
16
+ }
17
+
7
18
  export interface weatherforecastResponse {
8
19
  status: string;
9
20
  error: string | null;
10
21
  data: WeatherData;
11
22
  code?: number;
23
+ premium?: PremiumInfo;
12
24
  }
13
25
 
14
26
 
15
27
  interface WeatherData {
16
- tempC: number;
17
- tempF: number;
18
- windMph: number;
19
- windKph: number;
20
- windDegree: number;
21
- windDir: string;
22
- pressureMB: number;
23
- pressureIn: number;
24
- precipMm: number;
25
- precipIn: number;
26
- feelslikeC: number;
27
- feelslikeF: number;
28
- visKM: number;
29
- visMiles: number;
30
- gustMph: number;
31
- gustKph: number;
28
+ tempC: number | null;
29
+ tempF: number | null;
30
+ windMph: number | null;
31
+ windKph: number | null;
32
+ windDegree: number | null;
33
+ windDir: null | string;
34
+ pressureMB: number | null;
35
+ pressureIn: number | null;
36
+ precipMm: number | null;
37
+ precipIn: number | null;
38
+ feelslikeC: number | null;
39
+ feelslikeF: number | null;
40
+ visKM: number | null;
41
+ visMiles: number | null;
42
+ gustMph: number | null;
43
+ gustKph: number | null;
32
44
  }
33
45
 
34
46
  export default class weatherforecastWrapper {
package/index.js CHANGED
@@ -13,16 +13,10 @@ class weatherforecastWrapper {
13
13
  throw new Error('API key must be provided as a non-empty string. Get your API key at: https://apiverve.com');
14
14
  }
15
15
 
16
- // Validate API key format (GUID or alphanumeric with hyphens)
17
- const apiKeyPattern = /^[a-zA-Z0-9-]+$/;
16
+ // Validate API key format (GUID, prefixed keys like apv_xxx, or alphanumeric)
17
+ const apiKeyPattern = /^[a-zA-Z0-9_-]+$/;
18
18
  if (!apiKeyPattern.test(api_key)) {
19
- throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens. Get your API key at: https://apiverve.com');
20
- }
21
-
22
- // Check minimum length (GUIDs are typically 36 chars with hyphens, or 32 without)
23
- const trimmedKey = api_key.replace(/-/g, '');
24
- if (trimmedKey.length < 32) {
25
- throw new Error('Invalid API key. API key appears to be too short. Get your API key at: https://apiverve.com');
19
+ throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens and underscores. Get your API key at: https://apiverve.com');
26
20
  }
27
21
 
28
22
  if (typeof secure !== 'boolean') {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apiverve/weatherforecast",
3
- "version": "1.1.13",
3
+ "version": "1.2.0",
4
4
  "description": "Weather is a simple tool for getting the current weather. It returns the temperature, humidity, and more for a given location.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "sideEffects": false,
8
8
  "engines": {
9
- "node": ">=14.0.0"
9
+ "node": ">=18.0.0"
10
10
  },
11
11
  "files": [
12
12
  "index.js",
@@ -23,7 +23,7 @@
23
23
  "directory": "npm"
24
24
  },
25
25
  "keywords": [
26
- ""
26
+ "weather forecast", "weather forecast api", "weather forecast tool", "weather forecast software", "weather forecast service"
27
27
  ],
28
28
  "author": {
29
29
  "name": "APIVerve",
@@ -41,8 +41,7 @@
41
41
  "dotenv": "^16.4.7"
42
42
  },
43
43
  "dependencies": {
44
- "node-fetch": "^3.3.2",
45
- "promise": "^8.3.0",
46
- "axios": "1.13.2"
44
+ "axios": "1.13.2",
45
+ "form-data": "^4.0.1"
47
46
  }
48
47
  }