GithubHelp home page GithubHelp logo

cascadeenergy / dynamodb-marshaler Goto Github PK

View Code? Open in Web Editor NEW
116.0 116.0 19.0 402 KB

Translates sane javascript objects (and JSON) into DynamoDb format and vice versa.

License: MIT License

JavaScript 100.00%
deprecated

dynamodb-marshaler's People

Contributors

cberube avatar jinsyaoommen avatar nackjicholson avatar notxt avatar svozza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynamodb-marshaler's Issues

Don't deprecate - yet

I (still) use ddb-marshaler to process streams which come through in the ddb format.

DocumentClient does not expose a mechanism for translating arbitrary data to ddb's format and back, so this lib is my only option AFAIK.

Don't deprecate it quite yet?

default value for empty strings

DynamoDb does not accept empty strings and simply throws an error.

Would it make sense for the marshaler to replace empty strings with null? Perhaps make it configurable what value should be substituted for empty strings.

Memory leak when using marshaler

I currently have some tests set up for my project which uses the marshaller.

The tests are run with https://github.com/hapijs/lab which detects memory leaks. When this project is required anywhere in the code i get the following warning at the end :

The following leaks were detected:__core-js_shared__

Don't know where this happens in the code but it's certainly coming from this module.

Syntax Suggestion

I kinda like how aws labs does their setup:

var awsClient = AWS.DynamoDB();
var docClient = new DOC.DynamoDB(awsClient);

... that way we don't have to sprinkle marshalItem calls in our data structures

Minor bugfix obfuscated by transpilation

I found that dynamodb wasn't allowing string arrays which included empty strings and breaking (the data I have to work with is somewhat chaotic).

["foo", ""] -> {"SS": ["foo", ""] } //apparently breaks Dynamo

I've patched it simply by filtering out empty strings on string arrays, but I'm worried that there must be a diff with our babel minor versions or something because the diff is huge. Would you still want a PR or is there something else I can do to make this a nicer PR?

use this library without node or npm

I am a total noob when it comes to node and npm. Is there a way I could use this library without node? Could I load the library purely using html and js and then call the functions (especially unmarshal) in my js code?

Issues with the latest release: Cannot find module 'babel/polyfill'

Hi there,

I believe v1.1.0 is giving me this:

(master) addl1006018:tmp $ cat index.js 
var db = require('dynamoDb-marshaler');

(master) addl1006018:tmp $ cat package.json 
{
  "name": "blah",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "dynamodb-marshaler": "^1.1.0"
  }
}

(master) addl1006018:tmp $ node index.js 
module.js:338
    throw err;
          ^
Error: Cannot find module 'babel/polyfill'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/dank/Documents/code/tmp/node_modules/dynamoDb-marshaler/marshalItem.js:15:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
(master) addl1006018:tmp $ 

Forcing the version to 1.0.0, and it works again.

Please let me know if you need anything else, thanks.

Daniel

Babel Runtime Dependency

Just wondering is there a particular reason why the babel runtime is a main dependency rather that a dev one? It increases the size of the package by nearly 6Mb when you download it on npm. While that normally doesn't matter server side it is a problem when using the library in AWS Lambda because startup time and execution speed are influenced by the size of the zip file you upload.

Optionally use list type for ordered string/number arrays

Hello!

Really appreciating this library as it has saved me lots of time. However, I ran into a potential edge case when I realized that the order of my array was being changed when I inserted it into Dynamo. As stated here a String Set type will be used for an array of unique values, however Dynamo does not preserve order for sets.

I have a case where I need an ordered list of strings, so the List type would need to be used. Could this potentially be an option/configuration somewhere? Also to note is that the default in the DynamoDB console when an array is created in JSON view is to create a list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.