Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
api-pagination
Advanced tools
Provides API endpoints for HAPI servers to manage roles. DO NOT USE YET
(C) 2014 Martin Wawrusch
Helpers to provide pagination for APIs
The basic idea is that pagination is a tricky beast, better left to the server. There are a few different approaches to deal with pagination, including adding them to the header. This one is a bit different. We add a _pagination object that contains all the info needed. Here is a typical input and what comes out of it:
{
"items": ["a","b","c","d","e","f","g","h","l","m","a","b","c","d","e","f","g","h","l","m"],
"requestCount":20,
"requestOffset":60,
"totalCount":205
}
result after conversion
{
"items":[
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"l",
"m",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"l",
"m"
],
"_pagination":{
"totalCount":205,
"requestCount":20,
"requestOffset":60,
"requestPageNumber":3,
"requestPageNumberDisplay":"4",
"totalPageCount":11,
"pagingKind":"paged",
"previousUrl":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=40&count=20",
"nextUrl":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=80&count=20",
"firstUrl":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=0&count=20",
"lastUrl":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=200&count=20",
"pages":[
{
"kind":"page",
"pageNumber":0,
"pageNumberDisplay":"1",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=0&count=20"
},
{
"kind":"page",
"pageNumber":1,
"pageNumberDisplay":"2",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=20&count=20"
},
{
"kind":"page",
"pageNumber":2,
"pageNumberDisplay":"3",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=40&count=20"
},
{
"kind":"page",
"pageNumber":3,
"pageNumberDisplay":"4",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=60&count=20",
"active":true
},
{
"kind":"page",
"pageNumber":4,
"pageNumberDisplay":"5",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=80&count=20"
},
{
"kind":"page",
"pageNumber":5,
"pageNumberDisplay":"6",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=100&count=20"
},
{
"kind":"page",
"pageNumber":6,
"pageNumberDisplay":"7",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=120&count=20"
},
{
"kind":"page",
"pageNumber":7,
"pageNumberDisplay":"8",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=140&count=20"
},
{
"kind":"separator"
},
{
"kind":"page",
"pageNumber":10,
"pageNumberDisplay":"11",
"url":"http://www.hello.com:8012/my/rest?a=12&b=ss&offset=200&count=20"
}
]
}
}
and additionally
Copyright (c) 2014 Martin Wawrusch
FAQs
Provides API endpoints for HAPI servers to manage roles. DO NOT USE YET
The npm package api-pagination receives a total of 7 weekly downloads. As such, api-pagination popularity was classified as not popular.
We found that api-pagination 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.