A DynamoDB module for Nest framework (node.js) using typeDorm library
Installations
npm install @nest-dynamodb/typedorm
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=12.0.0
Score
41.2
Supply Chain
92.8
Quality
73.6
Maintenance
100
Vulnerability
97.9
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (91.69%)
JavaScript (8.31%)
Developer
nest-dynamodb
Download Statistics
Total Downloads
42,947
Last Day
54
Last Week
361
Last Month
2,989
Last Year
29,837
GitHub Statistics
7 Stars
18 Commits
1 Watching
11 Branches
1 Contributors
Bundle Size
4.25 kB
Minified
1.25 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.0
Package Id
@nest-dynamodb/typedorm@1.1.0
Unpacked Size
17.26 kB
Size
4.65 kB
File Count
20
Publised On
16 Jul 2023
Total Downloads
Cumulative downloads
Total Downloads
42,947
Last day
-59.1%
54
Compared to previous day
Last week
-61.1%
361
Compared to previous week
Last month
-1.2%
2,989
Compared to previous month
Last year
127.6%
29,837
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
4
Dev Dependencies
23
A DynamoDB module for Nest framework (node.js) using typeDorm library
Installation
with npm
1npm install --save @nest-dynamodb/typedorm
with yarn
1yarn add @nest-dynamodb/typedorm
How to use?
TypeDormModule.forRoot(options)
1import { Module } from '@nestjs/common'; 2import { TypeDormModule } from '@nest-dynamodb/typedorm'; 3import { AppController } from './app.controller'; 4@Module({ 5 imports: [ 6 TypeDormModule.forRoot({ 7 table, 8 entities: [], 9 documentClient: new DocumentClientV3(new DynamoDBClient({})), 10 name: instanceName 11 }), 12 ], 13 controllers: [AppController], 14}) 15export class AppModule {}
TypeDormModule.forRootAsync(options)
1import { Module } from '@nestjs/common'; 2import { TypeDormModule } from '@nest-dynamodb/typedorm'; 3import { AppController } from './app.controller'; 4@Module({ 5 imports: [ 6 TypeDormModule.forRootAsync({ 7 // need another name here for dependency injection, @InjectTypeDorm(instanceName) 8 name: instanceName, 9 useFactory: async () => { 10 return { 11 table, 12 entities: [], 13 documentClient: new DocumentClientV3(new DynamoDBClient({})), 14 name: instanceName 15 } 16 }, 17 }), 18 ], 19 controllers: [AppController], 20}) 21export class AppModule {}
InjectTypeDorm(name?)
1import { Controller, Get, } from '@nestjs/common'; 2import { InjectTypeDorm, TypeDormConnection } from '@nest-dynamodb/typedorm'; 3@Controller() 4export class AppController { 5 constructor( 6 @InjectTypeDorm() private readonly connection: TypeDormConnection, 7 ) {} 8 @Get() 9 async getHello() { 10 const item = await this.connection.entityManager.findOne(...); 11 return { item }; 12 } 13}
TypeDormModule.forRootNonInjection(options)
1import { Module } from '@nestjs/common'; 2import { TypeDormModule } from '@nest-dynamodb/typedorm'; 3import { AppController } from './app.controller'; 4@Module({ 5 imports: [ 6 TypeDormModule.forRootNonInjection({ 7 table, 8 entities: [], 9 documentClient: new DocumentClientV3(new DynamoDBClient({})), 10 }), 11 ], 12 controllers: [AppController], 13}) 14export class AppModule {}
1import { Controller, Get, } from '@nestjs/common'; 2import { TypeDormConnection } from '@nest-dynamodb/typedorm'; 3@Controller() 4export class AppController { 5 constructor( 6 // do not need InjectTypeDorm here 7 private readonly connection: TypeDormConnection, 8 ) {} 9 @Get() 10 async getHello() { 11 const item = await this.connection.entityManager.findOne(...); 12 return { item }; 13 } 14}
License
MIT
No vulnerabilities found.
No security vulnerabilities found.