From e8500e69371ad4b205d1586c7837120267595c70 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Sun, 13 Mar 2022 11:34:44 +0200 Subject: [PATCH] feat: Add new expression variables and support for luxon * :hammer: scaffolding for and * :hammer: added autocomplete * :hammer: N8N-2961-New-expression-variables * :hammer: added luxon DateTime to expressions and Functions node, replased with , clean up * :hammer: added and , fixed return values * :hammer: added tests for new variables * :hammer: removed unnecessary import * :hammer: return type fix * :hammer: working on review, wip * :hammer: working on review, improved errors, wip * :hammer: fixed disappearing error message box * :hammer: excluded variables from function node, added jmespath setup * :hamer: added $jmsepath to function nodes * :hammer: replacing proxy with data when using jmespath * :hammer: renamed function * :hammer: updated tips to function nodes * :hammer: fixes for errors messages * :hammer: review fixes * :hammer: removed $input and $() from autocomplete * :zap: removed comments * :zap: Remove unused code Co-authored-by: Jan Oberhauser --- package-lock.json | 15 ++ packages/editor-ui/package.json | 2 + .../editor-ui/src/components/CodeEdit.vue | 38 +++- .../src/components/mixins/pushConnection.ts | 1 + .../nodes/Function/Function.node.ts | 4 +- .../nodes/FunctionItem/FunctionItem.node.ts | 4 +- packages/workflow/package.json | 4 + packages/workflow/src/Expression.ts | 8 + packages/workflow/src/Interfaces.ts | 7 + packages/workflow/src/WorkflowDataProxy.ts | 198 ++++++++++++++++- .../workflow/test/WorkflowDataProxy.test.ts | 201 ++++++++++++++++++ 11 files changed, 468 insertions(+), 14 deletions(-) create mode 100644 packages/workflow/test/WorkflowDataProxy.test.ts diff --git a/package-lock.json b/package-lock.json index 43b32b3906..28cc797a5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12581,6 +12581,11 @@ "pretty-format": "^26.0.0" } }, + "@types/jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@types/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-SgFikJaoYjHIkaDi3szBX1PJKR0=" + }, "@types/json-diff": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@types/json-diff/-/json-diff-0.5.2.tgz", @@ -12656,6 +12661,11 @@ "resolved": "https://registry.npmjs.org/@types/lossless-json/-/lossless-json-1.0.1.tgz", "integrity": "sha512-zPE8kmpeL5/6L5gtTQHSOkAW/OSYYNTDRt6/2oEgLO1Zd3Rj5WVDoMloTtLJxQJhZGLGbL4pktKSh3NbzdaWdw==" }, + "@types/luxon": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-2.0.9.tgz", + "integrity": "sha512-ZuzIc7aN+i2ZDMWIiSmMdubR9EMMSTdEzF6R+FckP4p6xdnOYKqknTo/k+xXQvciSXlNGIwA4OPU5X7JIFzYdA==" + }, "@types/mailparser": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/@types/mailparser/-/mailparser-2.7.4.tgz", @@ -32252,6 +32262,11 @@ } } }, + "luxon": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.3.0.tgz", + "integrity": "sha512-gv6jZCV+gGIrVKhO90yrsn8qXPKD8HYZJtrUDSfEbow8Tkw84T9OnCyJhWvnJIaIF/tBuiAjZuQHUt1LddX2mg==" + }, "macos-release": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.5.0.tgz", diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 9ac551f79a..ec2be8f0ea 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -26,6 +26,7 @@ }, "dependencies": { "@fontsource/open-sans": "^4.5.0", + "luxon": "^2.3.0", "n8n-design-system": "~0.13.0", "monaco-editor": "^0.29.1", "timeago.js": "^4.0.2", @@ -45,6 +46,7 @@ "@types/lodash.camelcase": "^4.3.6", "@types/lodash.get": "^4.4.6", "@types/lodash.set": "^4.3.6", + "@types/luxon": "^2.0.9", "@types/node": "14.17.27", "@types/quill": "^2.0.1", "@types/uuid": "^8.3.2", diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index 0478ddae7d..59461a3c78 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -15,6 +15,7 @@