Skip to content

Release/1.12.0 #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 78 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c88d556
Testing JS github action package json module
bparmar-splunk Mar 11, 2022
4e1701b
List command & action module removed
bparmar-splunk Mar 11, 2022
804d859
Node v8 removed
bparmar-splunk Mar 11, 2022
d3c4b36
Mustache dependency added
bparmar-splunk Mar 11, 2022
fa5bfe4
Dependency and method of mustache js changed
bparmar-splunk Mar 14, 2022
5efe5c1
Test workflow modified
bparmar-splunk Mar 14, 2022
9156109
Sequence of test workflow changed
bparmar-splunk Mar 14, 2022
a4b8414
Docs generation and zipping added
bparmar-splunk Mar 14, 2022
2d55d5b
Github workflow files modified
bparmar-splunk Mar 14, 2022
c2b4303
Node v8 enabled on Test yml file
bparmar-splunk Mar 14, 2022
5152fff
Merge pull request #148 from splunk/DVPL-10799
bparmar-splunk Mar 16, 2022
2c0ecb2
Update cli.js
ashah-splunk Apr 8, 2022
6a011cd
removed examples directory
akaila-splunk Apr 11, 2022
2c68efd
Added cmdline.js file for test cases and removed examples test cases
akaila-splunk Apr 11, 2022
7fd6d92
Updated README.md file and removed examples references
akaila-splunk Apr 11, 2022
5955e37
updated compiled files
ashah-splunk Apr 13, 2022
b8f07e2
[DVPL-10898] Remove node_modules from repo
Mar 31, 2022
0db108d
Merge pull request #150 from splunk/master
ashah-splunk Apr 18, 2022
8debed5
Added 'User-Agent' header for the REST API calls
akaila-splunk Apr 19, 2022
01fc45f
node module changes
ashah-splunk Apr 21, 2022
d1c858f
node modules
ashah-splunk Apr 22, 2022
814838b
node modules
ashah-splunk Apr 22, 2022
303dee6
Update package-lock.json
ashah-splunk Apr 25, 2022
ff0ade6
Update package-lock.json
ashah-splunk Apr 25, 2022
ed024d3
node modules
ashah-splunk Apr 25, 2022
fabce0f
node modules
ashah-splunk Apr 25, 2022
9941ca8
node modules
ashah-splunk Apr 25, 2022
3beadf1
removed lib/modularinputs directory
akaila-splunk Apr 26, 2022
35b4780
removed modularinputs test cases
akaila-splunk Apr 26, 2022
dfb0d8d
Updated README.md file and removed modularinputs references
akaila-splunk Apr 26, 2022
4d17a09
Revert "node modules"
ashah-splunk Apr 27, 2022
e6dce4e
Revert "node modules"
ashah-splunk Apr 27, 2022
a6a7553
Revert "node modules"
ashah-splunk Apr 27, 2022
09c63fd
Revert "Update package-lock.json"
ashah-splunk Apr 27, 2022
08627a4
Revert "Update package-lock.json"
ashah-splunk Apr 27, 2022
1d8966d
Revert "node modules"
ashah-splunk Apr 27, 2022
29342c5
Revert "node modules"
ashah-splunk Apr 27, 2022
8742819
Revert "node module changes"
ashah-splunk Apr 27, 2022
b4160fd
Update README.md
ashah-splunk Apr 27, 2022
590b01a
Added "Splunk-Client" as the new header
ashah-splunk Apr 28, 2022
7202fec
Merge pull request #149 from splunk/compile-fix
ashah-splunk Apr 29, 2022
793a971
Merge branch 'develop' into DVPL-10513
ashah-splunk Apr 29, 2022
7a51d09
compiled files updated with user agent change
ashah-splunk Apr 29, 2022
9323b02
Merge pull request #151 from splunk/DVPL-10513
ashah-splunk Apr 29, 2022
7c34147
Merge branch 'develop' into DVPL-10779
akaila-splunk Apr 29, 2022
cbbacd2
Update cli.js
akaila-splunk Apr 29, 2022
b2f8000
Updated a compiled files
akaila-splunk Apr 29, 2022
7b05a22
[DVPL-10898] Re-implement getting Version and new unit test
Apr 29, 2022
7f3d2b2
added assets directory for the docs
akaila-splunk May 2, 2022
62978bc
Merge pull request #152 from splunk/DVPL-10779
ashah-splunk May 13, 2022
c697c63
Merge branch 'develop' into DVPL-11009
ashah-splunk May 13, 2022
37a1dc0
compiled files updated
ashah-splunk May 13, 2022
56dd574
changed assets path
ashah-splunk May 13, 2022
e25facc
static assets directory
ashah-splunk May 13, 2022
e5313f7
Update cli.js
ashah-splunk May 13, 2022
82fe596
Merge branch 'develop' into DVPL-11058
ashah-splunk May 13, 2022
ab48fa9
Update cli.js
ashah-splunk May 13, 2022
87e7cd2
Merge pull request #153 from splunk/DVPL-11009
ashah-splunk May 19, 2022
52e4472
Merge pull request #154 from splunk/DVPL-11058
ashah-splunk May 19, 2022
7e752b8
Search API jobs v2 (/results_preview, /results, /events) allows searc…
Jun 7, 2022
2201f4a
Update test job - post processing with search params
Jun 8, 2022
933bd3f
added create method for StoragePasswords
akaila-splunk Jun 13, 2022
37cb4ec
Revert "added create method for StoragePasswords"
akaila-splunk Jun 13, 2022
7736bb9
Take changes from develop
fantavlik Jun 13, 2022
3ad4307
Merge commit '37cb4ecb2bf433c3d217f9bc230a6cb26a69655a' into DVPL-108…
fantavlik Jun 13, 2022
986a367
Regenerate front-end files
fantavlik Jun 13, 2022
7aaba04
Revert node_modules removal for now
fantavlik Jun 13, 2022
fbc802e
Add back node_modules for now
fantavlik Jun 13, 2022
5d78a2a
Add back missing node_modules
fantavlik Jun 13, 2022
5ef4bb2
Take package-lock from develop
fantavlik Jun 13, 2022
a5e528e
Restore missing node_modules files
fantavlik Jun 13, 2022
70e57f5
Revert some testing changes from b8f07e2d
fantavlik Jun 15, 2022
1706753
Undo cmdline change related to examples removal
fantavlik Jun 15, 2022
8fbd62e
Update generated test files
fantavlik Jun 15, 2022
c4ac350
Update generated client files
fantavlik Jun 15, 2022
5f1df1d
Update test matrix to test 8.2 and latest (currently 9.0) and update …
fantavlik Jun 16, 2022
721a9ff
Merge pull request #157 from splunk/DVPL-10898-develop
fantavlik Jun 16, 2022
f32fb4e
release 1.12.0 version changes
akaila-splunk Jun 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Create Release
on:
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
Expand All @@ -16,3 +16,18 @@ jobs:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Package JSON Info
uses: myrotvorets/[email protected]
id: pkgjson

- name: Generate docs
run: |
node sdkdo docs
zip -r docs.zip docs/${{ steps.pkgjson.outputs.packageVersion }}/refs

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: apidocs
path: docs.zip
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- 14
- 8.17.0
splunk-version:
- "8.0"
- "8.2"
- "latest"

services:
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*build/
build/
.git
tests/html/*
*.out
Expand All @@ -17,4 +17,5 @@ cover_html
.splunkrc
*.zip
test_logs/*
docs/
docs/
.nyc_output/*
6 changes: 0 additions & 6 deletions .jshintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ node_modules
build
client
external
examples/browser/create-react-app
examples/browser/minisplunk
examples/browser/resources
examples\\browser\\create-react-app
examples\\browser\\minisplunk
examples\\browser\\resources
old_english
new_english
xml2json
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Splunk Enterprise SDK for JavaScript Changelog

## v1.12.0

### New features and APIs
* SDK Support for splunkd search API changes, for Splunk 9.0+. ([PR#157](https://github.com/splunk/splunk-sdk-javascript/pull/157))

### Minor changes
* Added assets directory to be included while generating docs ([PR#154](https://github.com/splunk/splunk-sdk-javascript/pull/154))
* Removed support for Modular Inputs from the SDK ([PR#153](https://github.com/splunk/splunk-sdk-javascript/pull/153))
* Removed examples and it's references from sdk ([PR#152](https://github.com/splunk/splunk-sdk-javascript/pull/152))
* Added 'User-Agent' header in REST API calls for the telemetry ([PR#151](https://github.com/splunk/splunk-sdk-javascript/pull/151))
* changes corresponding to API changes in the dependency library browserify ([PR#149](https://github.com/splunk/splunk-sdk-javascript/pull/149))
* JS SDK upload artifact script added for api docs ([PR#148](https://github.com/splunk/splunk-sdk-javascript/pull/148))

## v1.11.0

### Major changes
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,21 @@ wait_up:
down:
@echo "$(ATTN_COLOR)==> down $(NO_COLOR)"
@docker-compose stop

.PHONY: deps
deps:
@echo "$(ATTN_COLOR)==> Checking nodes.js dependencies $(NO_COLOR)"
@echo "$(ATTN_COLOR)==> Installing nodes.js 14 $(NO_COLOR)"
@source $(HOME)/.nvm/nvm.sh ; nvm install 14
@echo "$(ATTN_COLOR)==> npm install $(NO_COLOR)"
@npm install

.PHONY: clean
clean:
@echo "$(ATTN_COLOR)==> Cleaning client/ directory $(NO_COLOR)"
@rm -rf client/splunk.*.js >/dev/null 2>&1

.PHONY: build
build: clean deps
@echo "$(OK_COLOR)==> Initiating the build... $(NO_COLOR)"
@source $(HOME)/.nvm/nvm.sh; nvm run 14 sdkdo compile
53 changes: 13 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.org/splunk/splunk-sdk-javascript.svg?branch=master)](https://travis-ci.org/splunk/splunk-sdk-javascript)
# The Splunk Enterprise Software Development Kit for JavaScript

#### Version 1.11.0
#### Version 1.12.0

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.

Expand All @@ -13,9 +13,9 @@ For more information, see [Splunk Enterprise SDK for JavaScript](https://dev.spl

The Splunk Enterprise SDK for JavaScript was tested with Node.js v8.17.0, v14.

* Splunk Enterprise 8.0 or 8.2, or Splunk Cloud
* Splunk Enterprise 9.0 or 8.2, or Splunk Cloud

The Splunk Enterprise SDK for JavaScript was tested with Splunk Enterprise 8.0 or 8.2, or Splunk Cloud.
The Splunk Enterprise SDK for JavaScript was tested with Splunk Enterprise 9.0 or 8.2, or Splunk Cloud.

* Splunk Enterprise SDK for JavaScript

Expand Down Expand Up @@ -124,7 +124,7 @@ var serviceWithSessionKey = new splunkjs.Service(
host: 'localhost',
port: '8089',
sessionKey: SESSION_KEY, // Add your sessionKey here
version: '8',
version: '9.0',
});

serviceWithSessionKey.get("search/jobs", { count: 1 }, function (err, res) {
Expand Down Expand Up @@ -177,14 +177,17 @@ serviceWithBearerToken.get("search/jobs", { count: 2 }, function (err, res) {
});
```

### Modular inputs examples
Support for modular inputs is removed from Splunk Enterprise SDK for JavaScript and we recommand to use [Splunk Enterprise SDK for Python](https://github.com/splunk/splunk-sdk-python) for the modular inputs. See the [Python SDK modular inputs example](https://github.com/splunk/splunk-app-examples/tree/master/modularinputs/python) and [PythonSDK modular inputs docs](https://dev.splunk.com/enterprise/docs/devtools/python/sdk-python/howtousesplunkpython/howtocreatemodpy) for reference.

## SDK examples

The Splunk Enterprise SDK for JavaScript contains several server- and client-based examples.
The Splunk Enterprise SDK for JavaScript contains several server- and client-based examples, which are located in the [Splunk App Example repo](https://github.com/splunk/splunk-app-examples).
For details, see the [Splunk Enterprise SDK for JavaScript Examples](https://dev.splunk.com/enterprise/docs/devtools/javascript/sdk-javascript/sdkjavascriptexamples) on the Splunk Developer Portal.

#### Create a .splunkrc convenience file
## Create a .splunkrc convenience file

To connect to Splunk Enterprise, many of the SDK examples and unit tests take command-line arguments that specify values for the host, port, and login credentials for Splunk Enterprise. For convenience during development, you can store these arguments as key-value pairs in a text file named **.splunkrc**. Then, the SDK examples and unit tests use the values from the **.splunkrc** file when you don't specify them.
To connect to Splunk Enterprise, many of the SDK unit tests take command-line arguments that specify values for the host, port, and login credentials for Splunk Enterprise. For convenience during development, you can store these arguments as key-value pairs in a text file named **.splunkrc**. Then, the SDK unit tests use the values from the **.splunkrc** file when you don't specify them.

>**Note**: Storing login credentials in the **.splunkrc** file is only for convenience during development. This file isn't part of the Splunk platform and shouldn't be used for storing user credentials for production. And, if you're at all concerned about the security of your credentials, enter them at the command line rather than saving them in this file.

Expand All @@ -201,7 +204,7 @@ To use this convenience file, create a text file with the following format:
# Access scheme (default: https)
scheme=https
# Your version of Splunk Enterprise
version=8.2
version=9.0

Save the file as **.splunkrc** in the current user's home directory.

Expand Down Expand Up @@ -246,37 +249,6 @@ function (err) {
});
```

### Client-side examples

The Splunk Enterprise SDK for JavaScript includes several browser-based examples, which you can run from the Examples web page.

To start a simple web server and open the Examples page in a web browser, enter:

node sdkdo examples

### Node.js examples

The Splunk Enterprise SDK for JavaScript includes several command-line examples, which are located in the **/splunk-sdk-javascript/examples/node** directory. These examples run with Node.js and use the command-line arguments from the **.splunkrc** file, if you set this up with your login credentials.

For example, to run the **jobs.js** example, open a command prompt in the **/splunk-sdk-javascript/examples/node** directory and enter:

node jobs.js list

If you aren't storing your login credentials in **.splunkrc**, enter the following command, providing your own values:

node jobs.js --username yourusername --password yourpassword list

Your output should look something like this:

~\splunk-sdk-javascript\examples\node> node .\jobs.js list
Job 1 sid: scheduler__nobody__search_VG9wIGZpdmUgc291cmNldHlwZXM_at_1323917700_79740ae7e22350d6
Job 2 sid: scheduler__nobody__search_VG9wIGZpdmUgc291cmNldHlwZXM_at_1323917400_0dceb302931a2b3f
Job 3 sid: scheduler__nobody__search_SW5kZXhpbmcgd29ya2xvYWQ_at_1323917100_48fb4cc65a25c5b1
Job 4 sid: scheduler__nobody__search_SW5kZXhpbmcgd29ya2xvYWQ_at_1323916200_b2f239fef7834523
Job 5 sid: scheduler__nobody__unix_QWxlcnQgLSBzeXNsb2cgZXJyb3JzIGxhc3QgaG91cg_at_1323914400_96cb9084680b25d7
Job 6 sid: admin__admin__search_TXkgQXdlc29tZSBTYXZlZCBTZWFyY2g_1323901055.6
==============

## Development

The Splunk Enterprise SDK for JavaScript infrastructure relies on Node.js to build files, run examples, run tests, and generate documentation.
Expand All @@ -288,6 +260,7 @@ All development activities are managed by a helper script called `sdkdo`. For a
### Compile the browser files

To rebuild and minify the browser files, open a command prompt in the **splunk-sdk-javascript** directory and enter:
Note:- If any TypeError is encountered, please run "npm install" before running the below command.

node sdkdo compile

Expand Down Expand Up @@ -335,7 +308,6 @@ To get more info to run tests, enter:
| /client | Pre-built files for the browser |
| /contrib | Packaged third-party dependencies (such as test runners) |
| /docs | API reference documentation |
| /examples | Examples |
| /lib | The SDK code files |
| /licenses | License information for packaged third-party dependencies |
| /node_modules | JavaScript modules used by Node.js |
Expand All @@ -360,6 +332,7 @@ To learn about our branching model, see [Branching Model](https://github.com/spl
| [REST API Reference Manual](https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTprolog) | Splunk REST API reference documentation |
| [Splunk>Docs](https://docs.splunk.com/Documentation) | General documentation for the Splunk platform |
| [GitHub Wiki](https://github.com/splunk/splunk-sdk-javascript/wiki/) | Documentation for this SDK's repository on GitHub |
| [Splunk JavaScript SDK Examples](https://github.com/splunk/splunk-app-examples) | server- and client-based examples for the Splunk JavaScript SDK |


## Community
Expand Down
91 changes: 33 additions & 58 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* Constants
*/
var DEFAULT_PORT = 6969;
var DOC_DIRECTORY = "docs";
var REFDOC_DIRECTORY = "refs";
var CLIENT_DIRECTORY = "client";
var TEST_DIRECTORY = "tests";
Expand All @@ -44,6 +43,10 @@
var DOC_FILE = "index.html";
var BUILD_CACHE_FILE = ".buildcache";
var SDK_VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json")).toString("utf-8")).version;
var DOC_DIRECTORY = "docs-" + SDK_VERSION;
var DOC_ASSETS_DIRECTORY = "assets";
var DOC_DIRECTORY_ASSETS = path.join("bin/docs", DOC_ASSETS_DIRECTORY);
var GENERATED_DOC_ASSETS = path.join(DOC_DIRECTORY, DOC_ASSETS_DIRECTORY);
var IGNORED_MODULES = [
"../contrib/nodeunit/test_reporter",
"../contrib/nodeunit/junit_reporter",
Expand Down Expand Up @@ -103,7 +106,8 @@
headers: {
"Content-Length": req.headers["content-length"] || 0,
"Content-Type": req.headers["content-type"] || '',
"Authorization": req.headers["authorization"] || ''
"Authorization": req.headers["authorization"] || '',
"User-Agent": "splunk-sdk-javascript/" + SDK_VERSION
},
followAllRedirects: true,
body: body || '',
Expand Down Expand Up @@ -465,38 +469,30 @@
exportName = exportName || "splunkjs";

// Compile/combine all the files into the package
var bundle = browserify({
entry: entry,
ignore: IGNORED_MODULES,
cache: BUILD_CACHE_FILE,
filter: function (code) {
if (shouldUglify) {
var uglifyjs = require("uglify-js"),
parser = uglifyjs.parser,
uglify = uglifyjs.uglify;

var ast = parser.parse(code);
ast = uglify.ast_mangle(ast);
ast = uglify.ast_squeeze(ast);
code = uglify.gen_code(ast);
}

code = [
"(function() {",
"",
"var __exportName = '" + exportName + "';",
"",
code,
"",
"})();"
].join("\n");
return code;
var bundle = browserify();
bundle.add(entry);
bundle.ignore(IGNORED_MODULES);
bundle.bundle(function (err,src){
var code = [
"(function() {",
"",
"var __exportName = '" + exportName + "';",
"",
src.toString(),
"",
"})();"
].join("\n");
if(err){
throw err;
}
if (shouldUglify){
var UglifyJS = require("uglify-js");
code = UglifyJS.minify({"file1.js":code},{toplevel:true}).code;
}
fs.writeFileSync(path,code);
console.log("Compiled " + path);
});

var js = bundle.bundle();
fs.writeFileSync(path, js);
console.log("Compiled " + path);
};

var outOfDate = function (dependencies, compiled, compiledMin) {
Expand Down Expand Up @@ -615,11 +611,6 @@
launchBrowser("tests/tests.browser.html", port);
};

var launchBrowserExamples = function (port) {
runServer(port);
launchBrowser("examples/browser/index.html", port);
};

var generateDocs = function (callback) {
callback = (callback && utils.isFunction(callback)) ? callback : (function () { });

Expand All @@ -630,15 +621,6 @@
"lib/async.js",
"lib/context.js",
"lib/service.js",
"lib/modularinputs/argument.js",
"lib/modularinputs/event.js",
"lib/modularinputs/eventwriter.js",
"lib/modularinputs/inputdefinition.js",
"lib/modularinputs/logger.js",
"lib/modularinputs/modularinput.js",
"lib/modularinputs/scheme.js",
"lib/modularinputs/utils.js",
"lib/modularinputs/validationdefinition.js"
];

var comments = [];
Expand All @@ -655,11 +637,12 @@
}

ensureDirectoryExists(DOC_DIRECTORY);
ensureDirectoryExists(path.join(DOC_DIRECTORY, SDK_VERSION));
ensureDirectoryExists(path.join(DOC_DIRECTORY, SDK_VERSION, REFDOC_DIRECTORY));

// copy static assets directory
copyDirectoryRecursiveSync(DOC_DIRECTORY_ASSETS, GENERATED_DOC_ASSETS);

for (var name in data) {
var htmlPath = path.join(DOC_DIRECTORY, SDK_VERSION, REFDOC_DIRECTORY, name + ".html");
var htmlPath = path.join(DOC_DIRECTORY, name + ".html");
fs.writeFileSync(htmlPath, data[name]);
}

Expand Down Expand Up @@ -734,10 +717,7 @@

var files = args
.map(arg => {
if (arg.indexOf('modularinputs') >= 0) {
return path.join(TEST_DIRECTORY, 'modularinputs', TEST_PREFIX + arg.split('/')[1] + ".js");
}
else if (arg.indexOf('service_tests') >= 0) {
if (arg.indexOf('service_tests') >= 0) {
return path.join(TEST_DIRECTORY, 'service_tests', arg.split('/')[1] + ".js");
}
else {
Expand Down Expand Up @@ -812,7 +792,7 @@

program
.command('runserver [port]')
.description('Run a local server to serve tests and examples.')
.description('Run a local server to serve tests.')
.action(runServer);

program
Expand Down Expand Up @@ -843,11 +823,6 @@
.description('Launch the browser test suite.')
.action(launchBrowserTests);

program
.command('examples [port]')
.description('Launch the browser examples index page.')
.action(launchBrowserExamples);

program
.command('hint')
.description('Run JSHint on the codebase.')
Expand Down
Loading