diff --git a/__tests__/__packages__/cli-test-utils/package.json b/__tests__/__packages__/cli-test-utils/package.json index d313d72c5a..0ee125abdf 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.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544" + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" diff --git a/lerna.json b/lerna.json index a0c03b25f8..0088d1bffa 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index afc2d16c49..e7fbe458cc 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.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544" + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" @@ -16365,21 +16365,21 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544", - "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408291544", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809", + "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408301809", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -16392,7 +16392,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.0.0-next.202408291544", + "@zowe/cli-test-utils": "8.0.0-next.202408301809", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" @@ -16401,7 +16401,7 @@ "node": ">=18.12.0" }, "optionalDependencies": { - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408301809" } }, "packages/cli/node_modules/brace-expansion": { @@ -16448,15 +16448,15 @@ }, "packages/core": { "name": "@zowe/core-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { "comment-json": "~4.2.3", "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16467,7 +16467,7 @@ }, "packages/imperative": { "name": "@zowe/imperative", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { "@types/yargs": "^17.0.32", @@ -16520,7 +16520,7 @@ "@types/pacote": "^11.1.8", "@types/progress": "^2.0.7", "@types/stack-trace": "^0.0.33", - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408291544", + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408301809", "concurrently": "^8.0.0", "cowsay": "^1.6.0", "deep-diff": "^1.0.0", @@ -16661,16 +16661,16 @@ }, "packages/provisioning": { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { "js-yaml": "^4.1.0" }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16682,7 +16682,7 @@ }, "packages/secrets": { "name": "@zowe/secrets-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "hasInstallScript": true, "license": "EPL-2.0", "devDependencies": { @@ -16695,15 +16695,15 @@ }, "packages/workflows": { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16715,12 +16715,12 @@ }, "packages/zosconsole": { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16732,16 +16732,16 @@ }, "packages/zosfiles": { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16773,15 +16773,15 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16793,12 +16793,12 @@ }, "packages/zoslogs": { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16810,12 +16810,12 @@ }, "packages/zosmf": { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16827,15 +16827,15 @@ }, "packages/zostso": { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" @@ -16847,15 +16847,15 @@ }, "packages/zosuss": { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "license": "EPL-2.0", "dependencies": { "ssh2": "^1.15.0" }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" diff --git a/packages/cli/package.json b/packages/cli/package.json index f3cd980826..2a12662d17 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "zoweVersion": "v3.0.0-prerelease", "description": "Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.", "author": "Zowe", @@ -58,17 +58,17 @@ "preshrinkwrap": "node ../../scripts/rewriteShrinkwrap.js" }, "dependencies": { - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544", - "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408291544", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809", + "@zowe/provisioning-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-logs-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zos-workflows-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408301809", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -78,13 +78,13 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.0.0-next.202408291544", + "@zowe/cli-test-utils": "8.0.0-next.202408301809", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" }, "optionalDependencies": { - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408301809" }, "engines": { "node": ">=18.12.0" diff --git a/packages/core/package.json b/packages/core/package.json index fab341dedf..06d2dbdcdd 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/core-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 31e3b1db54..0a98089e66 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to the Imperative package will be documented in this file. +## `8.0.0-next.202408301809` + +- LTS Breaking: Removed the following obsolete V1 profile classes/functions: + - `CliProfileManager` + - `CliUtils.getOptValueFromProfiles` + - `CommandProfiles` + - `ProfileValidator` + + See [`8.0.0-next.202408271330`](#800-next202408271330) for replacements +- Next Breaking: Changed 2nd parameter of `CliUtils.getOptValuesFromConfig` method from type `ICommandDefinition` to `ICommandProfile`. +- Next Breaking: Renamed `ConfigSecure.secureFieldsForLayer` method to `securePropsForLayer`. + ## `8.0.0-next.202408291544` - Enhancement: Added a new SDK method (`ConfigSecure.secureFieldsForLayer`) to allow developers to get vault content in the context of the specified layer. [#2206](https://github.com/zowe/zowe-cli/issues/2206) @@ -10,13 +22,15 @@ All notable changes to the Imperative package will be documented in this file. ## `8.0.0-next.202408271330` - LTS Breaking: [#2231](https://github.com/zowe/zowe-cli/issues/2231) - - Removed the obsolete V1 `profiles` property from `IHandlerParameters` interface + - Removed the obsolete V1 `profiles` property from `IHandlerParameters` interface - Use `IHandlerParameters.arguments` to access profile properties in a command handler - Deprecated the following obsolete V1 profile interfaces: - `IProfileTypeConfiguration.dependencies` - For team config, use nested profiles instead - `IProfileTypeConfiguration.validationPlanModule` - For team config, validate with JSON schema instead - Deprecated the following obsolete V1 profile classes/functions: - - `CliUtils.getOptValueFromProfiles` - Use `getOptValuesFromConfig` instead to load from team config - - `CommandProfiles` - Use the `V1ProfileRead` class if you still need to read V1 profiles + - `CliProfileManager` - Use `ProfileInfo` class to manage team config profiles + - `CliUtils.getOptValueFromProfiles` - Use `CliUtils.getOptValuesFromConfig` to load properties from team config + - `CommandProfiles` - Use `ImperativeConfig.instance.config.api.profiles` to load profiles from team config + - `ProfileValidator` - No direct replacement ## `8.0.0-next.202408231832` diff --git a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts b/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts deleted file mode 100644 index 4f5ce662af..0000000000 --- a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManager.integration.test.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* -* 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. -* -*/ - -/* eslint-disable deprecation/deprecation */ - -import * as TestUtil from "../../../TestUtil"; -import { TestLogger } from "../../../../src/TestLogger"; -import { CliProfileManager } from "../../../../../src/cmd/src/profiles/CliProfileManager"; -import { ICommandProfileTypeConfiguration } from "../../../../../src/cmd"; -import { ProfileUtils } from "../../../../../src/profiles"; -import { ITestEnvironment } from "../../../../__src__/environment/doc/response/ITestEnvironment"; -import { SetupTestEnvironment } from "../../../../__src__/environment/SetupTestEnvironment"; -import { bananaProfile, getConfig, PROFILE_TYPE } from "./CliProfileManagerTestConstants"; - -let TEST_ENVIRONMENT: ITestEnvironment; - -describe("Cli Profile Manager", () => { - const testLogger = TestLogger.getTestLogger(); - const profileTypeOne = "banana"; - - beforeAll(async () => { - TEST_ENVIRONMENT = await SetupTestEnvironment.createTestEnv({ - cliHomeEnvVar: "CMD_CLI_CLI_HOME", - testName: "basic_profile_mgr" - }); - }); - - afterAll(() => { - TestUtil.rimraf(TEST_ENVIRONMENT.workingDir); - }); - - it("should create a profile manager", async () => { - let caughtError: Error = new Error(""); - let newProfMgr; - - try { - // Create a manager instance - newProfMgr = new CliProfileManager({ - logger: TestLogger.getTestLogger(), - type: PROFILE_TYPE.BANANA, - typeConfigurations: [bananaProfile] - }); - } catch (e) { - caughtError = e; - TestLogger.error(caughtError.message); - } - - expect(newProfMgr).not.toBeNull(); - expect(caughtError.message).toEqual(""); - }); - - it("should be able to retrieve all defined types after init", async function () { - const Imperative = require("../../../../../src/imperative/src/Imperative").Imperative; - const ImperativeConfig = require("../../../../../src/utilities/src/ImperativeConfig").ImperativeConfig; - - const config = getConfig(TEST_ENVIRONMENT.workingDir); - await Imperative.init(config); - expect(ProfileUtils.getAllTypeNames(ImperativeConfig.instance.loadedConfig.profiles).length).toEqual(Object.keys(PROFILE_TYPE).length); - expect(ProfileUtils.getAllTypeNames(ImperativeConfig.instance.loadedConfig.profiles)).toContain("banana"); - }); - - it("should be able to automatically map command line options to " + - "profile fields without a handler for a simple single layer " + - "profile schema", async () => { - // use different option names than the field names - // of the profile to test that the properties are associated - // with the correct command line options - const configs: ICommandProfileTypeConfiguration[] = [{ - type: profileTypeOne, - schema: { - type: "object", - title: "test profile", - description: "test profile", - properties: { - property1: { - type: "number", - optionDefinition: { - name: "differentProperty1", type: "number", description: "property1" - } - }, - property2: { - type: "string", - optionDefinition: { - name: "differentProperty2", type: "string", description: "property2" - } - } - }, - required: ["property1"] - }, - }]; - - let caughtError; - try { - new CliProfileManager({ - type: profileTypeOne, - logger: testLogger, - typeConfigurations: configs - }); - } catch (error) { - caughtError = error; - } - expect(caughtError).toBeUndefined(); - }); -}); diff --git a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManagerTestConstants.ts b/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManagerTestConstants.ts deleted file mode 100644 index a7e71d764f..0000000000 --- a/packages/imperative/__tests__/src/packages/cmd/__integration__/CliProfileManagerTestConstants.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* 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 { IImperativeConfig } from "../../../../../src/index"; -import * as TestUtils from "../../../TestUtil"; -import { ICommandProfileTypeConfiguration } from "../../../../../src/cmd"; - -/** - * Get a config and set the home directory. - * @export - * @param {string} home - * @returns - */ -export function getConfig(home: string) { - const copy = JSON.parse(JSON.stringify(SAMPLE_IMPERATIVE_CONFIG_WITH_PROFILES)); - copy.defaultHome = home; - return copy; -} - -export const PROFILE_TYPE = { - BANANA: "banana", - SECURE_ORANGE: "secure_orange", - STRAWBERRY: "strawberry" -}; - -export const bananaProfile: ICommandProfileTypeConfiguration = { - type: PROFILE_TYPE.BANANA, - schema: { - type: "object", - title: "The Banana command profile schema", - description: "The Banana command profile schema", - properties: { - age: { - optionDefinition: { - description: "The age of the Banana", - type: "number", - name: "age", aliases: ["a"], - required: true - }, - type: "number", - }, - }, - required: ["age"] - } -}; - -const secureOrangeProfile: ICommandProfileTypeConfiguration = { - type: PROFILE_TYPE.SECURE_ORANGE, - schema: { - type: "object", - title: "The secure_orange command profile schema", - description: "The secure_orange command profile schema", - properties: { - username: { - optionDefinition: { - description: "The username of the secure_orange", - type: "string", - name: "username", - }, - type: "string", - }, - password: { - optionDefinition: { - description: "The password of the secure_orange", - type: "string", - name: "password", - }, - type: "string", - }, - }, - required: [] - } -}; - -const strawberryProfile: ICommandProfileTypeConfiguration = { - type: PROFILE_TYPE.STRAWBERRY, - schema: { - type: "object", - title: "The strawberry command profile schema", - description: "The strawberry command profile schema", - properties: { - age: { - optionDefinition: { - description: "The age of the strawberry", - type: "number", - name: "age", aliases: ["a"], - required: true - }, - type: "number", - }, - }, - required: ["age"] - } -}; - -export const PROFILE_TYPE_CONFIGURATION: ICommandProfileTypeConfiguration[] = [ - bananaProfile, - secureOrangeProfile, - strawberryProfile -]; - -export const BANANA_AGE: number = 1000; -export const SAMPLE_IMPERATIVE_CONFIG_WITH_PROFILES: IImperativeConfig = { - definitions: [ - { - name: "hello", - type: "command", - options: [], - description: "my command" - } - ], - productDisplayName: "My product (packagejson)", - defaultHome: TestUtils.TEST_HOME, - rootCommandDescription: "My Product CLI", - profiles: PROFILE_TYPE_CONFIGURATION -}; diff --git a/packages/imperative/package.json b/packages/imperative/package.json index a726a4e4c8..2b337b056b 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/imperative", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "description": "framework for building configurable CLIs", "author": "Zowe", "license": "EPL-2.0", @@ -95,7 +95,7 @@ "@types/pacote": "^11.1.8", "@types/progress": "^2.0.7", "@types/stack-trace": "^0.0.33", - "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408291544", + "@zowe/secrets-for-zowe-sdk": "8.0.0-next.202408301809", "concurrently": "^8.0.0", "cowsay": "^1.6.0", "deep-diff": "^1.0.0", diff --git a/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts deleted file mode 100644 index 714dfc7d44..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/CliProfileManager.unit.test.ts +++ /dev/null @@ -1,182 +0,0 @@ -/* -* 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. -* -*/ - -/* eslint-disable deprecation/deprecation */ - -import { ImperativeError } from "../../../error"; -import { TestLogger } from "../../../../__tests__/src/TestLogger"; -import { APPLE_PROFILE_TYPE, ONLY_APPLE } from "./TestConstants"; -import { CliProfileManager } from "../../src/profiles/CliProfileManager"; -import { IProfileTypeConfiguration } from "../../../profiles/src/doc/config/IProfileTypeConfiguration"; - -describe("Basic Profile Manager Constructor", () => { - it("should detect no parms when instantiating", () => { - let error; - try { - new CliProfileManager(undefined as any); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("Expect Error: Profile Manager input parms not supplied"); - }); - - it("should detect that no type configuration is supplied", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: undefined, - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("V1 profiles are no longer read from disk. " + - "You can supply the profile type configurations to the profile manager constructor" - ); - }); - - it("should detect that the type configuration is an empty array", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: [], - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("V1 profiles are no longer read from disk. " + - "You can supply the profile type configurations to the profile manager constructor" - ); - }); - - it("should detect if the type is undefined", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: undefined as any, - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("Expect Error: No profile type supplied on the profile manager parameters"); - }); - - it("should detect if the type is blank", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: " ", - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("Expect Error: No profile type supplied on the profile manager parameters"); - }); - - it("should detect that a type not found within the configurations", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: "bad_apple", - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - TestLogger.info(error); - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain( - "Expect Error: Could not locate the profile type configuration for \"bad_apple\" within the input configuration list passed." - ); - }); - - it("should allow us to instantiate the cli profile manager", () => { - let error; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - TestLogger.info("Profile Manager Created"); - } catch (e) { - error = e; - TestLogger.error(e); - } - expect(error).toBeUndefined(); - }); - - it("should detect that a schema definition document is attempting to overload 'type'", () => { - const copy: IProfileTypeConfiguration[] = JSON.parse(JSON.stringify(ONLY_APPLE)); - copy[0].schema.properties.type = {type: "boolean"}; - let caughtError; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - } catch (error) { - caughtError = error; - } - expect(caughtError).toBeUndefined(); - }); - - it("should detect that a schema definition document is attempting to overload 'name'", () => { - const copy: IProfileTypeConfiguration[] = JSON.parse(JSON.stringify(ONLY_APPLE)); - copy[0].schema.properties.name = {type: "boolean"}; - let caughtError; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - } catch (error) { - caughtError = error; - } - expect(caughtError).toBeUndefined(); - }); - - it("should detect that a schema definition document is attempting to overload 'dependencies'", () => { - const copy: IProfileTypeConfiguration[] = JSON.parse(JSON.stringify(ONLY_APPLE)); - copy[0].schema.properties.dependencies = {type: "boolean"}; - let caughtError; - try { - new CliProfileManager({ - typeConfigurations: ONLY_APPLE, - type: APPLE_PROFILE_TYPE, - logger: TestLogger.getTestLogger() - }); - } catch (error) { - caughtError = error; - } - expect(caughtError).toBeUndefined(); - }); -}); diff --git a/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts deleted file mode 100644 index a23e844942..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/CommandProfileLoader.unit.test.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* -* 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. -* -*/ - -/* eslint-disable deprecation/deprecation */ - -import { CommandProfileLoader } from "../../src/profiles/CommandProfileLoader"; -import { ICommandDefinition } from "../../src/doc/ICommandDefinition"; -import { TestLogger } from "../../../../__tests__/src/TestLogger"; -import { CommandProfiles } from "../../src/profiles/CommandProfiles"; -import { ImperativeError } from "../../../error"; -import { IProfile, IProfileLoaded } from "../../../profiles"; - -const PROFILE_BANANA_TYPE: string = "banana"; - -const SAMPLE_COMMAND_NO_PROFILE: ICommandDefinition = { - name: PROFILE_BANANA_TYPE, - description: "The banana command", - type: "command" -}; - -const SAMPLE_COMMAND_PROFILE: ICommandDefinition = { - name: PROFILE_BANANA_TYPE, - description: "The banana command", - type: "command", - profile: { - required: [PROFILE_BANANA_TYPE] - } -}; - -describe("Command Profile Loader", () => { - - it("should allow us to create an instance", () => { - const loader = CommandProfileLoader.loader({ - commandDefinition: SAMPLE_COMMAND_NO_PROFILE, - logger: TestLogger.getTestLogger() - }); - expect(loader).toBeDefined(); - }); - - it("should allow us to create an instance and load nothing", async () => { - const loaded: CommandProfiles = await CommandProfileLoader.loader({ - commandDefinition: SAMPLE_COMMAND_NO_PROFILE, - logger: TestLogger.getTestLogger() - }).loadProfiles({ _: undefined as any, $0: undefined as any }); - expect(loaded).toBeDefined(); - }); - - it("should allow us to create an instance without a logger", () => { - const loader = CommandProfileLoader.loader({ - commandDefinition: SAMPLE_COMMAND_NO_PROFILE, - }); - expect(loader).toBeDefined(); - }); - - it("should allow us to create an instance (directly with constructor)", () => { - const loader = new CommandProfileLoader(SAMPLE_COMMAND_NO_PROFILE); - expect(loader).toBeDefined(); - }); - - it("should detect a bad logger instance", () => { - let error; - try { - let logger: any = TestLogger.getTestLogger(); - logger = {bad: "logger"}; - CommandProfileLoader.loader({ - commandDefinition: SAMPLE_COMMAND_NO_PROFILE, - logger - }); - } catch (e) { - error = e; - } - expect(error).toBeDefined(); - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain('Expect Error: Could not construct the profile loader. The "logger" supplied is not of type Logger.'); - }); - - it("should detect missing command definitions when creating the loader", () => { - let error; - try { - CommandProfileLoader.loader({ - commandDefinition: undefined as any, - logger: TestLogger.getTestLogger() - }); - } catch (e) { - error = e; - } - expect(error).toBeDefined(); - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toContain("Expect Error: Could not construct the profile loader. No command definition supplied."); - }); - - it("should never read V1 profiles", async () => { - const emptyProfileMap: Map = new Map(); - const emptyProfileMetaMap: Map = new Map(); - const noProfilesLoaded = new CommandProfiles(emptyProfileMap, emptyProfileMetaMap); - - // because we have a team config, we should load no old-scemptyProfileMaphool profiles - const loadedCmdProfiles: CommandProfiles = await CommandProfileLoader.loader({ - commandDefinition: SAMPLE_COMMAND_PROFILE, - logger: TestLogger.getTestLogger() - }).loadProfiles({ _: undefined as any, $0: undefined as any }); - - expect(loadedCmdProfiles).toEqual(noProfilesLoaded); - }); -}); diff --git a/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts b/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts deleted file mode 100644 index a8d2397c8a..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/CommandProfiles.unit.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* -* 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. -* -*/ - -/* eslint-disable deprecation/deprecation */ - -import { IProfile, IProfileLoaded } from "../../../profiles"; -import { CommandProfiles } from "../../src/profiles/CommandProfiles"; -import { ImperativeError } from "../../../error"; - -const BANANA_PROFILE_TYPE: string = "banana"; -const STRAWBERRY_PROFILE_TYPE: string = "strawberry"; - -describe("Command Profiles", () => { - it("should should allow us to create an instance", () => { - let caughtError; - try { - const profiles = new CommandProfiles(new Map()); - } catch (error) { - caughtError = error; - } - expect(caughtError).toBeUndefined(); - }); - - it("should allow us to create an instance with map values", () => { - const map = new Map(); - map.set(STRAWBERRY_PROFILE_TYPE, [{ - name: "great", - type: STRAWBERRY_PROFILE_TYPE, - age: 1 - }, { - name: "awesome", - type: STRAWBERRY_PROFILE_TYPE, - age: 2 - }]); - const metaMap = new Map(); - metaMap.set(STRAWBERRY_PROFILE_TYPE, [{ - name: "great", - type: STRAWBERRY_PROFILE_TYPE, - profile: { - age: 1 - }, - message: "just right", - failNotFound: false - }, - { - name: "gross", - type: STRAWBERRY_PROFILE_TYPE, - profile: { - age: 3 - }, - message: "too old", - failNotFound: false - }]); - - const profiles = new CommandProfiles(map, metaMap); - expect(profiles).toMatchSnapshot(); - }); - - it("should detect missing parameters", () => { - let error; - try { - new CommandProfiles(undefined); - } catch (e) { - error = e; - } - expect(error).toBeDefined(); - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toMatchSnapshot(); - }); - - it("should detect that the parameters are not a map", () => { - let error; - try { - const map = { not: "a-map" }; - new CommandProfiles(map as any); - } catch (e) { - error = e; - } - expect(error).toBeDefined(); - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toMatchSnapshot(); - }); -}); diff --git a/packages/imperative/src/cmd/__tests__/profiles/__snapshots__/CommandProfiles.unit.test.ts.snap b/packages/imperative/src/cmd/__tests__/profiles/__snapshots__/CommandProfiles.unit.test.ts.snap deleted file mode 100644 index ce0dc5c975..0000000000 --- a/packages/imperative/src/cmd/__tests__/profiles/__snapshots__/CommandProfiles.unit.test.ts.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Command Profiles should allow us to create an instance with map values 1`] = ` -CommandProfiles { - "mMap": Map { - "strawberry" => Array [ - Object { - "age": 1, - "name": "great", - "type": "strawberry", - }, - Object { - "age": 2, - "name": "awesome", - "type": "strawberry", - }, - ], - }, - "mMetaMap": Map { - "strawberry" => Array [ - Object { - "failNotFound": false, - "message": "just right", - "name": "great", - "profile": Object { - "age": 1, - }, - "type": "strawberry", - }, - Object { - "failNotFound": false, - "message": "too old", - "name": "gross", - "profile": Object { - "age": 3, - }, - "type": "strawberry", - }, - ], - }, -} -`; - -exports[`Command Profiles should detect missing parameters 1`] = `"Expect Error: Command Profiles Internal Error: No map was supplied."`; - -exports[`Command Profiles should detect that the parameters are not a map 1`] = `"Expect Error: Command Profiles Internal Error: The \\"map\\" supplied is not an instance of a map."`; diff --git a/packages/imperative/src/cmd/index.ts b/packages/imperative/src/cmd/index.ts index db5ee98923..d09801e1dc 100644 --- a/packages/imperative/src/cmd/index.ts +++ b/packages/imperative/src/cmd/index.ts @@ -54,8 +54,6 @@ export * from "./src/help/WebHelpGenerator"; export * from "./src/doc/profiles/definition/ICommandProfile"; export * from "./src/doc/profiles/definition/ICommandProfileTypeConfiguration"; -export * from "./src/profiles/CliProfileManager"; - // export * from "./src/syntax/SyntaxValidator"; // export * from "./src/utils/CommandUtils"; @@ -73,7 +71,6 @@ export * from "./src/profiles/CliProfileManager"; // export * from "./src/CommandPreparer"; // export * from "./src/CommandProcessor"; -export * from "./src/profiles/CommandProfiles"; export * from "./src/response/CommandResponse"; export * from "./src/response/HandlerResponse"; diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index 5ff82ff5eb..a3d0f077d0 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -898,7 +898,7 @@ export class CommandProcessor { // Build an object that contains all the options loaded from config if (this.mConfig != null) { // Merge the arguments from the config into the CLI args - const profArgs = CliUtils.getOptValuesFromConfig(this.mConfig, this.definition, args, allOpts); + const profArgs = CliUtils.getOptValuesFromConfig(this.mConfig, this.definition.profile, args, allOpts); this.log.trace(`Arguments extracted from the config:\n${inspect(profArgs)}`); args = CliUtils.mergeArguments(profArgs, args); } diff --git a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts deleted file mode 100644 index 82c97f0c94..0000000000 --- a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts +++ /dev/null @@ -1,193 +0,0 @@ -/* -* 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 { ImperativeExpect } from "../../../expect"; -import { inspect } from "util"; -import { Logger } from "../../../logger"; -import { ImperativeError } from "../../../error"; -import { ICommandProfileTypeConfiguration } from "../doc/profiles/definition/ICommandProfileTypeConfiguration"; -import { - IProfileManager, - IProfileSchema, -} from "../../../profiles/src/doc"; - -/** - * The CLI profile manager contains methods to manage Zowe profiles. Profiles - * are user configuration documents intended to be used on commands, as a convenience, to supply a slew of additional - * input and configuration (normally more than would be feasible as command arguments). See the "IProfile" interface - * for a detailed description of profiles, their use case, and examples. - * - * The Profile Manager no longer reads V1 profile from disk. It only processes profile information from a - * command's definition. The Config class now handles reading profiles from disk stored in a zowe.config.json file. - * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles - */ -export class CliProfileManager { - /** - * Parameters passed on the constructor (normally used to create additional instances of profile manager objects) - * @private - * @type {IProfileManager} - * @memberof CliProfileManager - */ - private mConstructorParms: IProfileManager; - - /** - * The full set of profile type configurations. The manager needs to ensure that A) the profile type configuration - * is among the set (because it contains schema and dependency specifications) and B) That other type configurations - * are available. - * @private - * @type {ICommandProfileTypeConfiguration[]} - * @memberof CliProfileManager - */ - private mProfileTypeConfigurations: ICommandProfileTypeConfiguration[]; - - /** - * The profile "type" for this manager - indicating the profile/schema that this manager is working directly with. - * @private - * @type {string} - * @memberof CliProfileManager - */ - private mProfileType: string; - - /** - * Product display name of the CLI. - * @private - * @type {string} - * @memberof CliProfileManager - */ - private mProductDisplayName: string; - - /** - * Logger instance - must be log4js compatible. Can be the Imperative logger (normally), but is required for - * profile manager operation. - * @private - * @type {Logger} - * @memberof CliProfileManager - */ - private mLogger: Logger = Logger.getImperativeLogger(); - - /** - * Creates an instance of ProfileManager - Performs basic parameter validation. - * It accepts the type definitions passed on the constructor parameters. - * - * @param {IProfileManager} parms - See the interface for details. - * @memberof ProfileManager - */ - constructor(parms: IProfileManager) { - ImperativeExpect.toNotBeNullOrUndefined(parms, "Profile Manager input parms not supplied."); - ImperativeExpect.keysToBeDefinedAndNonBlank(parms, ["type"], - "No profile type supplied on the profile manager parameters."); - this.mLogger = parms.logger == null ? this.mLogger : parms.logger; - this.mProfileType = parms.type; - this.mProfileTypeConfigurations = parms.typeConfigurations; - this.mProductDisplayName = parms.productDisplayName; - if (this.profileTypeConfigurations == null || this.profileTypeConfigurations.length === 0) { - throw new ImperativeError({ - msg: "V1 profiles are no longer read from disk. " + - "You can supply the profile type configurations to the profile manager constructor." - }); - } - this.mConstructorParms = parms; - ImperativeExpect.arrayToContain(this.mProfileTypeConfigurations, (entry) => { - return entry.type === this.mProfileType; - }, `Could not locate the profile type configuration for "${this.profileType}" within the input configuration list passed.` + - `\n${inspect(this.profileTypeConfigurations, { depth: null })}`); - for (const config of this.profileTypeConfigurations) { - this.validateConfigurationDocument(config); - } - } - - /** - * Accessor for the logger instance - passed on the constructor - * @readonly - * @protected - * @type {Logger} - * @memberof CliProfileManager - */ - protected get log(): Logger { - return this.mLogger; - } - - /** - * Accessor for the profile type specified on the constructor. - * @readonly - * @protected - * @type {string} - * @memberof CliProfileManager - */ - protected get profileType(): string { - return this.mProfileType; - } - - /** - * Accesor for the product display name. - * @readonly - * @protected - * @type {string} - * @memberof CliProfileManager - */ - protected get productDisplayName(): string { - return this.mProductDisplayName; - } - - /** - * Accessor for the full set of type configurations - passed on the constructor. - * @readonly - * @protected - * @type {ICommandProfileTypeConfiguration[]} - * @memberof CliProfileManager - */ - protected get profileTypeConfigurations(): ICommandProfileTypeConfiguration[] { - return this.mProfileTypeConfigurations; - } - - /** - * Validate that the schema document passed is well formed for the profile manager usage. Ensures that the - * schema is not overloading reserved properties. - * @private - * @param {IProfileSchema} schema - The schema document to validate. - * @param type - the type of profile for the schema - defaults to the current type for this manager - * @memberof CliProfileManager - */ - private validateSchema(schema: IProfileSchema, type = this.profileType) { - ImperativeExpect.keysToBeDefined(schema, ["properties"], `The schema document supplied for the profile type ` + - `("${type}") does NOT contain properties.`); - ImperativeExpect.keysToBeUndefined(schema, ["properties.dependencies"], `The schema "properties" property ` + - `(on configuration document for type "${type}") contains "dependencies". ` + - `"dependencies" is must be supplied as part of the "type" configuration document (no need to formulate the dependencies ` + - `schema yourself).`); - } - - /** - * Validates the basic configuration document to ensure it contains all the proper fields - * @private - * @param {ICommandProfileTypeConfiguration} typeConfiguration - The type configuration document - * @memberof CliProfileManager - */ - private validateConfigurationDocument(typeConfiguration: ICommandProfileTypeConfiguration) { - ImperativeExpect.keysToBeDefinedAndNonBlank(typeConfiguration, ["type"], `The profile type configuration document for ` + - `"${typeConfiguration.type}" does NOT contain a type.`); - ImperativeExpect.keysToBeDefined(typeConfiguration, ["schema"], `The profile type configuration document for ` + - `"${typeConfiguration.type}" does NOT contain a schema.`); - this.validateSchema(typeConfiguration.schema, typeConfiguration.type); - // eslint-disable-next-line deprecation/deprecation - if (!(typeConfiguration.dependencies == null)) { - // eslint-disable-next-line deprecation/deprecation - ImperativeExpect.toBeAnArray(typeConfiguration.dependencies, - `The profile type configuration for "${typeConfiguration.type}" contains a "dependencies" property, ` + - `but it is not an array (ill-formed)`); - // eslint-disable-next-line deprecation/deprecation - for (const dep of typeConfiguration.dependencies) { - ImperativeExpect.keysToBeDefinedAndNonBlank(dep, ["type"], "A dependency specified for the " + - "profile definitions did not contain a type."); - } - } - } -} diff --git a/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts b/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts deleted file mode 100644 index 2db7b75422..0000000000 --- a/packages/imperative/src/cmd/src/profiles/CommandProfileLoader.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* -* 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 { Arguments } from "yargs"; -import { ICommandDefinition } from "../doc/ICommandDefinition"; -import { IProfile, IProfileLoaded } from "../../../profiles"; -import { CommandProfiles } from "./CommandProfiles"; -import { inspect } from "util"; -import { ICommandProfileLoaderParms } from "../doc/profiles/parms/ICommandProfileLoaderParms"; -import { Logger } from "../../../logger"; -import { ImperativeExpect } from "../../../expect"; - -/** - * The command processor profile loader loads all profiles that are required (or optional) given a command - * definitions requirements. It returns the CommandProfiles object (which contains the map and getters for the - * command handlers usage). - * @internal - * @class CommandProfileLoader - * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles - */ -export class CommandProfileLoader { - /** - * Create a new instance of the profile loader - * @static - * @param {ICommandProfileLoaderParms} parms - contains command definition and logger - * @returns - * @memberof CommandProfileLoader - */ - public static loader(parms: ICommandProfileLoaderParms) { - // eslint-disable-next-line deprecation/deprecation - return new CommandProfileLoader(parms.commandDefinition, parms.logger || Logger.getImperativeLogger()); - } - - /** - * The input command definition for the command being issued. - * @private - * @type {ICommandDefinition} - * @memberof CommandProfileLoader - */ - private mCommandDefinition: ICommandDefinition; - - /** - * Logger - supplied on the constructor - but defaults to the Imperative logger. - * @private - * @type {Logger} - * @memberof CommandProfileLoader - */ - private mLog: Logger; - - /** - * Creates an instance of CommandProfileLoader. - * @param {ICommandDefinition} commandDefinition - The input command definition for the command being issued. - * @param {any} [logger=Logger.getImperativeLogger()] - A log4js instance - * @memberof CommandProfileLoader - */ - constructor(commandDefinition: ICommandDefinition, logger = Logger.getImperativeLogger()) { - const err: string = "Could not construct the profile loader."; - ImperativeExpect.toNotBeNullOrUndefined(commandDefinition, `${err} No command definition supplied.`); - this.mCommandDefinition = commandDefinition; - ImperativeExpect.toBeEqual(logger instanceof Logger, true, `${err} The "logger" supplied is not of type Logger.`); - this.mLog = logger; - this.log.trace(`Profile loader created for command: ${commandDefinition.name}`); - } - - /** - * Load the profiles for the command - the command arguments are supplied to grab the profile names from - * the arguments supplied by the user. - * @param {Arguments} commandArguments - The command arguments supplied on this command invocation (Yargs style) - * @returns {Promise} - The promise is fulfilled with the map object OR rejected with an - * Imperative error - * @memberof CommandProfileLoader - */ - // eslint-disable-next-line deprecation/deprecation - public async loadProfiles(commandArguments: Arguments): Promise { - // Validate parms - ImperativeExpect.toNotBeNullOrUndefined(commandArguments, `Could not load profiles. No command arguments supplied.`); - - // Log the API call - this.log.info(`Request to load profiles for command: ${this.definition.name}...`); - this.log.trace(`Profile load arguments supplied:\n${inspect(commandArguments, {depth: null})}`); - - // Create the map that eventually will be returned - const profileMap: Map = new Map(); - const profileMetaMap: Map = new Map(); - - // We no longer read V1 profile files, so just return empty maps - // eslint-disable-next-line deprecation/deprecation - return new CommandProfiles(profileMap, profileMetaMap); - } - - /** - * Accessor for the command definition document - * @readonly - * @private - * @type {ICommandDefinition} - * @memberof CommandProfileLoader - */ - private get definition(): ICommandDefinition { - return this.mCommandDefinition; - } - - /** - * Accessor for the logging object - * @readonly - * @private - * @type {Logger} - * @memberof CommandProfileLoader - */ - private get log(): Logger { - return this.mLog; - } -} diff --git a/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts b/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts deleted file mode 100644 index e57a267d41..0000000000 --- a/packages/imperative/src/cmd/src/profiles/CommandProfiles.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* -* 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 { ImperativeError } from "../../../error"; -import { IProfile, IProfileLoaded } from "../../../profiles"; -import { ImperativeExpect } from "../../../expect"; - -/** - * Profiles map created by the command profile loader and passed to the handler via parameters. Handlers can - * retrieve loaded profiles from the map via the profile type. - * @class CommandProfiles - * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles - */ -export class CommandProfiles { - /** - * The loaded profiles map - profiles are retrieved via the type key. More than one profile of a particular type - * can be loaded by the command processor (depending on dependencies, etc.) - * @private - * @type {Map} - * @memberof CommandProfiles - */ - private mMap: Map; - - /** - * The loaded profiles map with meta info - profiles are retrieved via the type key. More than one profile of a particular type - * can be loaded by the command processor (depending on dependencies, etc.) - * @private - * @type {Map} - * @memberof CommandProfiles - */ - private mMetaMap: Map = new Map(); - - /** - * Creates an instance of CommandProfiles. - * @param {Map} map - The map of profiles - * @memberof CommandProfiles - */ - constructor(map: Map, metaMap?: Map) { - // Simple validation of input parameters - const err: string = "Command Profiles Internal Error:"; - ImperativeExpect.toNotBeNullOrUndefined(map, `${err} No map was supplied.`); - ImperativeExpect.toBeEqual(map instanceof Map, true, `${err} The "map" supplied is not an instance of a map.`); - - // Ensure the correctness of each map entry - map.forEach((value, key) => { - ImperativeExpect.toBeAnArray(value, `${err} The "profiles" supplied for type "${key}" is NOT an array.`); - ImperativeExpect.toBeEqual(value.length > 0, true, `${err} No profiles supplied for type "${key}".`); - }); - this.mMap = map; - - if (metaMap) { - this.addMeta(metaMap); - } - } - - /** - * Add to an instance of CommandProfiles - * @private - * @param {Map} map - The map of profiles with meta information - * @memberof CommandProfiles - */ - private addMeta(map: Map) { - // Simple validation of input parameters - const err: string = "Command Profiles Internal Error:"; - ImperativeExpect.toNotBeNullOrUndefined(map, `${err} No map was supplied.`); - ImperativeExpect.toBeEqual(map instanceof Map, true, `${err} The "map" supplied is not an instance of a map.`); - - // Ensure the correctness of each map entry - map.forEach((value, key) => { - ImperativeExpect.toBeAnArray(value, `${err} The "profiles" supplied for type "${key}" is NOT an array.`); - ImperativeExpect.toBeEqual(value.length > 0, true, `${err} No profiles supplied for type "${key}".`); - }); - this.mMetaMap = map; - } - - /** - * Internal accessor for the map - * @readonly - * @private - * @type {Map} - The profile Map - * @memberof CommandProfiles - */ - private get map(): Map { - return this.mMap; - } - - /** - * Gets the first (or by name) profile in the map - automatically throws an exception (unless disabled) - * @template T - The expected profile mapping to be returned - * @param {string} type - The profile type - * @param {string} [name=""] - The name of the profile to retrieve - * @param {boolean} [failNotFound=true] - Automatically throws an imperative exception if not profiles are not - * found - this is provided as convince for the handlers (will fail your command if not found) - This would - * normally be the result of a command configuration problem. - * @returns {T} - The first profile in the map (or the one located by name) - * @memberof CommandProfiles - */ - public get(type: string, failNotFound = true, name = ""): T { - let profile: IProfile; - // If a profile is returned for the type, then we'll check if a profile of a specific name was requseted - // if not, just return the first profile found (first loaded) - if (this.map.get(type) != null) { - if (name != null && name.trim().length > 0) { - for (const prof of this.map.get(type)) { - - if (prof.name === name) { - profile = prof; - break; - } - } - } else { - profile = this.map.get(type)[0]; - } - } else if (failNotFound) { - this.fail(type); - } - return profile as T; - } - - /** - * Internal accessor for the meta map - * @readonly - * @private - * @type {Map} - The profile Map - * @memberof CommandProfiles - */ - private get metaMap(): Map { - return this.mMetaMap; - } - - /** - * Throw an error failing the get(requested by the caller if no profiles are available) - * @private - * @param {string} type - the profile type to get from the map - * @memberof CommandProfiles - */ - private fail(type: string) { - throw new ImperativeError({ - msg: `Internal Error: No profiles of type "${type}" were loaded for this command.`, - additionalDetails: `This error can occur for one of two reasons:\n` + - ` - The "profile" property on the command definition document ` + - `does NOT specify the requested profile type\n` + - ` - The profile type is marked "optional", no profiles of type "${type}" have been created, ` + - `and the command handler requested a profile of type "${type}" with "failNotFound=true"` - }); - } -} diff --git a/packages/imperative/src/config/__tests__/Config.secure.unit.test.ts b/packages/imperative/src/config/__tests__/Config.secure.unit.test.ts index 276531d6a9..6573aa2757 100644 --- a/packages/imperative/src/config/__tests__/Config.secure.unit.test.ts +++ b/packages/imperative/src/config/__tests__/Config.secure.unit.test.ts @@ -177,8 +177,8 @@ describe("Config secure tests", () => { jest.spyOn(fs, "readFileSync"); const config = await Config.load(MY_APP); config.mSecure = secureConfigs; - expect(config.api.secure.secureFieldsForLayer(projectConfigPath)).toEqual({ [securePropPath]: "area51" }); - expect(config.api.secure.secureFieldsForLayer(projectUserConfigPath)).toEqual(null); + expect(config.api.secure.securePropsForLayer(projectConfigPath)).toEqual({ [securePropPath]: "area51" }); + expect(config.api.secure.securePropsForLayer(projectUserConfigPath)).toEqual(null); config.mSecure = {}; }); diff --git a/packages/imperative/src/config/src/ProfileInfo.ts b/packages/imperative/src/config/src/ProfileInfo.ts index 84641b89f5..3b6824e1e8 100644 --- a/packages/imperative/src/config/src/ProfileInfo.ts +++ b/packages/imperative/src/config/src/ProfileInfo.ts @@ -1400,7 +1400,7 @@ export class ProfileInfo { const config = this.getTeamConfig(); const layer = opts ? config.findLayer(opts.user, opts.global) : config.layerActive(); const fields = config.api.secure.findSecure(layer.properties.profiles, "profiles"); - const vault = config.api.secure.secureFieldsForLayer(layer.path); + const vault = config.api.secure.securePropsForLayer(layer.path); const response: IProfArgAttrs[] = []; diff --git a/packages/imperative/src/config/src/api/ConfigSecure.ts b/packages/imperative/src/config/src/api/ConfigSecure.ts index ba43bfc143..2333bfdd2e 100644 --- a/packages/imperative/src/config/src/api/ConfigSecure.ts +++ b/packages/imperative/src/config/src/api/ConfigSecure.ts @@ -248,7 +248,7 @@ export class ConfigSecure extends ConfigApi { * @param layerPath Path of the layer to get secure properties for * @returns the secure properties for the given layer, or null if not found */ - public secureFieldsForLayer(layerPath: string): IConfigSecureProperties { + public securePropsForLayer(layerPath: string): IConfigSecureProperties { const secureLayer = Object.keys(this.mConfig.mSecure).find(osLocation => osLocation === layerPath); return secureLayer ? this.mConfig.mSecure[secureLayer] : null; } diff --git a/packages/imperative/src/imperative/src/api/ImperativeApi.ts b/packages/imperative/src/imperative/src/api/ImperativeApi.ts index 3f9e3b49a4..3fb75a82d9 100644 --- a/packages/imperative/src/imperative/src/api/ImperativeApi.ts +++ b/packages/imperative/src/imperative/src/api/ImperativeApi.ts @@ -12,7 +12,6 @@ import { IImperativeConfig } from "../doc/IImperativeConfig"; import { IImperativeApi } from "./doc/IImperativeApi"; import { Logger } from "../../../logger"; -import { CliProfileManager } from "../../../cmd"; export class ImperativeApi { /** @@ -63,21 +62,4 @@ export class ImperativeApi { public addAdditionalLogger(name: string, logger: Logger): void { this.mCustomLoggerMap[name] = logger; } - - /** - * Return an instance of a profile manager for a given profile type - * See ProfileManager.ts for more details - * @internal - * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles - */ - // eslint-disable-next-line deprecation/deprecation - public profileManager(type: string): CliProfileManager { - // eslint-disable-next-line deprecation/deprecation - return new CliProfileManager({ - type, - typeConfigurations: this.mConfig.profiles, - logger: this.imperativeLogger, - productDisplayName: this.mConfig.productDisplayName - }); - } } diff --git a/packages/imperative/src/profiles/index.ts b/packages/imperative/src/profiles/index.ts index 5d88f7458d..ec970a46f5 100644 --- a/packages/imperative/src/profiles/index.ts +++ b/packages/imperative/src/profiles/index.ts @@ -24,9 +24,3 @@ export * from "./src/doc/response/IProfileLoaded"; export * from "./src/utils/V1ProfileRead"; export * from "./src/utils/ProfileUtils"; - -export * from "./src/validation/doc/IProfileValidationPlan"; -export * from "./src/validation/doc/IProfileValidationReport"; -export * from "./src/validation/doc/IProfileValidationTask"; -export * from "./src/validation/doc/IProfileValidationTaskResult"; - diff --git a/packages/imperative/src/profiles/src/utils/__tests__/ProfileUtils.unit.test.ts b/packages/imperative/src/profiles/src/utils/__tests__/ProfileUtils.unit.test.ts index bfec2d8667..3b778b7e64 100644 --- a/packages/imperative/src/profiles/src/utils/__tests__/ProfileUtils.unit.test.ts +++ b/packages/imperative/src/profiles/src/utils/__tests__/ProfileUtils.unit.test.ts @@ -16,7 +16,7 @@ import * as path from "path"; import { IProfileLoaded } from "../../../../index"; import { APPLE_TWO_REQ_DEP_BANANA_ONE_REQ_DEP_GRAPE_ONE_REQ_DEP, BLUEBERRY_PROFILE_TYPE -} from "../../../../cmd/__tests__/profiles/TestConstants"; +} from "./TestConstants"; const mocks = { normalize: path.normalize as unknown as Mock diff --git a/packages/imperative/src/cmd/__tests__/profiles/TestConstants.ts b/packages/imperative/src/profiles/src/utils/__tests__/TestConstants.ts similarity index 99% rename from packages/imperative/src/cmd/__tests__/profiles/TestConstants.ts rename to packages/imperative/src/profiles/src/utils/__tests__/TestConstants.ts index 1258fa22a0..06a6eb8c18 100644 --- a/packages/imperative/src/cmd/__tests__/profiles/TestConstants.ts +++ b/packages/imperative/src/profiles/src/utils/__tests__/TestConstants.ts @@ -9,7 +9,7 @@ * */ -import { IProfileTypeConfiguration } from "../../../profiles/src/doc/config/IProfileTypeConfiguration"; +import { IProfileTypeConfiguration } from "../../../src/doc/config/IProfileTypeConfiguration"; export const TEST_PROFILE_ROOT_DIR: string = "__tests__/__results__/test_profiles/root/dir/"; diff --git a/packages/imperative/src/profiles/src/utils/__tests__/V1ProfileRead.unit.test.ts b/packages/imperative/src/profiles/src/utils/__tests__/V1ProfileRead.unit.test.ts index 2e96d07811..7596d3cafe 100644 --- a/packages/imperative/src/profiles/src/utils/__tests__/V1ProfileRead.unit.test.ts +++ b/packages/imperative/src/profiles/src/utils/__tests__/V1ProfileRead.unit.test.ts @@ -23,7 +23,7 @@ import { BLUEBERRY_PROFILE_TYPE, BLUEBERRY_TYPE_SCHEMA, STRAWBERRY_PROFILE_TYPE -} from "../../../../cmd/__tests__/profiles/TestConstants"; +} from "./TestConstants"; import { IProfile } from "../../../../index"; import { ImperativeConfig } from "../../../../utilities"; diff --git a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts b/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts deleted file mode 100644 index a36defb065..0000000000 --- a/packages/imperative/src/profiles/src/validation/__tests__/ProfileValidation.unit.test.ts +++ /dev/null @@ -1,429 +0,0 @@ -/* -* 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. -* -*/ - -/* eslint-disable deprecation/deprecation */ - -import { inspect } from "util"; -import { TestLogger } from "../../../../../__tests__/src/TestLogger"; -import { IProfile } from "../../doc/definition/IProfile"; -import { IProfileValidationPlan } from "../doc/IProfileValidationPlan"; -import { IProfileValidationReport } from "../doc/IProfileValidationReport"; -import { IProfileValidationTaskResult } from "../doc/IProfileValidationTaskResult"; -import { ProfileValidator } from "../api/ProfileValidator"; -import { IProfileValidationTask } from "../../.."; - -jest.mock("../../../../imperative/src/Imperative"); - - -const oldForceColorOption = process.env.FORCE_COLOR; - -describe("We should provide the ability to validate Imperative CLI profiles by trying out different APIs", () => { - beforeAll(async () => { - process.env.FORCE_COLOR = "0"; - }); - const displayName = "dummy"; - afterAll(() => { - process.env.FORCE_COLOR = oldForceColorOption; - } - ); - const dummyProfile: IProfile = {name: "dummy", type: "dummy"}; - - it("If we have a mock plan with a failing parent test, the validation should fail and " + - "none of the tasks dependent on the failing task should run ", () => { - let anyTaskRun = false; - const plan: IProfileValidationPlan = { - tasks: [{ - name: "Master task", - description: "This will fail, and none of the rest should run ", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "Failed", - resultDescription: "Failing master task" - }); - }, - dependentTasks: [ - { - name: "Task one", - description: "First task which should not run", - taskFunction: async (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - }, - dependentTasks: [ - { - name: "Task two", - description: "Two level nested task", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - }] - }, { - name: "Task three", - description: "Second task which should not run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - } - ] - }] - }; - - return ProfileValidator.validate(dummyProfile, plan, displayName).then((report: IProfileValidationReport) => { - const textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", - "dummy", "dummy"); - TestLogger.info(textReport); - expect(report.overallResult).toEqual("Failed"); - expect(anyTaskRun).toBeFalsy(); - - }); - }); - - it("If we have a mock plan with a parent test that gets a warning, the validation should fail and " + - "none of the tasks dependent on the failing task should run ", () => { - let anyTaskRun = false; - const plan: IProfileValidationPlan = { - tasks: [{ - name: "Master task", - description: "This will fail, and none of the rest should run ", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "Warning", - resultDescription: "Failing master task" - }); - }, - dependentTasks: [ - { - name: "Task one", - description: "First task which should not run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - }, - dependentTasks: [ - { - name: "Task two", - description: "Two level nested task", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - }] - }, { - name: "Task three", - description: "Second task which should not run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - } - ] - }] - }; - - return ProfileValidator.validate(dummyProfile, plan, displayName) - .then((report: IProfileValidationReport) => { - const textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", - "dummy", "dummy"); - expect(report.overallResult).toEqual("Warning"); - expect(anyTaskRun).toBeFalsy(); - expect(textReport).toContain("ambiguous results"); - }); - }); - - it("If we have a mock plan with a passing parent test, one failing task and two passing tasks, " + - "the overall result should be failure ", () => { - - const plan: IProfileValidationPlan = { - - tasks: [{ - name: "Master task", - description: "This will fail, and none of the rest should run ", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "This should pass" - }); - }, - dependentTasks: [ - { - name: "Task one", - description: "First task which succeeds", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "Passes" - }); - }, - }, - { - name: "Task two", - description: "Second task which fails", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "Failed", - resultDescription: "Fails" - }); - }, - - }, { - name: "Task three", - description: "Third task which succeeds", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "Passes" - }); - } - } - ] - }] - }; - - return ProfileValidator.validate(dummyProfile, plan, displayName).then((report: IProfileValidationReport) => { - const textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", - "dummy", "dummy"); - expect(report.overallResult).toEqual("Failed"); - expect(textReport).toContain("will not function"); - }); - }); - - const goodPlan: IProfileValidationPlan = { - tasks: [{ - name: "Master task", - description: "This will succeed, the rest should run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "This should pass" - }); - }, - dependentTasks: [ - { - name: "Task one", - description: "First task which succeeds", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "This should pass" - }); - } - }, - { - name: "Task two", - description: "Second task which fails", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "This should pass" - }); - }, - - }, { - name: "Task three", - description: "Third task which succeeds", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - done({ - outcome: "OK", - resultDescription: "This should pass" - }); - } - } - ] - }] - }; - it("If we have a mock plan with all passing tests, the result should be a successful validation", () => { - - - return ProfileValidator.validate(dummyProfile, goodPlan, displayName).then((report: IProfileValidationReport) => { - const textReport = ProfileValidator.getTextDisplayForReport(report, goodPlan, displayName, "yellow", - "dummy", "dummy"); - TestLogger.info(textReport); - expect(report.overallResult).toEqual("OK"); - expect(textReport).toContain("valid and ready"); - }); - }); - - it("If we have a mock plan with a parent test that throws an unexpected exception, " + - "the dependent tasks should still be skipped and we should still get " + - "a report ", () => { - let anyTaskRun = false; - const errorMessage = "This shouldn't disrupt the flow"; - const plan: IProfileValidationPlan = { - tasks: [{ - name: "Master task", - description: "This will fail, and none of the rest should run ", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - throw new Error(errorMessage); - }, - dependentTasks: [ - { - name: "Task one", - description: "First task which should not run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - }, - dependentTasks: [ - { - name: "Task two", - description: "Two level nested task", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - }] - }, { - name: "Task three", - description: "Second task which should not run", - taskFunction: (profile: any, done: (result: IProfileValidationTaskResult) => void) => { - anyTaskRun = true; // shouldn't happen! - done({ - outcome: "Warning", - resultDescription: "This should not run!" - }); - } - } - ] - }] - }; - - return ProfileValidator.validate(dummyProfile, plan, displayName).then((report: IProfileValidationReport) => { - const textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", - "dummy", "dummy"); - TestLogger.info(textReport); - expect(report.taskResults[0].resultDescription).toContain(errorMessage); - expect(report.overallResult).toEqual("Failed"); - expect(anyTaskRun).toBeFalsy(); - }); - }); - - it("If we get a text report for a validation plan, the report should contain all of the descriptions " + - "for each task", () => { - let expectedWords: string[] = []; - const findExpectedWordsInTask = (task: IProfileValidationTask) => { - expectedWords = expectedWords.concat(task.description.split(" ")); - for (const dependent of task.dependentTasks || []) { - findExpectedWordsInTask(dependent); - } - }; - for (const task of goodPlan.tasks) { - findExpectedWordsInTask(task); - } - const textPlanReport = ProfileValidator.getTextDisplayForPlan(goodPlan, dummyProfile, "yellow"); - for (const word of expectedWords) { - expect(textPlanReport).toContain(word); - } - }); - - it("If we try to validate with a plan with no tasks in it, an error should be thrown to let " + - "profile/module contributors know that their plan is invalid ", async () => { - const plan: IProfileValidationPlan = {tasks: []}; - let caughtError; - try { - await ProfileValidator.validate(dummyProfile, plan, displayName); - } catch (error) { - caughtError = error; - TestLogger.info("Got an error during validation as expected: " + inspect(error)); - } - expect(caughtError).toBeDefined(); - expect(caughtError.message).toContain("tasks"); - }); - - it("If we validate a profile with a result description that is too long, it should be truncated", async () => { - const thirtyTimes = 30; - const longDescription = Array(thirtyTimes) - .join("ABCDEFGHIJKLMNOPQRSTUVABCDEFGHIJKLMNOPQRSTUVABCDEFGHIJKLMNOPQRSTUV"); - const plan: IProfileValidationPlan = { - tasks: [{ - name: "Task one", - description: "Task which has a long result description", - taskFunction: (profile: any, taskDone: (result: IProfileValidationTaskResult) => void) => { - taskDone({ - outcome: "Warning", - resultDescription: longDescription - }); - } - }] - }; - let textReport: string; - let caughtError; - try { - const report = await ProfileValidator.validate(dummyProfile, plan, displayName); - textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", "dummy", "dummy"); - } catch (error) { - caughtError = error; - TestLogger.info("Got an error during unexpected validation: " + inspect(error)); - } - expect(caughtError).toBeUndefined(); - expect(textReport).toContain(longDescription.substring(0, 10)); // expect the report to have - // at least ten characters in a row of the description (Could test more but it's in a tabular format - // so the characters don't appear together - expect(textReport).toContain("..."); // expect it to be truncated - }); - - it("a failed profile validation report should include specified failure suggestions", async () => { - const failureSuggestion = "Try fixing whatever is wrong"; - const plan: IProfileValidationPlan = { - tasks: [{ - name: "Task one", - description: "Task which has a long result description", - taskFunction: (profile: any, taskDone: (result: IProfileValidationTaskResult) => void) => { - taskDone({ - outcome: "Failed", - resultDescription: "The task failed" - }); - } - }], - failureSuggestions: failureSuggestion - }; - let textReport: string; - let caughtError; - try { - const report = await ProfileValidator.validate(dummyProfile, plan, displayName); - textReport = ProfileValidator.getTextDisplayForReport(report, plan, displayName, "yellow", "dummy", "dummy"); - } catch (error) { - caughtError = error; - TestLogger.info("Got an error during unexpected validation: " + inspect(error)); - } - expect(caughtError).toBeUndefined(); - // each word of the failure suggestions should appear (tabular format - // so the characters don't appear together) - for (const word of failureSuggestion.split(" ")) { - expect(textReport).toContain(word); - } - }); -}); diff --git a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts deleted file mode 100644 index d363596ac7..0000000000 --- a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts +++ /dev/null @@ -1,415 +0,0 @@ -/* -* 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 { IProfileValidationReport } from "../doc/IProfileValidationReport"; -import { IProfileValidationPlan } from "../doc/IProfileValidationPlan"; -import { - IProfileValidationTask, - IProfileValidationTaskFunction, - VALIDATION_OUTCOME -} from "../doc/IProfileValidationTask"; -import { IProfileValidationTaskResult } from "../doc/IProfileValidationTaskResult"; -import { Logger } from "../../../../logger"; -import { LoggerUtils } from "../../../../logger/src/LoggerUtils"; -import { TextUtils } from "../../../../utilities"; -import { IPromiseWithProgress, ITaskWithStatus, TaskProgress, TaskStage } from "../../../../operations"; -import { ICommandOptionDefinition } from "../../../../cmd"; -import { IProfile } from "../../doc/definition/IProfile"; -import { CliUtils } from "../../../../utilities/src/CliUtils"; - -/** - * API for going through the full validation test for a Zowe CLI profile - * and producing validation report - * @internal - * @deprecated Use the `V1ProfileRead` class if you still need to read V1 profiles - */ -export class ProfileValidator { - - /** - * The key used to access the filename for the type containing the profile - * validation plan object. On your profile validation command definition, - * specify the filename in .customize[CUSTOMIZE_PLAN_KEY] - * @type {string} - */ - public static readonly CUSTOMIZE_PLAN_KEY = "validationPlanModule"; - - /** - * The command line option for printing the validation plan only - */ - public static get PRINT_PLAN_OPTION(): ICommandOptionDefinition { - return { - name: "print-plan-only", aliases: ["plan", "p"], - description: "Instead of validating your profile, print out " + - "a table of the tasks used for validation. This will explain the different services and " + - "functionality that will be tested during profile validation.", - type: "boolean" - }; - } - - /** - * Produce a profile validation report for a specific profile - * @param {IProfile} profile the profile to validate - * @param {IProfileValidationPlan} plan - the profile validation testing plan - * @param productDisplayName - the display name for your CLI - * @returns {IPromiseWithProgress} a promise of the validation report, with an additional field - * that can be used to create a progress bar or track progress in another UI - */ - public static validate(profile: IProfile, - plan: IProfileValidationPlan, - productDisplayName: string): IPromiseWithProgress { - const log = Logger.getImperativeLogger(); - const progress: ITaskWithStatus = { - stageName: TaskStage.IN_PROGRESS, - percentComplete: TaskProgress.ZERO_PERCENT, - statusMessage: "Preparing to validate profile" - }; - const promise: any = new Promise((validationComplete) => { - const report: IProfileValidationReport = { - overallResult: "OK", // start with success and change it if there are any failures - taskResults: [], - overallMessage: "Your profile is valid and ready for use with " + - productDisplayName, - profile - }; - log.debug("Validating profile with %d tasks", plan.tasks.length); - - let tasksCompleted = 0; - let numTasksToComplete = 0; - const countTasks = (task: IProfileValidationTask) => { - numTasksToComplete++; - if (!(task.dependentTasks == null)) { - for (const dependent of task.dependentTasks) { - countTasks(dependent); - } - } - }; - for (const task of plan.tasks) { - countTasks(task); // get the total number of tasks - } - if (numTasksToComplete === 0) { - throw new Error("Validation plan has no tasks! If you want to validate a profile, " + - "you need at least one task in your plan."); - } - - let tasksToRun = [].concat(plan.tasks); - - // define how tasks will be handled when we run them - const runTask = () => { - const currentTask = tasksToRun[0]; - tasksToRun = tasksToRun.slice(1); // take off the task we're working on now - - const skipDependentTask = (dependentTask: IProfileValidationTask, result: IProfileValidationTaskResult) => { - // add a 'skipped task' result for each descendant dependent task - const skippedResult: IProfileValidationTaskResult = { - taskName: dependentTask.name, - associatedEndpoints: dependentTask.associatedEndpoints, - outcome: "Warning", - resultDescription: TextUtils.formatMessage( - "Skipped due to '%s' getting a result of %s", - currentTask.name, this.outcomeToString(result.outcome)) - }; - report.taskResults.push(skippedResult); - tasksCompleted++; - if (!(dependentTask.dependentTasks == null)) { - for (const grandDependent of dependentTask.dependentTasks) { - skipDependentTask(grandDependent, result); - } - } - }; - - const taskFunction: IProfileValidationTaskFunction = currentTask.taskFunction; - progress.percentComplete = tasksCompleted / numTasksToComplete * TaskProgress.ONE_HUNDRED_PERCENT; - progress.statusMessage = TextUtils.formatMessage("Checking '%s' (%d of %d)", currentTask.name, - tasksCompleted + 1, numTasksToComplete); - try { - taskFunction(profile, (result: IProfileValidationTaskResult) => { - result.associatedEndpoints = currentTask.associatedEndpoints; - result.taskName = currentTask.name; - // task is complete, store off the results - tasksCompleted++; - report.taskResults.push(result); - log.debug("Profile validation task result: task name: %s, outcome %s, description %s, associated endpoints: %s", - result.taskName, this.outcomeToString(result.outcome), result.resultDescription, - result.associatedEndpoints == null ? "none" : result.associatedEndpoints.join(", ")); - - // set the overall status of the validation based on this outcome - // only 100% success is considered a successful validation - if (result.outcome === "Warning" && report.overallResult === "OK") { - report.overallResult = "Warning"; - - } else if (result.outcome === "Failed") { - // mark the validation failed if any task fails - report.overallResult = "Failed"; - } - if (!(currentTask.dependentTasks == null)) { - if (result.outcome === "Failed" || result.outcome === "Warning") { - log.warn("Parent task %s failed, skipping dependent tasks", - currentTask.name); - for (const dependent of currentTask.dependentTasks) { - skipDependentTask(dependent, result); - } - } else { - // add the dependent tasks as the next tasks to execute - log.debug("Adding dependent tasks of %s to the lists of tasks to run", - currentTask.name); - tasksToRun = currentTask.dependentTasks.concat(tasksToRun); - } - } - if (tasksCompleted < numTasksToComplete) { - // if there are more tasks, run the next one - runTask(); - } else { - log.info("All profile validation tasks have completed. The profile's validity: %s", - this.outcomeToString(report.overallResult)); - validationComplete(report); - } - }); - } - /** - * Catch unexpected exceptions within the task function - */ catch (e) { - tasksCompleted++; - report.overallResult = "Failed"; - log.error("Error during profile validation: %s\n%s", e.message, e.stack); - const result: IProfileValidationTaskResult = { - outcome: "Failed", - resultDescription: "Encountered an unexpected exception: " + e.message, - associatedEndpoints: currentTask.associatedEndpoints, - taskName: currentTask.taskName - }; - report.taskResults.push(result); - log.warn("Parent task %s failed, skipping dependent tasks", - currentTask.name); - for (const dependent of currentTask.dependentTasks) { - skipDependentTask(dependent, result); - } - if (tasksCompleted < numTasksToComplete) { - // if there are more tasks, run the next one - runTask(); - } else { - log.info("All profile validation tasks have completed. The profile's validity: %s", - this.outcomeToString(report.overallResult)); - validationComplete(report); - } - - } - }; - runTask(); - }); - - promise.progress = progress; - return promise; - } - - /** - * Get a printed/tabular version of your validation report - * @param {IProfileValidationReport} report - your completed validation result - * @param plan - the validation plan to use - * @param productDisplayName - the display name for your CLI used in the final result text - * @param primaryHighlightColor - color used to highlight headings and tables (used with chalk package) - * @param profileName - the name of the profile that was validated - * @param profileType - the type of the profile that was validated - * @returns {string} - the formatted report - */ - public static getTextDisplayForReport(report: IProfileValidationReport, plan: IProfileValidationPlan, - productDisplayName: string, primaryHighlightColor: string, - profileName: string, profileType: string): string { - const log = Logger.getImperativeLogger(); - let text = ""; - - let {failed, undetermined, succeeded} = this.countOutcomes(report); - - text += CliUtils.formatHelpHeader("Profile Summary", undefined, primaryHighlightColor) + "\n\n"; - const censoredProfile = LoggerUtils.censorYargsArguments(report.profile as any); - text += TextUtils.prettyJson(censoredProfile); - text += CliUtils.formatHelpHeader("Profile Validation Results", undefined, primaryHighlightColor) + "\n\n"; - - /** - * Get a colored summary of the total numbers of failed, warning, and succeeded tests - */ - if (failed === 0) { - failed = TextUtils.chalk.gray(failed); - } else { - failed = TextUtils.chalk.red(failed); - } - if (undetermined === 0) { - undetermined = TextUtils.chalk.gray(undetermined); - } else { - undetermined = TextUtils.chalk.yellow(undetermined); - } - if (succeeded === 0) { - succeeded = TextUtils.chalk.gray(succeeded); - } else { - succeeded = TextUtils.chalk.green(succeeded); - } - - interface ITaskResultRow { - Task: string; - Status: string; - Description: string; - Endpoint: string; - } - - const tableObject: ITaskResultRow[] = report.taskResults.map((taskResult) => { - let statusChar = ""; - if (taskResult.outcome === "OK") { - statusChar = TextUtils.chalk.green("OK"); - } else if (taskResult.outcome === "Warning") { - statusChar = TextUtils.chalk.yellow("?\nWarning"); - } else if (taskResult.outcome === "Failed") { - statusChar = TextUtils.chalk.red("X\nFailed"); - } - let description = taskResult.resultDescription; - const maxDescriptionLength = 500; - if (description.length > maxDescriptionLength) { - description = description.substring(0, maxDescriptionLength) + "...(more info in log)"; - log.info("Truncated description from profile validation: %s", taskResult.resultDescription); - } - const result = { - Task: taskResult.taskName, - Status: statusChar, - Description: description, - Endpoint: taskResult.associatedEndpoints ? taskResult.associatedEndpoints.join(", ") : undefined - }; - if (result.Endpoint == null) { - // this prevents the endpoint column from showing up - // if there are no endpoints specified - delete result.Endpoint; - } - return result; - }); - text += TextUtils.getTable(tableObject, primaryHighlightColor, undefined, true, true, true) + "\n\n"; - text += TextUtils.wordWrap(TextUtils.formatMessage("Of %s tests, %s succeeded, %s failed, and %s had warnings or undetermined results.\n\n", - report.taskResults.length, succeeded, failed, undetermined)); - - if (report.overallResult === "OK") { - text += TextUtils.chalk.green(" *~~ Perfect score! Wow! ~~* ") + "\n\n"; - } - let outcomeMessage = ""; - switch (report.overallResult) { - case "OK": - outcomeMessage = "is valid and ready for use with " + productDisplayName + ".\n All profile validation tests " + - "succeeded."; - break; - case "Failed": - outcomeMessage = "will not function fully with " + productDisplayName + ".\nAt least one of the above " + - "tests failed. " + (plan.failureSuggestions ? "\n" + plan.failureSuggestions : ""); - break; - case "Warning": - outcomeMessage = "might not function properly with " + productDisplayName + ".\nAt least one of the above " + - "tests got ambiguous results. " + (plan.failureSuggestions ? "\n" + plan.failureSuggestions : ""); - break; - default: - log.warn("Unknown validation outcome in report for %s profile %s", profileType, profileName); - } - - text += TextUtils.wordWrap(TextUtils.formatMessage("The %s profile named \"%s\" %s\n", - profileType + "", profileName + "", outcomeMessage)); - return text; - } - - /** - * Get a printed/tabular version of your validation plan, - * so that the user can see what steps the Zowe CLI will take to validate their profile - * @param {IProfileValidationPlan} plan - the plan for profile validation - * @param profile - the profile that would be validated - used only in this case to show a summary of the profile's contents - * @param primaryHighlightColor - primary highlight color for use with chalk - * @returns {string} - the formatted report - */ - public static getTextDisplayForPlan(plan: IProfileValidationPlan, profile: IProfile, primaryHighlightColor: string): string { - let text = ""; - - text += CliUtils.formatHelpHeader("Profile Summary", undefined, primaryHighlightColor) + "\n\n"; - const censoredProfile = LoggerUtils.censorYargsArguments(profile as any); - text += TextUtils.prettyJson(censoredProfile); - text += CliUtils.formatHelpHeader("Profile Validation Plan", undefined, primaryHighlightColor) + "\n\n"; - - /** - * Collapse the tree of task dependencies into a 1D array - * so that we can display it in the table - */ - const allTasks: IProfileValidationTask[] = []; - const addTasks = (task: IProfileValidationTask) => { - allTasks.push(task); - if (!(task.dependentTasks == null)) { - for (const dependent of task.dependentTasks) { - addTasks(dependent); - } - } - }; - for (const task of plan.tasks) { - addTasks(task); - } - - interface ITaskPlanRow { - Task: string; - Description: string; - Endpoints: string; - } - - const tableObject: ITaskPlanRow[] = allTasks.map((task) => { - const result: ITaskPlanRow = { - Task: task.name, - Description: task.description, - Endpoints: task.associatedEndpoints ? task.associatedEndpoints.join(", ") : undefined - }; - if (result.Endpoints == null) { - delete result.Endpoints; - } - return result; - }); - text += TextUtils.getTable(tableObject, primaryHighlightColor, undefined, - true, true) + "\n\n"; - return text; - } - - /** - * Get a more readable version of the outcome - * @param {VALIDATION_OUTCOME} outcome - the outcome to convert to readable version - * @returns {string} - full version of the outcome - */ - public static outcomeToString(outcome: VALIDATION_OUTCOME): string { - if (outcome === "OK") { - return "Succeeded"; - } else if (outcome === "Warning") { - return "Warning"; - } else if (outcome === "Failed") { - return "Failed"; - } - } - - /** - * Get the total number of each type of profile validation outcome - * @param {IProfileValidationReport} report - the report from which - * @returns {{succeeded: number, undetermined: number, failed: number}} - total count - * of what has succeeded, undetermined, failed - */ - private static countOutcomes(report: IProfileValidationReport): { succeeded: number, undetermined: number, failed: number } { - const log = Logger.getImperativeLogger(); - const result = {succeeded: 0, undetermined: 0, failed: 0}; - for (const task of report.taskResults) { - switch (task.outcome) { - case "OK": - result.succeeded++; - break; - case "Warning": - result.undetermined++; - break; - case "Failed": - result.failed++; - break; - default: - log.warn("Unknown validation outcome for %s profile %s", report.profile.type, report.profile.name); - } - } - return result; - } -} diff --git a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationPlan.ts b/packages/imperative/src/profiles/src/validation/doc/IProfileValidationPlan.ts deleted file mode 100644 index f6aaf1dd47..0000000000 --- a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationPlan.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* -* 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 { IProfileValidationTask } from "./IProfileValidationTask"; - -/** - * An overall plan for validating a profile, composed of multiple tasks - */ -export interface IProfileValidationPlan { - /** - * The tasks to run to validate the profile. - * They will be run sequentially in the order specified. - */ - tasks: IProfileValidationTask[]; - - /** - * Suggestions to the user that will be displayed in the validation - * report in the event profile validation is not successful. - */ - failureSuggestions?: string; -} diff --git a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationReport.ts b/packages/imperative/src/profiles/src/validation/doc/IProfileValidationReport.ts deleted file mode 100644 index 6c5d02fdd9..0000000000 --- a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationReport.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* 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 { IProfileValidationTaskResult } from "./IProfileValidationTaskResult"; -import { VALIDATION_OUTCOME } from "./IProfileValidationTask"; -import { IProfile } from "../../doc/definition/IProfile"; - -/** - * Complete report of the results of profile validation - */ -export interface IProfileValidationReport { - /** - * Is the profile valid overall? - */ - overallResult: VALIDATION_OUTCOME; - /** - * A final message explaining the general result of the report - */ - overallMessage: string; - /** - * List of detailed task results from running the profile validation - */ - taskResults: IProfileValidationTaskResult[]; - /** - * The profile that was validated - */ - profile: IProfile; -} diff --git a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTask.ts b/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTask.ts deleted file mode 100644 index 40a001cb6c..0000000000 --- a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTask.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* -* 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 { IProfileValidationTaskResult } from "./IProfileValidationTaskResult"; - -export type VALIDATION_OUTCOME = "Failed" | "OK" | "Warning"; - -/** - * A function that takes a profile and calls a done callback with the result of the - * profile validation - */ -export type IProfileValidationTaskFunction = (profile: any, - done: (result: IProfileValidationTaskResult) => void) => void; - -/** - * Criterion/task used for testing the validity of a profile - * You can use any number of these criteria to test different - * aspects of the profile - */ -export interface IProfileValidationTask { - /** - * Long form description of the task you'll take using the - * specified profile to test its validity - */ - description: string; - /** - * The short name of a task e.g. "Submitting a job" - */ - name: string; - /** - * The REST endpoints associated with this task if any, - * e.g. ["PUT /zosmf/restjobs/jobs", "GET /zosmf/restjobs/jobs"] - */ - associatedEndpoints?: string[]; - /** - * A function which tests the profile with your tasks - * Ultimately the result of this function is what determines whether - * the profile is valid or not for this task - */ - taskFunction: IProfileValidationTaskFunction; - - /** - * Any tasks you would like to only run if the current task succeeds - * (skipped on warning or failure of this, the parent task) - */ - dependentTasks?: IProfileValidationTask[]; -} diff --git a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTaskResult.ts b/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTaskResult.ts deleted file mode 100644 index 3182fbb878..0000000000 --- a/packages/imperative/src/profiles/src/validation/doc/IProfileValidationTaskResult.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* 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. -* -*/ - -/** - * A single result in the report from testing a profile against an IProfileValidationCriterion - * Used to build the final validation report - */ -import { VALIDATION_OUTCOME } from "./IProfileValidationTask"; - -/** - * Profile validation results for one particular task - */ -export interface IProfileValidationTaskResult { - /** - * Outcome of this task, whether it succeeded, failed, or somewhere in between - */ - outcome: VALIDATION_OUTCOME; - /** - * Name of the task - * (will be automatically populated by the validation API) - */ - taskName?: string; - /** - * A description of the result of the validation test, whether - * it succeeded or failed. Example: - * Successfully submitted job USER(JOB00001) - * or - * Failed to submit job due to the following error: - * Input was not recognized by the system as a job RC 4 RSN ... - */ - resultDescription: string; - /** - * Same as the endpoints in the profile validation task. - * (will be automatically populated by the validation API) - */ - associatedEndpoints?: string[]; -} - diff --git a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts index cf92150b13..b107ed6cd3 100644 --- a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts @@ -11,9 +11,9 @@ import * as stream from "stream"; import { CliUtils } from "../src/CliUtils"; -import { CommandProfiles, ICommandOptionDefinition } from "../../cmd"; -import { IProfile } from "../../profiles"; +import { ICommandOptionDefinition } from "../../cmd"; import { ImperativeError } from "../../error"; +import { Config, IConfig } from "../../config"; const TEST_PREFIX = "TEST_CLI_PREFIX"; const boolEnv = TEST_PREFIX + "_OPT_FAKE_BOOL_OPT"; @@ -22,6 +22,31 @@ const stringAliasEnv = TEST_PREFIX + "_OPT_FAKE_STRING_OPT_WITH_ALIASES"; const numberEnv = TEST_PREFIX + "_OPT_FAKE_NUMBER_OPT"; const arrayEnv = TEST_PREFIX + "_OPT_FAKE_ARRAY_OPT"; +function mockConfigApi(properties: IConfig | undefined): any { + properties = properties || Config.empty(); + return { + api: { + layers: { + get: () => ({ + exists: true, + path: "fakePath", + properties + }) + }, + profiles: { + defaultGet: jest.fn().mockReturnValue(properties.profiles[properties.defaults.banana]?.properties), + exists: () => properties.defaults.banana != null, + getProfilePathFromName: (name: string) => `profiles.${name}` + }, + secure: { + securePropsForProfile: jest.fn().mockReturnValue([]) + } + }, + exists: true, + properties + }; +} + describe("CliUtils", () => { describe("extractEnvForOptions", () => { @@ -262,7 +287,7 @@ describe("CliUtils", () => { }); }); - describe("getOptValueFromProfiles", () => { + describe("getOptValuesFromConfig", () => { const FAKE_OPTS: ICommandOptionDefinition[] = [{ name: "fake-string-opt", @@ -293,12 +318,8 @@ describe("CliUtils", () => { it("should throw an imperative error if a required profile is not present", () => { let error; try { - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(new Map()), - { required: ["banana"] }, - FAKE_OPTS); + CliUtils.getOptValuesFromConfig(mockConfigApi(undefined), + { required: ["banana"] } as any, {} as any, FAKE_OPTS); } catch (e) { error = e; } @@ -308,122 +329,129 @@ describe("CliUtils", () => { }); it("should return nothing if a profile was optional and not loaded", () => { - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(new Map()), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig(mockConfigApi(undefined), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(Object.keys(args).length).toBe(0); }); it("should return args (from definitions with no hyphen in name) extracted from loaded profile", () => { - const map = new Map(); - map.set("banana", [{ type: "banana", name: "fakebanana", nohyphen: "specified in profile" }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + nohyphen: "specified in profile" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args (with both cases) extracted from loaded profile, preferring the camel case", () => { - const map = new Map(); - map.set("banana", [{ - "type": "banana", - "name": "fakebanana", - "couldBeEither": "should be me", - "could-be-either": "should not be me" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + couldBeEither: "should be me", + "could-be-either": "should not be me" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args (with both cases) extracted from loaded profile, preferring the kebab case", () => { - const map = new Map(); - map.set("banana", [{ - "type": "banana", - "name": "fakebanana", - "fakeStringOpt": "should not be me", - "fake-string-opt": "should be me" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + fakeStringOpt: "should not be me", + "fake-string-opt": "should be me" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args with both cases, if the option is camel and the profile is kebab", () => { - const map = new Map(); - map.set("banana", [{ - "type": "banana", - "name": "fakebanana", - "could-be-either": "should be me" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + "could-be-either": "should be me" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args with both cases, if the option is kebab and the profile is camel", () => { - const map = new Map(); - map.set("banana", [{ - type: "banana", - name: "fakebanana", - fakeStringOpt: "should be me" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + fakeStringOpt: "should be me" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args with aliases if extracted option from a profile", () => { - const map = new Map(); - map.set("banana", [{ - type: "banana", - name: "fakebanana", - withAlias: "should have 'w' on args object too" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + withAlias: "should have 'w' on args object too" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toMatchSnapshot(); }); it("should return args if extracted option from a profile is only available as an alias", () => { - const map = new Map(); - map.set("banana", [{ - type: "banana", - name: "fakebanana", - username: "fake" - }]); - // eslint-disable-next-line deprecation/deprecation - const args = CliUtils.getOptValueFromProfiles( - // eslint-disable-next-line deprecation/deprecation - new CommandProfiles(map), - { optional: ["banana"] }, - FAKE_OPTS); + const args = CliUtils.getOptValuesFromConfig( + mockConfigApi({ + profiles: { + fakebanana: { + type: "banana", + properties: { + username: "fake" + } + } + }, + defaults: { banana: "fakebanana" } + }), + { optional: ["banana"] }, {} as any, FAKE_OPTS); expect(args).toEqual({ user: "fake", username: "fake" }); }); }); diff --git a/packages/imperative/src/utilities/__tests__/__snapshots__/CliUtils.unit.test.ts.snap b/packages/imperative/src/utilities/__tests__/__snapshots__/CliUtils.unit.test.ts.snap index 38efab29ef..c804cc3384 100644 --- a/packages/imperative/src/utilities/__tests__/__snapshots__/CliUtils.unit.test.ts.snap +++ b/packages/imperative/src/utilities/__tests__/__snapshots__/CliUtils.unit.test.ts.snap @@ -98,27 +98,27 @@ Object { } `; -exports[`CliUtils getOptValueFromProfiles should return args (from definitions with no hyphen in name) extracted from loaded profile 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args (from definitions with no hyphen in name) extracted from loaded profile 1`] = ` Object { "nohyphen": "specified in profile", } `; -exports[`CliUtils getOptValueFromProfiles should return args (with both cases) extracted from loaded profile, preferring the camel case 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args (with both cases) extracted from loaded profile, preferring the camel case 1`] = ` Object { "could-be-either": "should be me", "couldBeEither": "should be me", } `; -exports[`CliUtils getOptValueFromProfiles should return args (with both cases) extracted from loaded profile, preferring the kebab case 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args (with both cases) extracted from loaded profile, preferring the kebab case 1`] = ` Object { "fake-string-opt": "should be me", "fakeStringOpt": "should be me", } `; -exports[`CliUtils getOptValueFromProfiles should return args with aliases if extracted option from a profile 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args with aliases if extracted option from a profile 1`] = ` Object { "w": "should have 'w' on args object too", "with-alias": "should have 'w' on args object too", @@ -126,21 +126,21 @@ Object { } `; -exports[`CliUtils getOptValueFromProfiles should return args with both cases, if the option is camel and the profile is kebab 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args with both cases, if the option is camel and the profile is kebab 1`] = ` Object { "could-be-either": "should be me", "couldBeEither": "should be me", } `; -exports[`CliUtils getOptValueFromProfiles should return args with both cases, if the option is kebab and the profile is camel 1`] = ` +exports[`CliUtils getOptValuesFromConfig should return args with both cases, if the option is kebab and the profile is camel 1`] = ` Object { "fake-string-opt": "should be me", "fakeStringOpt": "should be me", } `; -exports[`CliUtils getOptValueFromProfiles should throw an imperative error if a required profile is not present 1`] = `"Profile of type \\"banana\\" does not exist within the loaded profiles for the command and it is marked as required."`; +exports[`CliUtils getOptValuesFromConfig should throw an imperative error if a required profile is not present 1`] = `"Profile of type \\"banana\\" does not exist within the loaded profiles for the command and it is marked as required."`; exports[`CliUtils setOptionValue should include aliases in the returned args object 1`] = ` Object { diff --git a/packages/imperative/src/utilities/src/CliUtils.ts b/packages/imperative/src/utilities/src/CliUtils.ts index 115548af5e..951145064e 100644 --- a/packages/imperative/src/utilities/src/CliUtils.ts +++ b/packages/imperative/src/utilities/src/CliUtils.ts @@ -14,11 +14,8 @@ import { Constants } from "../../constants"; import { Arguments } from "yargs"; import { TextUtils } from "./TextUtils"; import { IOptionFormat } from "./doc/IOptionFormat"; -import { CommandProfiles, ICommandOptionDefinition, ICommandPositionalDefinition, - ICommandProfile, IHandlerParameters -} from "../../cmd"; +import { ICommandOptionDefinition, ICommandPositionalDefinition, ICommandProfile, IHandlerParameters } from "../../cmd"; import { ICommandArguments } from "../../cmd/src/doc/args/ICommandArguments"; -import { IProfile } from "../../profiles/src/doc/definition/IProfile"; import { ProfileUtils } from "../../profiles/src/utils/ProfileUtils"; import { IPromptOptions } from "../../cmd/src/doc/response/api/handler/IPromptOptions"; import { read } from "read"; @@ -104,115 +101,28 @@ export class CliUtils { return newArgs; } - - /** - * Accepts the full set of loaded profiles and attempts to match the option names supplied with profile keys. - * - * @deprecated Use `getOptValuesFromConfig` instead to load from team config - * - * @param {Map} profiles - the map of type to loaded profiles. The key is the profile type - * and the value is an array of profiles loaded for that type. - * - * @param {definitions} definitions - the profile definition on the command. - * - * @param {(Array)} options - the full set of command options - * for the command being processed - * - * @returns {*} - * - * @memberof CliUtils - */ - // eslint-disable-next-line deprecation/deprecation - public static getOptValueFromProfiles(profiles: CommandProfiles, definitions: ICommandProfile, - options: Array): any { - let args: any = {}; - - // Construct the precedence order to iterate through the profiles - let profileOrder: any = definitions.required != null ? definitions.required : []; - if (definitions.optional != null) { - profileOrder = profileOrder.concat(definitions.optional); - } - - // Iterate through the profiles in the order they appear in the list provided. For each profile found, we will - // attempt to match the option name to a profile property exactly - and extract the value from the profile. - profileOrder.forEach((profileType: string) => { - - // Get the first profile loaded - for now, we won't worry about profiles and double-type loading for dependencies - // eslint-disable-next-line deprecation/deprecation - const profile: IProfile = profiles.get(profileType, false); - if (profile == null && definitions.required != null && definitions.required.indexOf(profileType) >= 0) { - throw new ImperativeError({ - msg: `Profile of type "${profileType}" does not exist within the loaded profiles for the command and it is marked as required.`, - additionalDetails: `This is an internal imperative error. ` + - `Command preparation was attempting to extract option values from this profile.` - }); - } else if (profile != null) { - // For each option - extract the value if that exact property exists - options.forEach((opt) => { - let cases; - if (profile[opt.name] == null && "aliases" in opt) { - // Use aliases for backwards compatibility - // Search for first alias available in the profile - const oldOption = opt.aliases.find(o => profile[o] != null); - // Get the camel an kebab case - if (oldOption) cases = CliUtils.getOptionFormat(oldOption); - } - - if (cases == null) { - cases = CliUtils.getOptionFormat(opt.name); - } - - // We have to "deal" with the situation that the profile contains both cases - camel and kebab. - // This is to support where the profile options have "-", but the properties are camel case in the - // yaml file - which is currently how most imperative CLIs have it coded. - const profileKebab = profile[cases.kebabCase]; - const profileCamel = profile[cases.camelCase]; - - // If the profile has either type (or both specified) we'll add it to args if the args object - // does NOT already contain the value in any case - if ((profileCamel !== undefined || profileKebab !== undefined) && - (!Object.prototype.hasOwnProperty.call(args, cases.kebabCase) && - !Object.prototype.hasOwnProperty.call(args, cases.camelCase))) { - - // If both case properties are present in the profile, use the one that matches - // the option name explicitly - const value = profileKebab !== undefined && profileCamel !== undefined ? - opt.name === cases.kebabCase ? profileKebab : profileCamel : - profileKebab !== undefined ? profileKebab : profileCamel; - const keys = CliUtils.setOptionValue(opt.name, - "aliases" in opt ? (opt as ICommandOptionDefinition).aliases : [], - value - ); - args = {...args, ...keys}; - } - }); - } - }); - return args; - } - /** * Searches properties in team configuration and attempts to match the option names supplied with profile keys. * @param {Config} config - Team config API - * @param {ICommandDefinition} definition - Definition of invoked command + * @param {ICommandProfile} profileDef - Profile definition of invoked command * @param {ICommandArguments} args - Arguments from command line and environment - * @param {(Array)} allOpts - the full set of command options + * @param {(Array)} options - the full set of command options * for the command being processed * * @returns {*} * * @memberof CliUtils */ - public static getOptValuesFromConfig(config: Config, definition: ICommandDefinition, args: ICommandArguments, - allOpts: Array): any { + public static getOptValuesFromConfig(config: Config, profileDef: ICommandProfile, args: ICommandArguments, + options: Array): any { // Build a list of all profile types - this will help us search the CLI // options for profiles specified by the user let allTypes: string[] = []; - if (definition.profile != null) { - if (definition.profile.required != null) - allTypes = allTypes.concat(definition.profile.required); - if (definition.profile.optional != null) - allTypes = allTypes.concat(definition.profile.optional); + if (profileDef != null) { + if (profileDef.required != null) + allTypes = allTypes.concat(profileDef.required); + if (profileDef.optional != null) + allTypes = allTypes.concat(profileDef.optional); } // Build an object that contains all the options loaded from config @@ -223,7 +133,7 @@ export class CliUtils { // that this type has been fulfilled - so that we do NOT load from // the traditional profile location const profileTypePrefix = profileType + "_"; - let p: any = {}; + let p: any = null; if (args[opt] != null && config.api.profiles.exists(args[opt])) { p = config.api.profiles.get(args[opt]); } else if (args[opt] != null && !args[opt].startsWith(profileTypePrefix) && @@ -234,13 +144,27 @@ export class CliUtils { config.api.profiles.exists(config.properties.defaults[profileType])) { p = config.api.profiles.defaultGet(profileType); } - fromCnfg = { ...p, ...fromCnfg }; + if (p == null && profileDef.required != null && profileDef.required.indexOf(profileType) >= 0) { + throw new ImperativeError({ + msg: `Profile of type "${profileType}" does not exist within the loaded profiles for the command and it is marked as required.`, + additionalDetails: `This is an internal imperative error. ` + + `Command preparation was attempting to extract option values from this profile.` + }); + } + fromCnfg = { ...p ?? {}, ...fromCnfg }; } // Convert each property extracted from the config to the correct yargs // style cases for the command handler (kebab and camel) - allOpts.forEach((opt) => { - const cases = CliUtils.getOptionFormat(opt.name); + options.forEach((opt) => { + let cases = CliUtils.getOptionFormat(opt.name); + if (fromCnfg[opt.name] == null && "aliases" in opt) { + // Use aliases for backwards compatibility + // Search for first alias available in the profile + const oldOption = opt.aliases.find(o => fromCnfg[o] != null); + // Get the camel and kebab case + if (oldOption) cases = CliUtils.getOptionFormat(oldOption); + } const profileKebab = fromCnfg[cases.kebabCase]; const profileCamel = fromCnfg[cases.camelCase]; @@ -252,10 +176,7 @@ export class CliUtils { const shouldUseKebab = profileKebab !== undefined && profileCamel !== undefined ? opt.name === cases.kebabCase : profileKebab !== undefined; const value = shouldUseKebab ? profileKebab : profileCamel; - const keys = CliUtils.setOptionValue(opt.name, - "aliases" in opt ? opt.aliases : [], - value - ); + const keys = CliUtils.setOptionValue(opt.name, "aliases" in opt ? opt.aliases : [], value); fromCnfg = { ...fromCnfg, ...keys }; } }); diff --git a/packages/provisioning/package.json b/packages/provisioning/package.json index 0b5e370e95..ec7b0534e8 100644 --- a/packages/provisioning/package.json +++ b/packages/provisioning/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/secrets/package.json b/packages/secrets/package.json index 1d849e396d..1fe56608c5 100644 --- a/packages/secrets/package.json +++ b/packages/secrets/package.json @@ -3,7 +3,7 @@ "description": "Credential management facilities for Imperative, Zowe CLI, and extenders.", "repository": "https://github.com/zowe/zowe-cli.git", "author": "Zowe", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "homepage": "https://github.com/zowe/zowe-cli/tree/master/packages/secrets#readme", "bugs": { "url": "https://github.com/zowe/zowe-cli/issues" diff --git a/packages/workflows/package.json b/packages/workflows/package.json index b1e637f2ff..464996147d 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosconsole/package.json b/packages/zosconsole/package.json index be7342265e..6fc0c2033c 100644 --- a/packages/zosconsole/package.json +++ b/packages/zosconsole/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosfiles/package.json b/packages/zosfiles/package.json index 77a63402a5..44c77c09b5 100644 --- a/packages/zosfiles/package.json +++ b/packages/zosfiles/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "description": "Zowe SDK to interact with files and data sets on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,10 +49,10 @@ "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544", - "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809", + "@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index d435f4a579..f954e843ad 100644 --- a/packages/zosjobs/package.json +++ b/packages/zosjobs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544" + "@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zoslogs/package.json b/packages/zoslogs/package.json index 583a095194..8f5ed0cac9 100644 --- a/packages/zoslogs/package.json +++ b/packages/zoslogs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosmf/package.json b/packages/zosmf/package.json index 5424557ca3..0c7283dc44 100644 --- a/packages/zosmf/package.json +++ b/packages/zosmf/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zostso/package.json b/packages/zostso/package.json index 20a41c55de..1a44c07d50 100644 --- a/packages/zostso/package.json +++ b/packages/zostso/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544" + "@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202408301809" }, "devDependencies": { - "@zowe/cli-test-utils": "8.0.0-next.202408291544", - "@zowe/core-for-zowe-sdk": "8.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/core-for-zowe-sdk": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0-next", diff --git a/packages/zosuss/package.json b/packages/zosuss/package.json index 50d438ab12..195dcd7a55 100644 --- a/packages/zosuss/package.json +++ b/packages/zosuss/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.0.0-next.202408291544", + "version": "8.0.0-next.202408301809", "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.0.0-next.202408291544", - "@zowe/imperative": "8.0.0-next.202408291544" + "@zowe/cli-test-utils": "8.0.0-next.202408301809", + "@zowe/imperative": "8.0.0-next.202408301809" }, "peerDependencies": { "@zowe/imperative": "^8.0.0-next"