0.0.4 • Published 2 years ago

@tonymacdonald/node-red-msg-encapsulation v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

node-red-msg-encapsulation

A pair of simple nodes to wrap an incoming node red message into a property of a new, otherwise empty, message and to, later, unwrap the previously wrapped message. This allows the state carried in the original message to be preserved for later use while still being carried along with the message.

Example

example

Nodes

nodes

wrap-msg

Outputs

outputdescription
wrapped_msg (object)the entire incoming message.

Details

The entire incoming message is wrapped into a property msg.wrapped_msg on a new otherwise empty message which is sent on the output.

unwrap-msg

Inputs

inputdescription
wrapped_msg (object)the original wrapped message object to be unwrapped.
payloadthe payload to be added to the unwrapped message as msg.outer_payload

Output

outputdescription
outer_payloadThe payload of the incoming message
all other propertiesThe properties of the original wrapped message from msg.wrapped_msg on the incoming message.

Details

The previously wrapped message is extracted from the wrapped_msg property of the incoming message, The payload of the incoming message is preserved as a new property outer_payload added to the unwrapped message which is sent to the output.

The outer_payload propterty on the unwrapped message allows the result of the intervening flow to be integrated with the newly unwrapped message.

If there is no wrapped_msg property on the incoming message, a catchable error is raised.

Using the wrap-msg and unwrap-msg nodes around a destructive section of the flow allows for processing on the intervening flow without owerwriting properties of the wrapped message.

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago