Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0134f9c
Untrack node_modules
Ickerday Jul 21, 2025
5dfd2ed
Remove compiled files from repo
Ickerday Jul 25, 2025
6a00ea9
Lint text files
Ickerday Jul 25, 2025
7e93926
Add optional platform statement for Apple M-series processor
Ickerday Jul 25, 2025
e16734b
Assorted file changes
Ickerday Jul 25, 2025
4f1ec73
Format docker-compose
Ickerday Jul 25, 2025
be324de
Reorganize package.json, start adding scripts found in other files
Ickerday Jul 28, 2025
06cb571
Merge branch 'develop' into dev/BJ/DVPL-12470-repo-cleanup
Ickerday Jul 28, 2025
2021cd8
Recreate lockfile with v1
Ickerday Jul 28, 2025
94f4bf7
Pin external GH Actions to specific commits
Ickerday Aug 5, 2025
98960bc
Remove engine-strict for now
Ickerday Aug 8, 2025
651fbe1
Remove .env, add it to gitignore
Ickerday Aug 8, 2025
c2cfd1e
Reorganize .splunkrc template
Ickerday Aug 8, 2025
9d17bf7
Update docker-compose.yml for Splunk 10
Ickerday Aug 8, 2025
63ba5eb
package-lock.json
Ickerday Aug 8, 2025
5be6208
Add matrix to release.yml to ease future configuration
Ickerday Aug 8, 2025
db40157
Change workflow names
Ickerday Aug 8, 2025
08bc715
Update CI triggers
Ickerday Aug 8, 2025
e575cc5
Remove code-workspace
Ickerday Aug 8, 2025
16d29dd
Fix CI
Ickerday Aug 8, 2025
acab1f8
Try restoring CI setup to previous matrix
Ickerday Aug 8, 2025
bc76a8f
Disable fail-fast in CI
Ickerday Aug 8, 2025
d97615f
Bump deps excluding those that need higher node versions etc.
Ickerday Aug 11, 2025
05c904b
Try udpating NPM as per https://github.com/npm/cli/pull/8429
Ickerday Aug 11, 2025
a80c597
Disable fail-fast, update NPM only if on latest Node.js
Ickerday Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .env

This file was deleted.

16 changes: 16 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SPLUNK_HOME="/opt/splunk"

# Your version of Splunk (default: latest)
version=latest

# Access scheme (default: https)
scheme=https
# Splunk host (default: localhost)
host=localhost
# Splunk admin port (default: 8089)
port=8089

# Splunk username
username=admin
# Splunk password
password=changed!
58 changes: 58 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Splunk Enterprise SDK for JavaScript - AI Coding Agent Instructions

This document provides guidance for AI coding agents working on the Splunk Enterprise SDK for JavaScript.

## Architecture Overview

The SDK is designed to be used in both Node.js and browser environments.

- **Core Logic (`lib/`)**: The main SDK logic resides in the `lib/` directory.
- `lib/context.js`: Manages the connection and authentication with the Splunk server.
- `lib/service.js`: Provides a high-level API for interacting with Splunk services and endpoints. This is the primary interface for most operations.
- `lib/http.js`: A low-level HTTP client for making requests to the Splunk REST API.
- `lib/utils.js`: Contains utility functions used throughout the SDK.

- **Platform-Specific Implementations (`lib/platform/`)**:
- `lib/platform/node/`: Contains Node.js-specific code.
- `lib/platform/client/`: Contains browser-specific code.

- **Entry Points (`lib/entries/`)**: These files are used by Browserify to create bundles for different environments.
- `browser.entry.js`: The main entry point for the browser bundle.

- **UI Components (`lib/ui/`)**: Reusable UI components.
- `charting.js`: For creating charts.
- `timeline.js`: For creating timelines.

## Developer Workflow

- **Installation**: To install dependencies, run:

```bash
npm install
```

- **Testing**: To run the test suite, use:

```bash
npm test
```

This command executes the tests located in the `tests/` directory using Mocha. The test configuration is in `package.json`.

- **Building**: The project uses a `Makefile` for build tasks. The primary build process uses `browserify` to create browser-compatible bundles from the entry points in `lib/entries/`.

## Key Conventions and Patterns

- **Asynchronous Operations**: The SDK uses Promises for all asynchronous operations. When adding new functionality, prefer `async/await` over callbacks.

- **Error Handling**: Errors from the API are returned as standard JavaScript `Error` objects in the `catch` block of a Promise chain.

- **Modularity**: The SDK is modular. When adding new features, consider if they can be implemented as separate modules.

## Important Files and Directories

- `package.json`: Defines project metadata, dependencies, and scripts.
- `tests/`: Contains all the tests for the SDK.
- `lib/`: The core of the SDK.
- `examples/`: Contains example usage of the SDK.
- `Makefile`: Contains build scripts.
36 changes: 19 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
name: Create Release
name: Publish release to NPM

on:
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [24.x]
splunk-version: ["latest"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Load current package version to env
run: echo "SDK_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 14
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- run: npm publish
- name: Publish package to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Package JSON Info
uses: myrotvorets/info-from-package-json-action@1.1.0
id: pkgjson

- name: Generate docs
- name: Generate API reference docs
run: node sdkdo docs

- name: Upload Artifact
uses: actions/upload-artifact@v4
- name: Upload API reference docs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: js_sdk_docs
path: docs-${{ steps.pkgjson.outputs.packageVersion }}/
path: docs-${{ env.SDK_VERSION }}/
73 changes: 27 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,41 @@
name: Node.js CI

on: [push, pull_request]
on: [push, workflow_dispatch]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
os: [ubuntu-latest]
node-version:
- 14
- 8.17.0
- latest
splunk-version:
- "8.2"
- "latest"

services:
splunk:
image: splunk/splunk:${{matrix.splunk-version}}
env:
SPLUNK_START_ARGS: --accept-license
SPLUNK_HEC_TOKEN: 11111111-1111-1111-1111-1111111111113
SPLUNK_PASSWORD: changed!
SPLUNK_APPS_URL: https://github.com/splunk/sdk-app-collection/releases/download/v1.1.0/sdkappcollection.tgz
ports:
- 8000:8000
- 8088:8088
- 8089:8089

- 9.4
- latest
steps:
- uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Create .splunkrc file
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up environment variables
run: |
cd ~
echo host=localhost > .splunkrc
echo port=8089 >> .splunkrc
echo username=admin >> .splunkrc
echo password=changed! >> .splunkrc
echo scheme=https >> .splunkrc
echo version=${{ matrix.splunk }} >> .splunkrc

- name: Run npm install
run: npm install

- name: Run make test
run: make test
cp ./.splunkrc.test ./.splunkrc
cp ./.env.test ./.env
- name: Launch Splunk ${{ matrix.splunk-version }}
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
- name: Use node ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: ${{ matrix.node-version }}
- name: Update npm?
if: ${{ matrix.node_version == 'latest' }}
run: npm i -g npm
- name: Install dependencies
run: type -a npm && npm ci
- name: Run test suite
run: node sdkdo tests
env:
SPLUNK_HOME: /opt/splunk
fossa-scan:
uses: splunk/oss-scanning-public/.github/workflows/oss-scan.yml@main
secrets: inherit
# fossa-scan:
# uses: splunk/oss-scanning-public/.github/workflows/oss-scan.yml@main
# secrets: inherit
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
build/
client/
.git
tests/html/*
*.out
*DS_Store
*.sublime-*
*.pyc
.idea/*
npm-debug.log
server.py
*.log
.buildcache
v8.log
cover_html
.coverage_data
.coverage_debug
*.swp
.splunkrc
.env
*.zip
test_logs/*
docs/
.nyc_output/*
/node_modules/*
.nyc_output/
node_modules/
.vscode/
.code-workspace
2 changes: 1 addition & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ lib/ui/timeline
lib\\ui\\charting
lib\\ui\\timeline
.coverage_debug
docs
docs
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fund=false
audit=false
14 changes: 14 additions & 0 deletions .splunkrc.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Your version of Splunk (default: latest)
version=latest

# Access scheme (default: https)
scheme=https
# Splunk host (default: localhost)
host=localhost
# Splunk admin port (default: 8089)
port=8089

# Splunk username
username=admin
# Splunk password
password=changed!
Loading
Loading