-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/n8n-io/n8n into node-1863-…
…input-fields-dragging
- Loading branch information
Showing
136 changed files
with
6,664 additions
and
2,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
"semver": "^7.5.4", | ||
"tslib": "^2.6.2", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.6.2", | ||
"typescript": "^5.7.2", | ||
"vue-tsc": "^2.1.6", | ||
"ws": ">=8.17.1" | ||
}, | ||
|
@@ -89,7 +89,8 @@ | |
"[email protected]": "patches/[email protected]", | ||
"@types/[email protected]": "patches/@[email protected]", | ||
"@types/[email protected]": "patches/@[email protected]", | ||
"@types/[email protected]": "patches/@[email protected]" | ||
"@types/[email protected]": "patches/@[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...ges/@n8n/task-runner/src/data-request/__tests__/data-request-response-reconstruct.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { mock } from 'jest-mock-extended'; | ||
import type { | ||
IExecuteData, | ||
INode, | ||
INodeExecutionData, | ||
ITaskDataConnectionsSource, | ||
} from 'n8n-workflow'; | ||
|
||
import type { DataRequestResponse, InputDataChunkDefinition } from '@/runner-types'; | ||
|
||
import { DataRequestResponseReconstruct } from '../data-request-response-reconstruct'; | ||
|
||
describe('DataRequestResponseReconstruct', () => { | ||
const reconstruct = new DataRequestResponseReconstruct(); | ||
|
||
describe('reconstructConnectionInputItems', () => { | ||
it('should return all input items if no chunk is provided', () => { | ||
const inputData: DataRequestResponse['inputData'] = { | ||
main: [[{ json: { key: 'value' } }]], | ||
}; | ||
|
||
const result = reconstruct.reconstructConnectionInputItems(inputData); | ||
|
||
expect(result).toEqual([{ json: { key: 'value' } }]); | ||
}); | ||
|
||
it('should reconstruct sparse array when chunk is provided', () => { | ||
const inputData: DataRequestResponse['inputData'] = { | ||
main: [[{ json: { key: 'chunked' } }]], | ||
}; | ||
const chunk: InputDataChunkDefinition = { startIndex: 2, count: 1 }; | ||
|
||
const result = reconstruct.reconstructConnectionInputItems(inputData, chunk); | ||
|
||
expect(result).toEqual([undefined, undefined, { json: { key: 'chunked' } }, undefined]); | ||
}); | ||
|
||
it('should handle empty input data gracefully', () => { | ||
const inputData: DataRequestResponse['inputData'] = { main: [[]] }; | ||
const chunk: InputDataChunkDefinition = { startIndex: 1, count: 1 }; | ||
|
||
const result = reconstruct.reconstructConnectionInputItems(inputData, chunk); | ||
|
||
expect(result).toEqual([undefined]); | ||
}); | ||
}); | ||
|
||
describe('reconstructExecuteData', () => { | ||
it('should reconstruct execute data with the provided input items', () => { | ||
const node = mock<INode>(); | ||
const connectionInputSource = mock<ITaskDataConnectionsSource>(); | ||
const response = mock<DataRequestResponse>({ | ||
inputData: { main: [[]] }, | ||
node, | ||
connectionInputSource, | ||
}); | ||
const inputItems: INodeExecutionData[] = [{ json: { key: 'reconstructed' } }]; | ||
|
||
const result = reconstruct.reconstructExecuteData(response, inputItems); | ||
|
||
expect(result).toEqual<IExecuteData>({ | ||
data: { | ||
main: [inputItems], | ||
}, | ||
node: response.node, | ||
source: response.connectionInputSource, | ||
}); | ||
}); | ||
|
||
it('should handle empty input items gracefully', () => { | ||
const node = mock<INode>(); | ||
const connectionInputSource = mock<ITaskDataConnectionsSource>(); | ||
const inputItems: INodeExecutionData[] = []; | ||
const response = mock<DataRequestResponse>({ | ||
inputData: { main: [[{ json: { key: 'value' } }]] }, | ||
node, | ||
connectionInputSource, | ||
}); | ||
|
||
const result = reconstruct.reconstructExecuteData(response, inputItems); | ||
|
||
expect(result).toEqual<IExecuteData>({ | ||
data: { | ||
main: [inputItems], | ||
}, | ||
node: response.node, | ||
source: response.connectionInputSource, | ||
}); | ||
}); | ||
}); | ||
}); |
39 changes: 31 additions & 8 deletions
39
packages/@n8n/task-runner/src/data-request/data-request-response-reconstruct.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.