featureflow-node-sdk 0.6.7 → 0.6.9

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
@@ -14,6 +14,14 @@ Get your Featureflow account at [featureflow.io](http://www.featureflow.io)
14
14
 
15
15
  The easiest way to get started is to follow the [Featureflow quick start guides](http://docs.featureflow.io/docs)
16
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
+
17
25
  ## Change Log
18
26
 
19
27
  Please see [CHANGELOG](https://github.com/featureflow/featureflow-node-sdk/blob/master/CHANGELOG.md).
@@ -0,0 +1,13 @@
1
+ export default class Featureflow {
2
+ constructor(config: any, callback?: (_err: any, self: any) => void);
3
+ failoverVariants: {};
4
+ isReady: boolean;
5
+ config: any;
6
+ eventsClient: EventsClient;
7
+ close: PollingClient;
8
+ ready(callback?: () => void): any;
9
+ evaluateAll(): any;
10
+ evaluate(key: any): any;
11
+ }
12
+ import EventsClient from "./EventsClient";
13
+ import PollingClient from "./PollingClient";
package/dist/Client.js CHANGED
@@ -44,7 +44,7 @@ var Featureflow = function (_EventEmitter) {
44
44
  _inherits(Featureflow, _EventEmitter);
45
45
 
46
46
  function Featureflow(config) {
47
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
47
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (_err, self) {};
48
48
 
49
49
  _classCallCheck(this, Featureflow);
50
50
 
@@ -0,0 +1 @@
1
+ export function test(op: any, a: any, b: any): any;
@@ -0,0 +1,11 @@
1
+ export default class Evaluate {
2
+ constructor(featureKey: any, evaluatedVariant: any, user: any, eventsClient: any);
3
+ featureKey: any;
4
+ evaluatedVariant: any;
5
+ user: any;
6
+ eventsClient: any;
7
+ is(value: any): boolean;
8
+ isOn(): boolean;
9
+ isOff(): boolean;
10
+ value(): any;
11
+ }
@@ -0,0 +1,5 @@
1
+ export function featureEvaluation(feature: any, user: any): any;
2
+ export function ruleMatches(rule: any, user: any): boolean;
3
+ export function getVariantSplitKey(variantSplits: any, variantValue: any): any;
4
+ export function calculateHash(salt: any, feature: any, id: any): any;
5
+ export function getVariantValue(hash: any): number;
@@ -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) {
@@ -0,0 +1,19 @@
1
+ export default class EventsClient {
2
+ constructor(apiKey: any, eventsUrl?: string, disabled?: boolean);
3
+ SEND_INTERVAL: number;
4
+ QUEUE_SIZE: number;
5
+ clientVersion: string;
6
+ queue: any[];
7
+ overLimit: boolean;
8
+ apiKey: any;
9
+ eventsUrl: string;
10
+ disabled: boolean;
11
+ sendInterval: number;
12
+ interval: number;
13
+ registerFeaturesEvent(features: any): void;
14
+ evaluateEvent(featureKey: any, evaluatedVariant: any, expectedVariant: any, user: any): void;
15
+ queueEvaluateEvent(event: any): void;
16
+ sendQueue(): void;
17
+ sendEvent(eventType: any, method: any, url: any, json: any): void;
18
+ close(): void;
19
+ }
@@ -0,0 +1 @@
1
+ export default function _default(options: any): (req: any, res: any, next: any) => void;
@@ -0,0 +1,12 @@
1
+ export default class Feature {
2
+ constructor(key: any, failoverVariant?: string);
3
+ variants: any[];
4
+ key: any;
5
+ failoverVariant: string;
6
+ addVariant(key: any, value: any): Feature;
7
+ build(): {
8
+ key: any;
9
+ failoverVariant: string;
10
+ variants: any[];
11
+ };
12
+ }
@@ -0,0 +1,8 @@
1
+ export class InMemoryFeatureStore {
2
+ constructor(features?: {});
3
+ features: {};
4
+ get(key: any): any;
5
+ set(key: any, feature: any): void;
6
+ setAll(features: any): void;
7
+ getAll(): {};
8
+ }
@@ -0,0 +1,13 @@
1
+ export default class PollingClient {
2
+ constructor(url: any, config: any, callback: any);
3
+ DEFAULT_TIMEOUT: number;
4
+ DEFAULT_INTERVAL: number;
5
+ clientVersion: string;
6
+ url: any;
7
+ apiKey: any;
8
+ featureStore: any;
9
+ interval: number;
10
+ timeout: number;
11
+ etag: string;
12
+ getFeatures(callback?: () => void): void;
13
+ }
package/dist/User.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export class UserBuilder {
2
+ constructor(id: any);
3
+ id: any;
4
+ attributes: {
5
+ 'featureflow.user.id': any[];
6
+ 'featureflow.date': string[];
7
+ };
8
+ withAttribute(key: any, value: any): UserBuilder;
9
+ withAttributes(key: any, values: any): UserBuilder;
10
+ build(): User;
11
+ }
12
+ declare class User {
13
+ constructor(id: any, attributes: any);
14
+ id: any;
15
+ attributes: any;
16
+ getId(): any;
17
+ getAttributesForKey(key: any): any;
18
+ addAttribute(key: any, value: any): void;
19
+ }
20
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _exports: any;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ declare namespace _default {
2
+ export { Client };
3
+ export { UserBuilder };
4
+ export { Feature };
5
+ export { ExpressClient };
6
+ }
7
+ export default _default;
8
+ import Client from "./Client";
9
+ import { UserBuilder } from "./User";
10
+ import Feature from "./Feature";
11
+ import ExpressClient from "./ExpressMiddleware";
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "featureflow-node-sdk",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Featureflow sdk for Node",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "engines": {
7
8
  "node": ">4.0.0"
8
9
  },
@@ -10,7 +11,7 @@
10
11
  "dist"
11
12
  ],
12
13
  "scripts": {
13
- "build": "babel src -d dist",
14
+ "build": "babel src -d dist && tsc",
14
15
  "watch": "babel --watch src -d dist",
15
16
  "prepublish": "npm run build",
16
17
  "test": "cucumber.js --compiler js:babel-core/register --tags \"not @ignore and not @integration\"",
@@ -31,7 +32,8 @@
31
32
  "big-integer": "^1.6.17",
32
33
  "debug": "^2.6.2",
33
34
  "request": "^2.88.0",
34
- "sha1-hex": "^1.0.0"
35
+ "sha1-hex": "^1.0.0",
36
+ "typescript": "^4.8.2"
35
37
  },
36
38
  "devDependencies": {
37
39
  "babel-cli": "^6.26.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
-