UNPKG

@brianveltman/sonatype-mcp

Version:

Model Context Protocol server for Sonatype Nexus Repository Manager

28 lines 901 B
export function createPaginationMeta(totalCount, limit, offset) { const pageSize = limit; const currentPage = Math.floor(offset / limit) + 1; const totalPages = Math.ceil(totalCount / limit); return { totalCount, pageSize, currentPage, totalPages, hasNextPage: currentPage < totalPages, hasPreviousPage: currentPage > 1 }; } export function createPaginatedResponse(items, totalCount, limit, offset) { return { items, meta: createPaginationMeta(totalCount, limit, offset) }; } export function calculateOffset(page, limit) { return Math.max(0, (page - 1) * limit); } export function validatePaginationParams(params) { const limit = Math.min(Math.max(params.limit || 25, 1), 1000); const offset = Math.max(params.offset || 0, 0); return { limit, offset }; } //# sourceMappingURL=pagination.js.map