Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@unrevealed/node
Advanced tools
The Node SDK helps you integrate Unrevealed in a Node server.
It's not suitable for serverless environments yet. If this is something you need, send us an email to thom@unrevealed.tech or open an issue and we'll prioritize it.
npm install @unrevealed/node
yarn add @unrevealed/node
pnpm install @unrevealed/node
UnrevealedClient
The Unrevealed client takes an UnrevealedClientOptions
object as a parameter:
const client = new UnrevealedClient({
apiKey: UNREVEALED_API_KEY,
logger: customLogger,
defaults: {
'feature-a': true,
},
});
Option | Type | Note |
---|---|---|
apiKey * | string | Generate a Server API key on Unrevealed |
logger | UnrevealedLogger | An optional custom logger (compatible with winston loggers) |
defaults | Record<string, boolean> | An optional map of default value for your feature flags. Used if the connection gets lost with the Unrevealed API |
connect
await client.connect();
Call this once when initializing your server. The SDK will open a connection to our servers that will receive the rules for your feature flags, and real-time updates when any of those rules change. Rules are stored and evaluated locally, so evaluating feature flags is fast and synchronous.
close
client.close();
Closes the connection with the Unrevealed API.
isFeatureEnabled
client.isFeatureEnabled('feature-b', { user: { id: 'user-id', traits: {...} }, team: { id: 'team-id', traits: {...} } });
Returns true
if a feature is enabled for a certain user in a certain team, false
otherwise.
Parameter | Type | Note |
---|---|---|
featureKey * | string | The key of the feature you want to check |
options.user | { id: string, traits: object } | An optional user |
options.team | { id: string, traits: object } | An optional team |
getEnabledFeatures
client.getEnabledFeatures({ user: { id: 'user-id', traits: {...} }, team: { id: 'team-id', traits: {...} } });
Returns an array of the keys of all the features enabled for a certain user in a certain team.
Parameter | Type | Note |
---|---|---|
options.user | { id: string, traits: object } | An optional user |
options.team | { id: string, traits: object } | An optional team |
await client.identify({ user: { id: 'user-id', traits: {...} }, team: { id: 'team-id', traits: {...} } });
Identifies a user and its current team. This will make the user and its team show up in the Unrevealed app, allowing you to select them for a beta for example.
You can make the identify
and isFeatureEnabled
functions type safe by using the code generator, and defining the traits of your users and teams in the app.
FAQs
Unrevealed SDK for Node
The npm package @unrevealed/node receives a total of 124 weekly downloads. As such, @unrevealed/node popularity was classified as not popular.
We found that @unrevealed/node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.