From fb688aee59d16d79dcf0fe933ee15db4a3703f56 Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:44:54 +0100 Subject: [PATCH 1/7] Update GetJobs.ts encoding.trim() only works if encoding is interpreted as a string, but it might just be a number. Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/src/GetJobs.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/zosjobs/src/GetJobs.ts b/packages/zosjobs/src/GetJobs.ts index 4e7c510f12..438571b410 100644 --- a/packages/zosjobs/src/GetJobs.ts +++ b/packages/zosjobs/src/GetJobs.ts @@ -375,7 +375,10 @@ export class GetJobs { ImperativeExpect.toNotBeNullOrUndefined(spoolId, "Required parameter spoolId must be defined"); let parameters: string = "/" + encodeURIComponent(jobname) + "/" + encodeURIComponent(jobid) + JobsConstants.RESOURCE_SPOOL_FILES + "/" + encodeURIComponent(spoolId) + JobsConstants.RESOURCE_SPOOL_CONTENT; - if (encoding && encoding.trim() != "") {parameters += "?fileEncoding=" + encoding;} + if (encoding) { + encoding = String(encoding); + if(encoding.trim() != "") {parameters += "?fileEncoding=" + encoding;} + } Logger.getAppLogger().info("GetJobs.getSpoolContentById() parameters: " + parameters); return ZosmfRestClient.getExpectString(session, JobsConstants.RESOURCE + parameters, [Headers.TEXT_PLAIN_UTF8]); } From 954816b1059ea49199086c5ecbfacfae11cc230e Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Tue, 17 Dec 2024 22:29:20 +0100 Subject: [PATCH 2/7] Combining ifs More succinct Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/src/GetJobs.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zosjobs/src/GetJobs.ts b/packages/zosjobs/src/GetJobs.ts index 438571b410..5e70cf0051 100644 --- a/packages/zosjobs/src/GetJobs.ts +++ b/packages/zosjobs/src/GetJobs.ts @@ -375,9 +375,9 @@ export class GetJobs { ImperativeExpect.toNotBeNullOrUndefined(spoolId, "Required parameter spoolId must be defined"); let parameters: string = "/" + encodeURIComponent(jobname) + "/" + encodeURIComponent(jobid) + JobsConstants.RESOURCE_SPOOL_FILES + "/" + encodeURIComponent(spoolId) + JobsConstants.RESOURCE_SPOOL_CONTENT; - if (encoding) { - encoding = String(encoding); - if(encoding.trim() != "") {parameters += "?fileEncoding=" + encoding;} + if (encoding != null && String(encoding).trim !== "") { + parameters += "?fileEncoding=" + encoding; + } } Logger.getAppLogger().info("GetJobs.getSpoolContentById() parameters: " + parameters); return ZosmfRestClient.getExpectString(session, JobsConstants.RESOURCE + parameters, [Headers.TEXT_PLAIN_UTF8]); From f3ecd41fffd86225ed6f252a2c7fe7b029b20d66 Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Tue, 17 Dec 2024 22:52:30 +0100 Subject: [PATCH 3/7] Changelog 8.7.2 Co-authored-by: Timothy Johnson Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index 46c4209895..91b76979f3 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -2,11 +2,16 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this file. +## `8.7.2` + +- BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding. [#2392] (https://github.com/zowe/zowe-cli/pull/2392). + ## `8.7.1` - BugFix: Fixed an error where the Delete Jobs API response was not returned if the `modifyVersion` parameter was not specified, even though it was available. [#2352](https://github.com/zowe/zowe-cli/pull/2352) ## `8.7.0` + - Enhancement: Added waitForOutput & waitForActive as optional parameters to download on zosjobs. [#2326] (https://github.com/zowe/zowe-cli/pull/2326). ## `8.5.0` From 074182ae0e2803ab8d3f221a23a5c10b2215b223 Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Fri, 20 Dec 2024 08:48:32 +0100 Subject: [PATCH 4/7] Update packages/zosjobs/CHANGELOG.md "Recent Changes" Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index 91b76979f3..1811b49980 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this file. -## `8.7.2` +## Recent Changes - BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding. [#2392] (https://github.com/zowe/zowe-cli/pull/2392). From 691a726c7b8c63623cd445c43a97621f198b5fdf Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Fri, 20 Dec 2024 08:50:01 +0100 Subject: [PATCH 5/7] Update packages/zosjobs/src/GetJobs.ts Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/src/GetJobs.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/zosjobs/src/GetJobs.ts b/packages/zosjobs/src/GetJobs.ts index 5e70cf0051..27e6b91dba 100644 --- a/packages/zosjobs/src/GetJobs.ts +++ b/packages/zosjobs/src/GetJobs.ts @@ -375,10 +375,9 @@ export class GetJobs { ImperativeExpect.toNotBeNullOrUndefined(spoolId, "Required parameter spoolId must be defined"); let parameters: string = "/" + encodeURIComponent(jobname) + "/" + encodeURIComponent(jobid) + JobsConstants.RESOURCE_SPOOL_FILES + "/" + encodeURIComponent(spoolId) + JobsConstants.RESOURCE_SPOOL_CONTENT; - if (encoding != null && String(encoding).trim !== "") { + if (encoding != null && String(encoding).trim() !== "") { parameters += "?fileEncoding=" + encoding; } - } Logger.getAppLogger().info("GetJobs.getSpoolContentById() parameters: " + parameters); return ZosmfRestClient.getExpectString(session, JobsConstants.RESOURCE + parameters, [Headers.TEXT_PLAIN_UTF8]); } From 05614f2d817087e9c7507176d6909eedc1b5a397 Mon Sep 17 00:00:00 2001 From: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:47:35 +0100 Subject: [PATCH 6/7] Add unit test Co-authored-by: Timothy Johnson Signed-off-by: COBOL-Erik <32245335+COBOL-Erik@users.noreply.github.com> --- packages/zosjobs/CHANGELOG.md | 2 +- packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index 1811b49980..4d7f222701 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this ## Recent Changes -- BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding. [#2392] (https://github.com/zowe/zowe-cli/pull/2392). +- BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding (GetJobs.ts). [#2392] (https://github.com/zowe/zowe-cli/pull/2392). ## `8.7.1` diff --git a/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts index 3f66dc74d7..be18bf4878 100644 --- a/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts @@ -521,6 +521,13 @@ describe("GetJobs tests", () => { expect(content).toEqual(GetJobsData.SAMPLE_JES_MSG_LG); }); + it("should return spool content from getSpoolContentById with encoding as a number if z/OSMF response is mocked", async () => { + (ZosmfRestClient.getExpectString as any) = mockGetJobsStringData(GetJobsData.SAMPLE_JES_MSG_LG); + const content = await GetJobs.getSpoolContentById(pretendSession, "MYJOB1", "JOB0123", 1, 278 as any); + expect((ZosmfRestClient.getExpectString as any).mock.calls[0][1]).toContain("fileEncoding=278"); + expect(content).toEqual(GetJobsData.SAMPLE_JES_MSG_LG); + }); + it("should error if spoolID is omitted from getSpoolContentById", async () => { let err: Error; try { From f94ed83d61da02b0e9f820b0acb3519941c05657 Mon Sep 17 00:00:00 2001 From: zowe-robot Date: Tue, 24 Dec 2024 15:13:50 +0000 Subject: [PATCH 7/7] Bump version to 8.10.2 [ci skip] Signed-off-by: zowe-robot --- lerna.json | 2 +- npm-shrinkwrap.json | 6 +++--- packages/cli/package.json | 4 ++-- packages/zosjobs/CHANGELOG.md | 2 +- packages/zosjobs/package.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lerna.json b/lerna.json index 1df9859d41..9a937c2af3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.10.1", + "version": "8.10.2", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 62f8db5971..072e17fab3 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -16269,7 +16269,7 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.10.1", + "version": "8.10.2", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { @@ -16278,7 +16278,7 @@ "@zowe/provisioning-for-zowe-sdk": "8.10.1", "@zowe/zos-console-for-zowe-sdk": "8.10.1", "@zowe/zos-files-for-zowe-sdk": "8.10.1", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.1", + "@zowe/zos-jobs-for-zowe-sdk": "8.10.2", "@zowe/zos-logs-for-zowe-sdk": "8.10.1", "@zowe/zos-tso-for-zowe-sdk": "8.10.1", "@zowe/zos-uss-for-zowe-sdk": "8.10.1", @@ -16678,7 +16678,7 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.10.1", + "version": "8.10.2", "license": "EPL-2.0", "dependencies": { "@zowe/zos-files-for-zowe-sdk": "8.10.1" diff --git a/packages/cli/package.json b/packages/cli/package.json index cf52e04915..98f3afcf04 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli", - "version": "8.10.1", + "version": "8.10.2", "zoweVersion": "v3.0.0", "description": "Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.", "author": "Zowe", @@ -63,7 +63,7 @@ "@zowe/provisioning-for-zowe-sdk": "8.10.1", "@zowe/zos-console-for-zowe-sdk": "8.10.1", "@zowe/zos-files-for-zowe-sdk": "8.10.1", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.1", + "@zowe/zos-jobs-for-zowe-sdk": "8.10.2", "@zowe/zos-logs-for-zowe-sdk": "8.10.1", "@zowe/zos-tso-for-zowe-sdk": "8.10.1", "@zowe/zos-uss-for-zowe-sdk": "8.10.1", diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index 4d7f222701..33947ef779 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this file. -## Recent Changes +## `8.10.2` - BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding (GetJobs.ts). [#2392] (https://github.com/zowe/zowe-cli/pull/2392). diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index cdd98b4ab8..17b1b86a99 100644 --- a/packages/zosjobs/package.json +++ b/packages/zosjobs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.10.1", + "version": "8.10.2", "description": "Zowe SDK to interact with jobs on z/OS", "author": "Zowe", "license": "EPL-2.0",