Expose file and page meta data directly

This commit is contained in:
Zef Hemel
2022-11-20 10:24:42 +01:00
parent 7a627c2f35
commit 89f27f9e9c
6 changed files with 114 additions and 40 deletions
+1 -14
View File
@@ -60,20 +60,7 @@ export async function indexLinks({ name, tree }: IndexTreeEvent) {
export async function pageQueryProvider({
query,
}: QueryProviderEvent): Promise<any[]> {
let allPages = await space.listPages();
const allPageMap: Map<string, any> = new Map(
allPages.map((pm) => [pm.name, pm]),
);
for (const { page, value } of await index.queryPrefix("meta:")) {
const p = allPageMap.get(page);
if (p) {
for (const [k, v] of Object.entries(value)) {
p[k] = v;
}
}
}
allPages = [...allPageMap.values()];
return applyQuery(query, allPages);
return applyQuery(query, await space.listPages());
}
export async function linkQueryProvider({