mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Introduce proxy completions to expressions (#5075)
* ⚡ Introduce proxy completions to expressions * 🧪 Add tests * ⚡ Replace snippet with alphabetic char completions * ⚡ Tighten `DateTime` check * 🧹 Clean up `n8nLang` * 🔥 Remove duplicate * 👕 Remove non-null assertion * ⚡ Confirm that `overlay` is needed * 🔥 Remove comment * 🔥 Remove more unneeded code * 🔥 Remove unneded Pinia setup * ⚡ Simplify syntax
This commit is contained in:
@@ -255,7 +255,7 @@ export class Expression {
|
||||
const returnValue = this.renderExpression(parameterValue, data);
|
||||
if (typeof returnValue === 'function') {
|
||||
if (returnValue.name === '$') throw new Error('invalid syntax');
|
||||
throw new Error(`${returnValue.name} is a function. Please add ()`);
|
||||
throw new Error('This is a function. Please add ()');
|
||||
} else if (typeof returnValue === 'string') {
|
||||
return returnValue;
|
||||
} else if (returnValue !== null && typeof returnValue === 'object') {
|
||||
|
||||
@@ -130,7 +130,7 @@ export class WorkflowDataProxy {
|
||||
return {}; // incoming connection has pinned data, so stub context object
|
||||
}
|
||||
|
||||
if (!that.runExecutionData?.executionData) {
|
||||
if (!that.runExecutionData?.executionData && !that.runExecutionData?.resultData) {
|
||||
throw new ExpressionError(
|
||||
"The workflow hasn't been executed yet, so you can't reference any context data",
|
||||
{
|
||||
@@ -931,6 +931,18 @@ export class WorkflowDataProxy {
|
||||
return new Proxy(
|
||||
{},
|
||||
{
|
||||
ownKeys(target) {
|
||||
return [
|
||||
'pairedItem',
|
||||
'itemMatching',
|
||||
'item',
|
||||
'first',
|
||||
'last',
|
||||
'all',
|
||||
'context',
|
||||
'params',
|
||||
];
|
||||
},
|
||||
get(target, property, receiver) {
|
||||
if (['pairedItem', 'itemMatching', 'item'].includes(property as string)) {
|
||||
const pairedItemMethod = (itemIndex?: number) => {
|
||||
|
||||
Reference in New Issue
Block a user