feat(core): Add Tournament as the new default expression evaluator (#6964)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
14
packages/cli/src/ExpressionEvalator.ts
Normal file
14
packages/cli/src/ExpressionEvalator.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import config from '@/config';
|
||||
import { ErrorReporterProxy, ExpressionEvaluatorProxy } from 'n8n-workflow';
|
||||
|
||||
export const initExpressionEvaluator = () => {
|
||||
ExpressionEvaluatorProxy.setEvaluator(config.getEnv('expression.evaluator'));
|
||||
ExpressionEvaluatorProxy.setDifferEnabled(config.getEnv('expression.reportDifference'));
|
||||
ExpressionEvaluatorProxy.setDiffReporter((expr) => {
|
||||
ErrorReporterProxy.warn('Expression difference', {
|
||||
extra: {
|
||||
expression: expr,
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -336,6 +336,9 @@ export class Server extends AbstractServer {
|
||||
variables: {
|
||||
limit: 0,
|
||||
},
|
||||
expressions: {
|
||||
evaluator: config.getEnv('expression.evaluator'),
|
||||
},
|
||||
banners: {
|
||||
dismissed: [],
|
||||
},
|
||||
|
||||
@@ -21,6 +21,7 @@ import { InternalHooks } from '@/InternalHooks';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
import { License } from '@/License';
|
||||
import { ExternalSecretsManager } from '@/ExternalSecrets/ExternalSecretsManager.ee';
|
||||
import { initExpressionEvaluator } from '@/ExpressionEvalator';
|
||||
|
||||
export abstract class BaseCommand extends Command {
|
||||
protected logger = LoggerProxy.init(getLogger());
|
||||
@@ -39,6 +40,7 @@ export abstract class BaseCommand extends Command {
|
||||
|
||||
async init(): Promise<void> {
|
||||
await initErrorHandling();
|
||||
initExpressionEvaluator();
|
||||
|
||||
process.once('SIGTERM', async () => this.stopProcess());
|
||||
process.once('SIGINT', async () => this.stopProcess());
|
||||
|
||||
@@ -1199,6 +1199,21 @@ export const schema = {
|
||||
},
|
||||
},
|
||||
|
||||
expression: {
|
||||
evaluator: {
|
||||
doc: 'Expression evaluator to use',
|
||||
format: ['tmpl', 'tournament'] as const,
|
||||
default: 'tournament',
|
||||
env: 'N8N_EXPRESSION_EVALUATOR',
|
||||
},
|
||||
reportDifference: {
|
||||
doc: 'Whether to report differences in the evaluator outputs',
|
||||
format: Boolean,
|
||||
default: false,
|
||||
env: 'N8N_EXPRESSION_REPORT_DIFFERENCE',
|
||||
},
|
||||
},
|
||||
|
||||
sourceControl: {
|
||||
defaultKeyPairType: {
|
||||
doc: 'Default SSH key type to use when generating SSH keys',
|
||||
|
||||
Reference in New Issue
Block a user