import { createPreviewAdapter } from '../preview/index.js';
export async function validatePreviewRequest(request, options) {
    const url = new URL(request.url);
    const token = url.searchParams.get('token');
    if (!token)
        return { valid: false };
    const preview = createPreviewAdapter(options.secret, options.db);
    const session = await preview.validatePreviewToken(token);
    if (!session)
        return { valid: false };
    return {
        valid: true,
        collection: session.collection,
        documentId: session.documentId,
    };
}
//# sourceMappingURL=preview.js.map