From 7c5a7d37fd0664726fe71ad426a364767e1a75c2 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 19:51:42 +0000 Subject: [PATCH 1/6] remove healthCheck Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- .../__snapshots__/imperative.test.ts.snap | 1 - packages/cli/src/healthCheck.handler.ts | 14 -------------- packages/cli/src/imperative.ts | 5 ++--- 3 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 packages/cli/src/healthCheck.handler.ts diff --git a/packages/cli/__tests__/__snapshots__/imperative.test.ts.snap b/packages/cli/__tests__/__snapshots__/imperative.test.ts.snap index c1800305..8bc3a7fa 100644 --- a/packages/cli/__tests__/__snapshots__/imperative.test.ts.snap +++ b/packages/cli/__tests__/__snapshots__/imperative.test.ts.snap @@ -6,7 +6,6 @@ exports[`imperative config should match the snapshot 1`] = ` "*/*.definition!(.d).*s", ], "name": "cics", - "pluginHealthCheck": "./lib/healthCheck.handler", "productDisplayName": "CLI Plug-in for IBM CICS", "profiles": [ { diff --git a/packages/cli/src/healthCheck.handler.ts b/packages/cli/src/healthCheck.handler.ts deleted file mode 100644 index dff08bd0..00000000 --- a/packages/cli/src/healthCheck.handler.ts +++ /dev/null @@ -1,14 +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. - * - */ - -export = () => { - return true; -}; diff --git a/packages/cli/src/imperative.ts b/packages/cli/src/imperative.ts index 86502af3..b58572d9 100644 --- a/packages/cli/src/imperative.ts +++ b/packages/cli/src/imperative.ts @@ -19,7 +19,6 @@ const config: IImperativeConfig = { rootCommandDescription: PluginConstants.PLUGIN_DESCRIPTION, productDisplayName: PluginConstants.PLUGIN_NAME, name: PluginConstants.PLUGIN_GROUP_NAME, - pluginHealthCheck: "./lib/healthCheck.handler", // apimlConnLookup: [ // { // apiId: "place_the_cics_apiId_here", @@ -34,8 +33,8 @@ const config: IImperativeConfig = { type: "object", title: "CICS Profile", description: "A cics profile is required to issue commands in the cics command group that interact with " + - "CICS regions. The cics profile contains your host, port, user name, and password " + - "for the IBM CICS management client interface (CMCI) server of your choice.", + "CICS regions. The cics profile contains your host, port, user name, and password " + + "for the IBM CICS management client interface (CMCI) server of your choice.", properties: { host: { type: "string", From 739e0e8a0ac9c1c38de5d112f5c4808109c12c28 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:14:56 +0000 Subject: [PATCH 2/6] remove some bright command instances Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- .../__scripts__/create_cics_profile.sh | 7 -- .../__scripts__/create_cics_profile_help.sh | 10 -- ...eate.cics-profile.integration.test.ts.snap | 116 ------------------ ...le.create.cics-profile.integration.test.ts | 60 --------- packages/cli/src/CicsSession.ts | 24 ++-- 5 files changed, 13 insertions(+), 204 deletions(-) delete mode 100755 packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile.sh delete mode 100755 packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile_help.sh delete mode 100644 packages/cli/__tests__/__system__/profiles/__snapshots__/cli.profile.create.cics-profile.integration.test.ts.snap delete mode 100644 packages/cli/__tests__/__system__/profiles/cli.profile.create.cics-profile.integration.test.ts diff --git a/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile.sh b/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile.sh deleted file mode 100755 index dd210fa7..00000000 --- a/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh -set -e - -echo "===============CREATE cics PROFILE===============" - -bright profiles create cics-profile cics1 --host cics1 --port 1234 --user ibmuser --password pwrd1234 -bright profiles delete cics-profile cics1 # delete the stored credentials \ No newline at end of file diff --git a/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile_help.sh b/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile_help.sh deleted file mode 100755 index 5a005301..00000000 --- a/packages/cli/__tests__/__system__/profiles/__scripts__/create_cics_profile_help.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -set -e - -echo "===============CREATE cics PROFILE HELP===============" - -bright profiles create cics-profile -h -if [ $? -gt 0 ] -then - exit $? -fi \ No newline at end of file diff --git a/packages/cli/__tests__/__system__/profiles/__snapshots__/cli.profile.create.cics-profile.integration.test.ts.snap b/packages/cli/__tests__/__system__/profiles/__snapshots__/cli.profile.create.cics-profile.integration.test.ts.snap deleted file mode 100644 index 9cfa8ebf..00000000 --- a/packages/cli/__tests__/__system__/profiles/__snapshots__/cli.profile.create.cics-profile.integration.test.ts.snap +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Create cics Profile Success scenarios should display create cics profile help 1`] = ` -"===============CREATE cics PROFILE HELP=============== - - COMMAND NAME - ------------ - - cics-profile | cics - - DESCRIPTION - ----------- - - A cics profile is required to issue commands in the cics command group that - interact with CICS regions. The cics profile contains your host, port, user - name, and password for the IBM CICS management client interface (CMCI) server of - your choice. - - Warning: This command has been deprecated. - Recommended replacement: The 'config init' command - - USAGE - ----- - - zowe profiles create cics-profile [options] - - POSITIONAL ARGUMENTS - -------------------- - - profileName (string) - - Specifies the name of the new cics profile. You can load this profile by using - the name on commands that support the "--cics-profile" option. - - OPTIONS - ------- - - --host | -H (string) - - The CMCI server host name - - --port | -P (number) - - The CMCI server port - - Default value: 1490 - - --user | -u (string) - - Your username to connect to CICS - - --password | -p (string) - - Your password to connect to CICS - - --region-name (string) - - The name of the CICS region name to interact with - - --cics-plex (string) - - The name of the CICSPlex to interact with - - --overwrite | --ow (boolean) - - Overwrite the cics profile when a profile of the same name exists. - - --disable-defaults | --dd (boolean) - - Disable populating profile values of undefined properties with default values. - - CICS CONNECTION OPTIONS - ----------------------- - - --reject-unauthorized | --ru (boolean) - - Reject self-signed certificates. - - Default value: true - - --protocol | -o (string) - - Specifies CMCI protocol (http or https). - - Default value: https - Allowed values: http, https - - GLOBAL OPTIONS - -------------- - - --show-inputs-only (boolean) - - Show command inputs and do not run the command - - --response-format-json | --rfj (boolean) - - Produce JSON formatted data from a command - - --help | -h (boolean) - - Display help text - - --help-web | --hw (boolean) - - Display HTML help in browser - - EXAMPLES - -------- - - - Create a cics profile named 'cics123' to connect to CICS at - host zos123 and port 1490: - - $ zowe profiles create cics-profile cics123 --host zos123 --port 1490 --user ibmuser --password myp4ss - -" -`; diff --git a/packages/cli/__tests__/__system__/profiles/cli.profile.create.cics-profile.integration.test.ts b/packages/cli/__tests__/__system__/profiles/cli.profile.create.cics-profile.integration.test.ts deleted file mode 100644 index 2e60a7a5..00000000 --- a/packages/cli/__tests__/__system__/profiles/cli.profile.create.cics-profile.integration.test.ts +++ /dev/null @@ -1,60 +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 { ITestEnvironment, TestEnvironment, runCliScript, stripProfileDeprecationMessages } from "@zowe/cli-test-utils"; -import { ITestPropertiesSchema } from "../../__src__/ITestPropertiesSchema"; - -let testEnvironment: ITestEnvironment; - -/* - NOTE!! The cics plugin must be installed into Brightside in order to test the creation of a cics profile. - */ - -describe("Create cics Profile", () => { - - const args: any[] = []; - - // Create the unique test environment - beforeAll(async () => { - testEnvironment = await TestEnvironment.setUp({ - testName: "zos_create_cics_profile", - installPlugin: true - }); - }); - - afterAll(async () => { - await TestEnvironment.cleanUp(testEnvironment); - }); - - describe("Success scenarios", () => { - - it("should display create cics profile help", () => { - - const scriptPath = __dirname + "/__scripts__/create_cics_profile_help.sh"; - const response = runCliScript(scriptPath, testEnvironment, args); - - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toMatchSnapshot(); - }); - - it("should create cics profile", () => { - - const scriptPath = __dirname + "/__scripts__/create_cics_profile.sh"; - const response = runCliScript(scriptPath, - testEnvironment, args); - - expect(stripProfileDeprecationMessages(response.stderr)).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Profile created successfully"); - }); - }); -}); diff --git a/packages/cli/src/CicsSession.ts b/packages/cli/src/CicsSession.ts index ebd15321..0c6648fb 100644 --- a/packages/cli/src/CicsSession.ts +++ b/packages/cli/src/CicsSession.ts @@ -9,11 +9,13 @@ * */ -import { ConnectionPropsForSessCfg, ICommandArguments, ICommandOptionDefinition, - IHandlerParameters, IProfile, ISession, Logger, Session } from "@zowe/imperative"; +import { + ConnectionPropsForSessCfg, ICommandArguments, ICommandOptionDefinition, + IHandlerParameters, IProfile, ISession, Logger, Session +} from "@zowe/imperative"; /** - * Utility Methods for Brightside + * Utility Methods for Zowe * @export */ export class CicsSession { @@ -64,9 +66,9 @@ export class CicsSession { type: "string", group: CicsSession.CICS_CONNECTION_OPTION_GROUP, }; - /** - * Option used in profile creation and commands for rejectUnauthorized setting for connecting to FMP - */ + /** + * Option used in profile creation and commands for rejectUnauthorized setting for connecting to FMP + */ public static CICS_OPTION_REJECT_UNAUTHORIZED: ICommandOptionDefinition = { name: "reject-unauthorized", aliases: ["ru"], @@ -75,16 +77,16 @@ export class CicsSession { defaultValue: true, group: CicsSession.CICS_CONNECTION_OPTION_GROUP }; - /** - * Option used in profile creation and commands for protocol for CMCI - */ + /** + * Option used in profile creation and commands for protocol for CMCI + */ public static CICS_OPTION_PROTOCOL: ICommandOptionDefinition = { name: "protocol", aliases: ["o"], description: "Specifies CMCI protocol (http or https).", type: "string", defaultValue: "https", - allowableValues: {values: ["http", "https"], caseSensitive: false}, + allowableValues: { values: ["http", "https"], caseSensitive: false }, group: CicsSession.CICS_CONNECTION_OPTION_GROUP }; @@ -160,7 +162,7 @@ export class CicsSession { protocol: args.protocol || "https", }; - const sessCfgWithCreds = await ConnectionPropsForSessCfg.addPropsOrPrompt(sessCfg, args, {doPrompting, parms: handlerParams}); + const sessCfgWithCreds = await ConnectionPropsForSessCfg.addPropsOrPrompt(sessCfg, args, { doPrompting, parms: handlerParams }); return new Session(sessCfgWithCreds); } From 0fb5c5252ce4416855b2d18c25b425a45a1e3944 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:40:29 +0000 Subject: [PATCH 3/6] add zowe-v3-lts tag Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- .github/release.config.js | 6 + .vscode/settings.json | 2 +- .../__src__/ITestPropertiesSchema.ts | 92 +++++------ packages/sdk/src/rest/CicsCmciRestClient.ts | 154 +++++++++--------- 4 files changed, 130 insertions(+), 124 deletions(-) diff --git a/.github/release.config.js b/.github/release.config.js index 3c139e6f..0f94fe57 100644 --- a/.github/release.config.js +++ b/.github/release.config.js @@ -58,6 +58,9 @@ module.exports = { $cwd: "packages/sdk", aliasTags: { "latest": ["zowe-v2-lts"], + "next": ["zowe-v3-lts"], + // TODO: Remove the two lines above when merging to the `main` branch + // "latest": ["zowe-v3-lts"], }, npmPublish: true, }, @@ -65,6 +68,9 @@ module.exports = { $cwd: "packages/cli", aliasTags: { "latest": ["zowe-v2-lts"], + "next": ["zowe-v3-lts"], + // TODO: Remove the two lines above when merging to the `main` branch + // "latest": ["zowe-v3-lts"], }, npmPublish: true, }, diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c21f322..98ae3bc6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,7 +20,7 @@ // Standardize on the Prettier formatter "editor.defaultFormatter": "esbenp.prettier-vscode", // Enforce prettier on save - "editor.formatOnSave": true, + "editor.formatOnSave": false, "npm.packageManager": "npm", "eslint.packageManager": "npm" } diff --git a/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts b/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts index 95fab20b..771c125c 100644 --- a/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts +++ b/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts @@ -15,57 +15,57 @@ */ export interface ITestPropertiesSchema { - /** - * Properties related to connecting to CICS service - */ - cics: { - /** - * user ID to connect to CMCI + /** + * Properties related to connecting to CICS service */ - user: string, - /** - * Password to connect to CMCI - */ - password: string, - /** - * host name for CMCI - */ - host: string, - /** - * Port for CMCI - */ - port?: number, + cics: { + /** + * user ID to connect to CMCI + */ + user: string, + /** + * Password to connect to CMCI + */ + password: string, + /** + * host name for CMCI + */ + host: string, + /** + * Port for CMCI + */ + port?: number, - /** - * http or https protocol for CMCI - */ - protocol?: string; + /** + * http or https protocol for CMCI + */ + protocol?: string; - /** - * http or https protocol for CMCI - */ - rejectUnauthorized?: boolean; - }; + /** + * http or https protocol for CMCI + */ + rejectUnauthorized?: boolean; + }; - /** - * Properties related to connecting to CMCI - */ - cmci: { - /** - * CSD group to define resources to + /** + * Properties related to connecting to CMCI */ - csdGroup?: string; + cmci: { + /** + * CSD group to define resources to + */ + csdGroup?: string; - /** - * Name of the CICS region e.g. "CICSCMCI" - */ - regionName?: string; - }; + /** + * Name of the CICS region e.g. "CICSCMCI" + */ + regionName?: string; + }; - urimap: { - /** - * Name of the certificate to use for CICS Client Testing - */ - certificate?: string; - }; + urimap: { + /** + * Name of the certificate to use for CICS Client Testing + */ + certificate?: string; + }; } diff --git a/packages/sdk/src/rest/CicsCmciRestClient.ts b/packages/sdk/src/rest/CicsCmciRestClient.ts index 9981f18e..94ab0d23 100644 --- a/packages/sdk/src/rest/CicsCmciRestClient.ts +++ b/packages/sdk/src/rest/CicsCmciRestClient.ts @@ -30,32 +30,32 @@ export class CicsCmciRestClient extends RestClient { public static readonly CMCI_SUCCESS_RESPONSE_1 = "1024"; /** - * If the API request is successful, this value should be in - * api_response2 in the resultsummary object in the response - */ + * If the API request is successful, this value should be in + * api_response2 in the resultsummary object in the response + */ public static readonly CMCI_SUCCESS_RESPONSE_2 = "0"; /** - * Convert an object to XML using the xml2js package - * @param obj - the object to convert to XML - * @returns {string} the string of XML generated by xml2js - */ + * Convert an object to XML using the xml2js package + * @param obj - the object to convert to XML + * @returns {string} the string of XML generated by xml2js + */ public static convertObjectToXML(obj: any): string { this.log.trace("Converting the following object to XML via xml2js:\n%s", JSON.stringify(obj, null, 2)); - const builder = new Builder({headless: true}); + const builder = new Builder({ headless: true }); return builder.buildObject(obj); } /** - * Call the RestClient.getExpectString function assuming the response is XML, then return a promise of the JSON representation. - * @static - * @param {AbstractSession} session - representing connection to this api - * @param {string} resource - URI for which this request should go against - * @param {any} reqHeaders - headers to include in the REST request - * @returns {Promise<*>} - response body content from http(s) call - * @throws {ImperativeError} verifyResponseCodes fails - */ + * Call the RestClient.getExpectString function assuming the response is XML, then return a promise of the JSON representation. + * @static + * @param {AbstractSession} session - representing connection to this api + * @param {string} resource - URI for which this request should go against + * @param {any} reqHeaders - headers to include in the REST request + * @returns {Promise<*>} - response body content from http(s) call + * @throws {ImperativeError} verifyResponseCodes fails + */ public static async getExpectParsedXml(session: AbstractSession, resource: string, reqHeaders: any[] = []): Promise { const data = await CicsCmciRestClient.getExpectString(session, resource, reqHeaders); @@ -64,14 +64,14 @@ export class CicsCmciRestClient extends RestClient { } /** - * Call the RestClient.deleteExpectString function assuming the response is XML, then return a promise of the JSON representation. - * @static - * @param {AbstractSession} session - representing connection to this api - * @param {string} resource - URI for which this request should go against - * @param {any} reqHeaders - headers to include in the REST request - * @returns {Promise<*>} - response body content from http(s) call - * @throws {ImperativeError} verifyResponseCodes fails - */ + * Call the RestClient.deleteExpectString function assuming the response is XML, then return a promise of the JSON representation. + * @static + * @param {AbstractSession} session - representing connection to this api + * @param {string} resource - URI for which this request should go against + * @param {any} reqHeaders - headers to include in the REST request + * @returns {Promise<*>} - response body content from http(s) call + * @throws {ImperativeError} verifyResponseCodes fails + */ public static async deleteExpectParsedXml(session: AbstractSession, resource: string, reqHeaders: any[] = []): Promise { const data = await CicsCmciRestClient.deleteExpectString(session, resource, reqHeaders); @@ -80,16 +80,16 @@ export class CicsCmciRestClient extends RestClient { } /** - * PUT a CMCI endpoint expecting an XML return value parsed into a JCL - * Call the RestClient.putExpectString function assuming the response is XML, then return a promise of the JSON representation. - * @static - * @param {AbstractSession} session - representing connection to this api - * @param {string} resource - URI for which this request should go against - * @param {any} reqHeaders - headers to include in the REST request - * @param payload - XML body to put or a javascript object to convert to XML - * @returns {Promise<*>} - response body content from http(s) call - * @throws {ImperativeError} verifyResponseCodes fails - */ + * PUT a CMCI endpoint expecting an XML return value parsed into a JCL + * Call the RestClient.putExpectString function assuming the response is XML, then return a promise of the JSON representation. + * @static + * @param {AbstractSession} session - representing connection to this api + * @param {string} resource - URI for which this request should go against + * @param {any} reqHeaders - headers to include in the REST request + * @param payload - XML body to put or a javascript object to convert to XML + * @returns {Promise<*>} - response body content from http(s) call + * @throws {ImperativeError} verifyResponseCodes fails + */ public static async putExpectParsedXml(session: AbstractSession, resource: string, reqHeaders: any[] = [], payload: any): Promise { @@ -102,16 +102,16 @@ export class CicsCmciRestClient extends RestClient { } /** - * POST a CMCI endpoint expecting a XML return value - * Calls the RestClient.postExpectString function assuming the response is XML, then return a promise of the JSON representation. - * @static - * @param {AbstractSession} session - representing connection to this api - * @param {string} resource - URI for which this request should go against - * @param {any} reqHeaders - headers to include in the REST request - * @param payload - XML body to put or a javascript object to convert to XML - * @returns {Promise<*>} - response body content from http(s) call - * @throws {ImperativeError} verifyResponseCodes fails - */ + * POST a CMCI endpoint expecting a XML return value + * Calls the RestClient.postExpectString function assuming the response is XML, then return a promise of the JSON representation. + * @static + * @param {AbstractSession} session - representing connection to this api + * @param {string} resource - URI for which this request should go against + * @param {any} reqHeaders - headers to include in the REST request + * @param payload - XML body to put or a javascript object to convert to XML + * @returns {Promise<*>} - response body content from http(s) call + * @throws {ImperativeError} verifyResponseCodes fails + */ public static async postExpectParsedXml(session: AbstractSession, resource: string, reqHeaders: any[] = [], payload: any): Promise { @@ -124,21 +124,21 @@ export class CicsCmciRestClient extends RestClient { } /** - * Internal logger - */ + * Internal logger + */ private static mLogger: Logger; /** - * Internal parser - */ + * Internal parser + */ private static mParser: Parser; /** - * Detect if a rpayload is a string or an object - * If it is an object, convert it to XML using xml2js - * @param payload - the request body / payload - * @returns {string} the XML that can be used as the request body - */ + * Detect if a payload is a string or an object + * If it is an object, convert it to XML using xml2js + * @param payload - the request body / payload + * @returns {string} the XML that can be used as the request body + */ private static convertPayloadToXML(payload: any): string { if (isString(payload)) { // if it's already a string, use it verbatim @@ -150,9 +150,9 @@ export class CicsCmciRestClient extends RestClient { } /** - * Use the Brightside logger instead of the imperative logger - * @return {Logger} - */ + * Use the Zowe logger instead of the imperative logger + * @return {Logger} + */ private static get log(): Logger { if (this.mLogger == null) { this.mLogger = Logger.getAppLogger(); @@ -161,9 +161,9 @@ export class CicsCmciRestClient extends RestClient { } /** - * Use a configured parser - * @return {Parser} - */ + * Use a configured parser + * @return {Parser} + */ private static get parser(): Parser { if (this.mParser == null) { this.mParser = new Parser({ @@ -176,15 +176,15 @@ export class CicsCmciRestClient extends RestClient { } /** - * Check that we got the expected response codes from the API after a request - * @param {ICMCIApiResponse} apiResponse - the parsed response - * @returns {ICMCIApiResponse} - the response if it was correct - * @throws {ImperativeError} request did not get the expected codes - */ + * Check that we got the expected response codes from the API after a request + * @param {ICMCIApiResponse} apiResponse - the parsed response + * @returns {ICMCIApiResponse} - the response if it was correct + * @throws {ImperativeError} request did not get the expected codes + */ private static verifyResponseCodes(apiResponse: ICMCIApiResponse): ICMCIApiResponse { if (apiResponse.response != null && apiResponse.response.resultsummary != null - && apiResponse.response.resultsummary.api_response1 === CicsCmciRestClient.CMCI_SUCCESS_RESPONSE_1 - && apiResponse.response.resultsummary.api_response2 === CicsCmciRestClient.CMCI_SUCCESS_RESPONSE_2) { + && apiResponse.response.resultsummary.api_response1 === CicsCmciRestClient.CMCI_SUCCESS_RESPONSE_1 + && apiResponse.response.resultsummary.api_response2 === CicsCmciRestClient.CMCI_SUCCESS_RESPONSE_2) { // expected return code and reason code specify return apiResponse; } else { @@ -195,13 +195,13 @@ export class CicsCmciRestClient extends RestClient { } /** - * parse an XML string with XML2js - * The API is already synchronous according to their documentation but requires a callback. - * This is a wrapper that doesn't require a callback. - * @param {string} str - the string of XML to parse - * @returns {any} the object parsed from the XML - * @throws {Error} xml2js.parseString fails - */ + * parse an XML string with XML2js + * The API is already synchronous according to their documentation but requires a callback. + * This is a wrapper that doesn't require a callback. + * @param {string} str - the string of XML to parse + * @returns {any} the object parsed from the XML + * @throws {Error} xml2js.parseString fails + */ private static parseStringSync(str: string) { let result; let error: Error; @@ -216,10 +216,10 @@ export class CicsCmciRestClient extends RestClient { } /** - * Process an error encountered in the rest client - * @param {IImperativeError} original - the original error automatically built by the abstract rest client - * @returns {IImperativeError} - the processed error with details added - */ + * Process an error encountered in the rest client + * @param {IImperativeError} original - the original error automatically built by the abstract rest client + * @returns {IImperativeError} - the processed error with details added + */ protected processError(original: IImperativeError): IImperativeError { original.msg = "CICS CMCI REST API Error:\n" + original.msg; let details = original.causeErrors; From 54dd050e8ea4ddd30c325156c554bca341188be6 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:26:00 +0000 Subject: [PATCH 4/6] address compilation failures Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- package-lock.json | 13 +++++ packages/vsce/package.json | 1 + packages/vsce/src/extension.ts | 4 +- packages/vsce/src/utils/loggerUtils.ts | 3 +- packages/vsce/src/utils/profileManagement.ts | 4 +- packages/vsce/tsconfig.json | 4 +- scripts/bundleTgz.js | 6 +- scripts/rewriteShrinkwrap.js | 60 +++++++++++--------- 8 files changed, 57 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 627fefe6..fcc0c25e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23395,6 +23395,7 @@ "version": "3.0.0", "dependencies": { "@zowe/cics-for-zowe-sdk": "6.0.0", + "@zowe/core-for-zowe-sdk": "^8.0.0-next.202402021649", "@zowe/zowe-explorer-api": "^3.0.0-next", "axios": "^1.6.7", "https": "~1.0.0", @@ -23408,6 +23409,18 @@ "vscode": "^1.53.2" } }, + "packages/vsce/node_modules/@zowe/core-for-zowe-sdk": { + "version": "8.0.0-next.202402021649", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/core-for-zowe-sdk/-/@zowe/core-for-zowe-sdk-8.0.0-next.202402021649.tgz", + "integrity": "sha512-a02D5BEX2B1W2kNa+vL5wCPyyhhUgUfPmU4o82Mu0k4bxkYBap/9Iad4spszFFlP4dbrqekyPcuomi0R+o9Gqg==", + "dependencies": { + "comment-json": "^4.1.1", + "string-width": "^4.2.3" + }, + "peerDependencies": { + "@zowe/imperative": "^8.0.0-next" + } + }, "packages/vsce/node_modules/axios": { "version": "1.6.7", "license": "MIT", diff --git a/packages/vsce/package.json b/packages/vsce/package.json index 67032dd4..5fecf364 100644 --- a/packages/vsce/package.json +++ b/packages/vsce/package.json @@ -892,6 +892,7 @@ }, "dependencies": { "@zowe/cics-for-zowe-sdk": "6.0.0", + "@zowe/core-for-zowe-sdk": "^8.0.0-next.202402021649", "@zowe/zowe-explorer-api": "^3.0.0-next", "axios": "^1.6.7", "https": "~1.0.0", diff --git a/packages/vsce/src/extension.ts b/packages/vsce/src/extension.ts index e2f6a81d..4bc9f782 100644 --- a/packages/vsce/src/extension.ts +++ b/packages/vsce/src/extension.ts @@ -89,8 +89,8 @@ export async function activate(context: ExtensionContext) { if (!zeVersion) { window.showErrorMessage("Zowe Explorer was not found: Please ensure Zowe Explorer v2.0.0 or higher is installed"); return; - } else if (zeVersion[0] !== "2") { - window.showErrorMessage(`Current version of Zowe Explorer is ${zeVersion}. Please ensure Zowe Explorer v2.0.0 or higher is installed`); + } else if (zeVersion[0] !== "3") { + window.showErrorMessage(`Current version of Zowe Explorer is ${zeVersion}. Please ensure Zowe Explorer v3.0.0 or higher is installed`); return; } if (ProfileManagement.apiDoesExist()) { diff --git a/packages/vsce/src/utils/loggerUtils.ts b/packages/vsce/src/utils/loggerUtils.ts index 87079711..c4b86251 100644 --- a/packages/vsce/src/utils/loggerUtils.ts +++ b/packages/vsce/src/utils/loggerUtils.ts @@ -9,7 +9,8 @@ * */ -import { IZoweLogger, getZoweDir } from "@zowe/zowe-explorer-api"; +import { IZoweLogger } from "@zowe/zowe-explorer-api"; +import { getZoweDir } from "@zowe/core-for-zowe-sdk"; import { join as joinPaths } from "path"; export class LoggerUtils { diff --git a/packages/vsce/src/utils/profileManagement.ts b/packages/vsce/src/utils/profileManagement.ts index bbf19c01..3760bdbe 100644 --- a/packages/vsce/src/utils/profileManagement.ts +++ b/packages/vsce/src/utils/profileManagement.ts @@ -9,7 +9,7 @@ * */ -import { ProfilesCache, ZoweExplorerApi, ZoweVsCodeExtension, imperative } from "@zowe/zowe-explorer-api"; +import { ProfilesCache, Types, ZoweVsCodeExtension, imperative } from "@zowe/zowe-explorer-api"; import axios, { AxiosRequestConfig } from "axios"; import { window } from "vscode"; import { xml2json } from "xml-js"; @@ -44,7 +44,7 @@ export class ProfileManagement { } public static async profilesCacheRefresh() { - const apiRegiser: ZoweExplorerApi.IApiRegisterClient = ProfileManagement.getExplorerApis(); + const apiRegiser: Types.IApiRegisterClient = ProfileManagement.getExplorerApis(); await ProfileManagement.getProfilesCache().refresh(apiRegiser); } diff --git a/packages/vsce/tsconfig.json b/packages/vsce/tsconfig.json index 36dda943..6e18e243 100644 --- a/packages/vsce/tsconfig.json +++ b/packages/vsce/tsconfig.json @@ -5,6 +5,6 @@ "outDir": "./lib" }, "include": [ - "./src" - ] + "./src/**/*.ts" + ], } diff --git a/scripts/bundleTgz.js b/scripts/bundleTgz.js index 0a1ada83..f1f3b941 100644 --- a/scripts/bundleTgz.js +++ b/scripts/bundleTgz.js @@ -48,10 +48,10 @@ if (fs.existsSync(path.join(cliPkgDir, "node_modules"))) { } fsE.copyFileSync(pkgJsonFile, pkgJsonFile + ".bak"); try { - // Install node_modules directly inside packages/cli - execCmd("npm run preshrinkwrap"); try { - execCmd(`npm view @zowe/cics-for-zowe-sdk`); + // Install node_modules directly inside packages/cli + execCmd("npm run preshrinkwrap"); + execCmd(`npm view @zowe/cics-for-zowe-sdk@${tempPkgJson.version}`); } catch (err) { const sdkTgzPath = path.relative(__dirname, "../dist/zowe-cics-for-zowe-sdk-" + tempPkgJson.version + ".tgz"); execCmd(`${npmInstallCmd} ${sdkTgzPath}`); diff --git a/scripts/rewriteShrinkwrap.js b/scripts/rewriteShrinkwrap.js index e5a4429b..e232199a 100644 --- a/scripts/rewriteShrinkwrap.js +++ b/scripts/rewriteShrinkwrap.js @@ -31,18 +31,19 @@ if (!fs.existsSync(rootShrinkwrapFile)) { // Remove "file:" links from shrinkwrap const shrinkwrap = JSON.parse(fs.readFileSync(rootShrinkwrapFile, "utf-8")); for (const [k, v] of Object.entries(shrinkwrap.packages)) { - if (v.link) { - delete shrinkwrap.packages[k]; - } + if (v.link) { + delete shrinkwrap.packages[k]; + } } fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); // Build deduped shrinkwrap for @zowe/cics-for-zowe-cli -const zoweRegistry = require(cliDir + "package.json").publishConfig.registry;; -getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }) -.then((lockfile) => fs.writeFileSync(cliShrinkwrapFile, lockfile)) -.then(() => console.log(chalk.green("Lockfile contents written!"))) -.catch((err) => { +const zoweRegistry = require(cliDir + "package.json").publishConfig.registry; +getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }).then((lockfile) => { + fs.writeFileSync(cliShrinkwrapFile, lockfile); + console.log(chalk.green("Lockfile contents written!")); + monorepoShrinkwrap(); +}).catch((err) => { if (err.statusCode !== 404) { console.error(err); process.exit(1); @@ -51,31 +52,34 @@ getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }) } }); -const pkgA = rootDir + "package.json"; -const pkgB = rootDir + "package.json_"; -try { - // Mimic non-workspaces monorepo - fs.renameSync(pkgA, pkgB); +function monorepoShrinkwrap() { + const pkgA = rootDir + "package.json"; + const pkgB = rootDir + "package.json_"; + try { + // Mimic non-workspaces monorepo + fs.renameSync(pkgA, pkgB); - cp.execSync("npm shrinkwrap", {cwd: cliDir}); + cp.execSync("npm shrinkwrap", { cwd: cliDir }); - const shrinkwrap = JSON.parse(fs.readFileSync(cliShrinkwrapFile, "utf-8")); - shrinkwrap.lockfileVersion = 2; - for (const [k, v] of Object.entries(shrinkwrap.packages)) { - if (v.link || v.extraneous || k === "../sdk") { + const shrinkwrap = JSON.parse(fs.readFileSync(cliShrinkwrapFile, "utf-8")); + shrinkwrap.lockfileVersion = 2; + for (const [k, v] of Object.entries(shrinkwrap.packages)) { + if (v.link || v.extraneous || k === "../sdk") { delete shrinkwrap.packages[k]; + } } - } - for (const [k, v] of Object.entries(shrinkwrap?.dependencies ?? [])) { - if (v.link || v.extraneous || k === "../sdk") { + for (const [k, v] of Object.entries(shrinkwrap?.dependencies ?? [])) { + if (v.link || v.extraneous || k === "../sdk") { delete shrinkwrap.dependencies[k]; + } } - } - fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); + fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); + console.log(chalk.green("Shrinkwrap contents written!")); - // cp.execSync(`sed -i 's#file:../sdk#${require(cliDir + "package.json").version}#g' npm-shrinkwrap.json`, {cwd: cliDir}); - // cp.execSync("npm i ../sdk --install-links --package-lock-only", {cwd: cliDir}); -} finally { - // revert back to workspaces monorepo - fs.renameSync(pkgB, pkgA); + // cp.execSync(`sed -i 's#file:../sdk#${require(cliDir + "package.json").version}#g' npm-shrinkwrap.json`, {cwd: cliDir}); + // cp.execSync("npm i ../sdk --install-links --package-lock-only", {cwd: cliDir}); + } finally { + // revert back to workspaces monorepo + fs.renameSync(pkgB, pkgA); + } } \ No newline at end of file From 64d121cc79893e3719ae1e24f2f4fded3a868567 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:28:19 +0000 Subject: [PATCH 5/6] update changelog Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- packages/cli/CHANGELOG.md | 4 ++++ packages/sdk/CHANGELOG.md | 4 ++++ packages/vsce/CHANGELOG.md | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index e4f3eef2..55035308 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the IBM® CICS® Plug-in for Zowe CLI will be documented in this file. +## Recent Changes + +- Major: Release v3.0.0-next pre-release + ## `5.0.3` - BugFix: Updated dependencies for technical currency diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index e4f3eef2..55035308 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the IBM® CICS® Plug-in for Zowe CLI will be documented in this file. +## Recent Changes + +- Major: Release v3.0.0-next pre-release + ## `5.0.3` - BugFix: Updated dependencies for technical currency diff --git a/packages/vsce/CHANGELOG.md b/packages/vsce/CHANGELOG.md index db72b9ba..f28968d8 100644 --- a/packages/vsce/CHANGELOG.md +++ b/packages/vsce/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the "cics-extension-for-zowe" extension will be documented in this file. +## Recent Changes + +- Major: Release v3.0.0-next pre-release + ## `2.3.3` - BugFix: Updated dependencies for technical currency From 0745776c476dc2775c525016d7803aa5bd79d118 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:33:00 +0000 Subject: [PATCH 6/6] fix lint issues Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- .../__src__/ITestPropertiesSchema.ts | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts b/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts index 771c125c..214932d5 100644 --- a/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts +++ b/packages/cli/__tests__/__src__/ITestPropertiesSchema.ts @@ -15,57 +15,57 @@ */ export interface ITestPropertiesSchema { - /** + /** * Properties related to connecting to CICS service */ - cics: { - /** + cics: { + /** * user ID to connect to CMCI */ - user: string, - /** + user: string, + /** * Password to connect to CMCI */ - password: string, - /** + password: string, + /** * host name for CMCI */ - host: string, - /** + host: string, + /** * Port for CMCI */ - port?: number, + port?: number, - /** + /** * http or https protocol for CMCI */ - protocol?: string; + protocol?: string; - /** + /** * http or https protocol for CMCI */ - rejectUnauthorized?: boolean; - }; + rejectUnauthorized?: boolean; + }; - /** + /** * Properties related to connecting to CMCI */ - cmci: { - /** + cmci: { + /** * CSD group to define resources to */ - csdGroup?: string; + csdGroup?: string; - /** + /** * Name of the CICS region e.g. "CICSCMCI" */ - regionName?: string; - }; + regionName?: string; + }; - urimap: { - /** + urimap: { + /** * Name of the certificate to use for CICS Client Testing */ - certificate?: string; - }; + certificate?: string; + }; }