mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-11 13:15:28 +03:00
feat(core): Add support for $("NodeName").isExecuted (#8683)
This commit is contained in:
parent
e2f2fc910d
commit
ad82f0c0c8
@ -922,10 +922,6 @@ export class WorkflowDataProxy {
|
||||
throw createExpressionError(`"${nodeName}" node doesn't exist`);
|
||||
}
|
||||
|
||||
if (!that?.runExecutionData?.resultData?.runData.hasOwnProperty(nodeName)) {
|
||||
throw createExpressionError(`no data, execute "${nodeName}" node first`);
|
||||
}
|
||||
|
||||
return new Proxy(
|
||||
{},
|
||||
{
|
||||
@ -933,6 +929,7 @@ export class WorkflowDataProxy {
|
||||
ownKeys() {
|
||||
return [
|
||||
'pairedItem',
|
||||
'isExecuted',
|
||||
'itemMatching',
|
||||
'item',
|
||||
'first',
|
||||
@ -945,6 +942,12 @@ export class WorkflowDataProxy {
|
||||
get(target, property, receiver) {
|
||||
if (property === 'isProxy') return true;
|
||||
|
||||
if (!that?.runExecutionData?.resultData?.runData.hasOwnProperty(nodeName)) {
|
||||
if (property === 'isExecuted') return false;
|
||||
throw createExpressionError(`no data, execute "${nodeName}" node first`);
|
||||
}
|
||||
if (property === 'isExecuted') return true;
|
||||
|
||||
if (['pairedItem', 'itemMatching', 'item'].includes(property as string)) {
|
||||
const pairedItemMethod = (itemIndex?: number) => {
|
||||
if (itemIndex === undefined) {
|
||||
|
@ -294,8 +294,9 @@ describe('WorkflowDataProxy', () => {
|
||||
expect(() => proxy.$('doNotExist')).toThrowError(ExpressionError);
|
||||
});
|
||||
|
||||
test('$("NodeName")', () => {
|
||||
expect(() => proxy.$('Set')).toThrowError(ExpressionError);
|
||||
test('test $("NodeName").isExecuted', () => {
|
||||
expect(proxy.$('Function').isExecuted).toEqual(true);
|
||||
expect(proxy.$('Set').isExecuted).toEqual(false);
|
||||
});
|
||||
|
||||
test('test $input.all()', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user