Further iteration

This commit is contained in:
Zef Hemel
2023-08-30 17:25:54 +02:00
parent cbc00b73a0
commit 75da8e7ca9
18 changed files with 128 additions and 147 deletions
+2 -13
View File
@@ -9,16 +9,13 @@ import { AssetBundlePlugSpacePrimitives } from "../common/spaces/asset_bundle_sp
export async function runPlug(
spacePath: string,
dbPath: string,
functionName: string | undefined,
args: string[] = [],
builtinAssetBundle: AssetBundle,
indexFirst = false,
httpServerPort = 3123,
httpHostname = "127.0.0.1",
) {
spacePath = path.resolve(spacePath);
const tempFile = Deno.makeTempFileSync({ suffix: ".db" });
console.log("Tempt db file", tempFile);
const serverController = new AbortController();
const app = new Application();
@@ -27,7 +24,7 @@ export async function runPlug(
new DiskSpacePrimitives(spacePath),
builtinAssetBundle,
),
tempFile,
dbPath,
app,
);
await serverSystem.init();
@@ -37,13 +34,6 @@ export async function runPlug(
signal: serverController.signal,
});
if (indexFirst) {
await serverSystem.system.loadedPlugs.get("index")!.invoke(
"reindexSpace",
[],
);
}
if (functionName) {
const [plugName, funcName] = functionName.split(".");
@@ -54,7 +44,6 @@ export async function runPlug(
const result = await plug.invoke(funcName, args);
await serverSystem.close();
serverSystem.denoKv.close();
await Deno.remove(tempFile);
serverController.abort();
return result;
} else {