General Option for all modules: Bundle input & results in output

The idea is:

There are a lot of modules where you “lose” the input that generated the outputs. HTTP and Database query modules are a great example. For every item that comes in you can generate zero to many items of output. Often you need both the input and the output downstream, but it can be be very difficult to link them back up because the output rarely contains all of the criteria in the input.

Merge “by position” helps a little. But not when one input item generates 0 or many output items. And not when you handle errors in a separate error output.

My use case:

On the settings page that’s common to all modules, add an option to “bundle input and output”.

When this option is set, every input item will generate exactly one output item containing two fields named “input” and “result”. The input field will contain the entire input item as an object. The result item will contain the entire output as an array.

It might be helpful to add an optional text field allowing the developer to prepend a string to those fields, so the output fields end up named “query1_input” and “query1_output”.

I think it would be beneficial to add this because:

This would greatly reduce all of the hoops we jump through to link inputs and outputs in modules. All of those merges and edit modules will go away.

Any resources to support this?

This will be pretty obvious to anyone who uses N8N regularly.

Are you willing to work on this?

Nobody wants that, especially with something so core to the architecture.

In this example, Facebook’s Graph API has different edges (endpoints) for insights and comments. But I’m storing those metrics in the same row of a table, which is keyed on the post id and the timestamp when the metrics were gathered. So the timestamp needs to be “carried downstream”. The post id also needs to be carried along, but Facebook annoyingly doesn’t include it in their output for the comments edge.

The flow required to handle that plus handle errors is a mess. If I could just carry the input along on the other side of the HTTP modules, I wouln’t need the merge by position or IF modules afterwards. I would just direct the error outputs to the error logger, and then continue processing the data.

Lee