
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@postnord/pretty-dynamo
Advanced tools
Run npm i @postnord/pretty-dynamo @aws/dynamodb-data-mapper-annotations
and you're good to go.
import { PrettyDynamo } from '@postnord/pretty-dynamo'
import { attribute, hashKey, table } from '@aws/dynamodb-data-mapper-annotations'
import * as https from 'https'
@table('users')
class User {
@hashKey()
id!: string
@attribute()
name!: string
}
const userService = new PrettyDynamo(User, {
region: 'eu-west-1',
httpOptions: {
agent: new https.Agent({
keepAlive: true,
}),
},
})
const createUser = async () => {
await userService.initDb()
// The input to those methods will be typed and expecting the schema declared above.
await userService.createOneRecord({ id: '1', name: 'Jerry' })
/*
* The output of the fetching methods will also be typed, so you should expect it to match the declared schema
* Methods will not throw errors unnecessarily (like when fetching a non existing object) which fixes
* one of the main design flaws of the native driver.
*/
const user = await userService.getOneRecord({ id: '1' })
console.log(user) // variable `user` is undefined if the user does not exist.
}
initDb()
Will initialize the DB connection and allow you to use the rest of the functions.
await userService.initDb()
getDb()
Will return the DataMapper
object.
const dataMapper = await userService.getDb()
getOneRecord(criteria)
Will grab an object from the database by the specified criteria. Returns undefined if no objects match the given criteria.
const user = await userService.getOneRecord({ id: '1' })
getManyRecords(criteria)
Will query the db for records matching the specified criteria and return an array of matching objects.
const users = await userService.getManyRecords({ name: 'Matt' })
createOneRecord(item)
Will store a new db record.
await userService.createOneRecord({ id: '1', name: 'Estelle' })
createManyRecords(item[])
Will store an array of items to the database.
await userService.createManyRecords([
{ id: '1', name: 'Elaine' },
{ id: '2', name: 'George' },
])
updateOneRecord(criteria, updates)
Will store an array of items to the database. Returns undefined if no items match the criteria.
const updated = await userService.updateOneRecord({ id: '1' }, { name: 'Jackie' })
updateManyRecords(criteria, updates)
Will update all matching objects.
const updated = await userService.updateManyRecords({ name: 'Kramer' }, { name: 'Cosmo' })
deleteOneRecord(criteria)
Will delete the first item matching the criteria. Will return undefined if there were no matches.
const deleted = await userService.deleteOneRecord({ id: '1' })
deleteManyRecords(criteria)
Will delete all matching the criteria. Will return undefined if there were no matches.
await userService.deleteManyRecords({ name: 'Susan' })
FAQs
An ODM that brings an easy to use interface to DynamoDB
The npm package @postnord/pretty-dynamo receives a total of 2 weekly downloads. As such, @postnord/pretty-dynamo popularity was classified as not popular.
We found that @postnord/pretty-dynamo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 52 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.