
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@begin/data
Advanced tools
Begin Data is a durable and fast key/value document store built on top of DynamoDB.
Begin Data is a durable and fast key/value store built on top of DynamoDB with super simple storage/access patterns that are similar to Redis.
Begin Data organizes itself into tables. Tables contain documents which are just collections of plain Object
s. documents stored in Begin Data always have the properties table
and key
. Optionally an document can also have a ttl
property with a UNIX epoch value representing the expiry time for the document.
Begin Data operates on one DynamoDB table named data
with a partition key scopeID
and a sort key of dataID
and, optionally, a ttl
for expiring documents.
Example .arc
:
@app
myapp
@tables
data
scopeID *String
dataID **String
ttl TTL
let data = require('@begin/data')
The core API is three methods:
data.get(params, [callback])
for retreiving datadata.set(params, [callback])
for writing datadata.destroy(params, [callback])
for removing dataAdditional helper methods are also made available:
data.incr(params, [callback])
increment an attribute on an documentdata.decr(params, [callback])
decrement an attribute on an documentdata.count(params, [callback])
get the number of documents for a given tableAll methods accept params object and, optionally, a Node style errback. If no errback is supplied a promise is returned. All methods support async
/await
.
Save an document in a table by key. Remember table
is always required.
let taco = await data.set({
table: 'tacos',
key: 'al-pastor'
})
key
is optional. But all documents have a key. If no key is given set
will generate a unique key
.
let token = await data.set({
table: 'tokens',
})
// {table:'tokens', key:'s89sdfjskfdj'}
Batch save multiple documents at once by passing an array of objects.
let collection = await data.set([
{table: 'ppl', name:'brian', email:'b@brian.io'},
{table: 'ppl', name:'sutr0', email:'sutr0@brian.io'},
{table: 'tacos', key:'pollo'},
{table: 'tacos', key:'carnitas'},
])
Read an document by key:
let yum = await data.get({
table: 'tacos',
key: 'baja'
})
Batch read by passing an array of objects. With these building blocks you can construct secondary indexes and joins like one-to-many and many-to-many.
await data.get([
{table:'tacos', key:'carnitas'},
{table:'tacos', key:'al-pastor'},
])
Delete an document by key.
await data.destroy({
table: 'tacos',
key: 'pollo'
})
Batch delete documents by passing an array of objects.
await data.destroy([
{table:'tacos', key:'carnitas'},
{table:'tacos', key:'al-pastor'},
])
ttl
to an UNIX epoch in the future.data.incr
and data.decr
See the tests for more examples!
Coming soon! Detailed guides for various data persistence tasks:
FAQs
Begin Data is a durable and fast key/value document store built on top of DynamoDB
The npm package @begin/data receives a total of 141 weekly downloads. As such, @begin/data popularity was classified as not popular.
We found that @begin/data demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.