DynamoDB client.
import { createClient } from "https://denopkg.com/chiefbiiko/dynamodb/mod.ts" ;
// minimal config to create a client
const conf = {
accessKeyId : "abc" ,
secretAccessKey : "def" ,
region : "local"
}
// the client has all of DynamoDB's operations as camelCased async methods
const ddbc = createClient ( conf ) ;
// imagine a world with top-level await
const result = await ddbc . listTables ( ) ;
Basics
Factory
Ops
/** Generic document. */
export interface Doc {
[ key : string ] : any ;
}
/** Generic representation of a DynamoDB client. */
export interface DynamoDBClient {
describeEndpoints : ( options ?: Doc ) => Promise < Doc > ;
describeLimits : ( options ?: Doc ) => Promise < Doc > ;
listTables : ( options ?: Doc ) => Promise < Doc > ;
scan : (
params : Doc ,
options ?: Doc
) => Promise < Doc | AsyncIterableIterator < Doc > > ;
query : (
params : Doc ,
options ?: Doc
) => Promise < Doc | AsyncIterableIterator < Doc > > ;
[ key : string ] : ( params : Doc , options ?: Doc ) => Promise < Doc > ;
}
/** Client configuration. */
export interface ClientConfig {
accessKeyId : string ; // AKIAIOSFODNN7EXAMPLE
secretAccessKey : string ; // wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region : string ; // us-west-2
canonicalUri ?: string ; // fx /path/to/somewhere
port ?: number ; // 8000
}
/** Op options. */
export interface OpOptions {
wrapNumbers ?: boolean , // wrap numbers to a special number value type? [false]
convertEmptyValues ?: boolean , // convert empty strings and binaries? [false]
translateJSON ?: boolean , // translate I/O JSON schemas? [true]
iteratePages ?: boolean // if a result is paged, async-iterate it? [true]
}
createClient(conf: ClientConfig): DynamoDBClient
Creates a DynamoDB client.
The client supports all DynamoDB operations. Check the linked aws docs for info about parameters of a specific operation.
batchGetItem(params: Doc, options?: OpOptions): Promise<Doc>
aws BatchGetItem docs
batchWriteItem(params: Doc, options?: OpOptions): Promise<Doc>
aws BatchWriteItem docs
createBackup(params: Doc, options?: OpOptions): Promise<Doc>
aws CreateBackup docs
createGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
aws CreateGlobalTable docs
createTable(params: Doc, options?: OpOptions): Promise<Doc>
aws CreateTable docs
deleteBackup(params: Doc, options?: OpOptions): Promise<Doc>
aws DeleteBackup docs
deleteItem(params: Doc, options?: OpOptions): Promise<Doc>
aws DeleteItem docs
deleteTable(params: Doc, options?: OpOptions): Promise<Doc>
aws DeleteTable docs
describeBackup(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeBackup docs
DescribeContinuousBackups
describeContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeContinuousBackups docs
describeEndpoints(options?: OpOptions): Promise<Doc>
aws DescribeEndpoints docs
describeGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeGlobalTable docs
DescribeGlobalTableSettings
describeGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeGlobalTableSettings docs
describeLimits(options?: OpOptions): Promise<Doc>
aws DescribeLimits docs
describeTable(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeTable docs
describeTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeTimeToLive docs
getItem(params: Doc, options?: OpOptions): Promise<Doc>
aws GetItem docs
listBackups(params: Doc, options?: OpOptions): Promise<Doc>
aws ListBackups docs
listGlobalTables(params: Doc, options?: OpOptions): Promise<Doc>
aws ListGlobalTables docs
listTables(options?: OpOptions): Promise<Doc>
aws ListTables docs
listTagsOfResource(params: Doc, options?: OpOptions): Promise<Doc>
aws ListTagsOfResource docs
putItem(params: Doc, options?: OpOptions): Promise<Doc>
aws PutItem docs
query(params: Doc, options?: OpOptions): Promise<Doc | AsyncIterableIterator<Doc>>
aws Query docs
restoreTableFromBackup(params: Doc, options?: OpOptions): Promise<Doc>
aws RestoreTableFromBackup docs
RestoreTableToPointInTime
restoreTableToPointInTime(params: Doc, options?: OpOptions): Promise<Doc>
aws RestoreTableToPointInTime docs
scan(params: Doc, options?: OpOptions): Promise<Doc | AsyncIterableIterator<Doc>>
aws Scan docs
tagResource(params: Doc, options?: OpOptions): Promise<Doc>
aws TagResource docs
transactGetItems(params: Doc, options?: OpOptions): Promise<Doc>
aws TransactGetItems docs
transactWriteItems(params: Doc, options?: OpOptions): Promise<Doc>
aws TransactWriteItems docs
untagResource(params: Doc, options?: OpOptions): Promise<Doc>
aws UntagResource docs
updateContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateContinuousBackups docs
updateGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateGlobalTable docs
UpdateGlobalTableSettings
updateGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateGlobalTableSettings docs
updateItem(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateItem docs
updateTable(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateTable docs
updateTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateTimeToLive docs
Don't want to do all development against the real AWS cloud?
MIT