forked from launchdarkly/node-server-sdk-dynamodb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Typescript defs and improve documentation (launchdarkly#3)
- Loading branch information
1 parent
5ebbe64
commit 7a79fbe
Showing
10 changed files
with
105 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
node_modules | ||
package-lock.json | ||
junit.xml | ||
|
||
test-types.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Type definitions for ldclient-node-dynamodb-store | ||
|
||
/** | ||
* Interface for the DynamoDB feature store component to be used with the LaunchDarkly SDK. | ||
* | ||
* See: https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store | ||
*/ | ||
|
||
declare module 'ldclient-node-dynamodb-store' { | ||
import { LDFeatureStore, LDLogger } from 'ldclient-node'; | ||
import { DynamoDB } from 'aws-sdk'; | ||
|
||
/** | ||
* Create a feature flag store backed by DynamoDB. | ||
*/ | ||
export function DynamoDBFeatureStore( | ||
/** | ||
* The table name in DynamoDB. This table must already exist (see readme). | ||
*/ | ||
tableName: string, | ||
|
||
/** | ||
* Options for configuring the feature store. | ||
*/ | ||
options?: LDDynamoDBOptions | ||
): LDFeatureStore; | ||
|
||
/** | ||
* Options for configuring a DynamoDBFeatureStore. | ||
*/ | ||
export interface LDDynamoDBOptions { | ||
/** | ||
* Options to be passed to the DynamoDB client constructor, as defined by the AWS SDK. | ||
*/ | ||
clientOptions?: DynamoDB.DocumentClient.DocumentClientOptions & DynamoDB.Types.ClientConfiguration; | ||
|
||
/** | ||
* Specifies an existing, already-configured DynamoDB client instance that the feature store | ||
* should use rather than creating one of its own. If you specify an existing client, then the | ||
* clientOptions property is ignored. | ||
*/ | ||
dynamoDBClient?: DynamoDB.DocumentClient; | ||
|
||
/** | ||
* An optional namespace prefix for all keys stored in DynamoDB. Use this if you are sharing | ||
* the same database table between multiple clients that are for different LaunchDarkly | ||
* environments, to avoid key collisions. | ||
*/ | ||
prefix?: string; | ||
|
||
/** | ||
* The expiration time for local caching, in seconds. To disable local caching, set this to zero. | ||
* If not specified, the default is 15 seconds. | ||
*/ | ||
cacheTTL?: number; | ||
|
||
/** | ||
* A logger to be used for warnings and errors generated by the feature store. If not specified, | ||
* the default is an instance of winston.Logger. | ||
*/ | ||
logger?: LDLogger; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
// This file exists only so that we can run the TypeScript compiler in the CI build | ||
// to validate our index.d.ts file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"strict": true, | ||
"lib": [ | ||
"es6" | ||
] | ||
}, | ||
"files": [ | ||
"index.d.ts", | ||
"test-types.ts" | ||
] | ||
} |