diff --git a/packages/cli-test/src/cli/commands/app.ts b/packages/cli-test/src/cli/commands/app.ts index edc682c32..bb6135320 100644 --- a/packages/cli-test/src/cli/commands/app.ts +++ b/packages/cli-test/src/cli/commands/app.ts @@ -55,9 +55,12 @@ export const install = async function workspaceInstall( * @param appPath path to app * @returns command output */ -export const list = async function appList(appPath: string): Promise { +export const list = async function appList( + appPath: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess('app list'); + const cmd = new SlackCLIProcess('app list', options); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/auth.ts b/packages/cli-test/src/cli/commands/auth.ts index e9dc90f46..d1cbdda11 100644 --- a/packages/cli-test/src/cli/commands/auth.ts +++ b/packages/cli-test/src/cli/commands/auth.ts @@ -87,11 +87,12 @@ export default { /** team domain to logout from */ teamFlag?: string; /** perform the logout for all authentications */ - allWorkspaces?: boolean + allWorkspaces?: boolean; + qa?: boolean; }): Promise { // TODO: (breaking change) inconsistent use of object-as-params vs. separate parameters // Create the command with workspaces to logout of - const globalOpts: SlackCLIGlobalOptions = {}; + const globalOpts: SlackCLIGlobalOptions = { qa: options?.qa }; const cmdOpts: SlackCLICommandOptions = {}; if (options?.teamFlag) { globalOpts.team = options.teamFlag; diff --git a/packages/cli-test/src/cli/commands/create.ts b/packages/cli-test/src/cli/commands/create.ts index 0c0a94cc2..0e5e2093f 100644 --- a/packages/cli-test/src/cli/commands/create.ts +++ b/packages/cli-test/src/cli/commands/create.ts @@ -8,7 +8,7 @@ import commandError from '../command-error'; * @returns command output */ export const create = async function create( - appName?: string, + appName?: string, // TODO: bad arg name. it should be app path, because this is effectively how it is used globalOpts?: SlackCLIGlobalOptions, commandOpts?: SlackCLICommandOptions, shellOpts?: SpawnOptionsWithoutStdio, @@ -43,7 +43,7 @@ export const createAppFromTemplate = async function createAppFromTemplate({ shellOpts = {}, }: { templateString: string; - appName?: string; + appName?: string; // TODO: bad arg name. it should be app path, because this is effectively how it is used branchName?: string; shellOpts?: SpawnOptionsWithoutStdio; }): Promise { diff --git a/packages/cli-test/src/cli/index.ts b/packages/cli-test/src/cli/index.ts index a9e936155..0af5c6c0d 100644 --- a/packages/cli-test/src/cli/index.ts +++ b/packages/cli-test/src/cli/index.ts @@ -66,6 +66,7 @@ export const SlackCLI = { appPath, appTeamID, isLocalApp, + qa, }: { // TODO: (breaking change) model these types better, if appPath isn't provided then appTeamId // and isLocalApp are not needed either @@ -74,15 +75,16 @@ export const SlackCLI = { /** Team domain or ID where app is installed */ appTeamID: string; isLocalApp?: boolean; + qa?: boolean; }): Promise { if (appPath) { // List instances of app installation if app path provided - const installedAppsOutput = await SlackCLI.app.list(appPath); + const installedAppsOutput = await SlackCLI.app.list(appPath, { qa }); // If app is installed if (!installedAppsOutput.includes('This project has no apps')) { // Soft app delete try { - await SlackCLI.app.delete(appPath, appTeamID, { isLocalApp }); + await SlackCLI.app.delete(appPath, appTeamID, { isLocalApp, qa }); } catch (error) { logger.warn(`stopSession could not delete app gracefully, continuing. Error: ${error}`); } @@ -97,7 +99,7 @@ export const SlackCLI = { // Log out if logged in try { - await SlackCLI.logout({ allWorkspaces: true }); + await SlackCLI.logout({ allWorkspaces: true, qa }); } catch (error) { // TODO: maybe should error instead? this seems pretty bad logger.warn(`Could not logout gracefully. Error: ${error}`); diff --git a/packages/cli-test/src/index.ts b/packages/cli-test/src/index.ts index c254d7355..e5224a9f0 100644 --- a/packages/cli-test/src/index.ts +++ b/packages/cli-test/src/index.ts @@ -1,6 +1,7 @@ export { SlackCLI } from './cli'; export { SlackCLIProcess } from './cli/cli-process'; export { SlackTracerId, SlackProduct } from './utils/constants'; +export { shell } from './cli/shell'; // Check for cli binary path if (!process.env.SLACK_CLI_PATH) { diff --git a/packages/cli-test/src/utils/constants.ts b/packages/cli-test/src/utils/constants.ts index dca462035..ce018fc5c 100644 --- a/packages/cli-test/src/utils/constants.ts +++ b/packages/cli-test/src/utils/constants.ts @@ -1,3 +1,4 @@ +// TODO: would be nice to add JSDocs for each of these to describe when they appear in CLI output /** * This file should be kept up to date with the source of truth in the Slack CLI repo */ @@ -12,16 +13,26 @@ export const SlackTracerId = { SLACK_TRACE_AUTH_LIST_SUCCESS: 'SLACK_TRACE_AUTH_LIST_SUCCESS', SLACK_TRACE_AUTH_LOGIN_START: 'SLACK_TRACE_AUTH_LOGIN_START', SLACK_TRACE_AUTH_LOGIN_SUCCESS: 'SLACK_TRACE_AUTH_LOGIN_SUCCESS', + SLACK_TRACE_AUTH_LOGOUT_START: 'SLACK_TRACE_AUTH_LOGOUT_START', SLACK_TRACE_AUTH_LOGOUT_SUCCESS: 'SLACK_TRACE_AUTH_LOGOUT_SUCCESS', + SLACK_TRACE_AUTH_REVOKE_START: 'SLACK_TRACE_AUTH_REVOKE_START', + SLACK_TRACE_AUTH_REVOKE_SUCCESS: 'SLACK_TRACE_AUTH_REVOKE_SUCCESS', + SLACK_TRACE_COLLABORATOR_ADD_COLLABORATOR: 'SLACK_TRACE_COLLABORATOR_ADD_COLLABORATOR', + SLACK_TRACE_COLLABORATOR_ADD_SUCCESS: 'SLACK_TRACE_COLLABORATOR_ADD_SUCCESS', + SLACK_TRACE_COLLABORATOR_LIST_COLLABORATOR: 'SLACK_TRACE_COLLABORATOR_LIST_COLLABORATOR', + SLACK_TRACE_COLLABORATOR_LIST_COUNT: 'SLACK_TRACE_COLLABORATOR_LIST_COUNT', + SLACK_TRACE_COLLABORATOR_LIST_SUCCESS: 'SLACK_TRACE_COLLABORATOR_LIST_SUCCESS', + SLACK_TRACE_COLLABORATOR_REMOVE_COLLABORATOR: 'SLACK_TRACE_COLLABORATOR_REMOVE_COLLABORATOR', + SLACK_TRACE_COLLABORATOR_REMOVE_SUCCESS: 'SLACK_TRACE_COLLABORATOR_REMOVE_SUCCESS', SLACK_TRACE_CREATE_DEPENDENCIES_SUCCESS: 'SLACK_TRACE_CREATE_DEPENDENCIES_SUCCESS', SLACK_TRACE_CREATE_ERROR: 'SLACK_TRACE_CREATE_ERROR', SLACK_TRACE_CREATE_PROJECT_PATH: 'SLACK_TRACE_CREATE_PROJECT_PATH', SLACK_TRACE_CREATE_START: 'SLACK_TRACE_CREATE_START', SLACK_TRACE_CREATE_SUCCESS: 'SLACK_TRACE_CREATE_SUCCESS', + SLACK_TRACE_CREATE_TEMPLATE_OPTIONS: 'SLACK_TRACE_CREATE_TEMPLATE_OPTIONS', SLACK_TRACE_DATASTORE_COUNT_DATASTORE: 'SLACK_TRACE_DATASTORE_COUNT_DATASTORE', SLACK_TRACE_DATASTORE_COUNT_SUCCESS: 'SLACK_TRACE_DATASTORE_COUNT_SUCCESS', SLACK_TRACE_DATASTORE_COUNT_TOTAL: 'SLACK_TRACE_DATASTORE_COUNT_TOTAL', - SLACK_TRACE_CREATE_TEMPLATE_OPTIONS: 'SLACK_TRACE_CREATE_TEMPLATE_OPTIONS', SLACK_TRACE_FEEDBACK_MESSAGE: 'SLACK_TRACE_FEEDBACK_MESSAGE', SLACK_TRACE_MANIFEST_VALIDATE_SUCCESS: 'SLACK_TRACE_MANIFEST_VALIDATE_SUCCESS', SLACK_TRACE_PLATFORM_DEPLOY_SUCCESS: 'SLACK_TRACE_PLATFORM_DEPLOY_SUCCESS', diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index a5904e180..953e26086 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -10,7 +10,6 @@ import isStream from 'is-stream'; import pQueue from 'p-queue'; import pRetry, { AbortError } from 'p-retry'; import axios, { AxiosHeaderValue, AxiosInstance, AxiosResponse } from 'axios'; -// eslint-disable-next-line @typescript-eslint/naming-convention import FormData from 'form-data'; import isElectron from 'is-electron'; import {