featureflow-node-sdk 0.6.5 → 0.6.9-alpha

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![][npm-img]][npm-url]
4
4
 
5
+ [![Featureflow](https://circleci.com/gh/featureflow/featureflow-node-sdk.svg?style=svg)](https://circleci.com/gh/featureflow/featureflow-node-sdk)
6
+
5
7
  [![][dependency-img]][dependency-url]
6
8
 
7
9
  > Featureflow Node SDK
@@ -12,6 +14,14 @@ Get your Featureflow account at [featureflow.io](http://www.featureflow.io)
12
14
 
13
15
  The easiest way to get started is to follow the [Featureflow quick start guides](http://docs.featureflow.io/docs)
14
16
 
17
+ ## Examples
18
+
19
+ Express: [here](https://github.com/featureflow/featureflow-node-example)
20
+
21
+ NextJS: [here](https://github.com/featureflow/featureflow-example-nextjs)
22
+
23
+ 5 Minute: [here](https://github.com/featureflow/featureflow-fiveminute-node) [(docs)](https://docs.featureflow.io/docs/nodejs-5-minute-test)
24
+
15
25
  ## Change Log
16
26
 
17
27
  Please see [CHANGELOG](https://github.com/featureflow/featureflow-node-sdk/blob/master/CHANGELOG.md).
package/dist/Client.js CHANGED
@@ -105,6 +105,17 @@ var Featureflow = function (_EventEmitter) {
105
105
  });
106
106
  }
107
107
  }
108
+ }, {
109
+ key: 'waitForReady',
110
+ value: function waitForReady() {
111
+ var _this3 = this;
112
+
113
+ return new Promise(function (resolve) {
114
+ _this3.ready(function () {
115
+ return resolve();
116
+ });
117
+ });
118
+ }
108
119
  }, {
109
120
  key: 'evaluateAll',
110
121
  value: function (_evaluateAll) {
@@ -52,7 +52,7 @@ function featureEvaluation(feature, user) {
52
52
  }
53
53
 
54
54
  function ruleMatches(rule, user) {
55
- if (rule.defaultRule) {
55
+ if (!rule.audience) {
56
56
  return true;
57
57
  } else {
58
58
  for (var cKey in rule.audience.conditions) {
@@ -29,7 +29,7 @@ var EventsClient = function () {
29
29
 
30
30
  this.SEND_INTERVAL = 5;
31
31
  this.QUEUE_SIZE = 10000;
32
- this.clientVersion = 'NodeJsClient/0.6.5';
32
+ this.clientVersion = 'NodeJsClient/0.6.6';
33
33
  this.queue = [];
34
34
  this.overLimit = false;
35
35
 
@@ -71,7 +71,6 @@ var EventsClient = function () {
71
71
  }, {
72
72
  key: 'sendQueue',
73
73
  value: function sendQueue() {
74
- console.log('Sent ' + this.queue.length);
75
74
  if (this.queue.length === 0) return;
76
75
  var sendQueue = this.queue;
77
76
  this.queue = [];
@@ -24,22 +24,25 @@ var PollingClient = function () {
24
24
 
25
25
  this.DEFAULT_TIMEOUT = 5 * 1000;
26
26
  this.DEFAULT_INTERVAL = 10 * 1000;
27
- this.clientVersion = 'NodeJsClient/0.6.5';
27
+ this.clientVersion = 'NodeJsClient/0.6.6';
28
28
 
29
29
  this.url = url;
30
30
  this.apiKey = config.apiKey;
31
31
  this.featureStore = config.featureStore;
32
-
33
- this.etag = "";
34
-
35
- this.timeout = this.DEFAULT_TIMEOUT;
36
32
  this.interval = this.DEFAULT_INTERVAL;
33
+ if (config.interval && config.interval > 5 || config.interval == 0) {
34
+ this.interval = config.interval * 1000;
35
+ }
36
+ this.timeout = this.DEFAULT_TIMEOUT;
37
+ this.etag = "";
37
38
 
38
39
  this.getFeatures(callback);
39
-
40
- var interval = setInterval(this.getFeatures.bind(this), this.interval);
41
-
42
- return clearInterval.bind(this, interval);
40
+ if (this.interval > 0) {
41
+ var interval = setInterval(this.getFeatures.bind(this), this.interval);
42
+ return clearInterval.bind(this, interval);
43
+ } else {
44
+ (0, _debug2.default)("Polling interval set to 0. Featureflow will NOT poll for feature changes.");
45
+ }
43
46
  }
44
47
 
45
48
  _createClass(PollingClient, [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featureflow-node-sdk",
3
- "version": "0.6.5",
3
+ "version": "0.6.9-alpha",
4
4
  "description": "Featureflow sdk for Node",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -14,6 +14,7 @@
14
14
  "watch": "babel --watch src -d dist",
15
15
  "prepublish": "npm run build",
16
16
  "test": "cucumber.js --compiler js:babel-core/register --tags \"not @ignore and not @integration\"",
17
+ "ci-test": "cucumber.js --format json:./cucumber/tests.cucumber --compiler js:babel-core/register --tags \"not @ignore and not @integration\"",
17
18
  "test:integration": "cucumber.js --compiler js:babel-core/register --tags \"@integration\""
18
19
  },
19
20
  "repository": {
@@ -33,8 +34,8 @@
33
34
  "sha1-hex": "^1.0.0"
34
35
  },
35
36
  "devDependencies": {
36
- "babel-cli": "^6.24.0",
37
- "babel-core": "^6.24.0",
37
+ "babel-cli": "^6.26.0",
38
+ "babel-core": "^6.26.0",
38
39
  "babel-plugin-transform-flow-strip-types": "^6.22.0",
39
40
  "babel-plugin-transform-object-rest-spread": "^6.23.0",
40
41
  "babel-preset-es2015": "^6.24.0",
package/CHANGELOG.md DELETED
@@ -1,42 +0,0 @@
1
- # Change log
2
- ## [0.6.4] - 2018-012-18
3
- ### Changed
4
- - Simplify express middleware
5
- - Update url to events.featureflow.io for events
6
- - Improve polling time
7
- - Update readme
8
- ## [0.5.5] - 2017-07-14
9
- ### Changed
10
- - Updated tests
11
- ## [0.5.4] - 2017-07-14
12
- ### Changed
13
- - Added baseUrl config option, added `featureflow.ready(function(){})` callback
14
- ### Fixed
15
- - Issue with offVariantKey
16
- ## [0.5.2] - 2017-07-10
17
- ### Changed
18
- - Fix support for `var Featureflow = require('featureflow-node-sdk')`, previously was on `Featureflow.default`
19
- ## [0.5.0] - 2017-06-30
20
- ### Breaking Changes
21
- - Entire api rewritten to follow closer to other SDK implementations.
22
- ## [0.3.0] - 2017-04-13
23
- ### Changed
24
- - `Featureflow.init()` now returns the client, and the callback is optional. You can listen to `Featureflow.events.INIT` and `Featureflow.events.UPDATED` separately using `featureflow.on(event, callback)`.
25
- - Added new events `Featureflow.events.INIT` and `Featureflow.events.UPDATED_VERBOSE`.
26
- ### Fixed
27
- - `Featureflow.events.INIT` now fires before `Featureflow.events.UPDATED`
28
- ## [0.1.3] - 2017-03-21
29
- ### Changed
30
- - Added `Featureflow.events.UPDATED` and `Featureflow.events.ERROR` constants for usage with `featureflow.on(event, callback)`.
31
- ## [0.1.2] - 2017-03-21
32
- ### Changed
33
- - `featureflow.close()` added to close connection with **featureflow.io**.
34
- ## [0.1.1] - 2017-03-21
35
- ### Changed
36
- - `Featureflow.init(config, callback)` now starts up with the feature values passed in with `config.withFeatures`
37
- and corresponding failoverVariants if your app is not able to connect to **featureflow.io**.
38
- - Callback now only fires once per call to `Featureflow.init(...)`
39
- ## [0.1.0] - 2017-03-20
40
- ### Changed
41
- - Initial Build
42
-