Files
plainleaf/plugs/index/plug_api.ts
T
2025-03-21 16:12:10 +01:00

28 lines
738 B
TypeScript

import type { KV, KvQuery, ObjectValue } from "../../plug-api/types.ts";
import { system } from "@silverbulletmd/silverbullet/syscalls";
export function indexObjects<T>(
page: string,
objects: ObjectValue<T>[],
): Promise<void> {
return system.invokeFunction("index.indexObjects", page, objects);
}
export function batchSet(page: string, kvs: KV[]): Promise<void> {
return system.invokeFunction("index.batchSet", page, kvs);
}
export function query(
query: KvQuery,
): Promise<KV[]> {
return system.invokeFunction("index.query", query);
}
export function getObjectByRef<T>(
page: string,
tag: string,
ref: string,
): Promise<T | undefined> {
return system.invokeFunction("index.getObjectByRef", page, tag, ref);
}