Hi,
Node UIM Version 2.0.0 is coming soon. On this new major release a lot of features has been removed around the PU interface (Most of them was useless).
This major release bring/refactor :
- Clean request constructor/handler
- Response with native JavaScript object ( ES6 Map was complicated for nothing ).
- Improved stdout parser.
- Now available with a probes and callbacks list (backed with a TypeScript definition).
const {
ProbeUtility,
callbacks: {
controller,
hub
}
} = require('./index');
process.env.NIM_ROOT = "/opt/nimsoft";
const pu = new ProbeUtility("administrator", "NimSoft!01");
async function main() {
const [{interface}, {robotlist}] = await Promise.all([
pu.exec(controller.get_info({ interfaces: true })),
pu.exec(hub.getrobots())
]);
console.log('\nInterfaces : ');
console.log(interface);
console.log('\n\nRobotslist: ');
for(const robot of robotlist) {
console.log(robot.ip);
}
}
main().catch(console.error);
Depending on the situation, the mechanism is capable to translate boolean value into integer value (a lot of callbacks ask for a 1/0 value).
The base code is ready, however it request a lot of works to retrieve all callbacks from all probes (without making errors).
declare namespace ProbeUtility {
export interface callbacks {
hub: hub_callbacks;
}
interface hub_callbacks {
_restart: () => any;
_status: ({ detail: boolean }) => any;
_stop: () => any;
_suspend: ({ seconds: number }) => any;
getrobots: ({ name: number, detail: boolean }) => any;
}
}
Best Regards,
Thomas