WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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[];
|
||||
|
||||
Reference in New Issue
Block a user