mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Remove linting exceptions in nodes-base (no-changelog) (#4944)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { NodeVM, NodeVMOptions } from 'vm2';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import {
|
||||
deepCopy,
|
||||
@@ -9,8 +10,6 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
const { NodeVM } = require('vm2');
|
||||
|
||||
export class Function implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Function',
|
||||
@@ -148,21 +147,24 @@ return items;`,
|
||||
|
||||
const mode = this.getMode();
|
||||
|
||||
const options = {
|
||||
const options: NodeVMOptions = {
|
||||
console: mode === 'manual' ? 'redirect' : 'inherit',
|
||||
sandbox,
|
||||
require: {
|
||||
external: false as boolean | { modules: string[] },
|
||||
external: false as boolean | { modules: string[]; transitive: boolean },
|
||||
builtin: [] as string[],
|
||||
},
|
||||
};
|
||||
|
||||
if (process.env.NODE_FUNCTION_ALLOW_BUILTIN) {
|
||||
if (process.env.NODE_FUNCTION_ALLOW_BUILTIN && typeof options.require === 'object') {
|
||||
options.require.builtin = process.env.NODE_FUNCTION_ALLOW_BUILTIN.split(',');
|
||||
}
|
||||
|
||||
if (process.env.NODE_FUNCTION_ALLOW_EXTERNAL) {
|
||||
options.require.external = { modules: process.env.NODE_FUNCTION_ALLOW_EXTERNAL.split(',') };
|
||||
if (process.env.NODE_FUNCTION_ALLOW_EXTERNAL && typeof options.require === 'object') {
|
||||
options.require.external = {
|
||||
modules: process.env.NODE_FUNCTION_ALLOW_EXTERNAL.split(','),
|
||||
transitive: false,
|
||||
};
|
||||
}
|
||||
|
||||
const vm = new NodeVM(options);
|
||||
|
||||
Reference in New Issue
Block a user