stack service and trigger service
This commit is contained in:
parent
1ed6449ac6
commit
cba12be4b1
16 changed files with 784 additions and 177 deletions
|
@ -1,14 +1,17 @@
|
|||
import { override } from "first-di";
|
||||
import { DevEnv, IEnv , UnitTestEnv } from "./env.js";
|
||||
import { DevEnv, IEnv, UnitTestEnv } from "./env.js";
|
||||
import { MetaDataFileManagerModel } from "../model/meta_data_file_manager_model.js";
|
||||
|
||||
export default function locator(env: IEnv){
|
||||
import { extensions } from "../extensions/extensions.js";
|
||||
|
||||
export default function locator(env: IEnv) {
|
||||
extensions();
|
||||
envRegister(env);
|
||||
registerRepository(env);
|
||||
registerController(env);
|
||||
registerService(env);
|
||||
override(MetaDataFileManagerModel, MetaDataFileManagerModel)
|
||||
override(MetaDataFileManagerModel, MetaDataFileManagerModel);
|
||||
}
|
||||
|
||||
const envRegister = (env: IEnv) => {
|
||||
switch (env.toStringEnv()) {
|
||||
case UnitTestEnv.env():
|
||||
|
@ -19,6 +22,7 @@ const envRegister = (env: IEnv) => {
|
|||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const registerRepository = (env: IEnv) => {
|
||||
switch (env.toStringEnv()) {
|
||||
case UnitTestEnv.env():
|
||||
|
@ -30,6 +34,7 @@ const registerRepository = (env: IEnv) => {
|
|||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const registerController = (env: IEnv) => {
|
||||
switch (env.toStringEnv()) {
|
||||
case UnitTestEnv.env():
|
||||
|
@ -38,6 +43,7 @@ const registerController = (env: IEnv) => {
|
|||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const registerService = (env: IEnv) => {
|
||||
switch (env.toStringEnv()) {
|
||||
case UnitTestEnv.env():
|
||||
|
|
31
server/src/core/extensions/array.ts
Normal file
31
server/src/core/extensions/array.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
export {};
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
// @strict: The parameter is determined whether the arrays must be exactly the same in content and order of this relationship or simply follow the same requirements.
|
||||
equals(array: Array<T>, strict: boolean): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export const ArrayEquals = () => {
|
||||
if ([].equals == undefined) {
|
||||
Array.prototype.equals = function (array, strict = true) {
|
||||
if (!array) return false;
|
||||
|
||||
if (arguments.length == 1) strict = true;
|
||||
|
||||
if (this.length != array.length) return false;
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
if (this[i] instanceof Array && array[i] instanceof Array) {
|
||||
if (!this[i].equals(array[i], strict)) return false;
|
||||
} else if (strict && this[i] != array[i]) {
|
||||
return false;
|
||||
} else if (!strict) {
|
||||
return this.sort().equals(array.sort(), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
};
|
5
server/src/core/extensions/extensions.ts
Normal file
5
server/src/core/extensions/extensions.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { ArrayEquals } from "./array.js";
|
||||
|
||||
export const extensions = () =>{
|
||||
ArrayEquals()
|
||||
}
|
|
@ -9,7 +9,7 @@ export interface Disposable {
|
|||
|
||||
export class TypedEvent<T> {
|
||||
private listeners: Listener<T>[] = [];
|
||||
public listenersOncer: Listener<T>[] = [];
|
||||
public listenersOnces: Listener<T>[] = [];
|
||||
|
||||
on = (listener: Listener<T>): Disposable => {
|
||||
this.listeners.push(listener);
|
||||
|
@ -19,7 +19,7 @@ export class TypedEvent<T> {
|
|||
};
|
||||
|
||||
once = (listener: Listener<T>): void => {
|
||||
this.listenersOncer.push(listener);
|
||||
this.listenersOnces.push(listener);
|
||||
};
|
||||
|
||||
off = (listener: Listener<T>) => {
|
||||
|
@ -31,15 +31,14 @@ export class TypedEvent<T> {
|
|||
};
|
||||
|
||||
emit = (event: T) => {
|
||||
/** Обновить слушателей */
|
||||
|
||||
this.listeners.forEach((listener) =>
|
||||
listener(event)
|
||||
);
|
||||
|
||||
/** Очистить очередь единожды */
|
||||
if (this.listenersOncer.length > 0) {
|
||||
const toCall = this.listenersOncer;
|
||||
this.listenersOncer = [];
|
||||
if (this.listenersOnces.length > 0) {
|
||||
const toCall = this.listenersOnces;
|
||||
this.listenersOnces = [];
|
||||
toCall.forEach((listener) => listener(event));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export class ExecError extends Error {
|
||||
static isExecError(e: any) {
|
||||
if ("type" in e && "script" in e && "unixTime" in e) {
|
||||
if ("type" in e && "script" in e && "unixTime" in e && 'error' in e) {
|
||||
return new ExecError(e.type, e.event, e.data);
|
||||
}
|
||||
return;
|
||||
|
@ -8,14 +8,15 @@ export class ExecError extends Error {
|
|||
script: string;
|
||||
unixTime: number;
|
||||
type = EXEC_TYPE.EXEC;
|
||||
|
||||
error:any;
|
||||
constructor(
|
||||
script: string,
|
||||
...args: any
|
||||
) {
|
||||
super(...args);
|
||||
this.script = script;
|
||||
this.script = script;
|
||||
this.unixTime = Date.now();
|
||||
this.error = args[0]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,10 +51,12 @@ export class SpawnError extends Error {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export enum EXEC_TYPE {
|
||||
SPAWN = "SPAWN",
|
||||
EXEC = "EXEC",
|
||||
}
|
||||
|
||||
export enum EXEC_EVENT {
|
||||
PROGRESS = "PROGRESS",
|
||||
ERROR = "ERROR",
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
export class CalculationProcess {
|
||||
process: ProcessMetaData[];
|
||||
constructor(process: ProcessMetaData[]) {
|
||||
this.process = process;
|
||||
}
|
||||
}
|
||||
import { EXEC_TYPE } from "./exec_error_model.js";
|
||||
|
||||
|
||||
export interface ProcessMetaData {
|
||||
process: Process;
|
||||
trigger: Trigger;
|
||||
env: Env | null;
|
||||
stackGenerateType:StackGenerateType;
|
||||
}
|
||||
|
||||
export enum ProcessType {
|
||||
EXEC = "EXEC",
|
||||
SPAWN = "SPAWN",
|
||||
export enum StackGenerateType{
|
||||
MAP = 'MAP',
|
||||
SINGLETON = 'SINGLETON'
|
||||
}
|
||||
|
||||
export interface Env {
|
||||
ssh_key: string;
|
||||
isUserInput: boolean;
|
||||
|
@ -22,12 +20,13 @@ export interface Env {
|
|||
}
|
||||
|
||||
export interface Process {
|
||||
type: ProcessType;
|
||||
type: EXEC_TYPE;
|
||||
command: string;
|
||||
isGenerating: boolean;
|
||||
isLocaleCode: boolean;
|
||||
issueType: IssueType;
|
||||
timeout: number;
|
||||
timeout?: number;
|
||||
commit?:string | undefined;
|
||||
}
|
||||
|
||||
export enum IssueType {
|
||||
|
@ -41,5 +40,5 @@ export enum TriggerType {
|
|||
}
|
||||
export interface Trigger {
|
||||
type: TriggerType;
|
||||
value: string;
|
||||
value: string[];
|
||||
}
|
||||
|
|
|
@ -24,7 +24,12 @@ export class ExecutorProgramService
|
|||
this.execPath = execPath;
|
||||
this.maxTime = maxTime;
|
||||
}
|
||||
private async workerExecuted(command: string, workerType: WorkerType,args:Array<string> | undefined = undefined) {
|
||||
|
||||
private async workerExecuted(
|
||||
command: string,
|
||||
workerType: WorkerType,
|
||||
args: Array<string> | undefined = undefined
|
||||
) {
|
||||
cluster.setupPrimary({
|
||||
exec: "./src/core/helper/worker_computed.js",
|
||||
});
|
||||
|
@ -39,22 +44,25 @@ export class ExecutorProgramService
|
|||
command: command,
|
||||
execPath: this.execPath,
|
||||
type: workerType,
|
||||
cliArgs:args
|
||||
cliArgs: args,
|
||||
};
|
||||
worker.send(workerDataExec);
|
||||
worker.on("message", (e) => {
|
||||
const spawnError = SpawnError.isError(e);
|
||||
if (spawnError instanceof SpawnError) {
|
||||
this.emit(Result.error(spawnError));
|
||||
return;
|
||||
}
|
||||
const executorResult = ExecutorResult.isExecutorResult(e);
|
||||
if (executorResult instanceof ExecutorResult) {
|
||||
this.emit(Result.ok(executorResult));
|
||||
return;
|
||||
}
|
||||
|
||||
const execError = ExecError.isExecError(e);
|
||||
if (execError instanceof ExecError) {
|
||||
this.emit(Result.error(execError));
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (this.maxTime != null) {
|
||||
|
@ -70,13 +78,18 @@ export class ExecutorProgramService
|
|||
}, this.maxTime!);
|
||||
}
|
||||
}
|
||||
public async call(type: EXEC_TYPE, command: string, args:Array<string> | undefined = undefined): Promise<void> {
|
||||
|
||||
public async call(
|
||||
type: EXEC_TYPE,
|
||||
command: string,
|
||||
args: Array<string> | undefined = undefined
|
||||
): Promise<void> {
|
||||
if (type == EXEC_TYPE.EXEC) {
|
||||
this.workerExecuted(command, WorkerType.EXEC);
|
||||
|
||||
return;
|
||||
}
|
||||
this.workerExecuted(command, WorkerType.SPAWN,args);
|
||||
this.workerExecuted(command, WorkerType.SPAWN, args);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,21 +4,48 @@ import { promisify } from "node:util";
|
|||
import { createHash } from "node:crypto";
|
||||
import "reflect-metadata";
|
||||
import { BinaryLike } from "crypto";
|
||||
import { EventsFileChanger, MetaDataFileManagerModel } from "../model/meta_data_file_manager_model.js";
|
||||
import {
|
||||
EventsFileChanger,
|
||||
MetaDataFileManagerModel,
|
||||
} from "../model/meta_data_file_manager_model.js";
|
||||
import { Result } from "../helper/result.js";
|
||||
import { TypedEvent } from "../helper/typed_event.js";
|
||||
|
||||
const readFileAsync = promisify(fs.readFile);
|
||||
const readdir = promisify(fs.readdir);
|
||||
const stat = promisify(fs.stat);
|
||||
const lsStat = promisify(fs.lstat);
|
||||
|
||||
function md5(content: Buffer | BinaryLike) {
|
||||
return createHash("md5").update(content).digest("hex");
|
||||
function joinBuffers(buffers, delimiter = " ") {
|
||||
const d = Buffer.from(delimiter);
|
||||
return buffers.reduce((prev, b) => Buffer.concat([prev, d, b]));
|
||||
}
|
||||
|
||||
interface IHashesCache {
|
||||
|
||||
async function readFileAtBuffer(path: string): Promise<Buffer> {
|
||||
if ((await lsStat(path)).isDirectory()) {
|
||||
return (
|
||||
await readdir(path, {
|
||||
encoding: "buffer",
|
||||
})
|
||||
).reduce(
|
||||
(accumulator, currentValue) => joinBuffers([accumulator, currentValue]),
|
||||
Buffer.from("")
|
||||
);
|
||||
}
|
||||
return await readFileAsync(path);
|
||||
}
|
||||
function md5(content: Buffer | BinaryLike): Promise<string> {
|
||||
return new Promise((resolve, _reject) => {
|
||||
return resolve(createHash("md5").update(content).digest("hex"));
|
||||
});
|
||||
}
|
||||
|
||||
export interface IHashesCache {
|
||||
[key: string]: MetaDataFileManagerModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export abstract class IFilesChangeNotifierService {
|
||||
abstract directory: string;
|
||||
}
|
||||
|
@ -42,7 +69,7 @@ export class FilesChangeNotifierService
|
|||
}
|
||||
async setHash(file: string) {
|
||||
const data = await readFileAsync(file);
|
||||
const md5Current = md5(data);
|
||||
const md5Current = await md5(data);
|
||||
|
||||
this.hashes[file] = new MetaDataFileManagerModel(
|
||||
file,
|
||||
|
@ -77,16 +104,16 @@ export class FilesChangeNotifierService
|
|||
fsWait = false;
|
||||
}, 100);
|
||||
try {
|
||||
const file = await readFileAsync(filePath);
|
||||
const md5Current = md5(file);
|
||||
|
||||
const file = await readFileAtBuffer(filePath);
|
||||
const md5Current = await md5(file);
|
||||
if (md5Current === md5Previous) {
|
||||
return;
|
||||
}
|
||||
const status = this.hashes[filePath] === undefined
|
||||
const status =
|
||||
this.hashes[filePath] === undefined
|
||||
? EventsFileChanger.create
|
||||
: EventsFileChanger.update;
|
||||
|
||||
|
||||
const model = new MetaDataFileManagerModel(
|
||||
filePath,
|
||||
md5Current,
|
||||
|
@ -115,8 +142,7 @@ export class FilesChangeNotifierService
|
|||
cancel() {
|
||||
if (this.watcher != undefined) {
|
||||
this.watcher.close();
|
||||
this.listenersOncer = []
|
||||
this.listenersOnces = [];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
137
server/src/core/services/stack_service.ts
Normal file
137
server/src/core/services/stack_service.ts
Normal file
|
@ -0,0 +1,137 @@
|
|||
import {
|
||||
FilesChangeNotifierService,
|
||||
IHashesCache,
|
||||
} from "./files_change_notifier_service.js";
|
||||
import { ProcessMetaData, Trigger } from "../model/process_model.js";
|
||||
import { ExecutorProgramService } from "./executor_program_service.js";
|
||||
import {
|
||||
EXEC_EVENT,
|
||||
ExecError,
|
||||
SpawnError,
|
||||
} from "../model/exec_error_model.js";
|
||||
import { TypedEvent } from "../helper/typed_event.js";
|
||||
import { Result } from "../helper/result.js";
|
||||
import { ExecutorResult } from "../model/executor_result.js";
|
||||
import { delay } from "../helper/delay.js";
|
||||
import { TriggerErrorReport, TriggerService } from "./trigger_service.js";
|
||||
|
||||
export interface Iteration {
|
||||
hashes: IHashesCache | null;
|
||||
process: ProcessMetaData;
|
||||
result?: ExecError | SpawnError | ExecutorResult;
|
||||
}
|
||||
|
||||
export abstract class IStackService {
|
||||
abstract callStack: Iteration[];
|
||||
abstract path: string;
|
||||
abstract init(processed: ProcessMetaData[], path: string): void;
|
||||
}
|
||||
|
||||
export class StackService extends TypedEvent<string> implements IStackService {
|
||||
callStack: Iteration[];
|
||||
path: string;
|
||||
constructor(processed: ProcessMetaData[], path: string) {
|
||||
super();
|
||||
this.path = path;
|
||||
this.callStack = [];
|
||||
this.init(processed);
|
||||
}
|
||||
|
||||
public init(processed: ProcessMetaData[]) {
|
||||
for (let el of processed) {
|
||||
el = this.commandHandler(el);
|
||||
this.callStack.push({
|
||||
hashes: null,
|
||||
process: el,
|
||||
});
|
||||
}
|
||||
}
|
||||
private commandHandler(processMetaData: ProcessMetaData) {
|
||||
processMetaData.process.command = processMetaData.process.command.replace(
|
||||
"$PATH",
|
||||
this.path
|
||||
);
|
||||
return processMetaData;
|
||||
}
|
||||
public async call() {
|
||||
let inc = 0;
|
||||
|
||||
for await (const el of this.callStack!) {
|
||||
await this.execStack(inc, el);
|
||||
inc += 1;
|
||||
}
|
||||
}
|
||||
async execStack(
|
||||
stackNumber: number,
|
||||
stackLayer: Iteration
|
||||
): Promise<void | boolean> {
|
||||
const executorService = new ExecutorProgramService(this.path);
|
||||
|
||||
executorService.call(
|
||||
stackLayer.process.process.type,
|
||||
stackLayer.process.process.command
|
||||
);
|
||||
|
||||
const filesChangeNotifierService = new FilesChangeNotifierService(
|
||||
this.path
|
||||
);
|
||||
|
||||
filesChangeNotifierService.call();
|
||||
const result = await this.waitEvent<
|
||||
Result<ExecError | SpawnError, ExecutorResult>
|
||||
>(executorService);
|
||||
await delay(100);
|
||||
if (result.isSuccess()) {
|
||||
this.callStack[stackNumber].result = result.value;
|
||||
this.callStack[stackNumber].hashes = filesChangeNotifierService.hashes;
|
||||
|
||||
const triggerResult = await this.triggerExec(
|
||||
stackLayer.process.trigger,
|
||||
stackNumber
|
||||
);
|
||||
triggerResult.fold(
|
||||
(s) => {
|
||||
s
|
||||
},
|
||||
(e) => {
|
||||
e;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
filesChangeNotifierService.cancel();
|
||||
return;
|
||||
}
|
||||
public waitEvent<T>(stream: TypedEvent<T>): Promise<T> {
|
||||
const promise = new Promise<T>((resolve, reject) => {
|
||||
const addListener = () => {
|
||||
stream.on((e) => {
|
||||
const event = e as Result<ExecError | SpawnError, ExecutorResult>;
|
||||
event.fold(
|
||||
(s) => {
|
||||
if (s.event === EXEC_EVENT.END) {
|
||||
resolve(e);
|
||||
}
|
||||
},
|
||||
(e) => {
|
||||
reject(e);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
addListener();
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
private async triggerExec(
|
||||
trigger: Trigger,
|
||||
stackNumber: number
|
||||
): Promise<Result<boolean, boolean>> {
|
||||
const hashes = this.callStack[stackNumber].hashes;
|
||||
|
||||
if (hashes != null) {
|
||||
return await new TriggerService(trigger, hashes, this.path).call();
|
||||
}
|
||||
throw new Error("Hashes is null");
|
||||
}
|
||||
}
|
140
server/src/core/services/trigger_service.ts
Normal file
140
server/src/core/services/trigger_service.ts
Normal file
|
@ -0,0 +1,140 @@
|
|||
import { Trigger, TriggerType } from "../model/process_model.js";
|
||||
import * as vm from "node:vm";
|
||||
import { IHashesCache } from "./files_change_notifier_service.js";
|
||||
import { EventsFileChanger } from "../model/meta_data_file_manager_model.js";
|
||||
import { Result } from "../helper/result.js";
|
||||
import { TypedEvent } from "../helper/typed_event.js";
|
||||
|
||||
export class TriggerCallResult {
|
||||
results: Array<TriggerSuccessResult | TriggerErrorReport>;
|
||||
|
||||
constructor(results: Array<TriggerSuccessResult | TriggerErrorReport>) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
get isErrorComputed(): Result<boolean, boolean> {
|
||||
for (const el of this.results) {
|
||||
if (el instanceof TriggerErrorReport) {
|
||||
return Result.error(true);
|
||||
}
|
||||
}
|
||||
return Result.ok(false);
|
||||
}
|
||||
}
|
||||
export class TriggerSuccessResult {
|
||||
status: boolean;
|
||||
processOutput: any;
|
||||
trigger: string;
|
||||
constructor(status: boolean, trigger: string, processOutput?: any) {
|
||||
this.status = status;
|
||||
this.processOutput = processOutput;
|
||||
this.trigger = trigger;
|
||||
}
|
||||
}
|
||||
export class TriggerErrorReport extends Error {
|
||||
hashes: IHashesCache;
|
||||
trigger: string | Trigger;
|
||||
processOutput: any;
|
||||
constructor(
|
||||
hashes: IHashesCache,
|
||||
trigger: string | Trigger,
|
||||
processOutput?: any
|
||||
) {
|
||||
super();
|
||||
this.hashes = hashes;
|
||||
this.trigger = trigger;
|
||||
this.processOutput = processOutput;
|
||||
}
|
||||
}
|
||||
export class TriggerService extends TypedEvent<TriggerCallResult> {
|
||||
context = {};
|
||||
|
||||
constructor(trigger: Trigger, hashes: IHashesCache, path: string) {
|
||||
super();
|
||||
this.trigger = trigger;
|
||||
this.hashes = hashes;
|
||||
this.path = path;
|
||||
this.triggerResult = null;
|
||||
this.init();
|
||||
}
|
||||
triggerResult: null | TriggerCallResult;
|
||||
path: string;
|
||||
hashes: IHashesCache;
|
||||
trigger: Trigger;
|
||||
private init(): void {
|
||||
this.context["hashes"] = this.hashes;
|
||||
}
|
||||
private getAllHashesDeleteWithouts(): string[] {
|
||||
return Object.entries(this.hashes).map(([k, v]) => {
|
||||
if (v.event !== EventsFileChanger.delete) {
|
||||
return k.replace(new RegExp(`${this.path}`), "");
|
||||
}
|
||||
return "";
|
||||
});
|
||||
}
|
||||
public async call(): Promise<Result<boolean, boolean>> {
|
||||
if (this.trigger.type === TriggerType.PROCESS) {
|
||||
const triggerResult = await this.triggerTypeProcess();
|
||||
this.emit(triggerResult);
|
||||
return triggerResult.isErrorComputed;
|
||||
}
|
||||
|
||||
if (this.trigger.type === TriggerType.FILE) {
|
||||
const triggerResult = await this.triggerTypeFile();
|
||||
this.emit(triggerResult);
|
||||
return triggerResult.isErrorComputed;
|
||||
}
|
||||
|
||||
return Result.error(false);
|
||||
}
|
||||
private triggerTypeProcess(): TriggerCallResult {
|
||||
const triggerResult: TriggerSuccessResult[] = [];
|
||||
|
||||
for (const el of this.trigger.value) {
|
||||
const processOutput = this.processCall(el);
|
||||
|
||||
triggerResult.push({
|
||||
status: processOutput ? processOutput : false,
|
||||
processOutput: processOutput,
|
||||
trigger: el,
|
||||
});
|
||||
}
|
||||
return this.reportTriggerTypeProcess(triggerResult);
|
||||
}
|
||||
private triggerTypeFile(): TriggerCallResult {
|
||||
const files = this.getAllHashesDeleteWithouts();
|
||||
|
||||
return new TriggerCallResult(
|
||||
this.trigger.value.map((el) => {
|
||||
let result = false;
|
||||
for (const file of files) {
|
||||
if (result != true) {
|
||||
result = new RegExp(`${el}`).test(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (result === false) {
|
||||
return new TriggerErrorReport(this.hashes, el);
|
||||
}
|
||||
return new TriggerSuccessResult(result, el);
|
||||
})
|
||||
);
|
||||
}
|
||||
private reportTriggerTypeProcess(
|
||||
triggerResult: Array<TriggerSuccessResult>
|
||||
): TriggerCallResult {
|
||||
return new TriggerCallResult(
|
||||
triggerResult.map((el) => {
|
||||
if (el.status) {
|
||||
return el;
|
||||
} else {
|
||||
return new TriggerErrorReport(this.hashes, el.trigger);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
private processCall(code: string): undefined | boolean | any {
|
||||
const ctx = vm.createContext(this.context);
|
||||
return vm.runInContext(code, ctx);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue