npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@teleology/dynamo

v0.2.1

Published

A configurable client wrapper around DynamoDB.DocumentClient

Downloads

4

Readme

Downloads Version License

@teleology/dynamo

A configurable client wrapper around DynamoDB.DocumentClient

Installation

yarn add aws-sdk @teleology/dynamo
# or
npm i --save aws-sdk @teleology/dynamo

Configuration

Configuration is easy and mimics much of the pre-defined attributes of the DynamoDB table such as a table name, primary key, and secondary indexes. The library is aimed to be used within an AWS lambda context, if you are not within an environment that automatically handles this for you. You can pass the optional options to seed credentials, region and apiVersion for DynamoDB.DocumentClient. For concerned parties, the options are used in a pass-through fashion.

import dynamo from '@teleology/dynamo';

const exampleTable = dynamo({
  table: process.env.EXAMPLE_TABLE || 'Example',

  // (Optional) depending on environment
  options: {
    accessKeyId: 'your_access_key_id', 
    secretAccessKey: 'your_secret_access_key',
    region: 'us-east-1',
  }
});

Usage


const exampleTable = ... // configuration example

const record = await exampleTable.create({
  id: '123',
  fName: 'Luke',
});

const updated = await exampleTable.update({
  id: '123',
  fName: 'Lucas',
  lName: 'Smith',
  hid: 'secondary-id',
});

const ping = await exampleTable.get('123');

const items = await exampleTable.query({ hid: 'secondary-id' });

await exampleTable.delete('123');

Get

async table.get(primaryKey: String) => Record || undefined

Create

async table.create(record: Object) => Record || Error

Update

async table.update(record: Object) => Record || Error

Delete

async table.delete(primaryKey: String)

Query

async table.query(globalSecondaryKeyVal: Object) => Record[] || [];

Batch Put

async table.batchPut(items ...Object);

Batch Delete

async table.batchDelete(primaryKeys ...String);

Batch Get

async table.batchGet(primaryKeys ...String) => Items[];

Changelog

0.2.1

  • Adding query operation to delete function for GSI

0.1.1

  • Adding ability to query on multiple GSI's instead of one

0.0.3

  • Fixed an issues related to updates

0.0.1

  • Initial upload