feat(data-source): 支持在指定js环境下不执行init的配置
This commit is contained in:
@@ -29,10 +29,17 @@ import type { DataSourceManagerData, DataSourceManagerOptions } from './types';
|
||||
class DataSourceManager extends EventEmitter {
|
||||
private static dataSourceClassMap = new Map<string, typeof DataSource>();
|
||||
|
||||
public static registe<T extends typeof DataSource = typeof DataSource>(type: string, dataSource: T) {
|
||||
public static register<T extends typeof DataSource = typeof DataSource>(type: string, dataSource: T) {
|
||||
DataSourceManager.dataSourceClassMap.set(type, dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static registe<T extends typeof DataSource = typeof DataSource>(type: string, dataSource: T) {
|
||||
DataSourceManager.register(type, dataSource);
|
||||
}
|
||||
|
||||
public static getDataSourceClass(type: string) {
|
||||
return DataSourceManager.dataSourceClassMap.get(type);
|
||||
}
|
||||
@@ -66,6 +73,10 @@ class DataSourceManager extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.app.jsEngine && ds.schema.disabledInitInJsEngine?.includes(this.app.jsEngine)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const beforeInit: ((...args: any[]) => any)[] = [];
|
||||
const afterInit: ((...args: any[]) => any)[] = [];
|
||||
|
||||
@@ -239,6 +250,6 @@ class DataSourceManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
DataSourceManager.registe('http', HttpDataSource as any);
|
||||
DataSourceManager.register('http', HttpDataSource as any);
|
||||
|
||||
export default DataSourceManager;
|
||||
|
||||
Reference in New Issue
Block a user