adapters: remove runtime options, serve app always fresh to prevent race conditions

This commit is contained in:
dswbx
2025-09-04 19:36:21 +02:00
parent e8f2c70279
commit fdec5f0693
14 changed files with 37 additions and 90 deletions

View File

@@ -21,13 +21,6 @@ export type BkndConfig<Args = any> = CreateAppConfig & {
export type FrameworkBkndConfig<Args = any> = BkndConfig<Args>;
export type CreateAdapterAppOptions = {
force?: boolean;
id?: string;
};
export type FrameworkOptions = CreateAdapterAppOptions;
export type RuntimeOptions = CreateAdapterAppOptions;
export type RuntimeBkndConfig<Args = any> = BkndConfig<Args> & {
distPath?: string;
serveStatic?: MiddlewareHandler | [string, MiddlewareHandler];
@@ -63,7 +56,6 @@ const apps = new Map<string, App>();
export async function createAdapterApp<Config extends BkndConfig = BkndConfig, Args = DefaultArgs>(
config: Config = {} as Config,
args?: Args,
opts?: CreateAdapterAppOptions,
): Promise<App> {
const appConfig = await makeConfig(config, args);
if (!appConfig.connection || !Connection.isConnection(appConfig.connection)) {
@@ -85,9 +77,8 @@ export async function createAdapterApp<Config extends BkndConfig = BkndConfig, A
export async function createFrameworkApp<Args = DefaultArgs>(
config: FrameworkBkndConfig = {},
args?: Args,
opts?: FrameworkOptions,
): Promise<App> {
const app = await createAdapterApp(config, args, opts);
const app = await createAdapterApp(config, args);
if (!app.isBuilt()) {
if (config.onBuilt) {
@@ -110,9 +101,8 @@ export async function createFrameworkApp<Args = DefaultArgs>(
export async function createRuntimeApp<Args = DefaultArgs>(
{ serveStatic, adminOptions, ...config }: RuntimeBkndConfig<Args> = {},
args?: Args,
opts?: RuntimeOptions,
): Promise<App> {
const app = await createAdapterApp(config, args, opts);
const app = await createAdapterApp(config, args);
if (!app.isBuilt()) {
app.emgr.onEvent(