Gathering detailed insights and metrics for typeorm-paginator
Gathering detailed insights and metrics for typeorm-paginator
Gathering detailed insights and metrics for typeorm-paginator
Gathering detailed insights and metrics for typeorm-paginator
npm install typeorm-paginator
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
3 Stars
145 Commits
1 Forks
2 Watching
8 Branches
3 Contributors
Updated on 11 Feb 2022
TypeScript (99.3%)
JavaScript (0.7%)
Cumulative downloads
Total Downloads
Last day
45%
2,895
Compared to previous day
Last week
1.4%
7,300
Compared to previous week
Last month
16.5%
32,099
Compared to previous month
Last year
1,041.2%
326,324
Compared to previous year
It provides cursor-based pagination and page-based pagination. Even if there is a transformer in the column, it works perfectly.
1npm install typeorm-paginator --save
1import { CursorPaginator } from 'typeorm-paginator'
Single cursor-based pagination.
1const paginator = new CursorPaginator(User, { 2 orderBy: { 3 id: false, 4 }, 5}) 6 7const pagination = await paginator.paginate(repoUsers.createQueryBuilder()) 8 9expect(pagination).toEqual({ 10 nodes: [ 11 /* 12 User { id: 3 }, 13 User { id: 2 }, 14 User { id: 1 }, 15 */ 16 ], 17 hasPrev: false, 18 hasNext: false, 19 nextCursor: expect.any(String), 20 prevCursor: expect.any(String), 21})
Multi cursor-based pagination.
1const paginator = new CursorPaginator(User, { 2 orderBy: [ 3 { name: true }, 4 { id: false }, 5 ], 6}) 7 8const result = await paginator.paginate(repoUsers.createQueryBuilder(), { take: 2 }) 9expect(result).toEqual({ 10 nodes: [ 11 User { id: 3, name: 'a' }, 12 User { id: 5, name: 'b' }, 13 ], 14 hasPrev: false, 15 hasNext: true, 16 prevCursor: expect.any(String), 17 nextCursor: expect.any(String), 18}) 19 20const resultNext = await paginator.paginate(repoUsers.createQueryBuilder(), { take: 2, nextCursor: result.nextCursor }) 21expect(resultNext).toEqual({ 22 nodes: [ 23 User { id: 2, name: 'b' }, 24 User { id: 6, name: 'c' }, 25 ], 26 hasPrev: true, 27 hasNext: true, 28 prevCursor: expect.any(String), 29 nextCursor: expect.any(String), 30}) 31 32const resultNextNext = await paginator.paginate(repoUsers.createQueryBuilder(), { take: 2, nextCursor: resultNext.nextCursor }) 33expect(resultNextNext).toEqual({ 34 nodes: [ 35 User { id: 4, name: 'c' }, 36 User { id: 1, name: 'c' }, 37 ], 38 hasPrev: true, 39 hasNext: false, 40 prevCursor: expect.any(String), 41 nextCursor: expect.any(String), 42}) 43 44const resultNextNextPrev = await paginator.paginate(repoUsers.createQueryBuilder(), { take: 2, prevCursor: resultNextNext.prevCursor }) 45expect(resultNextNextPrev).toEqual({ 46 nodes: [ 47 User { id: 2, name: 'b' }, 48 User { id: 6, name: 'c' }, 49 ], 50 hasPrev: true, 51 hasNext: true, 52 prevCursor: expect.any(String), 53 nextCursor: expect.any(String), 54})
1import { PagePaginator } from 'typeorm-paginator'
Single cursor-based pagination.
1const paginator = new PagePaginator(User, { 2 orderBy: { 3 id: false, 4 }, 5 take: 3, 6}) 7 8const pagination1 = await paginator.paginate(repoUsers.createQueryBuilder()) 9 10expect(pagination1).toEqual({ 11 nodes: [ 12 /* 13 User { id: 5 }, 14 User { id: 4 }, 15 User { id: 3 }, 16 */ 17 ], 18 hasNext: true, 19}) 20 21const pagination1 = await paginator.paginate(repoUsers.createQueryBuilder(), { page: 2 }) 22 23expect(pagination1).toEqual({ 24 nodes: [ 25 /* 26 User { id: 2 }, 27 User { id: 1 }, 28 */ 29 ], 30 hasNext: false, 31})
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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