Registry / database / pagi-help

pagi-help

JSON →
library2.5.4jsnpmunverified

Pagination API helper for MySQL and PostgreSQL. Current stable version is 2.5.4. Release cadence is irregular. Key differentiators: ships two APIs (legacy and v2) from one package; v2 supports both MySQL and PostgreSQL dialects, cursor pagination, and named exports. Legacy API remains unchanged for backward compatibility.

npm install pagi-help
INSTALL
IMPORT
SIG · PAGI-HELP
P
pagi-help
databasejavascriptv2.5.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PagiHelpV2
import { PagiHelpV2 } from 'pagi-help/v2'
const PagiHelpV2 = require('pagi-help')
v2 is available via subpath import 'pagi-help/v2' or named export. Using default 'pagi-help' gives legacy API.
PagiHelpLegacy
const PagiHelpLegacy = require('pagi-help')
import PagiHelpLegacy from 'pagi-help'
Legacy API is default CommonJS export. ESM import may work but not officially supported.
PagiHelpV210
import { PagiHelpV210 } from 'pagi-help'
Compatibility alias for PagiHelpV2; new code should use PagiHelpV2.

Demonstrates basic pagination with MySQL dialect: search, filters, sort, and column mapping.

const PagiHelpV2 = require('pagi-help/v2'); const pagiHelp = new PagiHelpV2({ dialect: 'mysql', }); const queries = pagiHelp.paginate( { search: 'Active', filters: [['status', 'IN', ['Active', 'Paused']]], sort: { attributes: ['created_at'], sorts: ['desc'], }, pageNo: 1, itemsPerPage: 10, }, [ { tableName: 'events', columnList: [ { name: 'id', alias: 'id' }, { name: 'status', alias: 'status' }, { name: 'created_at', alias: 'created_at' }, ], searchColumnList: [{ name: 'status' }], }, ] ); console.log(queries);
Debug
Known issues
breakingLegacy default export does not support PostgreSQL dialect; only MySQL.
fix
Use v2 subpath import: require('pagi-help/v2') and set dialect to 'postgres'.
affects: >=2.0.0
breakingv2 constructor rejects legacy compatibility options like safeOptions keys other than 'validate'.
fix
Only pass safeOptions.validate. Remove other safeOptions keys.
affects: >=2.0.0
gotchaCursor pagination (paginateCursor) is only available on v2 and has strict phase 1 rules (single-table, after only, sort required, etc.).
fix
Follow phase 1 rules: single table, use 'after', provide 'sort' and 'limit', omit pageNo/itemsPerPage/offset/before.
affects: >=2.0.0
deprecatedPagiHelpV210 named export is deprecated; use PagiHelpV2 instead.
fix
Replace PagiHelpV210 with PagiHelpV2 in imports.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'pagi-help/v2'
Using Node.js version that does not support subpath exports (pre v12.19.0) or missing package.json exports field.
fix
Update Node.js to >=12.19.0 or use named import: const { PagiHelpV2 } = require('pagi-help');
TypeError: pagiHelp.paginate is not a function
Importing legacy default export (which does not have paginate method) instead of v2.
fix
Use require('pagi-help/v2') or named import { PagiHelpV2 }.
Error: Unsupported dialect 'sqlite'
Only 'mysql' and 'postgres' are supported.
fix
Set dialect to 'mysql' or 'postgres'.
Upgrade
Version history
2.5.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
pagi-help — npm install pagi-help · libregistry