Skip to content

Commit 5dbfad3

Browse files
Merge pull request #164 from splunk/release/1.12.1
Release/1.12.1
2 parents cfe7602 + 4acba70 commit 5dbfad3

File tree

13 files changed

+10300
-10163
lines changed

13 files changed

+10300
-10163
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Generate docs
2525
run: |
2626
node sdkdo docs
27-
zip -r docs.zip docs/${{ steps.pkgjson.outputs.packageVersion }}/refs
27+
zip -r docs.zip docs-${{ steps.pkgjson.outputs.packageVersion }}
2828
2929
- name: Upload Artifact
3030
uses: actions/upload-artifact@v3

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Splunk Enterprise SDK for JavaScript Changelog
22

3+
## v1.12.1
4+
5+
### Minor changes
6+
* Special handling related to the semantic versioning of specific Search APIs functional in Splunk Enterprise 9.0.2 and (Splunk Cloud 9.0.2209). These SDK changes will enable seamless transition between the APIs based on the version of the Splunk Enterprise in use ([PR#163](https://github.com/splunk/splunk-sdk-javascript/pull/163))
7+
* added checks for wildcards in StoragePasswords ([PR#156](https://github.com/splunk/splunk-sdk-javascript/pull/156))
8+
* Update release docs path in release.yml ([PR#161](https://github.com/splunk/splunk-sdk-javascript/pull/161))
9+
310
## v1.12.0
411

512
### New features and APIs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build Status](https://travis-ci.org/splunk/splunk-sdk-javascript.svg?branch=master)](https://travis-ci.org/splunk/splunk-sdk-javascript)
22
# The Splunk Enterprise Software Development Kit for JavaScript
33

4-
#### Version 1.12.0
4+
#### Version 1.12.1
55

66
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.
77

client/splunk.js

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ var __exportName = 'splunkjs';
683683
this.version = params.version || "default";
684684
this.timeout = params.timeout || 0;
685685
this.autologin = true;
686+
this.instanceType = "";
686687

687688
// Initialize autologin
688689
// The reason we explicitly check to see if 'autologin'
@@ -717,16 +718,17 @@ var __exportName = 'splunkjs';
717718

718719
// We perform the bindings so that every function works
719720
// properly when it is passed as a callback.
720-
this._headers = utils.bind(this, this._headers);
721-
this.fullpath = utils.bind(this, this.fullpath);
722-
this.urlify = utils.bind(this, this.urlify);
723-
this.get = utils.bind(this, this.get);
724-
this.del = utils.bind(this, this.del);
725-
this.post = utils.bind(this, this.post);
726-
this.login = utils.bind(this, this.login);
727-
this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
728-
this._requestWrapper = utils.bind(this, this._requestWrapper);
729-
this.getVersion = utils.bind(this, this.getVersion);
721+
this._headers = utils.bind(this, this._headers);
722+
this.fullpath = utils.bind(this, this.fullpath);
723+
this.urlify = utils.bind(this, this.urlify);
724+
this.get = utils.bind(this, this.get);
725+
this.del = utils.bind(this, this.del);
726+
this.post = utils.bind(this, this.post);
727+
this.login = utils.bind(this, this.login);
728+
this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
729+
this._requestWrapper = utils.bind(this, this._requestWrapper);
730+
this.getInfo = utils.bind(this, this.getInfo);
731+
this.disableV2SearchApi = utils.bind(this, this.disableV2SearchApi);
730732
},
731733

732734
/**
@@ -897,19 +899,21 @@ var __exportName = 'splunkjs';
897899
* @method splunkjs.Context
898900
* @private
899901
*/
900-
getVersion: function (callback) {
902+
getInfo: function (callback) {
901903
var that = this;
902904
var url = this.paths.info;
903905

904906
callback = callback || function() {};
905907

906908
var wrappedCallback = function(err, response) {
907909
var hasVersion = !!(!err && response.data && response.data.generator.version);
910+
let hasInstanceType = !!(!err && response.data && response.data.generator["instance_type"]);
908911

909912
if (err || !hasVersion) {
910913
callback(err || "No version found", false);
911914
}
912915
else {
916+
that.instanceType = hasInstanceType ? response.data.generator["instance_type"] : "";
913917
that.version = response.data.generator.version;
914918
that.http.version = that.version;
915919
callback(null, true);
@@ -954,7 +958,7 @@ var __exportName = 'splunkjs';
954958
}
955959
else {
956960
that.sessionKey = response.data.sessionKey;
957-
that.getVersion(callback);
961+
that.getInfo(callback);
958962
}
959963
};
960964
return this.http.post(
@@ -1131,6 +1135,16 @@ var __exportName = 'splunkjs';
11311135
}
11321136
}
11331137
return 0;
1138+
},
1139+
1140+
disableV2SearchApi: function(){
1141+
let val;
1142+
if(this.instanceType.toLowerCase() == "cloud"){
1143+
val = this.versionCompare("9.0.2209");
1144+
}else{
1145+
val = this.versionCompare("9.0.2")
1146+
}
1147+
return val < 0;
11341148
}
11351149
});
11361150

@@ -2910,7 +2924,7 @@ var __exportName = 'splunkjs';
29102924
params.q = query;
29112925

29122926
// Pre-9.0 uses GET and v1 endpoint
2913-
if (this.versionCompare("9.0") < 0) {
2927+
if (this.disableV2SearchApi()) {
29142928
return this.get(Paths.parser, params, function(err, response) {
29152929
if (err) {
29162930
callback(err);
@@ -4433,6 +4447,12 @@ var __exportName = 'splunkjs';
44334447
*/
44344448
init: function(service, namespace) {
44354449
this._super(service, this.path(), namespace);
4450+
},
4451+
create: function(params, callback){
4452+
if(this.service.app == '-' || this.service.owner == '-'){
4453+
throw new Error("While creating StoragePasswords, namespace cannot have wildcards.");
4454+
}
4455+
this._super(params,callback);
44364456
}
44374457
});
44384458

@@ -5688,7 +5708,7 @@ var __exportName = 'splunkjs';
56885708
*/
56895709
path: function () {
56905710
// Pre-9.0 uses v1 endpoint
5691-
if (this.versionCompare("9.0") < 0) {
5711+
if (this.disableV2SearchApi()) {
56925712
return Paths.jobs + "/" + encodeURIComponent(this.name);
56935713
}
56945714
// Post-9.0 uses v2 endpoint
@@ -5713,6 +5733,7 @@ var __exportName = 'splunkjs';
57135733
// Passing the service version and versionCompare to this.path() before instantiating splunkjs.Service.Entity.
57145734
this.version = service.version;
57155735
this.versionCompare = service.versionCompare;
5736+
this.disableV2SearchApi = service.disableV2SearchApi;
57165737

57175738
this.name = sid;
57185739
this._super(service, this.path(), namespace);
@@ -5837,7 +5858,7 @@ var __exportName = 'splunkjs';
58375858
var eventsPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/events";
58385859
// Splunk version pre-9.0 doesn't support v2
58395860
// v1(GET), v2(POST)
5840-
if (this.versionCompare("9.0") < 0) {
5861+
if (this.disableV2SearchApi()) {
58415862
eventsPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/events";
58425863
return this.get(eventsPath, params, function(err, response) {
58435864
if (err) {
@@ -5953,7 +5974,7 @@ var __exportName = 'splunkjs';
59535974
var resultsPreviewPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/results_preview";
59545975
// Splunk version pre-9.0 doesn't support v2
59555976
// v1(GET), v2(POST)
5956-
if (this.versionCompare("9.0") < 0) {
5977+
if (this.disableV2SearchApi()) {
59575978
resultsPreviewPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/results_preview";
59585979
return this.get(resultsPreviewPath, params, function(err, response) {
59595980
if (err) {
@@ -6006,7 +6027,7 @@ var __exportName = 'splunkjs';
60066027
var resultsPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/results";
60076028
// Splunk version pre-9.0 doesn't support v2
60086029
// v1(GET), v2(POST)
6009-
if (this.versionCompare("9.0") < 0) {
6030+
if (this.disableV2SearchApi()) {
60106031
resultsPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/results";
60116032
return this.get(resultsPath, params, function(err, response) {
60126033
if (err) {
@@ -6347,7 +6368,7 @@ var __exportName = 'splunkjs';
63476368
*/
63486369
path: function () {
63496370
// Pre-9.0 uses v1 endpoint
6350-
if (this.versionCompare("9.0") < 0) {
6371+
if (this.disableV2SearchApi()) {
63516372
return Paths.jobs;
63526373
}
63536374
// Post-9.0 uses v2 endpoint
@@ -6385,6 +6406,7 @@ var __exportName = 'splunkjs';
63856406
// Passing the service version and versionCompare to this.path() before instantiating splunkjs.Service.Collection.
63866407
this.version = service.version;
63876408
this.versionCompare = service.versionCompare;
6409+
this.disableV2SearchApi = service.disableV2SearchApi;
63886410

63896411
this._super(service, this.path(), namespace);
63906412
// We perform the bindings so that every function works
@@ -29945,7 +29967,7 @@ module.exports={
2994529967
"_args": [
2994629968
[
2994729969
29948-
"/Users/tpavlik/src/enterprise/semantic-versioning/splunk-sdk-javascript"
29970+
"/Users/abhis/Documents/JS/splunk-sdk-javascript"
2994929971
]
2995029972
],
2995129973
"_development": true,
@@ -29971,7 +29993,7 @@ module.exports={
2997129993
],
2997229994
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
2997329995
"_spec": "6.5.4",
29974-
"_where": "/Users/tpavlik/src/enterprise/semantic-versioning/splunk-sdk-javascript",
29996+
"_where": "/Users/abhis/Documents/JS/splunk-sdk-javascript",
2997529997
"author": {
2997629998
"name": "Fedor Indutny",
2997729999
"email": "[email protected]"
@@ -39855,7 +39877,7 @@ module.exports={
3985539877
"_args": [
3985639878
[
3985739879
39858-
"/Users/tpavlik/src/enterprise/semantic-versioning/splunk-sdk-javascript"
39880+
"/Users/abhis/Documents/JS/splunk-sdk-javascript"
3985939881
]
3986039882
],
3986139883
"_from": "[email protected]",
@@ -39879,13 +39901,13 @@ module.exports={
3987939901
],
3988039902
"_resolved": "https://registry.npmjs.org/needle/-/needle-3.0.0.tgz",
3988139903
"_spec": "3.0.0",
39882-
"_where": "/Users/tpavlik/src/enterprise/semantic-versioning/splunk-sdk-javascript",
39904+
"_where": "/Users/abhis/Documents/JS/splunk-sdk-javascript",
3988339905
"author": {
3988439906
"name": "Tomás Pollak",
3988539907
"email": "[email protected]"
3988639908
},
3988739909
"bin": {
39888-
"needle": "bin/needle"
39910+
"needle": "./bin/needle"
3988939911
},
3989039912
"bugs": {
3989139913
"url": "https://github.com/tomas/needle/issues"
@@ -55692,7 +55714,7 @@ function extend() {
5569255714
},{}],259:[function(require,module,exports){
5569355715
module.exports={
5569455716
"name": "splunk-sdk",
55695-
"version": "1.11.0",
55717+
"version": "1.12.1",
5569655718
"description": "SDK for usage with the Splunk REST API",
5569755719
"homepage": "http://dev.splunk.com",
5569855720
"main": "index.js",

client/splunk.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)