From 75f8b40cc4de3f656f3ea2eb8611ed55a8168448 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 5 Feb 2024 10:18:49 +0100 Subject: [PATCH] Clean code --- packages/server/src/utilities/scriptRunner.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/utilities/scriptRunner.ts b/packages/server/src/utilities/scriptRunner.ts index fe59117466..b6e597cc55 100644 --- a/packages/server/src/utilities/scriptRunner.ts +++ b/packages/server/src/utilities/scriptRunner.ts @@ -25,14 +25,14 @@ class ScriptRunner { class IsolatedVM { isolate: ivm.Isolate vm: ivm.Context - jail: ivm.Reference + #jail: ivm.Reference script: any constructor({ memoryLimit }: { memoryLimit: number }) { this.isolate = new ivm.Isolate({ memoryLimit }) this.vm = this.isolate.createContextSync() - this.jail = this.vm.global - this.jail.setSync("global", this.jail.derefInto()) + this.#jail = this.vm.global + this.#jail.setSync("global", this.#jail.derefInto()) } getValue(key: string) { @@ -44,7 +44,7 @@ class IsolatedVM { set context(context: Record) { for (let key in context) { - this.jail.setSync(key, this.copyRefToVm(context[key])) + this.#jail.setSync(key, this.copyRefToVm(context[key])) } }