sap-b1-mcp-server
Version:
SAP Business One Service Layer MCP Server
37 lines • 1.04 kB
JavaScript
/**
* Extract pagination information from SAP B1 OData response
*/
export function extractPaginationInfo(response, currentParams) {
const skip = currentParams?.$skip || 0;
const top = currentParams?.$top || 100;
return {
hasNextPage: !!response['@odata.nextLink'],
nextLink: response['@odata.nextLink'],
currentPage: Math.floor(skip / top) + 1,
pageSize: top,
totalCount: response['@odata.count']
};
}
/**
* Generate pagination parameters for next page
*/
export function getNextPageParams(currentParams) {
const skip = currentParams?.$skip || 0;
const top = currentParams?.$top || 100;
return {
$skip: skip + top,
$top: top
};
}
/**
* Generate pagination parameters for previous page
*/
export function getPrevPageParams(currentParams) {
const skip = currentParams?.$skip || 0;
const top = currentParams?.$top || 100;
return {
$skip: Math.max(0, skip - top),
$top: top
};
}
//# sourceMappingURL=pagination.js.map