natureco-sdk 1.0.0 → 1.0.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/index.js +6 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NatureCo JavaScript SDK
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.1
|
|
4
4
|
* @description Official JavaScript SDK for NatureCo API
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -10,6 +10,11 @@ class NatureCoClient {
|
|
|
10
10
|
throw new Error('API key is required');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Validate API key format (accept both nc_ and nco_ prefixes)
|
|
14
|
+
if (!apiKey.startsWith('nc_') && !apiKey.startsWith('nco_')) {
|
|
15
|
+
throw new Error('Invalid API key format. Key must start with nc_ or nco_');
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
this.apiKey = apiKey;
|
|
14
19
|
this.baseURL = options.baseURL || 'https://api.natureco.me/api/v1';
|
|
15
20
|
this.timeout = options.timeout || 30000;
|