I'm using UiPath Orchestrator. This runs as expected. But I now additionally want to reduce the authentication to a single call (instead of always do an auth when requesting an odata
). So my idea was to write the object to a file and on the odata
request read that object and re-use it.
The following orchestrator
object comes from the constructor of new Orchestrator
. This object is ready to be used and has the following structure (via console.log(orchestrator)
):
In my tool I need the object functions of odata
. So this works:
console.log(orchestrator['v2']['odata']);
I now want to save that object as file to be able to re-use it, so I did:
fs.writeFileSync('./data.json', orchestrator, 'utf-8')
But sadly I get the error:
Converting circular structure to JSON
That is intended as the node package is using a circulare structure. So my idea was to use the circular-json
package to fix that issue:
const {parse, stringify} = require('circular-json');
...
var savetofile = stringify(orchestrator);
...
var readfromfile = parse(savetofile);
...
console.log(readfromfile['v2']['odata']);
But sadly than readfromfile['v2']['odata']
is not available anymore. The reason is that stringify(orchestrator)
is already minifying too heavy:
So how I achieve that I am able to read the Orchestrator object from the file and being able to use the functions again? Or is it more useful to use a memory tool in my case?