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

mp-dynamo

v1.0.0

Published

DynamoDB client for node.js

Downloads

9

Readme

dynamo

This is a fork jed/dynamo. I fixed some issues and added some features to keep it alive, because i'm using it within a bigger project

Build Status

This is a node.js binding for the DynamoDB service provided by Amazon Web Services. It aims to abstract DynamoDB's implementation (request signing, session tokens, pagination), but not its tradeoffs/philosophy, by providing two APIs:

Example

var dynamo = require("dynamo")
  , client = dynamo.createClient()
  , db = client.get("us-east-1")

// High-level API

db.get("myTable")
  .query({id: "123", date: {">=": new Date - 6000 }})
  .get("id", "date", "name")
  .reverse()
  .fetch(function(err, data){ ... })

// Same call, using low-level API

db.query({
  TableName: "myTable",
  HashKeyValue: {S: "123"},
  RangeKeyValue: {
    ComparisonOperator: "LE",
    AttributeValueList: [{N: "1329912311806"}]
  },
  AttributesToGet: ["id", "date", "name"],
  ScanIndexForward: false
}, function(err, data){ ... })

Installation

This library has no dependencies, and can be installed from npm:

npm install mp-dynamo

API

dynamo = require("dynamo")

This module exposes the createClient method, which is the preferred way to interact with dynamo.

client = dynamo.createClient([credentials])

Returns a client instance attached to the account specified by the given credentials. The credentials can be specified as an object with accessKeyId and secretAccessKey members such as the following:

client = dynamo.createClient({
  accessKeyId: "...",    // your access key id
  secretAccessKey: "..." // your secret access key
})

You can also omit these credentials by storing them in the environment under which the current process is running, as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

If neither of the above are provided, an error will be thrown.

db = client.get(regionName)

Returns a database in the selected region. Currently, DynamoDB supports the following regions:

  • us-east-1
  • us-west-1
  • us-west-2
  • ap-northeast-1
  • ap-southeast-1
  • eu-west-1

Once you have a database instance, you can use either of the provided APIs:

High-level API (blue pill)

The primary purpose of this library is to abstract away the often bizzare API design decisions of DynamoDB, into a composable and intuitive interface based on Database, Table, Item, Batch, Query, and Scan objects.

See the wiki for more information.

Low-level API (red pill)

All of the original DynamoDB operations are provided as methods on database instances. You won't need to use them unless you want to sacrifice a clean interdace for more control, and don't mind learning Amazon's JSON format.

See the wiki for more information.

Testing

Testing for dynamo is handled using continuous integration against a real DynamoDB instance, under credentials limited to Travis CI.

If you'd like to run the test stuie with your own credentials, make sure they're set using the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, and then run the tests:

npm test

The test suite creates two tables called DYNAMO_TEST_TABLE_1 and DYNAMO_TEST_TABLE_2 before the tests are run, and then deletes them once the tests are done. Note that you will need to delete them manually in the event that the tests fail.

To do

  • Factor out tests into integration tests and unit tests
  • Make all callbacks optional, returning an event emitter no callback given
  • Add method to specify Limit and ExclusiveStartKey

Credits

Copyright

Copyright (c) 2012 Jed Schmidt. See LICENSE.txt for details.

Send any questions or comments here.

Release History

|Version|Date|Description| |:--:|:--:|:--| |1.0.0|2016-09-21|use module aws4 to generate the signature. So it's possible to use new regions (like eu-central-1) with Signature Version V4 only.| |0.2.13|2016-07-05|Use versioning as new npm package mp-dynamo to use it within simple-dynamo. Fixed Batch load for newer api version|