added /dist

This commit is contained in:
2026-08-03 12:24:28 +02:00
parent dd97bb67fe
commit 05150e7ece
490 changed files with 6667 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
/**
* Fetches one page of a collection's entries for an archive listing.
*
* Only published documents are returned when the collection has drafts enabled;
* Payload's `where` on `_status` is left to the caller, since a collection
* without drafts has no such field.
*
* Returns pagination facts rather than markup — the listing itself belongs to
* the client (as a block on the archive page, most likely), because how a list
* of posts should look isn't something a plugin can decide.
*/ export async function getArchiveEntries({ collection, depth = 1, locale, page = 1, payload, perPage = 10, sort = '-createdAt', where }) {
const result = await payload.find({
collection: collection,
depth,
limit: perPage,
locale: locale,
page: Math.max(1, page),
sort,
...where ? {
where: where
} : {}
});
return {
docs: result.docs,
hasNextPage: result.hasNextPage,
hasPrevPage: result.hasPrevPage,
page: result.page ?? 1,
totalDocs: result.totalDocs,
totalPages: result.totalPages
};
}
//# sourceMappingURL=getArchiveEntries.js.map