Refactor VM and Plugin Management
- Removed the `plugins.constants.ts` file as it was no longer needed. - Updated the `vm.class.ts` to improve result handling and logging. - Introduced `vm.constants.ts` to manage registered plugins and modules. - Simplified the test payload in `case1-payload.js` by removing unnecessary insert logic. - Enhanced `case1.ts` to include database and migration setup, improving test clarity. - Deleted unused functions for adding modules and plugins, streamlining the codebase.
This commit is contained in:
@ -56,10 +56,10 @@ export class Vm {
|
||||
rejectPromise = reject;
|
||||
});
|
||||
|
||||
this.setFunction("returnResult", (...args) => {
|
||||
console.log("Script result:", args);
|
||||
this.setFunction("returnResult", (res) => {
|
||||
console.log("Returning result from VM:", res);
|
||||
|
||||
resolvePromise(args);
|
||||
resolvePromise(JSON.parse(res));
|
||||
});
|
||||
|
||||
// TODO: log
|
||||
@ -77,7 +77,7 @@ export class Vm {
|
||||
${script}
|
||||
try {
|
||||
const result = await main(${JSON.stringify(args)});
|
||||
returnResult(result)
|
||||
returnResult(JSON.stringify(result))
|
||||
} catch (e) {
|
||||
error(e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user