From a3f4678a42f406a854d71010b56abb67e7a1e833 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 11:56:23 -0500 Subject: [PATCH 01/23] implementation and unit tests Signed-off-by: Pujal --- RELEASE_HISTORY.md | 3 +- .../__packages__/cli-test-utils/package.json | 4 +- lerna.json | 2 +- npm-shrinkwrap.json | 116 +++++++++--------- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 63 +++++++++- packages/cli/package.json | 28 ++--- packages/cli/src/zosfiles/-strings-/en.ts | 6 +- .../cli/src/zosfiles/copy/ds/Ds.definition.ts | 10 ++ .../cli/src/zosfiles/copy/ds/Ds.handler.ts | 16 ++- packages/core/package.json | 6 +- packages/imperative/CHANGELOG.md | 4 + packages/imperative/package.json | 2 +- .../ProfileInfo.TeamConfig.unit.test.ts | 14 ++- .../__tests__/DeferredPromise.unit.test.ts | 47 +++++++ packages/imperative/src/utilities/index.ts | 1 + .../src/utilities/src/DeferredPromise.ts | 53 ++++++++ packages/provisioning/package.json | 8 +- packages/workflows/package.json | 10 +- packages/zosconsole/package.json | 8 +- .../methods/copy/Copy.system.test.ts | 81 ++++++++++++ .../methods/invoke/DefineVSAM.ams.temp | 1 + .../methods/invoke/DeleteVSAM.ams.temp | 1 + .../__unit__/methods/copy/Copy.unit.test.ts | 50 ++++++++ packages/zosfiles/package.json | 10 +- packages/zosfiles/src/methods/copy/Copy.ts | 12 +- .../methods/copy/doc/ICopyDatasetOptions.ts | 15 ++- packages/zosjobs/package.json | 10 +- packages/zoslogs/package.json | 8 +- packages/zosmf/package.json | 8 +- packages/zostso/package.json | 10 +- packages/zosuss/package.json | 6 +- 31 files changed, 480 insertions(+), 133 deletions(-) create mode 100644 packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts create mode 100644 packages/imperative/src/utilities/src/DeferredPromise.ts create mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp create mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp diff --git a/RELEASE_HISTORY.md b/RELEASE_HISTORY.md index 0b2797c4e5..996ec9c844 100644 --- a/RELEASE_HISTORY.md +++ b/RELEASE_HISTORY.md @@ -7,7 +7,8 @@ Zowe follows a regular release schedule with major versions released every two y ### Zowe v3.x LTS Releases | Version | Release Date | Status | Release Notes | |:--------:|:------------:|:----------:|:-------------:| -| v3.0.0-prerelease | 2024-08 | **Under Development** | | +| v3.0.0 | 2024-10 | **Active** | | +| v3.1.0 | 2025-02 | **Under Development** | | ### Major Release Timeline diff --git a/__tests__/__packages__/cli-test-utils/package.json b/__tests__/__packages__/cli-test-utils/package.json index 43e0fc9efb..eab1d2ac72 100644 --- a/__tests__/__packages__/cli-test-utils/package.json +++ b/__tests__/__packages__/cli-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli-test-utils", - "version": "8.10.4", + "version": "8.11.0", "description": "Test utilities package for Zowe CLI plug-ins", "author": "Zowe", "license": "EPL-2.0", @@ -43,7 +43,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.10.4" + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/lerna.json b/lerna.json index cee9d13cfc..4e58110f1d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.10.4", + "version": "8.11.0", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f9b605540d..13240f3b4e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -52,7 +52,7 @@ }, "__tests__/__packages__/cli-test-utils": { "name": "@zowe/cli-test-utils", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "find-up": "^5.0.0", @@ -63,7 +63,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.10.4" + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" @@ -16271,21 +16271,21 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.10.4", + "version": "8.11.0", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/provisioning-for-zowe-sdk": "8.10.4", - "@zowe/zos-console-for-zowe-sdk": "8.10.4", - "@zowe/zos-files-for-zowe-sdk": "8.10.4", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.4", - "@zowe/zos-logs-for-zowe-sdk": "8.10.4", - "@zowe/zos-tso-for-zowe-sdk": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4", - "@zowe/zos-workflows-for-zowe-sdk": "8.10.4", - "@zowe/zosmf-for-zowe-sdk": "8.10.4", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/provisioning-for-zowe-sdk": "8.11.0", + "@zowe/zos-console-for-zowe-sdk": "8.11.0", + "@zowe/zos-files-for-zowe-sdk": "8.11.0", + "@zowe/zos-jobs-for-zowe-sdk": "8.11.0", + "@zowe/zos-logs-for-zowe-sdk": "8.11.0", + "@zowe/zos-tso-for-zowe-sdk": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0", + "@zowe/zos-workflows-for-zowe-sdk": "8.11.0", + "@zowe/zosmf-for-zowe-sdk": "8.11.0", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -16298,7 +16298,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.10.4", + "@zowe/cli-test-utils": "8.11.0", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" @@ -16354,15 +16354,15 @@ }, "packages/core": { "name": "@zowe/core-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "comment-json": "~4.2.3", "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16373,7 +16373,7 @@ }, "packages/imperative": { "name": "@zowe/imperative", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "@types/yargs": "^17.0.32", @@ -16567,16 +16567,16 @@ }, "packages/provisioning": { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "js-yaml": "^4.1.0" }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16601,15 +16601,15 @@ }, "packages/workflows": { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16621,12 +16621,12 @@ }, "packages/zosconsole": { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16638,17 +16638,17 @@ }, "packages/zosfiles": { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "lodash": "^4.17.21", "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16680,15 +16680,15 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16700,12 +16700,12 @@ }, "packages/zoslogs": { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16717,12 +16717,12 @@ }, "packages/zosmf": { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16734,15 +16734,15 @@ }, "packages/zostso": { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.10.4" + "@zowe/zosmf-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16754,15 +16754,15 @@ }, "packages/zosuss": { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "ssh2": "^1.15.0" }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index 778b440d72..c71536a39c 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -12,6 +12,9 @@ import { Copy, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; import DsHandler from "../../../../../src/zosfiles/copy/ds/Ds.handler"; import { ZosFilesBaseHandler } from "../../../../../src/zosfiles/ZosFilesBase.handler"; +import { u } from "tar"; +import { resolvePtr } from "dns"; +import en from "../../../../../src/zosfiles/-strings-/en"; describe("DsHandler", () => { const defaultReturn: IZosFilesResponse = { @@ -33,11 +36,24 @@ describe("DsHandler", () => { const fromDataSetName = "ABCD"; const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + const commandParameters: any = { arguments: { fromDataSetName, - toDataSetName + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -49,7 +65,14 @@ describe("DsHandler", () => { expect(copyDatasetSpy).toHaveBeenLastCalledWith( dummySession, { dsn: commandParameters.arguments.toDataSetName }, - { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName } } + { + "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, + "enq": commandParameters.arguments.enq, + "replace": commandParameters.arguments.replace, + "responseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) + } ); expect(response).toBe(defaultReturn); }); @@ -63,11 +86,22 @@ describe("DsHandler", () => { const fromMemberName = "mem1"; const toDataSetName = "EFGH"; const toMemberName = "mem2"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; const commandParameters: any = { arguments: { fromDataSetName: `${fromDataSetName}(${fromMemberName})`, - toDataSetName: `${toDataSetName}(${toMemberName})` + toDataSetName: `${toDataSetName}(${toMemberName})`, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -79,7 +113,14 @@ describe("DsHandler", () => { expect(copyDatasetSpy).toHaveBeenLastCalledWith( dummySession, { dsn: toDataSetName, member: toMemberName }, - { "from-dataset": { dsn: fromDataSetName, member: fromMemberName } } + { + "from-dataset": { dsn: fromDataSetName, member: fromMemberName }, + "enq": commandParameters.arguments.enq, + "replace": commandParameters.arguments.replace, + "responseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) + } ); expect(response).toBe(defaultReturn); }); @@ -93,13 +134,20 @@ describe("DsHandler", () => { const toDataSetName = "EFGH"; const enq = "SHR"; const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; const commandParameters: any = { arguments: { fromDataSetName, toDataSetName, enq, - replace + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -114,7 +162,10 @@ describe("DsHandler", () => { { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, "enq": commandParameters.arguments.enq, - "replace": commandParameters.arguments.replace + "replace": commandParameters.arguments.replace, + "reseponseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) } ); expect(response).toBe(defaultReturn); diff --git a/packages/cli/package.json b/packages/cli/package.json index 987ac43b33..fc82320aa1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@zowe/cli", - "version": "8.10.4", - "zoweVersion": "v3.0.0", + "version": "8.11.0", + "zoweVersion": "v3.1.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", "license": "EPL-2.0", @@ -58,17 +58,17 @@ "preshrinkwrap": "node ../../scripts/rewriteShrinkwrap.js" }, "dependencies": { - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/provisioning-for-zowe-sdk": "8.10.4", - "@zowe/zos-console-for-zowe-sdk": "8.10.4", - "@zowe/zos-files-for-zowe-sdk": "8.10.4", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.4", - "@zowe/zos-logs-for-zowe-sdk": "8.10.4", - "@zowe/zos-tso-for-zowe-sdk": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4", - "@zowe/zos-workflows-for-zowe-sdk": "8.10.4", - "@zowe/zosmf-for-zowe-sdk": "8.10.4", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/provisioning-for-zowe-sdk": "8.11.0", + "@zowe/zos-console-for-zowe-sdk": "8.11.0", + "@zowe/zos-files-for-zowe-sdk": "8.11.0", + "@zowe/zos-jobs-for-zowe-sdk": "8.11.0", + "@zowe/zos-logs-for-zowe-sdk": "8.11.0", + "@zowe/zos-tso-for-zowe-sdk": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0", + "@zowe/zos-workflows-for-zowe-sdk": "8.11.0", + "@zowe/zosmf-for-zowe-sdk": "8.11.0", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -78,7 +78,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.10.4", + "@zowe/cli-test-utils": "8.11.0", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" diff --git a/packages/cli/src/zosfiles/-strings-/en.ts b/packages/cli/src/zosfiles/-strings-/en.ts index dad7b32bf6..10aa5b7648 100644 --- a/packages/cli/src/zosfiles/-strings-/en.ts +++ b/packages/cli/src/zosfiles/-strings-/en.ts @@ -195,7 +195,9 @@ export default { TODSNAME: "The name of the data set that you want to copy to" }, OPTIONS: { - REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set" + REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set", + SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set." + + "This option will prompt to confirm." }, EXAMPLES: { EX1: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET'", @@ -204,7 +206,7 @@ export default { EX4: "Copy the data set member named 'USER.FROM.SET(MEM1)' to the data set named 'USER.TO.SET'", EX5: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members", EX6: "Copy the partitioned data set named 'TEST.PDS1' to the partitioned data set named 'TEST.PDS2'", - EX7: "Copy the partionted data set named 'EXISTING.PDS' to a non-existent target 'NEW.PDS'" + EX7: "Copy the partitioned data set named 'EXISTING.PDS' to a non-existent target 'NEW.PDS'" } }, DATA_SET_CROSS_LPAR: { diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts index 6324f99352..959be54458 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts @@ -53,6 +53,12 @@ export const DsDefinition: ICommandDefinition = { aliases: ["rep"], description: strings.OPTIONS.REPLACE, type: "boolean" + }, + { + name: "safe-replace", + aliases: ["safe-rep"], + description: strings.OPTIONS.SAFE_REPLACE, + type: "boolean", } ] as ICommandOptionDefinition[]).sort((a, b) => a.name.localeCompare(b.name) @@ -77,6 +83,10 @@ export const DsDefinition: ICommandDefinition = { { description: strings.EXAMPLES.EX5, options: `"USER.FROM.SET" "USER.TO.SET" --replace` + }, + { + description: strings.EXAMPLES.EX6, + options: `"USER.FROM.SET" "USER.TO.SET" --safe-replace` } ] }; diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 47a21cfb62..8689ec306d 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -9,7 +9,7 @@ * */ -import { AbstractSession, IHandlerParameters } from "@zowe/imperative"; +import { AbstractSession, IHandlerParameters, IHandlerResponseConsoleApi } from "@zowe/imperative"; import { Copy, IZosFilesResponse, IDataSet, ICopyDatasetOptions, ZosFilesUtils } from "@zowe/zos-files-for-zowe-sdk"; import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler"; @@ -24,9 +24,21 @@ export default class DsHandler extends ZosFilesBaseHandler { "from-dataset": fromDataSet, enq: commandParameters.arguments.enq, replace: commandParameters.arguments.replace, - responseTimeout: commandParameters.arguments.responseTimeout + responseTimeout: commandParameters.arguments.responseTimeout, + safeReplace: commandParameters.arguments.safeReplace, + promptFn: this.promptForSafeReplace(commandParameters.response.console) }; return Copy.dataSet(session, toDataSet, options); } + + private promptForSafeReplace(console: IHandlerResponseConsoleApi) { + return async (targetDSN: string) => { + const answer: string = await console.prompt( + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. + Are you sure you want to continue? [y/N]: ` + ); + return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); + }; + } } diff --git a/packages/core/package.json b/packages/core/package.json index 4300ed7478..38adb55a68 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/core-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Core libraries shared by Zowe SDK packages", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 7259be27ac..059c83a266 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## `8.11.0` + +- Enhancement: Added `DeferredPromise` class to Imperative to provide utilities for data synchronization. [#2405](https://github.com/zowe/zowe-cli/pull/2405) + ## `8.10.4` - BugFix: Fixed a typo in the syntax validation code for positional arguments which caused the validation to never fail. [#2375](https://github.com/zowe/zowe-cli/issues/2375) diff --git a/packages/imperative/package.json b/packages/imperative/package.json index ccbd3c7d7d..7e861fc465 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/imperative", - "version": "8.10.4", + "version": "8.11.0", "description": "framework for building configurable CLIs", "author": "Zowe", "license": "EPL-2.0", diff --git a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts index 91bea7b8c6..fb5833a1e0 100644 --- a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts @@ -1367,8 +1367,18 @@ describe("TeamConfig ProfileInfo tests", () => { const targetProfile = profiles.find(p => p.profName === "base1234567"); expect(caughtError).toBeUndefined(); expect(targetProfile).toBeDefined(); - expect(targetProfile?.profLoc?.osLoc?.[0]).toEqual(path.join(testDir,"/ProfInfoApp_proj_nested_global_empty/ProfInfoApp.config.json")); - expect(targetProfile?.profLoc?.osLoc?.[0]).not.toEqual(path.join(testDir,"/ProfInfoApp_proj_nested_global_empty_proj/ProfInfoApp.config.json")); + expect(targetProfile?.profLoc?.osLoc?.[0]).toEqual( + path.join( + testDir, + "/ProfInfoApp_proj_nested_global_empty/ProfInfoApp.config.json" + ) + ); + expect(targetProfile?.profLoc?.osLoc?.[0]).not.toEqual( + path.join( + testDir, + "/ProfInfoApp_proj_nested_global_empty_proj/ProfInfoApp.config.json" + ) + ); }); }); diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts new file mode 100644 index 0000000000..7ab1cf1bbe --- /dev/null +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -0,0 +1,47 @@ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ + +import { DeferredPromise, DeferredPromiseStatus } from "../src/DeferredPromise"; + +describe("DeferredPromise constructor", () => { + it("sets resolve and reject functions", () => { + const deferred = new DeferredPromise(); + expect(deferred.promise).toBeInstanceOf(Promise); + expect(deferred.reject).toBeInstanceOf(Function); + expect(deferred.resolve).toBeInstanceOf(Function); + }); +}); + +describe("DeferredPromise.status", () => { + it("returns pending when not yet resolved", () => { + const deferred = new DeferredPromise(); + expect(deferred.status).toBe(DeferredPromiseStatus.Pending); + }); + + it("returns resolved when resolved", () => { + const deferred = new DeferredPromise(); + deferred.resolve(null); + expect(deferred.status).toBe(DeferredPromiseStatus.Resolved); + }); + + it("returns rejected when rejected", async () => { + const deferred = new DeferredPromise(); + let errorCaught = false; + setImmediate(() => deferred.reject()); + try { + await deferred.promise; + } catch (err) { + errorCaught = true; + } + expect(deferred.status).toBe(DeferredPromiseStatus.Rejected); + expect(errorCaught).toBe(true); + }); +}); diff --git a/packages/imperative/src/utilities/index.ts b/packages/imperative/src/utilities/index.ts index b3464e1879..360b5f3d30 100644 --- a/packages/imperative/src/utilities/index.ts +++ b/packages/imperative/src/utilities/index.ts @@ -26,3 +26,4 @@ export * from "./src/doc/ISystemInfo"; export * from "./src/diff/DiffUtils"; export * from "./src/diff/doc/IDiffOptions"; export * from "./src/diff/doc/IDiffNameOptions"; +export * from "./src/DeferredPromise"; diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts new file mode 100644 index 0000000000..65324d0855 --- /dev/null +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -0,0 +1,53 @@ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ + +/* Status of the deferred promise */ +export enum DeferredPromiseStatus { + Pending = "pending", + Resolved = "resolved", + Rejected = "rejected", +} + +/** + * @brief Externally control the resolution and rejection of a promise. + * + * @details + * Creates a promise with accessible `resolve` and `reject` methods, enabling external entities to + * settle the promise based on custom logic or asynchronous events. This is particularly useful when + * the promise's outcome depends on factors outside the immediate context. + */ +export class DeferredPromise { + private mStatus: DeferredPromiseStatus = DeferredPromiseStatus.Pending; + + public promise: Promise; + public resolve: (value: T | PromiseLike) => void; + public reject: (reason?: any) => void; + + public constructor() { + this.promise = new Promise((resolve, reject) => { + this.resolve = (value): void => { + this.mStatus = DeferredPromiseStatus.Resolved; + resolve(value); + }; + this.reject = (err): void => { + this.mStatus = DeferredPromiseStatus.Rejected; + reject(err); + }; + }); + } + + /** + * @returns {PromiseStatus} The status of the deferred promise + */ + public get status(): DeferredPromiseStatus { + return this.mStatus; + } +} diff --git a/packages/provisioning/package.json b/packages/provisioning/package.json index 6230caf808..e4177a54f6 100644 --- a/packages/provisioning/package.json +++ b/packages/provisioning/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS provisioning APIs", "author": "Zowe", "license": "EPL-2.0", @@ -49,9 +49,9 @@ }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/workflows/package.json b/packages/workflows/package.json index 435a68db9b..abb563c26f 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS workflows APIs", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosconsole/package.json b/packages/zosconsole/package.json index d7ed7246af..c980c3cd63 100644 --- a/packages/zosconsole/package.json +++ b/packages/zosconsole/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS console", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index bccc37a439..db23bfe4fa 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -466,6 +466,87 @@ describe("Copy", () => { expect(contents1.toString()).toEqual(contents2.toString()); }); }); + + describe("Safe replace option", () => { + const promptFn = jest.fn(); + beforeEach(async () => { + try { + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, fromDataSetName); + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, toDataSetName); + await Upload.fileToDataset(REAL_SESSION, fileLocation, fromDataSetName); + await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName } } + ); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + }); + + it("Should succeed with safe replace option", async () => { + let error; + let response; + let contents1; + let contents2; + promptFn.mockResolvedValue(true); + + try { + response = await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName}, + { + "from-dataset": { dsn: fromDataSetName }, + "safeReplace": true, + promptFn + } + ); + contents1 = await Get.dataSet(REAL_SESSION, `${fromDataSetName}`); + contents2 = await Get.dataSet(REAL_SESSION, `${toDataSetName}`); + Imperative.console.info(`Response: ${inspect(response)}`); + } catch (err) { + error = err; + Imperative.console.info(`Error: ${inspect(err)}`); + } + + expect(error).toBeFalsy(); + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + expect(response).toBeTruthy(); + expect(response.success).toBe(true); + expect(response.commandResponse).toContain(ZosFilesMessages.datasetCopiedSuccessfully.message); + + expect(contents1).toBeTruthy(); + expect(contents2).toBeTruthy(); + expect(contents1.toString()).toEqual(contents2.toString()); + }); + + it("Should result in error when safe replace option is selected but the user declines the prompt", async () => { + let error; + let response; + promptFn.mockResolvedValue(false); + + try { + response = await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName, member: file2 }, + { + "from-dataset": { dsn: fromDataSetName}, + "safeReplace": true, + promptFn + } + ); + Imperative.console.info(`Response: ${inspect(response)}`); + } catch (err) { + error = err; + Imperative.console.info(`Error: ${inspect(err)}`); + } + + expect(error).toBeTruthy(); + expect(error.message).toContain(ZosFilesMessages.datasetCopiedAborted.message); + expect(response).toBeFalsy(); + }); + + }); describe("responseTimeout option", () => { beforeEach(async () => { try { diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp new file mode 100644 index 0000000000..9bd65e97a9 --- /dev/null +++ b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp @@ -0,0 +1 @@ +DEFINE CLUSTER (NAME (PG899423.ZOSFILE.ENCO#ED.VSAM.A196525) CYLINDERS (5 2 ) VOLUMES(TSOE20)) \ No newline at end of file diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp new file mode 100644 index 0000000000..d7b3d3464e --- /dev/null +++ b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp @@ -0,0 +1 @@ +DELETE PG899423.ZOSFILE.ENCO#ED.VSAM.A196525 CLUSTER \ No newline at end of file diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 2cfbf762ff..7934c7df05 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -36,6 +36,7 @@ describe("Copy", () => { const toMemberName = "mem2"; const isPDSSpy = jest.spyOn(Copy as any, "isPDS"); let dataSetExistsSpy: jest.SpyInstance; + const promptFn = jest.fn(); beforeEach(() => { copyPDSSpy.mockClear(); @@ -459,6 +460,55 @@ describe("Copy", () => { expect(lastArgumentOfCall).toHaveProperty("replace", false); }); }); + describe("Safe replace option", () => { + it("should not throw error if safeReplace has value of true", async () => { + promptFn.mockResolvedValue(true); + + const response = await Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: true, + promptFn } + ); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); + const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; + const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; + expect(lastArgumentOfCall).toHaveProperty("safeReplace", true); + expect(response).toEqual({success: true, commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message}); + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + }); + + it("should throw error if user declines to replace the dataset", async () => { + promptFn.mockResolvedValue(false); + + await expect(Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: true, + promptFn } + )).rejects.toThrow(new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message })); + + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + + }); + + it("should not throw error if safeReplace has value of false", async () => { + await expect(Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: false, + } + )).resolves.not.toThrow(); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); + const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; + const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; + expect(lastArgumentOfCall).toHaveProperty("safeReplace", false); + }); + + }); describe("Partitioned > Partitioned", () => { let createSpy: jest.SpyInstance; let dataSetExistsSpy: jest.SpyInstance; diff --git a/packages/zosfiles/package.json b/packages/zosfiles/package.json index d3a62bf394..ff7f87b7c1 100644 --- a/packages/zosfiles/package.json +++ b/packages/zosfiles/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with files and data sets on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -50,10 +50,10 @@ "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index cce57fd5fd..5a29673a9a 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -57,8 +57,9 @@ export class Copy { ): Promise { ImperativeExpect.toBeDefinedAndNonBlank(options["from-dataset"].dsn, "fromDataSetName"); ImperativeExpect.toBeDefinedAndNonBlank(toDataSetName, "toDataSetName"); + const safeReplace: boolean = options.safeReplace; - if(options["from-dataset"].dsn === toDataSetName) { + if(options["from-dataset"].dsn === toDataSetName && toMemberName === options["from-dataset"].member) { return { success: false, commandResponse: ZosFilesMessages.identicalDataSets.message @@ -71,6 +72,15 @@ export class Copy { if (newDataSet) { await Create.dataSetLike(session, toDataSetName, options["from-dataset"].dsn); } + else if(safeReplace) { + if (options.promptFn != null) { + const userResponse = await options.promptFn(toDataSetName); + + if(!userResponse) { + throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message }); + } + } + } if(!toMemberName && !options["from-dataset"].member) { const sourceIsPds = await this.isPDS(session, options["from-dataset"].dsn); const targetIsPds = await this.isPDS(session, toDataSetName); diff --git a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts index b0e2285db6..de9e68662d 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts @@ -30,8 +30,21 @@ export interface ICopyDatasetOptions extends IZosFilesOptions { enq?: string; /** - * Replace option + * Replace option (DEPRECATED) * @type {boolean} */ replace?: boolean; + + /** + * Safe replace option + * @type {boolean}; + */ + safeReplace?: boolean; + + /** + * Prompt callback that will be invoked before overwiting a data set. + * @param targetDSN Name of data set that already exists + * @returns True if target data set should be overwritten + */ + promptFn?: (targetDSN: string) => Promise; } diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index 21fde31efa..687d05101d 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.4", + "version": "8.11.0", "description": "Zowe SDK to interact with jobs on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -46,12 +46,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zoslogs/package.json b/packages/zoslogs/package.json index 7ab2cf3128..1700fa0de5 100644 --- a/packages/zoslogs/package.json +++ b/packages/zoslogs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS logs", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosmf/package.json b/packages/zosmf/package.json index 32f07b4d54..7342062b5d 100644 --- a/packages/zosmf/package.json +++ b/packages/zosmf/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS Management Facility", "author": "Zowe", "license": "EPL-2.0", @@ -44,9 +44,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zostso/package.json b/packages/zostso/package.json index 4cac1b54bb..f2c3488dbc 100644 --- a/packages/zostso/package.json +++ b/packages/zostso/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with TSO on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.10.4" + "@zowe/zosmf-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosuss/package.json b/packages/zosuss/package.json index dfc0cef6a5..1de62e5c88 100644 --- a/packages/zosuss/package.json +++ b/packages/zosuss/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with USS on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" From 62eab1d37405db5cd747f5b530dfa08086932a5e Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 12:00:23 -0500 Subject: [PATCH 02/23] update snapshots Signed-off-by: Pujal --- .../ds/__snapshots__/Ds.definition.unit.test.ts.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index cee4e8287e..a99ecb2810 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -10,6 +10,14 @@ Array [ "name": "replace", "type": "boolean", }, + Object { + "aliases": Array [ + "safe-rep", + ], + "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set.This option will prompt to confirm.", + "name": "safe-replace", + "type": "boolean", + }, ] `; @@ -35,5 +43,9 @@ Array [ "description": "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members", "options": "\\"USER.FROM.SET\\" \\"USER.TO.SET\\" --replace", }, + Object { + "description": "Copy the partitioned data set named 'TEST.PDS1' to the partitioned data set named 'TEST.PDS2'", + "options": "\\"USER.FROM.SET\\" \\"USER.TO.SET\\" --safe-replace", + }, ] `; From 484775d744387f6a346c44fe8196273cc6f306bd Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:12:46 -0500 Subject: [PATCH 03/23] Updated changelog Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 3 +++ .../cli.files.copy.ds.integration.test.ts.snap | 14 ++++++++++++-- packages/zosfiles/CHANGELOG.md | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index d98dcf7be5..84d227ac06 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes +- BugFix: Added a `--safe-replace` option that prompts the user to confirm overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) + ## Recent Changes - Enhancement: The `zowe zos-files copy data-set` command no longer requires the target data set to be preallocated. [##2349] (https://github.com/zowe/zowe-cli/issues/2349) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index 63dd437f15..7c77bb278b 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -37,6 +37,11 @@ exports[`Copy Data Set should display the help 1`] = ` Specify this option as true if you wish to replace like-named members in the target data set + --safe-replace | --safe-rep (boolean) + + Specify this option as true if you wish to replace like-named members or the + content of the target data set.This option will prompt to confirm. + --response-timeout | --rto (number) The maximum amount of time in seconds the z/OSMF Files TSO servlet should run @@ -161,6 +166,11 @@ exports[`Copy Data Set should display the help 1`] = ` $ zowe zos-files copy data-set \\"USER.FROM.SET\\" \\"USER.TO.SET\\" --replace + - Copy the partitioned data set named 'TEST.PDS1' to the + partitioned data set named 'TEST.PDS2': + + $ zowe zos-files copy data-set \\"USER.FROM.SET\\" \\"USER.TO.SET\\" --safe-replace + " `; @@ -170,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `; diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index d8d9c25b63..f383845b5e 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm overwriting the contents of the target data set with the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From af98302d9a35f86f6d1a8357e8b54d23c45c24c3 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:16:10 -0500 Subject: [PATCH 04/23] unused import fix Signed-off-by: Pujal --- .../zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index c71536a39c..7f394f43fe 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -12,9 +12,6 @@ import { Copy, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; import DsHandler from "../../../../../src/zosfiles/copy/ds/Ds.handler"; import { ZosFilesBaseHandler } from "../../../../../src/zosfiles/ZosFilesBase.handler"; -import { u } from "tar"; -import { resolvePtr } from "dns"; -import en from "../../../../../src/zosfiles/-strings-/en"; describe("DsHandler", () => { const defaultReturn: IZosFilesResponse = { From 981bdc1b7c8ecd6e0dc741a530761525b184feb8 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:18:10 -0500 Subject: [PATCH 05/23] Delete packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- .../__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp deleted file mode 100644 index d7b3d3464e..0000000000 --- a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp +++ /dev/null @@ -1 +0,0 @@ -DELETE PG899423.ZOSFILE.ENCO#ED.VSAM.A196525 CLUSTER \ No newline at end of file From 85db2c49f7bed9b9cf618ce16a6cbcbf043dcdd3 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:18:22 -0500 Subject: [PATCH 06/23] Delete packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- .../__tests__/__system__/methods/invoke/DefineVSAM.ams.temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp deleted file mode 100644 index 9bd65e97a9..0000000000 --- a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp +++ /dev/null @@ -1 +0,0 @@ -DEFINE CLUSTER (NAME (PG899423.ZOSFILE.ENCO#ED.VSAM.A196525) CYLINDERS (5 2 ) VOLUMES(TSOE20)) \ No newline at end of file From d45ef6ca72bca230b7525916d6ae100d7200eb0e Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:58:03 -0500 Subject: [PATCH 07/23] fixed en.ts error Signed-off-by: Pujal --- packages/cli/src/zosfiles/-strings-/en.ts | 2 +- .../__tests__/DeferredPromise.unit.test.ts | 20 +++++++++---------- .../src/utilities/src/DeferredPromise.ts | 20 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/zosfiles/-strings-/en.ts b/packages/cli/src/zosfiles/-strings-/en.ts index 10aa5b7648..8649f8866b 100644 --- a/packages/cli/src/zosfiles/-strings-/en.ts +++ b/packages/cli/src/zosfiles/-strings-/en.ts @@ -196,7 +196,7 @@ export default { }, OPTIONS: { REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set", - SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set." + + SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set. " + "This option will prompt to confirm." }, EXAMPLES: { diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 146067c919..7ab1cf1bbe 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,13 +1,13 @@ -/** - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - * - */ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ import { DeferredPromise, DeferredPromiseStatus } from "../src/DeferredPromise"; diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index 20b8fcfd22..65324d0855 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,13 +1,13 @@ -/** - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - * - */ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ /* Status of the deferred promise */ export enum DeferredPromiseStatus { From 37c02a58ef838f9f3ad396e4c4f4de4bbf9147e4 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 14:15:50 -0500 Subject: [PATCH 08/23] updated snapshots Signed-off-by: Pujal --- .../cli.files.copy.ds.integration.test.ts.snap | 6 +++--- .../copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index 7c77bb278b..c439ffd6e3 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -40,7 +40,7 @@ exports[`Copy Data Set should display the help 1`] = ` --safe-replace | --safe-rep (boolean) Specify this option as true if you wish to replace like-named members or the - content of the target data set.This option will prompt to confirm. + content of the target data set. This option will prompt to confirm. --response-timeout | --rto (number) @@ -180,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `; diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index a99ecb2810..0bc8ffcfc4 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -14,7 +14,7 @@ Array [ "aliases": Array [ "safe-rep", ], - "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set.This option will prompt to confirm.", + "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm.", "name": "safe-replace", "type": "boolean", }, From f18a8d65848ae62b2c7486bcdc8345258a045481 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:04:17 -0500 Subject: [PATCH 09/23] updated handler Signed-off-by: Pujal --- packages/cli/src/zosfiles/copy/ds/Ds.handler.ts | 3 +-- .../src/utilities/__tests__/DeferredPromise.unit.test.ts | 2 +- packages/imperative/src/utilities/src/DeferredPromise.ts | 2 +- packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 8689ec306d..4d81a1c3a9 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -35,8 +35,7 @@ export default class DsHandler extends ZosFilesBaseHandler { private promptForSafeReplace(console: IHandlerResponseConsoleApi) { return async (targetDSN: string) => { const answer: string = await console.prompt( - `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. - Are you sure you want to continue? [y/N]: ` + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. Are you sure you want to continue? [y/N]: ` ); return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); }; diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 7ab1cf1bbe..7e0806ce4a 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,4 +1,4 @@ -/* +/** * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index 65324d0855..fdcec4b54a 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,4 +1,4 @@ -/* +/** * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts index de9e68662d..23d75b7967 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts @@ -30,7 +30,7 @@ export interface ICopyDatasetOptions extends IZosFilesOptions { enq?: string; /** - * Replace option (DEPRECATED) + * Replace option * @type {boolean} */ replace?: boolean; From 0f41919540f89971fec413553a45cfa3e1f6f137 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:15:40 -0500 Subject: [PATCH 10/23] deferred promise format fix Signed-off-by: Pujal --- packages/cli/src/zosfiles/copy/ds/Ds.handler.ts | 3 ++- .../src/utilities/__tests__/DeferredPromise.unit.test.ts | 2 +- packages/imperative/src/utilities/src/DeferredPromise.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 4d81a1c3a9..40913a7d5c 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -35,7 +35,8 @@ export default class DsHandler extends ZosFilesBaseHandler { private promptForSafeReplace(console: IHandlerResponseConsoleApi) { return async (targetDSN: string) => { const answer: string = await console.prompt( - `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. Are you sure you want to continue? [y/N]: ` + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` ); return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); }; diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 7e0806ce4a..7ab1cf1bbe 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,4 +1,4 @@ -/** +/* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index fdcec4b54a..65324d0855 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,4 +1,4 @@ -/** +/* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html From 6f70fd0f62caeb11c1269d67308ed4c401754edf Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:54:01 -0500 Subject: [PATCH 11/23] imperative changelog update Signed-off-by: Pujal --- packages/imperative/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 059c83a266..6d269b63d1 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes +- Format fix: `DeferredPromise` and `DeferredPromise.unit.test` comment format changed to match standard. + ## `8.11.0` - Enhancement: Added `DeferredPromise` class to Imperative to provide utilities for data synchronization. [#2405](https://github.com/zowe/zowe-cli/pull/2405) From 61ae6859e591f90c7e0ce0a58e5543b9a9509055 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 13:57:48 -0500 Subject: [PATCH 12/23] removed promptFn from ICrossLparCopyDataSetOptions.ts Signed-off-by: Pujal --- .../src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts index 67eb680818..dc954fe028 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts @@ -44,11 +44,4 @@ export interface ICrossLparCopyDatasetOptions extends ICopyDatasetOptions { * @type {boolean} */ overwrite?: boolean; - - /** - * Prompt callback that will be invoked before overwiting a data set. - * @param targetDSN Name of data set that already exists - * @returns True if target data set should be overwritten - */ - promptFn?: (targetDSN: string) => Promise; } From b6a671a104d2f43e4be138a75bcd86a35caf6188 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 16:01:17 -0500 Subject: [PATCH 13/23] updated changelogs Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 2 +- packages/zosfiles/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 84d227ac06..51fc3ad646 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes -- BugFix: Added a `--safe-replace` option that prompts the user to confirm overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- BugFix: The `zowe zos-files copy data-set` command overwrites the contents of the target data set without user confirmation. A `--safe-replace` option was added which prompts the user to confirm before overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `zowe zos-files copy data-set` command no longer requires the target data set to be preallocated. [##2349] (https://github.com/zowe/zowe-cli/issues/2349) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index f383845b5e..8b0d9495a9 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes -- Bug Fix: The `Copy.data.set` function now prompts the user to confirm overwriting the contents of the target data set with the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From 98cdedbd4cbed1bfc2c0161975ef0502f67a0898 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 16:01:46 -0500 Subject: [PATCH 14/23] updated changelogs Signed-off-by: Pujal --- packages/zosfiles/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 8b0d9495a9..fec4b4770d 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes -- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with the addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From 7bbb5c5e20da038e8a94b19c04365600361c7f4b Mon Sep 17 00:00:00 2001 From: Pujal Date: Tue, 21 Jan 2025 15:22:42 -0500 Subject: [PATCH 15/23] updated code coverage for handler Signed-off-by: Pujal --- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 38 ++++++++++++++++++- .../__unit__/methods/copy/Copy.unit.test.ts | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index 7f394f43fe..bbf9abfdfe 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -160,11 +160,47 @@ describe("DsHandler", () => { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, "enq": commandParameters.arguments.enq, "replace": commandParameters.arguments.replace, - "reseponseTimeout": commandParameters.arguments.responseTimeout, + "responseTimeout": commandParameters.arguments.responseTimeout, "safeReplace": commandParameters.arguments.safeReplace, "promptFn": expect.any(Function) } ); expect(response).toBe(defaultReturn); }); + it("should prompt the user and return true when input is 'y'", async () => { + const handler = new DsHandler(); + + expect(handler).toBeInstanceOf(ZosFilesBaseHandler); + const fromDataSetName = "ABCD"; + const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + + const commandParameters: any = { + arguments: { + fromDataSetName, + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } + } + }; + const promptMock = jest.fn(); + promptMock.mockResolvedValue("y"); + + const promptFn = (handler as any)["promptForSafeReplace"]({ prompt: promptMock }); + const result = await promptFn(commandParameters.arguments.toDataSetName); + + expect(promptMock).toHaveBeenCalledWith( + "The dataset 'EFGH' exists on the target system. This copy will result in data loss." + + " Are you sure you want to continue? [y/N]: " + ); + expect(result).toBe(true); + }); }); diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 7934c7df05..9fa1cea7e1 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -471,6 +471,7 @@ describe("Copy", () => { safeReplace: true, promptFn } ); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; @@ -491,7 +492,6 @@ describe("Copy", () => { )).rejects.toThrow(new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message })); expect(promptFn).toHaveBeenCalledWith(toDataSetName); - }); it("should not throw error if safeReplace has value of false", async () => { From 12827c9188e37fedfb0d3a39974139ec047c700b Mon Sep 17 00:00:00 2001 From: Pujal Date: Tue, 21 Jan 2025 16:30:05 -0500 Subject: [PATCH 16/23] updated handler unit test Signed-off-by: Pujal --- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index bbf9abfdfe..2975ad8629 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -198,9 +198,45 @@ describe("DsHandler", () => { const result = await promptFn(commandParameters.arguments.toDataSetName); expect(promptMock).toHaveBeenCalledWith( - "The dataset 'EFGH' exists on the target system. This copy will result in data loss." + - " Are you sure you want to continue? [y/N]: " + `The dataset '${toDataSetName}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` ); expect(result).toBe(true); }); + it("should prompt the user and return true when input is 'N'", async () => { + const handler = new DsHandler(); + + expect(handler).toBeInstanceOf(ZosFilesBaseHandler); + const fromDataSetName = "ABCD"; + const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + + const commandParameters: any = { + arguments: { + fromDataSetName, + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } + } + }; + const promptMock = jest.fn(); + promptMock.mockResolvedValue("N"); + + const promptFn = (handler as any)["promptForSafeReplace"]({ prompt: promptMock }); + const result = await promptFn(commandParameters.arguments.toDataSetName); + + expect(promptMock).toHaveBeenCalledWith( + `The dataset '${toDataSetName}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` + ); + expect(result).toBe(false); + }); }); From 3fc5fb5fd2e7322022a66958ad90f5425e5c7fd2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 15:38:07 -0500 Subject: [PATCH 17/23] data set copy aborted message fix - PR comment Signed-off-by: Pujal --- packages/zosfiles/src/constants/ZosFiles.messages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/src/constants/ZosFiles.messages.ts b/packages/zosfiles/src/constants/ZosFiles.messages.ts index 33d74079ec..9c4b9d8e7a 100644 --- a/packages/zosfiles/src/constants/ZosFiles.messages.ts +++ b/packages/zosfiles/src/constants/ZosFiles.messages.ts @@ -678,7 +678,7 @@ export const ZosFilesMessages: { [key: string]: IMessageDefinition } = { * @type {IMessageDefinition} */ datasetCopiedAborted: { - message: "Data set copied aborted. The existing target data set was not overwritten." + message: "Data set copy aborted. The existing target data set was not overwritten." }, /** From da4fe158602206898c3fe5154f641cae2d9bd9d2 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:10:13 -0500 Subject: [PATCH 18/23] Update packages/cli/CHANGELOG.md Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- packages/cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index a9cd026349..8bb8e266d1 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes + - BugFix: The `zowe zos-files copy data-set` command overwrites the contents of the target data set without user confirmation. A `--safe-replace` option was added which prompts the user to confirm before overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## `8.12.0` From f21d2eaf44471759a223db030497ac2cb6dae10a Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:10:36 -0500 Subject: [PATCH 19/23] Update packages/zosfiles/CHANGELOG.md Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- packages/zosfiles/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 84b4d226b3..ac0caa7519 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes + - Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with the addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## `8.12.0` From 68b2efb4b559f916221ed1a350664d04d0c0fff8 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:16:09 -0500 Subject: [PATCH 20/23] updated snapshot Signed-off-by: Pujal --- .../utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap b/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap index 59245f88cb..61acd4749f 100644 --- a/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap +++ b/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap @@ -85,7 +85,7 @@ Object { "message": "Data set allocation aborted. The \\"allocate like\\" data set was not found.", }, "datasetCopiedAborted": Object { - "message": "Data set copied aborted. The existing target data set was not overwritten.", + "message": "Data set copy aborted. The existing target data set was not overwritten.", }, "datasetCopiedAbortedNoPDS": Object { "message": "Data set copied aborted. Copying from a PDS to PDS is not supported when using the 'dsclp' option.", From 956f3a5f4f3c6e409bacb4c874a484d3f1a37ae2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:26:51 -0500 Subject: [PATCH 21/23] updated --sr alias Signed-off-by: Pujal --- .../copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap | 1 + packages/cli/src/zosfiles/copy/ds/Ds.definition.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index 0bc8ffcfc4..7e0c8a3fa9 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -13,6 +13,7 @@ Array [ Object { "aliases": Array [ "safe-rep", + "--sr", ], "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm.", "name": "safe-replace", diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts index 959be54458..a3d9cb4b28 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts @@ -56,7 +56,7 @@ export const DsDefinition: ICommandDefinition = { }, { name: "safe-replace", - aliases: ["safe-rep"], + aliases: ["safe-rep", "--sr"], description: strings.OPTIONS.SAFE_REPLACE, type: "boolean", } From 2f15736aa03b291a1e14e11fc3b53741ac8779e7 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:34:20 -0500 Subject: [PATCH 22/23] updated system tests Signed-off-by: Pujal --- .../__tests__/__system__/methods/copy/Copy.system.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index db23bfe4fa..da8fd8b947 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -713,7 +713,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -853,7 +853,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -967,7 +967,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -1082,7 +1082,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); From 6591bee130c6f1eb45fd96d470a6e7c380beea83 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 30 Jan 2025 08:41:47 -0500 Subject: [PATCH 23/23] integration snapshots Signed-off-by: Pujal --- .../cli.files.copy.ds.integration.test.ts.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index c439ffd6e3..c432eb3b15 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -37,7 +37,7 @@ exports[`Copy Data Set should display the help 1`] = ` Specify this option as true if you wish to replace like-named members in the target data set - --safe-replace | --safe-rep (boolean) + --safe-replace | --safe-rep | ----sr (boolean) Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm. @@ -180,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep | ----sr (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep | ----sr (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `;