fix cloudflare adapter warm mode and type improvements

Adds warm mode support to cloudflare adapter to enable app instance caching. Improves BkndConfig type handling and makes hybrid mode reader optional. Fixes entity hook types to properly handle Generated ID types from kysely.
This commit is contained in:
dswbx
2025-11-21 17:35:45 +01:00
parent 5c3eeb7642
commit c3ae4a3999
4 changed files with 27 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ export type BkndHybridModeOptions = {
* Reader function to read the configuration from the file system.
* This is required for hybrid mode to work.
*/
reader: (path: string) => MaybePromise<string | object>;
reader?: (path: string) => MaybePromise<string | object>;
/**
* Provided secrets to be merged into the configuration
*/
@@ -47,7 +47,7 @@ export function hybrid<
"You must set a `reader` option when using hybrid mode",
);
const fileContent = await appConfig.reader(configFilePath);
const fileContent = await appConfig.reader?.(configFilePath);
let fileConfig = typeof fileContent === "string" ? JSON.parse(fileContent) : fileContent;
if (!fileConfig) {
$console.warn("No config found, using default config");