Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamodb-table-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamodb-table-client

A DocumentClient wrapper for single table design and better typescript support.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

dynamodb-table-client

A DocumentClient wrapper for single table design and better typescript support.

For the most part, the API is the same as DocumentClient aside from having to provide the TableName for each request. batchGet and batchWrite have a slightly different API because they don't need to be concerned with multiple tables.

Install

npm install dynamodb-table-client

Usage

import { TableClient } from 'dynamodb-table-client';

// common attributes between all items
interface DynamoDBItem {
  // this is where you would type your Key and GSI schemas
  PK: string;
  SK: string;
  GSI1PK?: string;
  GSI1SK?: string;

  // but you could use it for common meta atts as well
  created: string;
}

const tableClient = new TableClient<DynamoDBItem>({
  tableName: `my-table`,
  region: `us-east-1`,
});

interface Note extends DynamoDBItem {
  title: string;
}

await tableClient.put<Note>({
  Item: {
    PK: 'NOTE#1',
    SK: 'META',
    created: new Date().toISOString(),
    title: 'My Note',
  },
});

const note = await tableClient.get<Note>({
  Key: {
    PK: 'NOTE#1',
    SK: 'META',
  },
});

FAQs

Package last updated on 09 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc