Comparing version
{ | ||
"name": "tog-node", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "jest --runInBand", | ||
"test:watch": "jest --watch --runInBand", | ||
"lint": "standard", | ||
"jsdoc": "jsdoc -c jsdoc.json" | ||
"typedoc": "typedoc", | ||
"build": "tsc", | ||
"release": "./scripts/release.sh" | ||
}, | ||
"files": [ | ||
"/index.js", | ||
"/types.js", | ||
"/lib" | ||
@@ -21,18 +20,29 @@ ], | ||
"dependencies": { | ||
"ramda": "^0.26.1", | ||
"redis": "^2.8.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.6", | ||
"@babel/preset-env": "^7.8.6", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"@types/jest": "^24.0.15", | ||
"docdash": "^1.1.1", | ||
"@types/redis": "^2.8.16", | ||
"babel-jest": "^25.1.0", | ||
"jest": "^24.8.0", | ||
"jsdoc": "^3.6.3", | ||
"jsdoc-plugin-typescript": "^2.0.1", | ||
"standard": "^12.0.1" | ||
"standard-version": "^7.1.0", | ||
"typedoc": "^0.17.0-3", | ||
"typescript": "^3.8.2" | ||
}, | ||
"standard": { | ||
"env": { | ||
"jest": true | ||
} | ||
"babel": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
], | ||
"@babel/preset-typescript" | ||
] | ||
} | ||
} |
@@ -8,13 +8,45 @@ # Tog Node.js Client | ||
```sh | ||
$ npm install tog | ||
$ npm install tog-node | ||
``` | ||
For details, see the full [API reference](https://escaletech.github.io/tog-node/modules/_index_.html). | ||
### For using sessions | ||
[`SessionClient` reference](https://escaletech.github.io/tog-node/classes/_index_.sessionclient.html) | ||
```js | ||
const TogClient = require('tog-node') | ||
const { SessionClient } = require('tog-node') | ||
const tog = new TogClient('redis://127.0.0.1:6379') | ||
const sessions = new SessionClient('redis://127.0.0.1:6379') | ||
// wherever you whish to retrieve a session | ||
const session = await sessions.session('my_app', 'session-123-xyz', { duration: 60 }) | ||
const buttonColor = session.flags['blue-button'] ? 'blue' : 'red' | ||
``` | ||
## API reference | ||
### For managing flags | ||
See the [API reference](https://escaletech.github.io/tog-node/TogClient.html). | ||
[`FlagClient` reference](https://escaletech.github.io/tog-node/classes/_index_.flagclient.html) | ||
```js | ||
const { FlagClient } = require('tog-node') | ||
const flags = new FlagClient('redis://127.0.0.1:6379') | ||
const allFlags = await flags.listFlags('my_app') | ||
const oneFlag = await flags.getFlag('my_app', 'blue-button') | ||
await flags.saveFlag({ | ||
namespace: 'my_app', | ||
name: 'blue-button', | ||
description: 'Makes the call-to-action button blue', | ||
rollout: [ | ||
{ percentage: 30, value: true } // will be `true` for 30% of users | ||
] | ||
}) | ||
const deleted = await flags.deleteFlag('my_app', 'blue-button') | ||
``` |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
-50%52
160%4643
-68.78%10
66.67%4
-60%0
-100%2
Infinity%- Removed
- Removed