@hyphen/sdk 1.6.0 → 1.7.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/README.md +29 -2
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
# Hyphen Node.js SDK
|
|
9
9
|
|
|
10
|
-
The Hyphen Node.js SDK is a JavaScript library that allows developers to easily integrate Hyphen's feature flag service [Toggle](https://hyphen.ai/toggle)
|
|
10
|
+
The Hyphen Node.js SDK is a JavaScript library that allows developers to easily integrate Hyphen's feature flag service [Toggle](https://hyphen.ai/toggle), secret management service [ENV](https://hyphen.ai/env), and geo information service [Net Info](https://hyphen.ai/net-info) into their Node.js applications.
|
|
11
11
|
|
|
12
12
|
# Table of Contents
|
|
13
13
|
- [Installation](#installation)
|
|
@@ -20,6 +20,9 @@ The Hyphen Node.js SDK is a JavaScript library that allows developers to easily
|
|
|
20
20
|
- [Toggle Caching](#toggle-caching)
|
|
21
21
|
- [Toggle Environment Variables](#toggle-environment-variables)
|
|
22
22
|
- [Toggle Self-Hosted](#toggle-self-hosted)
|
|
23
|
+
- [ENV](#env)
|
|
24
|
+
- [Loading Environment Variables](#loading-environment-variables)
|
|
25
|
+
- [Net Info](#net-info)
|
|
23
26
|
- [Contributing](#contributing)
|
|
24
27
|
- [Testing Your Changes](#testing-your-changes)
|
|
25
28
|
- [License and Copyright](#license-and-copyright)
|
|
@@ -529,6 +532,27 @@ import { loadEnv } from '@hyphen/sdk';
|
|
|
529
532
|
loadEnv({ local: false });
|
|
530
533
|
```
|
|
531
534
|
|
|
535
|
+
# Net Info (https://net.info)
|
|
536
|
+
|
|
537
|
+
The Hyphen Node.js SDK also provides a `NetInfo` class that allows you to fetch geo information about an IP address. This can be useful for debugging or logging purposes. You can read more about it:
|
|
538
|
+
|
|
539
|
+
* [Website](https://hyphen.ai/net-info)
|
|
540
|
+
* [Quick Start Guide](https://docs.hyphen.ai/docs/netinfo-quickstart)
|
|
541
|
+
|
|
542
|
+
To use the `NetInfo` class, you can do the following:
|
|
543
|
+
|
|
544
|
+
```javascript
|
|
545
|
+
import { NetInfo } from '@hyphen/sdk';
|
|
546
|
+
const netInfo = new NetInfo({
|
|
547
|
+
apiKey: 'your_api_key',
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
const ipInfo = await netInfo.getIpInfo('8.8.8.8');
|
|
551
|
+
console.log('IP Info:', ipInfo);
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
You can also set the API key using the `HYPHEN_API_KEY` environment variable. This is useful for keeping your API key secure and not hardcoding it in your code.
|
|
555
|
+
|
|
532
556
|
# Contributing
|
|
533
557
|
|
|
534
558
|
We welcome contributions to the Hyphen Node.js SDK! If you have an idea for a new feature, bug fix, or improvement, please follow these steps:
|
|
@@ -566,10 +590,13 @@ Once you have created the project, added the toggles, and created your applicati
|
|
|
566
590
|
|
|
567
591
|
|
|
568
592
|
```bash
|
|
569
|
-
HYPHEN_PUBLIC_API_KEY=
|
|
593
|
+
HYPHEN_PUBLIC_API_KEY=your_public_api_key
|
|
594
|
+
HYPHEN_API_KEY=your_api_key
|
|
570
595
|
HYPHEN_APPLICATION_ID=your_project_id
|
|
571
596
|
```
|
|
572
597
|
|
|
598
|
+
The `HYPHEN_PUBLIC_API_KEY` is the public API key for your Hyphen project, `HYPHEN_API_KEY` is the API key used for things such as `NetInfo` and is located under settings in the dashboard, and `HYPHEN_APPLICATION_ID` is the application ID for your Hyphen project.
|
|
599
|
+
|
|
573
600
|
Then run the tests with the following command:
|
|
574
601
|
|
|
575
602
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyphen/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Hyphen SDK for Node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -46,7 +46,10 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@hyphen/openfeature-server-provider": "^1.0.7",
|
|
48
48
|
"@openfeature/server-sdk": "^1.18.0",
|
|
49
|
+
"axios": "^1.10.0",
|
|
50
|
+
"cacheable": "^1.10.0",
|
|
49
51
|
"dotenv": "^16.5.0",
|
|
50
|
-
"hookified": "^1.9.0"
|
|
52
|
+
"hookified": "^1.9.0",
|
|
53
|
+
"pino": "^9.7.0"
|
|
51
54
|
}
|
|
52
55
|
}
|