https://deno.land/x/dynamodb 

dynamodb

Travis AppVeyor

DynamoDB client.

👾⚡️🌀🌁🌊🐱🐶 Can't run this against a real DynamoDB until Deno supports TLS. Till then DynamoDB Local.

Usage

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();

API

Contents

  1. Basics

  2. Factory

  3. Ops

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>;
}

/** 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]
}

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>

aws BatchGetItem docs

BatchWriteItem

batchWriteItem(params: Doc, options?: OpOptions): Promise<Doc>

aws BatchWriteItem docs

CreateBackup

createBackup(params: Doc, options?: OpOptions): Promise<Doc>

aws CreateBackup docs

CreateGlobalTable

createGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>

aws CreateGlobalTable docs

CreateTable

createTable(params: Doc, options?: OpOptions): Promise<Doc>

aws CreateTable docs

DeleteBackup

deleteBackup(params: Doc, options?: OpOptions): Promise<Doc>

aws DeleteBackup docs

DeleteItem

deleteItem(params: Doc, options?: OpOptions): Promise<Doc>

aws DeleteItem docs

DeleteTable

deleteTable(params: Doc, options?: OpOptions): Promise<Doc>

aws DeleteTable docs

DescribeBackup

describeBackup(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeBackup docs

DescribeContinuousBackups

describeContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeContinuousBackups docs

DescribeEndpoints

describeEndpoints(options?: OpOptions): Promise<Doc>

aws DescribeEndpoints docs

DescribeGlobalTable

describeGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeGlobalTable docs

DescribeGlobalTableSettings

describeGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeGlobalTableSettings docs

DescribeLimits

describeLimits(options?: OpOptions): Promise<Doc>

aws DescribeLimits docs

DescribeTable

describeTable(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeTable docs

DescribeTimeToLive

describeTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>

aws DescribeTimeToLive docs

GetItem

getItem(params: Doc, options?: OpOptions): Promise<Doc>

aws GetItem docs

ListBackups

listBackups(params: Doc, options?: OpOptions): Promise<Doc>

aws ListBackups docs

ListGlobalTables

listGlobalTables(params: Doc, options?: OpOptions): Promise<Doc>

aws ListGlobalTables docs

ListTables

listTables(options?: OpOptions): Promise<Doc>

aws ListTables docs

ListTagsOfResource

listTagsOfResource(params: Doc, options?: OpOptions): Promise<Doc>

aws ListTagsOfResource docs

PutItem

putItem(params: Doc, options?: OpOptions): Promise<Doc>

aws PutItem docs

Query

query(params: Doc, options?: OpOptions): Promise<Doc | AsyncIterableIterator<Doc>>

aws Query docs

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>>

aws Scan docs

TagResource

tagResource(params: Doc, options?: OpOptions): Promise<Doc>

aws TagResource docs

TransactGetItems

transactGetItems(params: Doc, options?: OpOptions): Promise<Doc>

aws TransactGetItems docs

TransactWriteItems

transactWriteItems(params: Doc, options?: OpOptions): Promise<Doc>

aws TransactWriteItems docs

UntagResource

untagResource(params: Doc, options?: OpOptions): Promise<Doc>

aws UntagResource docs

UpdateContinuousBackups

updateContinuousBackups(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateContinuousBackups docs

UpdateGlobalTable

updateGlobalTable(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateGlobalTable docs

UpdateGlobalTableSettings

updateGlobalTableSettings(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateGlobalTableSettings docs

UpdateItem

updateItem(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateItem docs

UpdateTable

updateTable(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateTable docs

UpdateTimeToLive

updateTimeToLive(params: Doc, options?: OpOptions): Promise<Doc>

aws UpdateTimeToLive docs

FYI

Don't want to do all development against the real AWS cloud?

License

MIT