In the following code, when calling _.get(json, 'params', json), the params node is no longer found since we've now flattened the task JSON, however the third parameter json is the object that is passed into the toCode function and so the delete params['op'] call is actually mutating the object that was passed into this function, which actually propagates all the way back to an object that was passed into the JS SDK from outside code.
This is happening in the following places (that I could see):
Connect
|
connect.toCode = function(json, Flexio) { |
|
var params = _.get(json, 'params', json) |
|
delete params['op'] |
|
return 'connect(' + JSON.stringify(params) + ')' |
|
} |
Email
|
email.toCode = function(json, Flexio) { |
|
var params = _.get(json, 'params', json) |
|
delete params['op'] |
|
return 'email(' + JSON.stringify(params, null, 2) + ')' |
|
} |
Transform
|
transform.toCode = function(json, Flexio) { |
|
var params = _.get(json, 'params', json) |
|
delete params['op'] |
|
if (!_.has(params,'columns') && _.has(params, 'operations') && Array.isArray(params.operations) && params.operations.length == 1) { |
|
return "transform(" + JSON.stringify(params.operations[0]) + ")" |
|
} else { |
|
return "transform(" + JSON.stringify(params) + ")" |
|
} |
|
} |
In the following code, when calling
_.get(json, 'params', json), theparamsnode is no longer found since we've now flattened the task JSON, however the third parameterjsonis the object that is passed into thetoCodefunction and so thedelete params['op']call is actually mutating the object that was passed into this function, which actually propagates all the way back to an object that was passed into the JS SDK from outside code.This is happening in the following places (that I could see):
Connect
flexio-sdk-js/src/task/connect.js
Lines 7 to 11 in 475e3dd
Email
flexio-sdk-js/src/task/email.js
Lines 20 to 24 in 475e3dd
Transform
flexio-sdk-js/src/task/transform.js
Lines 38 to 46 in 475e3dd