diff --git a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap index bf7ee4dda4..1500ca567e 100644 --- a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap +++ b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap @@ -1,6 +1,113 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Imperative Secure Tests imperative-test-cli config profiles should list profiles 1`] = ` +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config import failure scenarios should fail to import if location is not specified 1`] = ` +" +Syntax Error: +Missing Positional Argument: location +Argument Description: File path or URL to import from. + +Example: + + - Import config from local file on disk: + + $ imperative-test-cli config import ~/Downloads/zowe.config.json + +Use \\"imperative-test-cli config import --help\\" to view command description, usage, and options. +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration 1`] = ` +"profiles: + secured: + type: secured + properties: + info: + secure: + (empty array) + project_base: + type: base + properties: + secure: + - secret + global_base: + type: base + properties: + secure: + - secret +defaults: + secured: secured + base: project_base +autoStore: true +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration without showing secure values 1`] = ` +"profiles: + secured: + type: secured + properties: + info: + secure: + (empty array) + project_base: + type: base + properties: + secret: (secure value) + secure: + - secret + global_base: + type: base + properties: + secure: + - secret +defaults: + secured: secured + base: project_base +autoStore: true +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the defaults configuration property 1`] = ` +"secured: secured +base: project_base +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the profiles configuration property 1`] = ` +"secured: + type: secured + properties: + info: + secure: + (empty array) +project_base: + type: base + properties: + secure: + - secret +global_base: + type: base + properties: + secure: + - secret +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 1 1`] = ` +"profiles +defaults +autoStore +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 2 1`] = ` +"profiles +defaults +autoStore +" +`; + +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config profiles should list profiles 1`] = ` "secured project_base global_base diff --git a/__tests__/__integration__/imperative.secure.integration.test.ts b/__tests__/__integration__/imperative.secure.integration.test.ts index 6866c29d31..7091c85c7b 100644 --- a/__tests__/__integration__/imperative.secure.integration.test.ts +++ b/__tests__/__integration__/imperative.secure.integration.test.ts @@ -11,19 +11,12 @@ // These tests require access to the same values on the keyring, therefore they cannot run in parallel // The test order is important - some tests depend on other tests not running first - do not change it +// All tests that mess with the keyring must go here - the MacOS Keyring is NOT thread safe, and cannot run anything in parallel /* eslint-disable max-len */ describe("Imperative Secure Tests", () => { - require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/ConfigLoading.integration.subtest"); - require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/init/cli.imperative-test-cli.config.init.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/profiles/cli.imperative-test-cli.config.profiles.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/test/cli.imperative-test-cli.test.config-auto-store.integration.subtest"); - require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/test/cli.imperative-test-cli.test.config-override.integration.subtest"); + require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/ConfigLoading.integration.subtest"); + require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest"); + require("../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/cli.imperative-test-cli.integration.subtest"); + require("../../packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.subtest"); }); - - diff --git a/__tests__/__packages__/cli-test-utils/CHANGELOG.md b/__tests__/__packages__/cli-test-utils/CHANGELOG.md index 47c3b98053..4188e894a5 100644 --- a/__tests__/__packages__/cli-test-utils/CHANGELOG.md +++ b/__tests__/__packages__/cli-test-utils/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe CLI test utils package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202407262216` - Update: See `7.28.2` for details @@ -18,6 +22,10 @@ All notable changes to the Zowe CLI test utils package will be documented in thi - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.28.2` - BugFix: Improved the error message shown on Windows when `runCliScript` method cannot find `sh` executable on PATH. [#2208](https://github.com/zowe/zowe-cli/issues/2208) diff --git a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts index bda522b7b1..30d3fc0eb6 100644 --- a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts +++ b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts @@ -135,6 +135,7 @@ export function mockHandlerParameters(params: PartialHandlerParameters): IHandle ...params.arguments || {} }, positionals: params.positionals || [], + // eslint-disable-next-line deprecation/deprecation profiles: params.profiles || new CommandProfiles(new Map()), definition: params.definition, fullDefinition: params.definition, diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 1100e5c139..7e8dcf894f 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202407181904` - Enhancement: The 'zowe config auto-init' command now generates a base profile name of 'global_base' or 'project_base', depending on whether a global or project configuration file is being generated. Related to Zowe Explorer issue https://github.com/zowe/zowe-explorer-vscode/issues/2682. @@ -143,6 +147,10 @@ LTS Breaking: Removed the following previously deprecated items: [#1981](https:/ - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.25.1` - BugFix: Updated `braces` dependency for technical currency. [#2157](https://github.com/zowe/zowe-cli/pull/2157) diff --git a/packages/cli/src/provisioning/perform/action/Action.handler.ts b/packages/cli/src/provisioning/perform/action/Action.handler.ts index b4059b45b4..33e7480a26 100644 --- a/packages/cli/src/provisioning/perform/action/Action.handler.ts +++ b/packages/cli/src/provisioning/perform/action/Action.handler.ts @@ -34,7 +34,7 @@ export default class ActionHandler extends ZosmfBaseHandler { commandParameters.arguments.name ); const instances: IProvisionedInstance[] = registry["scr-list"]; - if (instances== null) { + if (instances == null) { commandParameters.response.console.error( "No instance with name " + commandParameters.arguments.name + diff --git a/packages/cli/src/provisioning/provision/template/Template.handler.ts b/packages/cli/src/provisioning/provision/template/Template.handler.ts index a87e6536e8..b4823dd670 100644 --- a/packages/cli/src/provisioning/provision/template/Template.handler.ts +++ b/packages/cli/src/provisioning/provision/template/Template.handler.ts @@ -26,7 +26,7 @@ export default class Handler extends ZosmfBaseHandler { let usedOptionalParms: boolean = false; let arrayOfSystemNickNames: string[]; - if (!(commandParameters.arguments.systemNickNames== null)) { + if (commandParameters.arguments.systemNickNames != null) { arrayOfSystemNickNames = commandParameters.arguments.systemNickNames .split(",") .map((systemName: string) => { @@ -46,13 +46,7 @@ export default class Handler extends ZosmfBaseHandler { ); for (const property in provisionOptionalParams) { - if ( - !( - provisionOptionalParams[ - property as keyof IProvisionOptionals - ] == null - ) - ) { + if ( provisionOptionalParams[property as keyof IProvisionOptionals] != null ) { usedOptionalParms = true; } } diff --git a/packages/cli/src/zosconsole/issue/command/Command.handler.ts b/packages/cli/src/zosconsole/issue/command/Command.handler.ts index ca187f1a2a..a2f981fe4e 100644 --- a/packages/cli/src/zosconsole/issue/command/Command.handler.ts +++ b/packages/cli/src/zosconsole/issue/command/Command.handler.ts @@ -57,7 +57,7 @@ export default class Handler extends ZosmfBaseHandler { responseKey: response.lastResponseKey, cmdResponseUrl: response.cmdResponseUrl || undefined, keywordDetected: response.keywordDetected || - (!(commandParameters.arguments["solicited-keyword"] == null) ? false : undefined) + (commandParameters.arguments["solicited-keyword"] != null ? false : undefined) }; commandParameters.response.console.log("Additional details:"); commandParameters.response.console.log("-------------------"); diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 19921e7637..a429d28c60 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes + +- Update: See `5.26.2` for details + ## `8.0.0-next.202408092029` - BugFix: Resolved bug that resulted in user not being prompted for a key passphrase if it is located in the secure credential array of the ssh profile. [#1770](https://github.com/zowe/zowe-cli/issues/1770) @@ -430,6 +434,11 @@ All notable changes to the Imperative package will be documented in this file. - Major: First major version bump for V3 +## `5.26.2` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) +- BugFix: Fixed error in REST client when making requests with session type of `SessConstants.AUTH_TYPE_NONE`. [#2219](https://github.com/zowe/zowe-cli/issues/2219) + ## `5.26.1` - BugFix: Fixed missing export for `Proxy` class in Imperative package. [#2205](https://github.com/zowe/zowe-cli/pull/2205) diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.subtest.ts similarity index 64% rename from packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.test.ts rename to packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.subtest.ts index f8fed6e38f..059acf1bd7 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.test.ts +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/auth/Cmd.cli.auth.fruit.integration.subtest.ts @@ -9,5 +9,7 @@ * */ -require("./Cmd.cli.auth.login.fruit.integration.subtest"); -require("./Cmd.cli.auth.logout.fruit.integration.subtest"); +describe("Cmd CLI Secure Tests", () => { + require("./Cmd.cli.auth.login.fruit.integration.subtest"); + require("./Cmd.cli.auth.logout.fruit.integration.subtest"); +}); \ No newline at end of file diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts index c5b0d5430e..750248d6c4 100644 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts +++ b/packages/imperative/__tests__/__integration__/cmd/src/cli/invalid/profile-spec/ProfileSpec.handler.ts @@ -13,6 +13,7 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../../../lib"; export default class ProfileSpecHandler implements ICommandHandler { public async process(params: IHandlerParameters): Promise { + // eslint-disable-next-line deprecation/deprecation params.profiles.get("blah"); } } diff --git a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts b/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts index b3b229760e..18da0fe758 100644 --- a/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts +++ b/packages/imperative/__tests__/__integration__/cmd/src/cli/read/profile/Profile.handler.ts @@ -13,6 +13,7 @@ import { IHandlerParameters, ICommandHandler, TextUtils } from "../../../../../. export default class FirstGroupCommandOneHandler implements ICommandHandler { public async process(params: IHandlerParameters): Promise { + // eslint-disable-next-line deprecation/deprecation const prof = params.profiles.get("insecure"); params.response.console.log(TextUtils.prettyJson(prof)); } diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/cli.imperative-test-cli.integration.subtest.ts b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/cli.imperative-test-cli.integration.subtest.ts new file mode 100644 index 0000000000..3ecf113291 --- /dev/null +++ b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/cli.imperative-test-cli.integration.subtest.ts @@ -0,0 +1,30 @@ +/* +* 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. +* +*/ + +// These tests require access to the same values on the keyring, therefore they cannot run in parallel +// The test order is important - some tests depend on other tests not running first - do not change it +/* eslint-disable max-len */ + +describe("Imperative Test CLI Secure Tests", () => { + // require("./auth/imperative.test.cli.auth.login.fruit.integration.subtest"); + // require("./auth/imperative.test.cli.auth.logout.fruit.integration.subtest"); + require("./config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.subtest"); + require("./config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest"); + require("./config/edit/cli.imperative-test-cli.config.edit.integration.subtest"); + require("./config/import/cli.imperative-test-cli.config.import.integration.subtest"); + require("./config/init/cli.imperative-test-cli.config.init.integration.subtest"); + require("./config/list/cli.imperative-test-cli.config.list.integration.subtest"); + require("./config/profiles/cli.imperative-test-cli.config.profiles.integration.subtest"); + require("./config/secure/cli.imperative-test-cli.config.secure.integration.subtest"); + require("./config/set/cli.imperative-test-cli.config.set.integration.subtest"); + require("./test/cli.imperative-test-cli.test.config-auto-store.integration.subtest"); + require("./test/cli.imperative-test-cli.test.config-override.integration.subtest"); +}); diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/edit/cli.imperative-test-cli.config.edit.integration.test.ts b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/edit/cli.imperative-test-cli.config.edit.integration.subtest.ts similarity index 100% rename from packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/edit/cli.imperative-test-cli.config.edit.integration.test.ts rename to packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/edit/cli.imperative-test-cli.config.edit.integration.subtest.ts diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/__snapshots__/cli.imperative-test-cli.config.import.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/__snapshots__/cli.imperative-test-cli.config.import.integration.test.ts.snap deleted file mode 100644 index 015d0c0d8e..0000000000 --- a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/__snapshots__/cli.imperative-test-cli.config.import.integration.test.ts.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`imperative-test-cli config import failure scenarios should fail to import if location is not specified 1`] = ` -" -Syntax Error: -Missing Positional Argument: location -Argument Description: File path or URL to import from. - -Example: - - - Import config from local file on disk: - - $ imperative-test-cli config import ~/Downloads/zowe.config.json - -Use \\"imperative-test-cli config import --help\\" to view command description, usage, and options. -" -`; diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/cli.imperative-test-cli.config.import.integration.test.ts b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/cli.imperative-test-cli.config.import.integration.subtest.ts similarity index 100% rename from packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/cli.imperative-test-cli.config.import.integration.test.ts rename to packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/import/cli.imperative-test-cli.config.import.integration.subtest.ts diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/__snapshots__/cli.imperative-test-cli.config.list.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/__snapshots__/cli.imperative-test-cli.config.list.integration.test.ts.snap deleted file mode 100644 index 58b90e28c6..0000000000 --- a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/__snapshots__/cli.imperative-test-cli.config.list.integration.test.ts.snap +++ /dev/null @@ -1,92 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`imperative-test-cli config list should list the configuration 1`] = ` -"profiles: - secured: - type: secured - properties: - info: - secure: - (empty array) - project_base: - type: base - properties: - secure: - - secret - global_base: - type: base - properties: - secure: - - secret -defaults: - secured: secured - base: project_base -autoStore: true -" -`; - -exports[`imperative-test-cli config list should list the configuration without showing secure values 1`] = ` -"profiles: - secured: - type: secured - properties: - info: - secure: - (empty array) - project_base: - type: base - properties: - secret: (secure value) - secure: - - secret - global_base: - type: base - properties: - secure: - - secret -defaults: - secured: secured - base: project_base -autoStore: true -" -`; - -exports[`imperative-test-cli config list should list the defaults configuration property 1`] = ` -"secured: secured -base: project_base -" -`; - -exports[`imperative-test-cli config list should list the profiles configuration property 1`] = ` -"secured: - type: secured - properties: - info: - secure: - (empty array) -project_base: - type: base - properties: - secure: - - secret -global_base: - type: base - properties: - secure: - - secret -" -`; - -exports[`imperative-test-cli config list should list the root level property names only 1 1`] = ` -"profiles -defaults -autoStore -" -`; - -exports[`imperative-test-cli config list should list the root level property names only 2 1`] = ` -"profiles -defaults -autoStore -" -`; diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/cli.imperative-test-cli.config.list.integration.test.ts b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/cli.imperative-test-cli.config.list.integration.subtest.ts similarity index 100% rename from packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/cli.imperative-test-cli.config.list.integration.test.ts rename to packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/list/cli.imperative-test-cli.config.list.integration.subtest.ts diff --git a/packages/imperative/__tests__/src/TestUtil.ts b/packages/imperative/__tests__/src/TestUtil.ts index 382a5460a4..93e0ceab01 100644 --- a/packages/imperative/__tests__/src/TestUtil.ts +++ b/packages/imperative/__tests__/src/TestUtil.ts @@ -357,8 +357,8 @@ export function compareJsonObjects(actual: any, expected: any, parms?: ICompareP if (parms) { diffs.forEach((difference: any) => { const path = difference.path.join("."); - if (parms.ignorePaths == undefined || parms.ignorePaths.indexOf(path) < 0) { - if (!(parms.pathRegex == undefined)) { + if (parms.ignorePaths == null || parms.ignorePaths.indexOf(path) < 0) { + if (parms.pathRegex != null) { let regexPathMatch: boolean = false; for (const reg of parms.pathRegex) { if (path === reg.path) { @@ -386,7 +386,7 @@ export function compareJsonObjects(actual: any, expected: any, parms?: ICompareP } }); } else { - if (!(diffs == undefined)) { + if (diffs != null) { returnDiffs = returnDiffs.concat(diffs); } } diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts index d1569f9b0b..6122fd06a4 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts +++ b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/OptionalProfileCHandler.ts @@ -13,6 +13,7 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; export default class OptionalProfileCHandler implements ICommandHandler { public async process(params: IHandlerParameters) { + // eslint-disable-next-line deprecation/deprecation const profile = params.profiles.get("profile-c", false); params.response.console.log(`Profile Cs loaded: ${profile}`); } diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts index 6226127a15..94722840a3 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts +++ b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseDependentProfileHandler.ts @@ -13,8 +13,10 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; export default class UseDependentProfile implements ICommandHandler { public async process(params: IHandlerParameters) { + // eslint-disable-next-line deprecation/deprecation const dependencyProfile = params.profiles.get("profile-a"); params.response.console.log("Loaded profile dependency of type profile-a"); + // eslint-disable-next-line deprecation/deprecation const mainProfile = params.profiles.get("profile-with-dependency"); params.response.console.log("Loaded main profile of type profile-with-dependency"); } diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts index ac7c8dcc26..1745880c01 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts +++ b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileAHandler.ts @@ -13,6 +13,7 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; export default class UseProfileAHandler implements ICommandHandler { public async process(params: IHandlerParameters) { + // eslint-disable-next-line deprecation/deprecation const profile = params.profiles.get("profile-a"); params.response.console.log("Loaded profile {{name}} of type {{type}}", {name: profile.name, type: profile.type}); diff --git a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts index ad65f364e9..246abae3c1 100644 --- a/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts +++ b/packages/imperative/__tests__/src/example_clis/with_profiles/handlers/UseProfileBHandler.ts @@ -13,6 +13,7 @@ import { ICommandHandler, IHandlerParameters } from "../../../../../src/cmd"; export default class UseProfileAHandler implements ICommandHandler { public async process(params: IHandlerParameters): Promise { + // eslint-disable-next-line deprecation/deprecation const profile = params.profiles.get("profile-b"); params.response.console.log("Loaded profile {{name}} of type {{type}}", {name: profile.name, type: profile.type}); diff --git a/packages/imperative/__tests__/src/packages/cmd/__integration__/SyntaxValidator.integration.test.ts b/packages/imperative/__tests__/src/packages/cmd/__integration__/SyntaxValidator.integration.test.ts index 6032192a6b..cde77a8f29 100644 --- a/packages/imperative/__tests__/src/packages/cmd/__integration__/SyntaxValidator.integration.test.ts +++ b/packages/imperative/__tests__/src/packages/cmd/__integration__/SyntaxValidator.integration.test.ts @@ -101,7 +101,7 @@ describe("Imperative should provide advanced syntax validation rules", function } else { expect(completedResponse.success).toEqual(false); } - if (!(expectedText == undefined) && expectedText.length > 0) { + if (expectedText != null && expectedText.length > 0) { (completedResponse.stderr as any) = completedResponse.stderr.toString(); (completedResponse.stdout as any) = completedResponse.stdout.toString(); for (const text of expectedText) { diff --git a/packages/imperative/package.json b/packages/imperative/package.json index 1491d43a54..09fff2ee67 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -30,9 +30,9 @@ "scripts": { "build:packages": "tsc --pretty", "build": "npm run build:packages && npm run build:webHelp", - "lint": "eslint \"src/**/*.ts\" \"**/__tests__/**/*.ts\"", - "lint:packages": "eslint \"src/**/*.ts\" --ignore-pattern \"**/__tests__/**/*.ts\"", - "lint:tests": "eslint \"./__tests__/**/*.ts\"", + "lint": "eslint \"src/**/*.ts\" \"**/__tests__/**/*.ts\" --ignore-pattern \"**/__mocks__/*.ts\"", + "lint:packages": "eslint \"src/**/*.ts\" --ignore-pattern \"**/__tests__/**/*.ts\" --ignore-pattern \"**/__mocks__/*.ts\"", + "lint:tests": "eslint \"**/__tests__/**/*.ts\"", "circularDependencyCheck": "madge -c lib", "watch": "concurrently \"tsc --pretty --watch\" \"npm run watch:webHelp\"", "build:webHelp": "cd web-help && npm run build", diff --git a/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts b/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts index 4a02792b23..e572f2d338 100644 --- a/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts +++ b/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts @@ -504,7 +504,7 @@ export class SyntaxValidator { if (!isPositional) { const def = optionDefinition as ICommandOptionDefinition; - aliasString = !(def.aliases == null) && def.aliases.length > 0 ? + aliasString = def.aliases != null && def.aliases.length > 0 ? "(" + def.aliases.map((alias: string) => { return this.getDashFormOfOption(alias); }).join(",") + ")" : ""; diff --git a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts index 0546c04998..f955fe691d 100644 --- a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts +++ b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts @@ -32,7 +32,7 @@ export class CommandYargs extends AbstractCommandYargs { * @param {ICommandOptionDefinition[]} zoweOptions: The option definition document array. */ public static defineOptionsToYargs(yargsInstance: Argv, zoweOptions: ICommandOptionDefinition[]): void { - if (!(zoweOptions == null)) { + if (zoweOptions != null) { for (const option of zoweOptions) { const definition: Options = { alias: option.aliases, diff --git a/packages/imperative/src/profiles/src/utils/ProfileUtils.ts b/packages/imperative/src/profiles/src/utils/ProfileUtils.ts index 2e67fe118a..408ad49e10 100644 --- a/packages/imperative/src/profiles/src/utils/ProfileUtils.ts +++ b/packages/imperative/src/profiles/src/utils/ProfileUtils.ts @@ -47,7 +47,7 @@ export class ProfileUtils { let flatten: IProfileLoaded[] = []; if (!(dependencyResponses == null)) { for (const response of dependencyResponses) { - const moreDependencies = !(response.dependencyLoadResponses == null) ? + const moreDependencies = response.dependencyLoadResponses != null ? JSON.parse(JSON.stringify(response.dependencyLoadResponses)) : []; flatten.push(response); delete response.dependencyLoadResponses; diff --git a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts index 19d337f0c7..61045414d5 100644 --- a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts @@ -14,7 +14,7 @@ import * as https from "https"; import * as http from "http"; import { Session } from "../../src/session/Session"; import { - AUTH_TYPE_BASIC, AUTH_TYPE_BEARER, AUTH_TYPE_CERT_PEM, AUTH_TYPE_TOKEN + AUTH_TYPE_BASIC, AUTH_TYPE_BEARER, AUTH_TYPE_CERT_PEM, AUTH_TYPE_NONE, AUTH_TYPE_TOKEN } from "../../src/session/SessConstants"; import { RestClient } from "../../src/client/RestClient"; import { Headers } from "../../src/client/Headers"; @@ -78,15 +78,19 @@ describe("AbstractRestClient tests", () => { expect(error.message).toMatchSnapshot(); }); - it("should throw an error when when no creds are in the session", async () => { + it("should throw an error when session type is basic and no creds are in the session", async () => { // restore setPasswordAuth spy to its original implementation setPasswordAuthSpy.mockRestore(); let caughtError; try { - await RestClient.getExpectString(new Session({ - hostname: "test" - }), "/resource"); + const sessWithoutCreds = new Session({ + hostname: "test", + type: AUTH_TYPE_BASIC, + base64EncodedAuth: "FakeBase64EncodedCred" + }); + delete sessWithoutCreds.ISession.base64EncodedAuth; + await RestClient.getExpectString(sessWithoutCreds, "/resource"); } catch (error) { caughtError = error; } @@ -95,6 +99,46 @@ describe("AbstractRestClient tests", () => { expect(caughtError.message).toContain("No credentials for a BASIC or TOKEN type of session"); }); + it("should not error when session type is none and no creds are in the session", async () => { + const emitter = new MockHttpRequestResponse(); + const requestFnc = jest.fn((options, callback) => { + ProcessUtils.nextTick(async () => { + + const newEmit = new MockHttpRequestResponse(); + callback(newEmit); + + await ProcessUtils.nextTick(() => { + newEmit.emit("data", Buffer.from("{\"newData\":", "utf8")); + }); + + await ProcessUtils.nextTick(() => { + newEmit.emit("data", Buffer.from("\"response data\"}", "utf8")); + }); + + await ProcessUtils.nextTick(() => { + newEmit.emit("end"); + }); + }); + + return emitter; + }); + + (https.request as any) = requestFnc; + + let caughtError; + try { + await RestClient.getExpectString(new Session({ + hostname: "test", + type: AUTH_TYPE_NONE + }), "/resource"); + } catch (error) { + caughtError = error; + } + + expect(caughtError).toBeUndefined(); + expect(requestFnc).toHaveBeenCalledTimes(1); + }); + it("should not error when chunking data and payload data are present in outgoing request", async () => { interface IPayload { diff --git a/packages/imperative/src/rest/src/client/AbstractRestClient.ts b/packages/imperative/src/rest/src/client/AbstractRestClient.ts index 18d10dc6f3..bb9280be54 100644 --- a/packages/imperative/src/rest/src/client/AbstractRestClient.ts +++ b/packages/imperative/src/rest/src/client/AbstractRestClient.ts @@ -530,7 +530,7 @@ export abstract class AbstractRestClient { /* There is probably a better way report this kind of problem and a better message, * but we do it this way to maintain backward compatibility. */ - if (!credsAreSet) { + if (!credsAreSet && this.session.ISession.type !== SessConstants.AUTH_TYPE_NONE) { throw new ImperativeError({ msg: "No credentials for a BASIC or TOKEN type of session." }); } diff --git a/packages/imperative/src/utilities/src/CliUtils.ts b/packages/imperative/src/utilities/src/CliUtils.ts index 8082613889..6e03604c98 100644 --- a/packages/imperative/src/utilities/src/CliUtils.ts +++ b/packages/imperative/src/utilities/src/CliUtils.ts @@ -133,6 +133,7 @@ export class CliUtils { 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({ @@ -599,7 +600,7 @@ export class CliUtils { * - hello--------world -> helloWorld * - hello-World- -> helloWorld */ - const returnChar = p1.substr(-1).toUpperCase(); + const returnChar = p1.slice(-1).toUpperCase(); return returnChar !== "-" ? returnChar : ""; }), kebabCase: key.replace(/(-*[A-Z]|-{2,}|-$)/g, (match, p1, offset, inputString) => { @@ -644,7 +645,7 @@ export class CliUtils { return "-" + p1.toLowerCase(); } } else { // 2 - const returnChar = p1.substr(-1); // Get the last character of the sequence + const returnChar = p1.slice(-1); // Get the last character of the sequence if (returnChar === "-") { // 2.1 if (offset + p1.length === inputString.length) { // 2.1.1 diff --git a/packages/imperative/src/utilities/src/TextUtils.ts b/packages/imperative/src/utilities/src/TextUtils.ts index f18a64c7fa..1c8e3ff54d 100644 --- a/packages/imperative/src/utilities/src/TextUtils.ts +++ b/packages/imperative/src/utilities/src/TextUtils.ts @@ -42,7 +42,7 @@ export class TextUtils { const widthSafeGuard = 8; // prevent partial words from continuing over lines const yargs = require("yargs"); // eslint-disable-next-line no-extra-parens - const maxWidth = (!(yargs.terminalWidth() == null) && yargs.terminalWidth() > 0) ? + const maxWidth = (yargs.terminalWidth() != null && yargs.terminalWidth() > 0) ? yargs.terminalWidth() - widthSafeGuard : preferredWidth; return Math.min(preferredWidth, maxWidth); } diff --git a/packages/provisioning/CHANGELOG.md b/packages/provisioning/CHANGELOG.md index 35b1f0b1a8..862e54aca0 100644 --- a/packages/provisioning/CHANGELOG.md +++ b/packages/provisioning/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe provisioning SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -23,6 +27,10 @@ All notable changes to the Zowe provisioning SDK package will be documented in t - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.6.2` - BugFix: Updated `js-yaml` dependency for technical currency. diff --git a/packages/secrets/package.json b/packages/secrets/package.json index 90321d7a76..e5929e9134 100644 --- a/packages/secrets/package.json +++ b/packages/secrets/package.json @@ -39,6 +39,7 @@ "build:debug": "cd src/keyring && napi build --config napi.json --js false --platform", "build:ts": "tsc --pretty", "install": "node scripts/prebuildCheck.js || npm run rebuild", + "lint": "echo 'Nothing to Lint'", "prepack": "node ../../scripts/prepareLicenses.js", "prepublishOnly": "bash scripts/prebuildify.sh", "rebuild": "npx --yes --package=@napi-rs/cli@2.16.2 -- napi build --config src/keyring/napi.json --cargo-cwd src/keyring --platform --release --js=false src/keyring", diff --git a/packages/workflows/CHANGELOG.md b/packages/workflows/CHANGELOG.md index a7c840082d..53dd23645b 100644 --- a/packages/workflows/CHANGELOG.md +++ b/packages/workflows/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS workflows SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -15,6 +19,10 @@ All notable changes to the Zowe z/OS workflows SDK package will be documented in - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.0.0` - Major: Introduced Team Profiles, Daemon mode, and more. See the prerelease items (if any) below for more details. diff --git a/packages/zosconsole/CHANGELOG.md b/packages/zosconsole/CHANGELOG.md index 795da10dd7..0ee78b6944 100644 --- a/packages/zosconsole/CHANGELOG.md +++ b/packages/zosconsole/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS console SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -15,6 +19,10 @@ All notable changes to the Zowe z/OS console SDK package will be documented in t - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.0.0` - Major: Introduced Team Profiles, Daemon mode, and more. See the prerelease items (if any) below for more details. diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 90062b81bc..072b34263e 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202407021516` - BugFix: Updated dependencies for technical currency [#2188](https://github.com/zowe/zowe-cli/pull/2188) @@ -66,6 +70,10 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.26.1` - BugFix: Fixed `Get.dataSet` and `Get.USSFile` methods so that they return an empty buffer instead of null for empty files. [#2173](https://github.com/zowe/zowe-cli/pull/2173) diff --git a/packages/zoslogs/CHANGELOG.md b/packages/zoslogs/CHANGELOG.md index 4ad8dc0292..92706657cc 100644 --- a/packages/zoslogs/CHANGELOG.md +++ b/packages/zoslogs/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS logs SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -15,6 +19,10 @@ All notable changes to the Zowe z/OS logs SDK package will be documented in this - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.0.0` - Major: Introduced Team Profiles, Daemon mode, and more. See the prerelease items (if any) below for more details. diff --git a/packages/zosmf/CHANGELOG.md b/packages/zosmf/CHANGELOG.md index 2dfbe41cfb..b31634044e 100644 --- a/packages/zosmf/CHANGELOG.md +++ b/packages/zosmf/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to the Zowe z/OSMF SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details +- LTS Breaking: Removed the following obsolete V1 profile attributes from ZosmfBaseHandler: + - mZosmfProfile + - mZosmfLoadedProfile + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -25,7 +32,12 @@ All notable changes to the Zowe z/OSMF SDK package will be documented in this fi - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.6.2` + - BugFix: Updated example for `zowe profiles create zosmf-profile` command. [#1152](https://github.com/zowe/zowe-cli/issues/1152) ## `7.1.0` diff --git a/packages/zosmf/src/ZosmfBaseHandler.ts b/packages/zosmf/src/ZosmfBaseHandler.ts index c2203cd23d..67d3c56d5a 100644 --- a/packages/zosmf/src/ZosmfBaseHandler.ts +++ b/packages/zosmf/src/ZosmfBaseHandler.ts @@ -14,14 +14,12 @@ import { ICommandArguments, ICommandHandler, IHandlerParameters, - IProfile, IHandlerResponseConsoleApi, IHandlerFormatOutputApi, IHandlerResponseDataApi, IHandlerProgressApi, IImperativeError, ImperativeError, - IProfileLoaded, ISession, Session, ConnectionPropsForSessCfg @@ -38,16 +36,6 @@ export abstract class ZosmfBaseHandler implements ICommandHandler { */ protected mSession: AbstractSession; - /** - * Loaded z/OSMF profile if needed - */ - protected mZosmfProfile: IProfile; - - /** - * Loaded z/OSMF profile with meta information - */ - protected mZosmfLoadedProfile: IProfileLoaded; - /** * Command line arguments passed */ diff --git a/packages/zostso/CHANGELOG.md b/packages/zostso/CHANGELOG.md index f8bbf9033d..c493a9fe4f 100644 --- a/packages/zostso/CHANGELOG.md +++ b/packages/zostso/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS TSO SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202403041352` - BugFix: Updated engine to Node 18.12.0. [#2074](https://github.com/zowe/zowe-cli/pull/2074) @@ -22,6 +26,10 @@ All notable changes to the Zowe z/OS TSO SDK package will be documented in this - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.1.0` - Enhancement: Exposed `tso` profile type configuration. diff --git a/packages/zosuss/CHANGELOG.md b/packages/zosuss/CHANGELOG.md index 95824880aa..d4c382418b 100644 --- a/packages/zosuss/CHANGELOG.md +++ b/packages/zosuss/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS USS SDK package will be documented in this file. +## Recent Changes + +- Update: See `7.28.3` for details + ## `8.0.0-next.202408092029` - BugFix: Resolved bug that resulted in user not being prompted for a key passphrase if it is located in the secure credential array of the ssh profile. [#1770](https://github.com/zowe/zowe-cli/issues/1770) @@ -43,6 +47,10 @@ running `zowe zos-uss issue ssh` commands. [#2081](https://github.com/zowe/zowe- - Major: First major version bump for V3 +## `7.28.3` + +- BugFix: Refactored code to reduce the use of deprecated functions to prepare for upcoming Node.js 22 support. [#2191](https://github.com/zowe/zowe-cli/issues/2191) + ## `7.24.0` - Enhancement: Provide legible errors to users when they are missing user/password credentials while