(feat) add $ROOT variable in the shift operation to perform root payload shifting
Signed-off-by: Noah Kreiger [email protected]
This change would support a variable $ROOT in the shift operation to move everything in the root payload under that key, it maintains backwards comp...and makes logical sense, aka, if you add a variable before you shift the root, it will shift with that variable, if you store a variable after the shift, you need to specify the path taking into account the shift...etc
Examples:
context:
- operation: store
paths:
- key: $id
value: id
data:
- operation: store
paths:
- key: $tstore
value: test
- operation: add
paths:
- key: context.transaction
value: $id
- key: shifted.test
value: noah
- key: noah
value: $tstore
- operation: shift
paths:
- key: $ROOT:data
input ->
{
"test": "teststore",
"Shifter": {
"some": "values"
}
}
outputs from tsf ->
{
"data": {
"Shifter": {
"some": "values"
},
"context": {
"transaction": "say-hello"
},
"noah": "teststore",
"shifted": {
"test": "noah"
},
"test": "teststore"
}
}
I didn't abstract the code as much as it could've been, because I couldn't think of another use case, so I thought I would keep it simple :)
Also... I dont think you are in our community slack -> https://join.slack.com/t/triggermesh-community/shared_invite/zt-1e0wvv0ud-CoM_73OBunIDoYR29eMo8A @nkreiger jump in so I can bug you! 😁
pre-approving, before test fixes.
@JeffNeff it looks like the linting failed on a code file unrelated to my chagne, would you like me to resolve this as well?
@nkreiger Thanks for the PR. Before I review the code, does this change somehow correlate with this https://github.com/triggermesh/triggermesh/pull/1049 ?
@nkreiger Thanks for the PR. Before I review the code, does this change somehow correlate with this #1049 ?
@tzununbekov yes lol, exactly, I guess I should've looked at open PRs/Issues first but it was a quick thing so I didn't my bad...I can close this PR