Migrate from Callbacks (v1.x) to Promises/async-await (v2.x)
developIn version 2.x, Splunk Enterprise SDK for JavaScript methods have been updated to return Promises. This allows you to use async/await instead of passing callback functions.
Important Change: The abort() method has been replaced by the response_timeout parameter, which allows you to specify a timeout for a particular API call.
// v2.x Promise/async-await approach
let appName = "<app-name>";
try {
let apps = await service.apps().fetch();
let appList = apps.list();
// other code
} catch (err) {
console.log("There was an error retrieving the list of applications:", err);
}