You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,18 @@
1
1
# Splunk Enterprise SDK for JavaScript Changelog
2
2
3
+
## v2.0.0
4
+
5
+
### New features and APIs
6
+
* Callbacks have been removed and instead we are returning Promises which enables users to use Async/Await features of JS. ([PR#162](https://github.com/splunk/splunk-sdk-javascript/pull/162))
7
+
* Added 'response_timeout' parameter which enables user to specify the timeout for a particular API call.
8
+
* Removed Async.js file and the required methods have been migrated to Utils.js following the Promise structure.
9
+
10
+
### Minor changes
11
+
* Update doc generation logic in GitHub ci ([PR#167](https://github.com/splunk/splunk-sdk-javascript/pull/167))
* Added feature that allows to update ACL properties of an entity ([PR#170](https://github.com/splunk/splunk-sdk-javascript/pull/170))
14
+
* Support for updated SDK examples ([PR#171](https://github.com/splunk/splunk-sdk-javascript/pull/171))
# The Splunk Enterprise Software Development Kit for JavaScript
3
3
4
-
#### Version 1.12.1
4
+
#### Version 2.0.0
5
5
6
6
The Splunk Enterprise Software Development Kit (SDK) for JavaScript contains library code and examples designed to enable developers to build applications using the Splunk platform and JavaScript. This SDK supports server-side and client-side JavaScript.
7
7
@@ -52,12 +52,44 @@ To use the Splunk Enterprise SDK for JavaScript with your Node.js programs, inst
52
52
53
53
Then, to include the Splunk Enterprise SDK for JavaScript, use the `require` function in your code:
54
54
55
-
var splunkjs = require('splunk-sdk');
55
+
let splunkjs = require('splunk-sdk');
56
56
57
57
## Usage
58
58
59
59
The following examples show you how to list search jobs using client-side and server-side code.
60
60
61
+
### Migrate from Callbacks(v1.x) to Promise/async-await(v2.x)
62
+
63
+
Previous Callback Approach:
64
+
```javascript
65
+
let appName ="<app-name>";
66
+
67
+
service.apps().fetch(function (err, apps) {
68
+
if (err) {
69
+
done(err);
70
+
}
71
+
let appList =apps.list();
72
+
// other code
73
+
done();
74
+
});
75
+
```
76
+
77
+
From v2.x, Splunk Enterprise SDK for JavaScript methods are updated to return Promises, which will enable users to utilize Async/await feature of JS.
78
+
79
+
Promise Approach:
80
+
```javascript
81
+
let appName ="<app-name>";
82
+
try {
83
+
let apps =awaitservice.apps().fetch();
84
+
let appList =apps.list();
85
+
// other code
86
+
} catch (err) {
87
+
console.log("There was an error retrieving the list of applications:", err);
88
+
}
89
+
```
90
+
91
+
>**Note**: `abort()` method has been replaced with 'response_timeout' parameter which enables user to specify the timeout for a particular API call.
92
+
61
93
### Client-side code example
62
94
63
95
This HTML example uses the Splunk Enterprise SDK for JavaScript to list all jobs:
@@ -66,22 +98,18 @@ This HTML example uses the Splunk Enterprise SDK for JavaScript to list all jobs
0 commit comments