mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Add new expression variables and support for luxon
* 🔨 scaffolding for and * 🔨 added autocomplete * 🔨 N8N-2961-New-expression-variables * 🔨 added luxon DateTime to expressions and Functions node, replased with , clean up * 🔨 added and , fixed return values * 🔨 added tests for new variables * 🔨 removed unnecessary import * 🔨 return type fix * 🔨 working on review, wip * 🔨 working on review, improved errors, wip * 🔨 fixed disappearing error message box * 🔨 excluded variables from function node, added jmespath setup * :hamer: added $jmsepath to function nodes * 🔨 replacing proxy with data when using jmespath * 🔨 renamed function * 🔨 updated tips to function nodes * 🔨 fixes for errors messages * 🔨 review fixes * 🔨 removed $input and $() from autocomplete * ⚡ removed comments * ⚡ Remove unused code Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import {DateTime} from 'luxon';
|
||||
|
||||
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
||||
import { workflowHelpers } from '@/components/mixins/workflowHelpers';
|
||||
@@ -176,13 +177,39 @@ export default mixins(
|
||||
const autoCompleteItems = [
|
||||
`function $evaluateExpression(expression: string, itemIndex?: number): any {};`,
|
||||
`function getNodeParameter(parameterName: string, itemIndex: number, fallbackValue?: any): any {};`,
|
||||
`function getWorkflowStaticData(type: string): object {};`,
|
||||
`function $item(itemIndex: number, runIndex?: number) {};`,
|
||||
`function $items(nodeName?: string, outputIndex?: number, runIndex?: number) {};`,
|
||||
`function getWorkflowStaticData(type: string): {};`,
|
||||
`function $item(itemIndex: number, runIndex?: number): {};`,
|
||||
`function $items(nodeName?: string, outputIndex?: number, runIndex?: number): {};`,
|
||||
];
|
||||
|
||||
const baseKeys = ['$env', '$executionId', '$mode', '$parameter', '$position', '$resumeWebhookUrl', '$workflow'];
|
||||
const additionalKeys = ['$json', '$binary'];
|
||||
const baseKeys = [
|
||||
'$env',
|
||||
'$executionId',
|
||||
'$mode',
|
||||
'$parameter',
|
||||
'$resumeWebhookUrl',
|
||||
'$workflow',
|
||||
'$now',
|
||||
'$today',
|
||||
'$thisRunIndex',
|
||||
'DateTime',
|
||||
'Duration',
|
||||
'Interval',
|
||||
];
|
||||
|
||||
const functionItemKeys = [
|
||||
'$json',
|
||||
'$binary',
|
||||
'$position',
|
||||
'$thisItem',
|
||||
'$thisItemIndex',
|
||||
];
|
||||
|
||||
const additionalKeys: string[] = [];
|
||||
if (this.codeAutocomplete === 'functionItem') {
|
||||
additionalKeys.push(...functionItemKeys);
|
||||
}
|
||||
|
||||
if (executedWorkflow && connectionInputData && connectionInputData.length) {
|
||||
baseKeys.push(...additionalKeys);
|
||||
} else {
|
||||
@@ -216,6 +243,7 @@ export default mixins(
|
||||
} catch(error) {}
|
||||
}
|
||||
autoCompleteItems.push(`const $node = ${JSON.stringify(nodes)}`);
|
||||
autoCompleteItems.push(`function $jmespath(jsonDoc: object, query: string): {};`);
|
||||
|
||||
if (this.codeAutocomplete === 'function') {
|
||||
if (connectionInputData) {
|
||||
|
||||
Reference in New Issue
Block a user