Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knex-paginate

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex-paginate - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

10

CHANGELOG.md

@@ -7,5 +7,13 @@ ### Changelog

#### [v2.0.0](https://github.com/felixmosh/knex-paginate/compare/v1.2.4...v2.0.0)
#### [v2.1.0](https://github.com/felixmosh/knex-paginate/compare/v2.0.0...v2.1.0)
- feat: improve return type inference [`2b29b29`](https://github.com/felixmosh/knex-paginate/commit/2b29b29eece7531d580d25b1c97cc9772f0987ff)
- Move type tests to __tests-tsd__ [`319b275`](https://github.com/felixmosh/knex-paginate/commit/319b27519d91a1ccdd5d6be71386d67ba16403ce)
### [v2.0.0](https://github.com/felixmosh/knex-paginate/compare/v1.2.4...v2.0.0)
> 7 March 2021
- feature: support knex 0.95.0 [`#15`](https://github.com/felixmosh/knex-paginate/pull/15)
- Release 2.0.0 [`34f2861`](https://github.com/felixmosh/knex-paginate/commit/34f2861fbab13a4df04a2971f434f58c70d3338c)

@@ -12,0 +20,0 @@ #### [v1.2.4](https://github.com/felixmosh/knex-paginate/compare/v1.2.3...v1.2.4)

4

package.json
{
"name": "knex-paginate",
"version": "2.0.0",
"version": "2.1.0",
"description": "Extension of Knex's query builder with `paginate` method that will help with your pagination tasks.",

@@ -62,3 +62,3 @@ "main": "lib/index.js",

"tsd": {
"directory": "test-tsd",
"directory": "__tests-tsd__",
"compilerOptions": {

@@ -65,0 +65,0 @@ "esModuleInterop": false,

import { Knex } from 'knex';
interface IPaginateParams {
perPage: number,
currentPage: number,
isFromStart?: boolean,
isLengthAware?: boolean,
perPage: number;
currentPage: number;
isFromStart?: boolean;
isLengthAware?: boolean;
}
interface IWithPagination<T = any> {
data: T;
pagination: IPagination;
interface IWithPagination<Data, TParams = IPaginateParams> {
data: Data;
pagination: IPagination<TParams>;
}
interface IPagination {
total?: number;
lastPage?: number;
type IPagination<TParams> = TParams extends
| { currentPage: 1 }
| { isFromStart: true }
| { isLengthAware: true }
? ILengthAwarePagination
: IBasePagination;
interface IBasePagination {
currentPage: number;

@@ -24,6 +29,13 @@ perPage: number;

interface ILengthAwarePagination extends IBasePagination {
total: number;
lastPage: number;
}
declare module 'knex' {
namespace Knex {
interface QueryBuilder {
paginate<TResult = any[]>(params: IPaginateParams): Knex.QueryBuilder<any, IWithPagination<TResult>>;
paginate<TData = any[], TParams extends IPaginateParams = IPaginateParams>(
params: Readonly<TParams>
): Knex.QueryBuilder<any, IWithPagination<TData, TParams>>;
}

@@ -30,0 +42,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc