Skip to content

Commit

Permalink
prepare 5.1.1 release (launchdarkly#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Jul 19, 2018
1 parent 17ace62 commit 91d8bff
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 19 deletions.
111 changes: 95 additions & 16 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,33 @@
* Documentation: http://docs.launchdarkly.com/docs/node-sdk-reference
*/

declare module "ldclient-node" {
declare module 'ldclient-node' {
import { EventEmitter } from 'events';

import { ClientOpts } from 'redis';

namespace errors {
export const LDPollingError: ErrorConstructor;
export const LDStreamingError: ErrorConstructor;
export const LDClientError: ErrorConstructor;
export const LDUnexpectedResponseError: ErrorConstructor;
export const LDInvalidSDKKeyError: ErrorConstructor;
}

/**
* The LaunchDarkly static global.
*/
export function init(key: string, options?: LDOptions): LDClient;

/**
* Create a feature flag store backed by a Redis instance
*/
export function RedisFeatureStore(
redisOpts: ClientOpts,
cacheTTL: number,
prefix: string,
logger: LDLogger | object
): LDFeatureStore;

/**
* The types of values a feature flag can have.
*
Expand All @@ -31,7 +44,7 @@ declare module "ldclient-node" {
* A map of feature flags from their keys to their values.
*/
export type LDFlagSet = {
[key: string]: LDFlagValue,
[key: string]: LDFlagValue;
};

/**
Expand Down Expand Up @@ -79,7 +92,6 @@ declare module "ldclient-node" {
*/
logger?: LDLogger | object;


/**
* Feature store used by the LaunchDarkly client, defaults to in memory storage.
*
Expand Down Expand Up @@ -131,7 +143,7 @@ declare module "ldclient-node" {

/**
* Whether to send events back to LaunchDarkly
*/
*/
sendEvents?: boolean;

/**
Expand Down Expand Up @@ -165,7 +177,6 @@ declare module "ldclient-node" {
* Defaults to 300.
*/
userKeysFlushInterval?: number;

}

/**
Expand Down Expand Up @@ -230,7 +241,11 @@ declare module "ldclient-node" {
* Any additional attributes associated with the user.
*/
custom?: {
[key: string]: string | boolean | number | Array<string | boolean | number>,
[key: string]:
| string
| boolean
| number
| Array<string | boolean | number>;
};
}

Expand Down Expand Up @@ -358,10 +373,34 @@ declare module "ldclient-node" {
/**
* Close the feature store.
*
* @returns
* The store instance.
*/
close: () => LDFeatureStore;
close: () => void;
}

/**
* The LaunchDarkly client stream processor
*
* The client uses this internally to retrieve updates from LaunchDarkly.
*/
export interface LDStreamProcessor {
start: (fn?: (err?: any) => void) => void;
stop: () => void;
close: () => void;
}

/**
* The LaunchDarkly client feature flag requestor
*
* The client uses this internally to retrieve feature
* flags from LaunchDarkly.
*/
export interface LDFeatureRequestor {
requestObject: (
kind: any,
key: string,
cb: (err: any, body: any) => void
) => void;
requestAllData: (cb: (err: any, body: any) => void) => void;
}

/**
Expand Down Expand Up @@ -412,12 +451,22 @@ declare module "ldclient-node" {
*
* @param callback
* The callback to receive the variation result.
*
*
* @returns a Promise containing the flag value
*/
variation: (key: string, user: LDUser, defaultValue: LDFlagValue, callback?: (err: any, res: LDFlagValue) => void) => Promise<LDFlagValue>;
variation: (
key: string,
user: LDUser,
defaultValue: LDFlagValue,
callback?: (err: any, res: LDFlagValue) => void
) => Promise<LDFlagValue>;

toggle: (key: string, user: LDUser, defaultValue: LDFlagValue, callback?: (err: any, res: LDFlagValue) => void) => Promise<LDFlagValue>;
toggle: (
key: string,
user: LDUser,
defaultValue: LDFlagValue,
callback?: (err: any, res: LDFlagValue) => void
) => Promise<LDFlagValue>;

/**
* Retrieves the set of all flag values for a user.
Expand All @@ -429,7 +478,10 @@ declare module "ldclient-node" {
* The node style callback to receive the variation result.
* @returns a Promise containing the set of all flag values for a user
*/
allFlags: (user: LDUser, callback?: (err: any, res: LDFlagSet) => void) => Promise<LDFlagSet>;
allFlags: (
user: LDUser,
callback?: (err: any, res: LDFlagSet) => void
) => Promise<LDFlagSet>;

/**
*
Expand All @@ -449,7 +501,6 @@ declare module "ldclient-node" {
*/
close: () => void;


/**
*
* @returns Whether the client is configured in offline mode.
Expand Down Expand Up @@ -491,9 +542,37 @@ declare module "ldclient-node" {
* Internally, the LaunchDarkly SDK keeps an event queue for track and identify calls.
* These are flushed periodically (see configuration option: flushInterval)
* and when the queue size limit (see configuration option: capacity) is reached.
*
*
* @returns a Promise which resolves once flushing is finished
*/
flush: (callback?: (err: any, res: boolean) => void) => Promise<void>;
}
}

declare module 'ldclient-node/streaming' {
import {
LDOptions,
LDFeatureRequestor,
LDStreamProcessor
} from 'ldclient-node';

function StreamProcessor(
sdkKey: string,
options: LDOptions,
requestor: LDFeatureRequestor
): LDStreamProcessor;
export = StreamProcessor;
}
declare module 'ldclient-node/requestor' {
import { LDOptions, LDFeatureRequestor } from 'ldclient-node';

function Requestor(sdkKey: string, options: LDOptions): LDFeatureRequestor;
export = Requestor;
}

declare module 'ldclient-node/feature_store' {
import { LDFeatureStore } from 'ldclient-node';

function InMemoryFeatureStore(): LDFeatureStore;
export = InMemoryFeatureStore;
}
23 changes: 21 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
},
"homepage": "https://github.com/launchdarkly/node-client",
"dependencies": {
"@types/redis": "2.8.6",
"async": "2.6.0",
"crypto": "0.0.3",
"hoek": "4.2.1",
"lrucache": "^1.0.3",
"node-cache": "^3.2.1",
"node-sha1": "0.0.1",
"redis": "^2.6.0-2",
"request": "2.85.0",
"request": "2.87.0",
"request-etag": "^2.0.3",
"semver": "5.5.0",
"tunnel": "https://github.com/launchdarkly/node-tunnel/tarball/d860e57650cce1ea655d00854c81babe6b47e02c",
Expand Down

0 comments on commit 91d8bff

Please sign in to comment.