Repository
Current version released
5 years ago
Versions
dynamodb
DynamoDB client.
Usage
import { createClient } from "https://denopkg.com/chiefbiiko/dynamodb/mod.ts";
// if config/credentials not passed they will be read from the env/fs
const dyno = createClient();
// the client has all of DynamoDB's operations as camelCased async methods
const result = await dyno.listTables();
The client config can be omitted entirely when calling createClient
. If that is the case the config will be derived from the environment and filesystem, in that order, using get-aws-config
.
Prefer using temporary credentials and a session token.
API
Contents
Basics
/** 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>;
}
/** Credentials. */
export interface Credentials {
accessKeyId: string; // AKIAIOSFODNN7EXAMPLE
secretAccessKey: string; // wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
sessionToken?: string; // somesessiontoken
}
/** Client configuration. */
export interface ClientConfig {
credentials?: Credentials | (() => Credentials | Promise<Credentials>);
region?: string; // us-west-2
profile?: string; // default
canonicalUri?: string; // fx /path/to/somewhere
port?: number; // 80
}
/** 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]
}
Factory
createClient
createClient(conf: ClientConfig): DynamoDBClient
Creates a DynamoDB client.
Ops
The client supports all DynamoDB operations. Check the linked aws docs for info about parameters of a specific operation.
BatchGetItem
batchGetItem(params: Doc, options?: OpOptions): Promise<Doc>
BatchWriteItem
batchWriteItem(params: Doc, options?: OpOptions): Promise<Doc>
CreateBackup
createBackup(params: Doc, options?: OpOptions): Promise<Doc>
CreateGlobalTable
createGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
CreateTable
createTable(params: Doc, options?: OpOptions): Promise<Doc>
DeleteBackup
deleteBackup(params: Doc, options?: OpOptions): Promise<Doc>
DeleteItem
deleteItem(params: Doc, options?: OpOptions): Promise<Doc>
DeleteTable
deleteTable(params: Doc, options?: OpOptions): Promise<Doc>
DescribeBackup
describeBackup(params: Doc, options?: OpOptions): Promise<Doc>
DescribeContinuousBackups
describeContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeContinuousBackups docs
DescribeEndpoints
describeEndpoints(options?: OpOptions): Promise<Doc>
DescribeGlobalTable
describeGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
DescribeGlobalTableSettings
describeGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>
aws DescribeGlobalTableSettings docs
DescribeLimits
describeLimits(options?: OpOptions): Promise<Doc>
DescribeTable
describeTable(params: Doc, options?: OpOptions): Promise<Doc>
DescribeTimeToLive
describeTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>
GetItem
getItem(params: Doc, options?: OpOptions): Promise<Doc>
ListBackups
listBackups(params: Doc, options?: OpOptions): Promise<Doc>
ListGlobalTables
listGlobalTables(params: Doc, options?: OpOptions): Promise<Doc>
ListTables
listTables(options?: OpOptions): Promise<Doc>
ListTagsOfResource
listTagsOfResource(params: Doc, options?: OpOptions): Promise<Doc>
PutItem
putItem(params: Doc, options?: OpOptions): Promise<Doc>
Query
query(params: Doc, options?: OpOptions): Promise<Doc | AsyncIterableIterator<Doc>>
RestoreTableFromBackup
restoreTableFromBackup(params: Doc, options?: OpOptions): Promise<Doc>
aws RestoreTableFromBackup docs
RestoreTableToPointInTime
restoreTableToPointInTime(params: Doc, options?: OpOptions): Promise<Doc>
aws RestoreTableToPointInTime docs
Scan
scan(params: Doc, options?: OpOptions): Promise<Doc | AsyncIterableIterator<Doc>>
TagResource
tagResource(params: Doc, options?: OpOptions): Promise<Doc>
TransactGetItems
transactGetItems(params: Doc, options?: OpOptions): Promise<Doc>
TransactWriteItems
transactWriteItems(params: Doc, options?: OpOptions): Promise<Doc>
UntagResource
untagResource(params: Doc, options?: OpOptions): Promise<Doc>
UpdateContinuousBackups
updateContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateContinuousBackups docs
UpdateGlobalTable
updateGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>
UpdateGlobalTableSettings
updateGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>
aws UpdateGlobalTableSettings docs
UpdateItem
updateItem(params: Doc, options?: OpOptions): Promise<Doc>
UpdateTable
updateTable(params: Doc, options?: OpOptions): Promise<Doc>
UpdateTimeToLive
updateTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>
FYI
Don’t want to do all development against the real AWS cloud?