npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evo/featureflags-client

v1.6.0

Published

GRPC node client for feacture flags service

Downloads

1,860

Readme

Feature Flags client

NodeJS client grpc lib, for featureflags service. Provides abilitty to gracefull set and updates for ur features.

.proto files were taken directly from repo above. They should be uploaded in some place from the root repo on deploy i guess

API

FeatureClient is the base class. With it's constructor u will init grpc client.

So u do this on application start:

import { FeatureClient, Variable, Types } from '@evo/featureflags-client';

// Ur default flags dict
const Flags = {
  TEST: false,
  NODE: false
};

const featureClient = new FeatureClient(
  'thecorp', // project name
  'grpc:50051', // grpc-url
  Flags, // default flags
  [
    new Variable('username', Types.STRING) // ur controll values for Checks
  ],
  // it`s the default value, u can skeep it, if dont want
  // to controll loop start manualy
  true, // isDebugg mode
  // Optional argument for set interval in milliseconds for fetching flags
  // from service. By default set to 5 min (5 * 60 * 1000).
  1000 * 10,
);

Next thing u do, is start grpc client in async infinite loop, it will be refetching ur flags values every 5 minutes.

try {
    await featureClient.start();
} catch(e) {
    console.log('FF client failed to start:', e);
}

NOTE! In rare cases it can fail on start (due grpc server hangout or networks issues), then u should relaunch ur app.

In ur controllers, or somewhere when ur need ur features to work properly, call getFlags, and provide there context = {}. Ctx is the object with Variable as a key, and a value u want checks to depend on.

import { getFlags } from '@evo/featureflags-client';

// ready to use object with proceeded checks
const flags = getFlags({ username: 'Petro' });

if (flags.TEST) doSomeThing();

Left to implement

There several features, that exists in python flags.lib , that u are free to extend:

  • StatsController - Accumulates interval/flag/requests count
  • Tracer - Accumulates request/flag/values