Installations
npm install @midwayjs/typeorm
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=12
Node Version
18.20.4
NPM Version
lerna/7.4.2/node@v18.20.4+arm64 (darwin)
Score
73.4
Supply Chain
97.8
Quality
95.8
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Languages
TypeScript (62.04%)
Shell (34.78%)
JavaScript (2.99%)
CSS (0.16%)
HTML (0.03%)
Developer
Download Statistics
Total Downloads
60,570
Last Day
74
Last Week
407
Last Month
2,095
Last Year
26,771
GitHub Statistics
7,432 Stars
4,043 Commits
578 Forks
101 Watching
34 Branches
169 Contributors
Bundle Size
6.26 kB
Minified
1.84 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.19.2
Package Id
@midwayjs/typeorm@3.19.2
Unpacked Size
19.10 kB
Size
5.56 kB
File Count
17
NPM Version
lerna/7.4.2/node@v18.20.4+arm64 (darwin)
Node Version
18.20.4
Publised On
15 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
60,570
Last day
-14.9%
74
Compared to previous day
Last week
-40.3%
407
Compared to previous week
Last month
-20.4%
2,095
Compared to previous month
Last year
25.7%
26,771
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
4
midway typeorm component
How to use
in Configuration.ts file
1import * as typeorm from '@midwayjs/typeorm'; 2import { join } from 'path'; 3 4@Configuration({ 5 imports: [ 6 typeorm, 7 ], 8 importConfigs: [ 9 join(__dirname, './config') 10 ] 11}) 12export class ContainerConfiguration { 13} 14
Configuration
in config files
1export default { 2 typeorm: { 3 dataSource: { 4 default: { 5 type: 'mysql', 6 host: '', 7 port: 3306, 8 username: '', 9 password: '', 10 database: undefined, 11 synchronize: true, 12 logging: false, 13 } 14 } 15 } 16};
Define EntityModel
1// model/user.ts 2import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'; 3 4@Entity('test_user') 5export class Photo { 6 @PrimaryGeneratedColumn({ name: "id" }) 7 id: number; 8 9 @Column({ name: "name" }) 10 name: string; 11 12 @OneToMany(type => Message, message => message.sender) 13 messages: Message[]; 14}
Use Model
in code files
1import { InjectEntityModel } from '@midwayjs/orm'; 2import { User } from './model/user'; 3import { Repository } from 'typeorm'; 4 5@Provide() 6export class UserService { 7 8 @InjectEntityModel(User) 9 userModel: Repository<User>; 10 11 async testUser() { 12 const u = new User(); 13 u.name = 'oneuser1'; 14 const uu = await this.userModel.save(u); 15 console.log('user one id = ', uu.id); 16 17 const user = new User(); 18 user.id = 1; 19 const users = await this.userModel.findAndCount({ 20 where: user 21 }); 22 return 'hello world' + JSON.stringify(users); 23 } 24}
No vulnerabilities found.
Reason
30 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no binaries found in the repo
Reason
Found 3/17 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/benchmark.yml:1
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Warn: no topLevel permission defined: .github/workflows/precheck.yml:1
- Warn: no topLevel permission defined: .github/workflows/presite.yml:1
- Warn: no topLevel permission defined: .github/workflows/site.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/benchmark.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/benchmark.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/benchmark.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/lock.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/lock.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:85: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/nodejs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:88: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/nodejs.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:93: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/nodejs.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:113: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/nodejs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/precheck.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/precheck.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/precheck.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/precheck.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/precheck.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/precheck.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/presite.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/presite.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/presite.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/presite.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/site.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/site.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/site.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/site.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/midwayjs/midway/site.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: benchmark/ready.sh:5
- Warn: npmCommand not pinned by hash: benchmark/ready.sh:15
- Warn: npmCommand not pinned by hash: scripts/install_npm.sh:10
- Warn: npmCommand not pinned by hash: .github/workflows/benchmark.yml:49
- Warn: npmCommand not pinned by hash: .github/workflows/benchmark.yml:51
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:99
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:99
- Warn: npmCommand not pinned by hash: .github/workflows/precheck.yml:89
- Warn: npmCommand not pinned by hash: .github/workflows/presite.yml:28
- Warn: npmCommand not pinned by hash: .github/workflows/presite.yml:30
- Warn: npmCommand not pinned by hash: .github/workflows/site.yml:28
- Info: 0 out of 11 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 7 third-party GitHubAction dependencies pinned
- Info: 0 out of 11 npmCommand dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 23 are checked with a SAST tool
Reason
34 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-325j-24f4-qv5x
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3.9
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More