DynamoDB client.
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.
/** 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
host?: string; // localhost
}
/** 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]
}
Creates a DynamoDB client.
The client supports all DynamoDB operations. Check the linked aws docs for info about parameters of a specific operation.
aws DescribeContinuousBackups docs
aws DescribeGlobalTableSettings docs
aws RestoreTableFromBackup docs
aws RestoreTableToPointInTime docs
aws UpdateContinuousBackups docs
aws UpdateGlobalTableSettings docs
Don't want to do all development against the real AWS cloud?