prisma-extension-pagination
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -19,3 +19,3 @@ "use strict"; | ||
withPages: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) { | ||
const { page, limit, includePageCount } = Object.assign(Object.assign({ page: 1, includePageCount: false }, globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.pages), options); | ||
const { page = 1, limit, includePageCount = false, } = Object.assign(Object.assign({}, globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.pages), options); | ||
if (typeof page !== "number" || | ||
@@ -41,19 +41,16 @@ page < 1 || | ||
withCursor: (...args_2) => __awaiter(this, [...args_2], void 0, function* (options = {}) { | ||
const { limit, after, before, getCursor, parseCursor } = Object.assign(Object.assign({ | ||
// @ts-expect-error actual fields of the model are not known | ||
getCursor({ id }) { | ||
if (typeof id !== "number") { | ||
throw new Error("Unable to serialize cursor"); | ||
} | ||
return id.toString(); | ||
}, | ||
parseCursor(cursor) { | ||
const id = parseInt(cursor, 10); | ||
if (Number.isNaN(id)) { | ||
throw new Error("Unable to parse cursor"); | ||
} | ||
return { | ||
id, | ||
}; | ||
} }, globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.cursor), options); | ||
const { limit, after, before, getCursor = ({ id }) => { | ||
if (typeof id !== "number") { | ||
throw new Error("Unable to serialize cursor"); | ||
} | ||
return id.toString(); | ||
}, parseCursor = (cursor) => { | ||
const id = parseInt(cursor, 10); | ||
if (Number.isNaN(id)) { | ||
throw new Error("Unable to parse cursor"); | ||
} | ||
return { | ||
id, | ||
}; | ||
}, } = Object.assign(Object.assign({}, globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.cursor), options); | ||
if (limit !== null && typeof limit !== "number") { | ||
@@ -60,0 +57,0 @@ throw new Error("Missing limit value"); |
{ | ||
"name": "prisma-extension-pagination", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Prisma Client extension for pagination", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24050
342