strapi-nextgen-framework
Version:
Production-ready, type-safe framework bridging Strapi v4 CMS and Next.js 14+ App Router with automatic cache management, Error Boundaries, and SEO optimization
50 lines • 1.47 kB
TypeScript
/**
* Revalidation Handler - Phase 4 Implementation
* This is a placeholder for the webhook revalidation handler
*/
import { NextResponse, type NextRequest } from 'next/server';
/**
* Configuration for the revalidation handler
*/
export interface RevalidatorConfig {
/** Webhook secret for validation */
secret: string;
/** Optional mapping of Strapi model names to cache tag prefixes */
tagMap?: Record<string, string>;
/** Enable logging */
logging?: boolean;
}
/**
* Creates a webhook handler for Strapi on-demand revalidation
*
* Automatically revalidates Next.js cache when content is published in Strapi.
*
* @param config - Revalidator configuration
* @returns Next.js Route Handler
*
* @example
* ```typescript
* // app/api/revalidate/route.ts
* import { createStrapiRevalidator } from 'strapi-nextgen-framework';
*
* const handler = createStrapiRevalidator({
* secret: process.env.STRAPI_WEBHOOK_SECRET!,
* tagMap: {
* 'api::page.page': 'strapi_page',
* 'api::blog-post.blog-post': 'strapi_collection_blogPosts',
* 'api::global.global': 'strapi_global',
* },
* logging: true,
* });
*
* export { handler as POST };
* ```
*/
export declare function createStrapiRevalidator(config: RevalidatorConfig): (request: NextRequest) => Promise<NextResponse<{
error: string;
}> | NextResponse<{
revalidated: boolean;
tag: string;
now: number;
}>>;
//# sourceMappingURL=index.d.ts.map