mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Expression function $ifEmpty (#7660)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
@@ -44,7 +44,7 @@ export const baseCompletions = defineComponent({
|
||||
|
||||
/**
|
||||
* - Complete `$` to `$execution $input $prevNode $runIndex $workflow $now $today
|
||||
* $jmespath $('nodeName')` in both modes.
|
||||
* $jmespath $ifEmpt $('nodeName')` in both modes.
|
||||
* - Complete `$` to `$json $binary $itemIndex` in single-item mode.
|
||||
*/
|
||||
baseCompletions(context: CompletionContext): CompletionResult | null {
|
||||
@@ -58,6 +58,10 @@ export const baseCompletions = defineComponent({
|
||||
label: `${prefix}execution`,
|
||||
info: this.$locale.baseText('codeNodeEditor.completer.$execution'),
|
||||
},
|
||||
{
|
||||
label: `${prefix}ifEmpty()`,
|
||||
info: this.$locale.baseText('codeNodeEditor.completer.$ifEmpty'),
|
||||
},
|
||||
{ label: `${prefix}input`, info: this.$locale.baseText('codeNodeEditor.completer.$input') },
|
||||
{
|
||||
label: `${prefix}prevNode`,
|
||||
|
||||
@@ -460,6 +460,7 @@ export const MAPPING_PARAMS = [
|
||||
'$env',
|
||||
'$evaluateExpression',
|
||||
'$execution',
|
||||
'$ifEmpty',
|
||||
'$input',
|
||||
'$item',
|
||||
'$jmespath',
|
||||
|
||||
@@ -47,7 +47,7 @@ export function dollarCompletions(context: CompletionContext): CompletionResult
|
||||
export function dollarOptions() {
|
||||
const rank = setRank(['$json', '$input']);
|
||||
const SKIP = new Set();
|
||||
const DOLLAR_FUNCTIONS = ['$jmespath'];
|
||||
const DOLLAR_FUNCTIONS = ['$jmespath', '$ifEmpty'];
|
||||
|
||||
if (isCredentialsModalOpen()) {
|
||||
return useExternalSecretsStore().isEnterpriseExternalSecretsEnabled
|
||||
|
||||
@@ -328,6 +328,7 @@ export class I18nClass {
|
||||
rootVars: Record<string, string | undefined> = {
|
||||
$binary: this.baseText('codeNodeEditor.completer.binary'),
|
||||
$execution: this.baseText('codeNodeEditor.completer.$execution'),
|
||||
$ifEmpty: this.baseText('codeNodeEditor.completer.$ifEmpty'),
|
||||
$input: this.baseText('codeNodeEditor.completer.$input'),
|
||||
$jmespath: this.baseText('codeNodeEditor.completer.$jmespath'),
|
||||
$json: this.baseText('codeNodeEditor.completer.json'),
|
||||
|
||||
@@ -168,6 +168,7 @@
|
||||
"codeNodeEditor.completer.$execution.customData.get()": "Get custom data set in the current execution. <a href=\"https://docs.n8n.io/workflows/executions/custom-executions-data/\" target=\"_blank\">Learn More</a>",
|
||||
"codeNodeEditor.completer.$execution.customData.setAll()": "Set multiple custom data key/value pairs with an object for the current execution. <a href=\"https://docs.n8n.io/workflows/executions/custom-executions-data/\" target=\"_blank\">Learn More</a>",
|
||||
"codeNodeEditor.completer.$execution.customData.getAll()": "Get all custom data for the current execution. <a href=\"https://docs.n8n.io/workflows/executions/custom-executions-data/\" target=\"_blank\">Learn More</a>",
|
||||
"codeNodeEditor.completer.$ifEmpty": "Checks whether the first parameter is empty, and if so returns the second parameter. Otherwise returns the first parameter. The following count as empty: null/undefined values, empty strings, empty arrays, objects with no keys.",
|
||||
"codeNodeEditor.completer.$input": "This node’s input data",
|
||||
"codeNodeEditor.completer.$input.all": "@:_reusableBaseText.codeNodeEditor.completer.all",
|
||||
"codeNodeEditor.completer.$input.first": "@:_reusableBaseText.codeNodeEditor.completer.first",
|
||||
|
||||
Reference in New Issue
Block a user