丰富了initialize时候对现有数据的处理

This commit is contained in:
Xu Chang 2025-10-07 18:02:10 +08:00
parent 2014dbd91b
commit 7f14dba278
3 changed files with 5 additions and 5 deletions

2
lib/AppLoader.d.ts vendored
View File

@ -35,7 +35,7 @@ export declare class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt exten
result: any;
message?: string;
}>;
initialize(): Promise<void>;
initialize(ifExists?: 'drop' | 'omit' | 'dropIfNotStatic'): Promise<void>;
getStore(): DbStore<ED, Cxt>;
getEndpoints(prefix: string): [string, "post" | "get" | "put" | "delete", string, (params: Record<string, string>, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise<{
headers?: Record<string, string | string[]> | undefined;

View File

@ -185,8 +185,8 @@ class AppLoader extends types_1.AppLoader {
throw err;
}
}
async initialize() {
await this.dbStore.initialize({ ifExists: 'dropIfNotStatic' });
async initialize(ifExists) {
await this.dbStore.initialize({ ifExists });
const data = this.requireSth('lib/data/index');
// oak-domain中只有i18n
(0, assert_1.default)(data.i18n);

View File

@ -235,8 +235,8 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
}
}
async initialize() {
await this.dbStore.initialize({ ifExists: 'dropIfNotStatic' });
async initialize(ifExists?: 'drop' | 'omit' | 'dropIfNotStatic') {
await this.dbStore.initialize({ ifExists });
const data = this.requireSth('lib/data/index')!;
// oak-domain中只有i18n