import { getRenderDocument } from "./getRenderDocument.js"; import { render } from "../render/index.js"; /** * Get a single page with rendering * Fetches a document and renders it with the provided function context * * @param client Database client * @param query Query to find the document (by id or path) * @param requestQuery Optional request query parameters * @param fn Function context factory for nested rendering * @returns Rendered document or null if not found */ export const getPage = async (client, query, requestQuery, fn) => { const renderDocument = await getRenderDocument(client, query, { includeRedirects: false, includeUploads: false, includeSlot: true, includeTemplate: true, draft: false, }); if (!renderDocument) { return null; } const safeQuery = requestQuery || {}; const _render = await render(renderDocument, { fn: fn(client, renderDocument, safeQuery), query: safeQuery, }); return _render; }; //# sourceMappingURL=getPage.js.map