This is a feature proposal to add a new function Table.prototype.createParams which will return the validated, processed parameters required to create the item using the DynamoDB API. It would behave like this:
const item = new MyItem({....});
item.createParams((err, params) => {
// params have been validated by schema and processed by `create` hook
// do something with params
});
Why
AWS Data Pipeline provides a helpful solution for the hard-ish problem of bulk loading data into DynamoDB. It reads JSON files from S3 and throttles the rate at which data is written to DynamoDB.
It would be nice to use Dynogels models schema validation and data processing to generate the required JSON.
Proposal
I think this should be straightforward. Look here in internals.createItem in table.js. I think we just want to return params without calling sendRequest.
So, here is what I'm proposing, specifically. I'd be willing to take a crack at it if it's acceptable.
Separate the code in internals.createItem before sendRequest into a new function internals.makeCreateItemParams, and call this inside internals.createItem
Add a new function Table.prototype.createParams() which returns the value from internals.makeCreateItemParams
(Maybe do the same for updateItem and deleteItem too).
This is a feature proposal to add a new function
Table.prototype.createParams
which will return the validated, processed parameters required to create the item using the DynamoDB API. It would behave like this:Why
AWS Data Pipeline provides a helpful solution for the hard-ish problem of bulk loading data into DynamoDB. It reads JSON files from S3 and throttles the rate at which data is written to DynamoDB.
References:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBPipeline.html
http://eng.hakopako.net/entry/2016/08/22/100000
It would be nice to use Dynogels models schema validation and data processing to generate the required JSON.
Proposal
I think this should be straightforward. Look here in
internals.createItem
intable.js
. I think we just want to return params without callingsendRequest
.So, here is what I'm proposing, specifically. I'd be willing to take a crack at it if it's acceptable.
internals.createItem
before sendRequest into a new functioninternals.makeCreateItemParams
, and call this insideinternals.createItem
Table.prototype.createParams()
which returns the value frominternals.makeCreateItemParams
(Maybe do the same for
updateItem
anddeleteItem
too).