UNPKG

actinium-nodevm

Version:

🔒 Secure Node.js virtual machine for the Gary8D ACTINIUM platform - enhanced security and performance

59 lines (58 loc) • 2.22 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActiniumSecureVM = exports.ActiniumVM = exports.NodeVM = exports.VM = void 0; const vm2_1 = require("@n8n/vm2"); Object.defineProperty(exports, "VM", { enumerable: true, get: function () { return vm2_1.VM; } }); Object.defineProperty(exports, "NodeVM", { enumerable: true, get: function () { return vm2_1.NodeVM; } }); // Re-export everything from @n8n/vm2 for compatibility __exportStar(require("@n8n/vm2"), exports); // Default export for easy importing exports.default = { VM: vm2_1.VM, NodeVM: vm2_1.NodeVM }; // ACTINIUM-specific wrapper with default security settings class ActiniumVM extends vm2_1.NodeVM { constructor(options = {}) { const defaultOptions = { console: 'inherit', sandbox: {}, require: { external: false, builtin: ['fs', 'path', 'crypto', 'util', 'url', 'querystring'], root: './', mock: {} }, timeout: 30000, // 30 second timeout ...options }; super(defaultOptions); } } exports.ActiniumVM = ActiniumVM; // ACTINIUM-specific secure VM for code execution class ActiniumSecureVM extends vm2_1.VM { constructor(options = {}) { const defaultOptions = { timeout: 10000, // 10 second timeout sandbox: {}, ...options }; super(defaultOptions); } } exports.ActiniumSecureVM = ActiniumSecureVM;