Add error logs for server functions. Add cache dynamic function.

This commit is contained in:
2026-03-27 05:22:31 +01:00
parent 572f739b5c
commit 950bdc3dca
10 changed files with 157 additions and 32 deletions
+16 -2
View File
@@ -222,7 +222,10 @@ export type BunextPageServerFn<
) => Promise<BunextPageModuleServerReturn<T>>;
export type BunextRouteConfig = {
cachePage?: boolean;
/**
* Whether to cache the current page
*/
cachePage?: BunextCachePageType;
/**
* Expiry time of the cache in seconds
*/
@@ -237,14 +240,25 @@ export type BunextPageModuleServerReturn<
query?: Q;
redirect?: BunextPageModuleServerRedirect;
responseOptions?: ResponseInit;
cachePage?: boolean;
/**
* Whether to cache the current page
*/
cachePage?: BunextCachePageType;
/**
* Expiry time of the cache in seconds
*/
cacheExpiry?: number;
url?: BunextPageModuleServerReturnURLObject;
error?: string;
};
export type BunextCachePageType =
| boolean
| ((params: {
ctx: Omit<BunxRouteParams, "body">;
serverRes?: BunextPageModuleServerReturn;
}) => Promise<boolean> | boolean);
export type BunextPageProps<
T extends { [k: string]: any } = { [k: string]: any },
Q extends { [k: string]: any } = { [k: string]: any },