2.0.0 • Published 3 years ago
@uim/pu v2.0.0
Node Probe Utility
CA UIM - Node.js Probe Utility interface.
This package has been designed to replace
nodeuim.
Getting Started
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @uim/pu
# or
$ yarn add @uim/puUsage example
const { pu, PDS_VOID } = require("@uim/pu");
async function main() {
const nimSoft = pu({
login: "adminitrator",
password: "NimSoft!01",
path: "/opt/nimsoft/bin/pu"
});
const response = await nimSoft("getrobots", [PDS_VOID, PDS_VOID]);
console.log(JSON.stringify(response, null, 4));
}
main().catch(console.error);API
PDS_VOID
Constant variable equal to ''. Use this when you want to enter empty Probe Utility argument (if not entered, the call will timeout).
pu(options: PUOptions): ProbeUtility.Request
Instanciate/Create a new ProbeUtility gateway.
Available options are:
interface PUOptions {
login: string;
password: string;
path: string;
debug?: boolean;
timeout?: number;
}ProbeUtility.Request(fullAddr: string | NimAddr, args?: (string | number)[]): any
Send a new request to Probe Utility. fullAddr can be callback name or the full NimSoft ADDR, ex:
hub/getrobots
domain/hub/robot/hub/getrobotsNimAddr
NimAddr is a class implementation to build NimSoft Addr.
const { NimAddr } = require("@uim/pu");
const DEFAULT_ADDR = new NimAddr("domain/hub/robotname");
const test = new NimAddr("controller/get_info", DEFAULT_ADDR);
console.log(test.toString()); // domain/hub/robotname/controller
console.log(test.callback); // get_infoThe implementation support / and . seperator. Example:
const DEFAULT_ADDR = new NimAddr("domain.hub.robotname");Licence
MIT