diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 9cb11ae..10500ca 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -22,7 +22,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm install - run: xvfb-run -a npm test if: runner.os == 'Linux' @@ -41,7 +41,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm install - run: npm run compile-tests - run: echo "Run acceptance tests" && node ./out/test/runFunctionalTests.js diff --git a/.github/workflows/package-acceptance-test.yaml b/.github/workflows/package-acceptance-test.yaml index 1665487..7fd4222 100644 --- a/.github/workflows/package-acceptance-test.yaml +++ b/.github/workflows/package-acceptance-test.yaml @@ -7,6 +7,7 @@ on: branches: - main - master + - tpavlik/stage-v0.3.5-beta1 jobs: package: @@ -17,7 +18,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm --version - run: node --version - run: npm install @@ -54,7 +55,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm --version - run: node --version - run: npm install diff --git a/out/notebooks/splunk.ts b/out/notebooks/splunk.ts index b3fb1f8..e81ee8b 100644 --- a/out/notebooks/splunk.ts +++ b/out/notebooks/splunk.ts @@ -60,7 +60,7 @@ export function getSearchHeadClusterMemberClient(service: any): Promise { shcUrl, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized' : false, @@ -99,7 +99,7 @@ export function getSearchHeadClusterMemberClient(service: any): Promise { } /** - * Update a module by calling the PUT /services/spl2/modules/. + * Update a module by calling the PUT /services/orchestrator/v1/spl2/modules/. * @param service Instance of the Javascript SDK Service * @param moduleName Name of the module to append to the namespace to form the request path * @param namespace Full namespace to be used directly to form the request path @@ -110,7 +110,7 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st // The Splunk SDK for Javascript doesn't currently support the spl2/modules endpoints // nor does it support sending requests in JSON format (only receiving responses), so // for now use the underlying needle library that the SDK uses for requests/responses - console.log(`Request: [PUT] to ${service.prefix}/services/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`); + console.log(`Request: [PUT] to ${service.prefix}/services/orchestrator/v1/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`); console.log(`Request Body: \n'${JSON.stringify({ 'name': moduleName, 'namespace': namespace, @@ -119,8 +119,8 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st console.log(`Request Headers: ${JSON.stringify(makeHeaders(service))}`); return needle( 'PUT', - // example: https://myhost.splunkcloud.com:8089/services/spl2/modules/apps.search._default - `${service.prefix}/services/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`, + // example: https://myhost.splunkcloud.com:8089/services/orchestrator/v1/spl2/modules/apps.search._default + `${service.prefix}/services/orchestrator/v1/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`, { 'name': moduleName, 'namespace': namespace, @@ -128,7 +128,7 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st }, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized' : false, @@ -153,10 +153,10 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st } /** - * Dispatch a module to create a job using the POST /servicesNS/-//search/spl2-module-dispatch endpoint + * Dispatch a module to create a job using the POST /services/orchestrator/v1/spl2/modules/dispatch endpoint * @param service Instance of the Javascript SDK Service * @param spl2Module Full text of the SPL2 module to run (contents of a SPL2 notebook cell, for example) - * @param app App namespace to run within, this will determine /servicesNS/-//search/spl2-module-dispatch endpoint + * @param app App namespace to run within, this will determine /services/orchestrator/v1/spl2/modules/dispatch endpoint * @param namespace Namespace _within_ the apps. to run, this will be used directly in the body of the request * @param earliest Earliest time to be included in the body of the request * @param latest Latest time to be included in the body of the request @@ -194,7 +194,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string // The Splunk SDK for Javascript doesn't currently support the spl2-module-dispatch endpoint // nor does it support sending requests in JSON format (only receiving responses), so // for now use the underlying needle library that the SDK uses for requests/responses - console.log(`Request: [POST] to ${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`); + console.log(`Request: [POST] to ${service.prefix}/services/orchestrator/v1/spl2/modules/dispatch`); console.log(`Request Body: \n'${JSON.stringify({ 'module': spl2Module, 'namespace': namespace, @@ -205,7 +205,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string console.log(`Request Headers: ${JSON.stringify(makeHeaders(service))}`); return needle( 'POST', - `${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`, + `${service.prefix}/services/orchestrator/v1/spl2/modules/dispatch`, { 'module': spl2Module, 'namespace': namespace, @@ -215,7 +215,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string }, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized': false, @@ -225,12 +225,12 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string console.log(`Response body: \n'${JSON.stringify(response.body)}'`); console.log(`Response headers: \n'${JSON.stringify(response.headers)}'`); const data = response.body; - if (response.statusCode >= 400 || !Array.prototype.isPrototypeOf(data) || data.length < 1) { + if ((response.statusCode >= 400) || !Object.prototype.isPrototypeOf(data) || !Object.prototype.isPrototypeOf(data.queryParameters) || !Object.prototype.isPrototypeOf(data.queryParameters[statementIdentifier])) { handleErrorPayloads(data, response.statusCode); return; } // This is in the expected successful response format - const sid = data[0]['sid']; + const sid = data.queryParameters[statementIdentifier]['sid']; return getSearchJobBySid(service, sid); }); } diff --git a/package-lock.json b/package-lock.json index 18921e6..4aab6a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "splunk", - "version": "0.3.3", + "version": "0.3.5-beta1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "splunk", - "version": "0.3.3", + "version": "0.3.5-beta1", "license": "MIT", "dependencies": { "@babel/core": "^7.22.8", diff --git a/package.json b/package.json index dea9443..ba3de29 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "splunk", - "version": "0.3.4", + "version": "0.3.5-beta1", "publisher": "Splunk", "engines": { "vscode": "^1.75.0", - "node": "18.x" + "node": "22.x" }, "license": "MIT", "displayName": "Splunk Extension",