import { AllPageDatasource } from './all-page-datasource.js';
import { DatabaseBlockDatasource } from './database-block-datasource.js';
import { TagsDatasource } from './tags-datasource.js';
const datasourceMap = {
    'database-block': {
        title: (host, config) => {
            const dbblock = host.page.workspace
                .getPage(config.pageId)
                ?.getBlockById(config.blockId);
            return dbblock?.title.toString() ?? '';
        },
        constructor: DatabaseBlockDatasource,
    },
    'all-pages': {
        title: (_host, _config) => {
            return 'All Pages';
        },
        constructor: AllPageDatasource,
    },
    tags: {
        title: (_host, _config) => {
            return 'Tags';
        },
        constructor: TagsDatasource,
    },
};
export const createDatasource = (host, config) => {
    return new datasourceMap[config.type].constructor(host, config);
};
export const getDatasourceTitle = (host, config) => {
    return datasourceMap[config.type].title(host, config);
};
//# sourceMappingURL=datasource-manager.js.map