More event refactoring work
This commit is contained in:
@@ -37,6 +37,7 @@ functions:
|
||||
name: "Editor: Move Cursor to Position"
|
||||
clearPageIndex:
|
||||
path: "./page.ts:clearPageIndex"
|
||||
env: server
|
||||
events:
|
||||
- page:saved
|
||||
- page:deleted
|
||||
@@ -46,6 +47,7 @@ functions:
|
||||
- query:page
|
||||
parseIndexTextRepublish:
|
||||
path: "./page.ts:parseIndexTextRepublish"
|
||||
env: server
|
||||
events:
|
||||
- page:index_text
|
||||
reindexSpaceCommand:
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ import {
|
||||
import { events, mq } from "$sb/plugos-syscall/mod.ts";
|
||||
|
||||
import { applyQuery } from "$sb/lib/query.ts";
|
||||
import { invokeFunction } from "$sb/silverbullet-syscall/system.ts";
|
||||
import { invoke } from "$sb/silverbullet-syscall/system.ts";
|
||||
import type { Message } from "$sb/types.ts";
|
||||
import { sleep } from "../../common/async_util.ts";
|
||||
import { cacheFileListing } from "../federation/federation.ts";
|
||||
@@ -135,7 +135,7 @@ export async function reindexSpace() {
|
||||
console.log("Clearing page index...");
|
||||
await index.clearPageIndex();
|
||||
// Executed this way to not have to embed the search plug code here
|
||||
await invokeFunction("client", "search.clearIndex");
|
||||
await invoke("search.clearIndex");
|
||||
const pages = await space.listPages();
|
||||
|
||||
// Queue all page names to be indexed
|
||||
@@ -172,7 +172,7 @@ export async function clearPageIndex(page: string) {
|
||||
}
|
||||
|
||||
export async function parseIndexTextRepublish({ name, text }: IndexEvent) {
|
||||
// console.log("Reindexing", name);
|
||||
console.log("Reindexing", name);
|
||||
await events.dispatchEvent("page:index", {
|
||||
name,
|
||||
tree: await markdown.parseMarkdown(text),
|
||||
|
||||
@@ -44,7 +44,7 @@ export async function evalDirectiveRenderer(
|
||||
const result = await (0, eval)(
|
||||
`(async () => {
|
||||
function invokeFunction(name, ...args) {
|
||||
return syscall("system.invokeFunction", "server", name, ...args);
|
||||
return syscall("system.invoke", name, ...args);
|
||||
}
|
||||
return ${replaceTemplateVars(translateJs(expression), pageMeta)};
|
||||
})()`,
|
||||
|
||||
@@ -12,6 +12,7 @@ functions:
|
||||
|
||||
searchUnindex:
|
||||
path: "./search.ts:pageUnindex"
|
||||
env: client
|
||||
events:
|
||||
- page:deleted
|
||||
searchQueryProvider:
|
||||
|
||||
Reference in New Issue
Block a user