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

daymon

v1.2.27

Published

ORM for DynamoDB

Downloads

100

Readme

** This is in early development so new versions will continuously be published.

*** Usage

var options = {
  convertEmptyStringToNull: true,
  timeStamps: {
    update: 'dateUpdated',
    create: 'dateCreated'
  },
  awsConfig: {
    region: 'aws region'
    accessKeyId: 'aws id',
    secretAccessKey: 'aws secret',
    dynamodb: {
      endpoint: 'some endpoint'
    }
  }
}
var daymon = require('daymon')(options);

var tableName = 'users'
var Model = daymon(tableName);

The awsConfig property on the options object is required. The convertEmptyStringToNull converts empty strings to null values, as dynamodb does not accept empty strings as values. convertEmptyStringToNull is false by default and instead of converting empty strings to null, the property will not be updated.

To automatically set timestamps when calling save() or update(), set timeStamps.create and/or timeStamps.update. The values will be Date.now(). If these keys are set on individual saves or updates before calling save() or update(), the automatic timestamp will not override these values.

*** Query

Model.query(options) => promise;

The options object has the be an object that has a key of either primary index hash key or a secondary index hash key. Error will be thrown otherwise.

You can either pass single value or an array of values:

var queryOptions = {
  id: 'some id'
}

or

var queryOptions = {
  id: ['id1', 'id2', 'id3']
}

*** Scan

Model.scan(options) => promise;

The options object has to be an object. Keys and values can be anything.

*** instance.save();

new Model(objectToSave).save() => promise;

If the objectToSave has no primary index hash key, a unique one will be generated as a String. This will most probably change at some point.

If the objectToSave already has a primary index hash key, an update will be performed instead.

*** instance.update()

new Model(objectWithHashKey).update() => promise

Updates an existing object. It uses dynamodb.documentClient.update and will create a new item if it is not already there.