
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
type-dynamodb
Advanced tools
type-dynamodb is simple but powerful dynamodb ORM that uses decorator design pattern to get the most benefits from typescript and oop like inheritance, overload methods and adding multiple layers of decorators.
npm i class-transformer aws-sdk type-dynamodb --save
npm install `reflect-metadata` --save
reflect-metadata to the root file of your projectimport "reflect-metadata";
export AWS_ACCESS_KEY_ID=<AWS_ID> # macos or linux
export AWS_SECRET_ACCESS_KEY=<AWS_ACCESS_KEY>
export AWS_DEFAULT_REGION=<AWS_REGION>
or here for other os.
tsconfig.json:"emitDecoratorMetadata": true,
"experimentalDecorators": true,
1- first we add @DyTable decorator and extends BaseDyTable to get the db functionalities.
@DyTable('<TableName>') // default is User
class User extends BaseDyTable{
id: string
name: string
userPassword: string
created: string
}
2- then we determined which fields are part of our dynamodb table by adding @DyField:
@DyTable()
class User extends BaseDyTable{
@DyField()
id: string
@DyField()
name: string
@DyField()
userPassword: string
@DyField()
created: string
}
3- then we specify the partition key field in @DyField and sorting key fields if exist:
...
@DyField({isPartitionKey: true})
id: string
@DyField({isSortingKey: true})
created: string
...
4- now we can use the db functions (dyGet, dyUpdate, dyDelete, dyPut, dyScan, dyQuery) as shown here:
/* using await */
const user = await User.dyGet({id: "id1"})
await user.dyUpdate({userPassword: "12345"});
await user.dyDelete();
// scan function
const scannedUsers = await User.dyScan(
{
filter: {
created: {range: {to:"<ISOSTRING>"}},
name: {equal: "Amro"}
},// note every key can have only one filter parameter.
limit: 50,
}
);
// faster query method that uses PartitionKey(must be specified) and specify sortingKey automatically
const users = await User.dyQuery(
"PARTITION_KEY_VALUE",
{
filter: {
created: {range: {from:"<ISOSTRING>"}},
name: {contains: "Amro"}
}
}
);
/* using then */
User.dyGet({id: "user1"})
.then((user)=> user.dyUpdate( {userPassword: "12345"}))
.then((updatedUser)=> {
// some other logic
updatedUser.dyDelete();
})
@DyTable()
class User {
...
@DyGlobalSecondaryIndex("name_index", {isPartitionKey: true})
@DyField()
name: string
@DyLocalSecondaryIndex("created_index")
@DyField({isSortingKey: true})
created: string
...
}
FAQs
simple dynamodb ORM that uses the decorator design pattern.
We found that type-dynamodb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.