This commit is contained in:
Zef Hemel
2026-01-20 13:48:15 +01:00
parent 55bb0f0a0a
commit c25a073e81
22 changed files with 461 additions and 409 deletions
+13 -2
View File
@@ -31,9 +31,8 @@ export function queryLuaObjects<T>(
tag: string,
query: LuaCollectionQuery,
scopedVariables?: Record<string, any>,
ttlSecs?: number,
): Promise<ObjectValue<T>[]> {
return syscall("index.queryLuaObjects", tag, query, scopedVariables, ttlSecs);
return syscall("index.queryLuaObjects", tag, query, scopedVariables);
}
/**
@@ -57,3 +56,15 @@ export function getObjectByRef<T>(
export function ensureFullIndex(): Promise<void> {
return syscall("index.ensureFullIndex");
}
export function reindexSpace(): Promise<void> {
return syscall("index.reindexSpace");
}
export function deleteObject(
page: string,
tag: string,
ref: string,
): Promise<void> {
return syscall("index.deleteObject", page, tag, ref);
}
+5 -2
View File
@@ -2,6 +2,7 @@ import { Config } from "../client/config.ts";
import { DataStore } from "../client/data/datastore.ts";
import { MemoryKvPrimitives } from "../client/data/memory_kv_primitives.ts";
import { DataStoreMQ } from "../client/data/mq.datastore.ts";
import { ObjectIndex } from "../client/data/object_index.ts";
import { EventHook } from "../client/plugos/hooks/event.ts";
import {
dataStoreReadSyscalls,
@@ -46,9 +47,11 @@ export function createMockSystem() {
eventedSpacePrimitives: spacePrimitives,
};
const objectIndex = new ObjectIndex(ds, config, eventHook, mq);
const clientSystemMock: any = {
system: system,
spaceLuaEnv: new SpaceLuaEnvironment(system),
spaceLuaEnv: new SpaceLuaEnvironment(system, objectIndex),
};
clientMock.clientSystem = clientSystemMock;
@@ -60,7 +63,7 @@ export function createMockSystem() {
markdownSyscalls(clientMock),
languageSyscalls(),
jsonschemaSyscalls(),
indexSyscalls(clientMock),
indexSyscalls(objectIndex, clientMock),
luaSyscalls(clientSystemMock),
mqSyscalls(mq),
dataStoreReadSyscalls(ds, clientSystemMock),
+1 -1
View File
@@ -47,7 +47,7 @@ export type SyscallMeta = {
* - ref: a unique reference (id) for the object, ideally a page reference
* - tags: a list of tags that the object belongs to
*/
export type ObjectValue<T> = {
export type ObjectValue<T = any> = {
ref: string;
tag: string; // main tag
tags?: string[];