Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Node version available in expression #9350

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export const baseCompletions = defineComponent({
label: `${prefix}today`,
info: this.$locale.baseText('codeNodeEditor.completer.$today'),
},
{
label: `${prefix}nodeVersion`,
info: this.$locale.baseText('codeNodeEditor.completer.$nodeVersion'),
},
{
label: `${prefix}jmespath()`,
info: this.$locale.baseText('codeNodeEditor.completer.$jmespath'),
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ export const MAPPING_PARAMS = [
'$resumeWebhookUrl',
'$runIndex',
'$today',
'$nodeVersion',
'$vars',
'$workflow',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ export const ROOT_DOLLAR_COMPLETIONS: Completion[] = [
section: METADATA_SECTION,
info: i18n.rootVars.$today,
},
{
label: '$nodeVersion',
section: METADATA_SECTION,
info: i18n.rootVars.$nodeVersion,
},
{
label: '$vars',
section: METADATA_SECTION,
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/plugins/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ export class I18nClass {
$min: this.baseText('codeNodeEditor.completer.$min'),
$runIndex: this.baseText('codeNodeEditor.completer.$runIndex'),
$today: this.baseText('codeNodeEditor.completer.$today'),
$nodeVersion: this.baseText('codeNodeEditor.completer.$nodeVersion'),
$vars: this.baseText('codeNodeEditor.completer.$vars'),
$workflow: this.baseText('codeNodeEditor.completer.$workflow'),
DateTime: this.baseText('codeNodeEditor.completer.dateTime'),
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"codeNodeEditor.completer.$prevNode.runIndex": "The run of the node providing input data to the current one",
"codeNodeEditor.completer.$runIndex": "The index of the current run of this node",
"codeNodeEditor.completer.$today": "A timestamp representing the current day (at midnight, as a Luxon object)",
"codeNodeEditor.completer.$nodeVersion": "The type version of the current node",
"codeNodeEditor.completer.$vars": "The variables defined in your instance",
"codeNodeEditor.completer.$vars.varName": "Variable set on this n8n instance. All variables evaluate to strings.",
"codeNodeEditor.completer.$secrets": "The external secrets connected to your instance",
Expand Down
2 changes: 2 additions & 0 deletions packages/workflow/src/WorkflowDataProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ export class WorkflowDataProxy {
// Before resolving the pairedItem make sure that the requested node comes in the
// graph before the current one
const activeNode = that.workflow.getNode(that.activeNodeName);

let contextNode = that.contextNodeName;
if (activeNode) {
const parentMainInputNode = that.workflow.getParentMainInputNode(activeNode);
Expand Down Expand Up @@ -1281,6 +1282,7 @@ export class WorkflowDataProxy {
$thisItem: that.connectionInputData[that.itemIndex],
$thisItemIndex: this.itemIndex,
$thisRunIndex: this.runIndex,
$nodeVersion: that.workflow.getNode(that.activeNodeName)?.typeVersion,
};

return new Proxy(base, {
Expand Down
Loading