diff --git a/packages/core/src/codecatalyst/utils.ts b/packages/core/src/codecatalyst/utils.ts index b28aea75d4d..3f9cf6fe0bf 100644 --- a/packages/core/src/codecatalyst/utils.ts +++ b/packages/core/src/codecatalyst/utils.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Ides } from 'aws-sdk/clients/codecatalyst' +import { Ide } from '@aws-sdk/client-codecatalyst' import * as vscode from 'vscode' import { CodeCatalystResource, getCodeCatalystConfig } from '../shared/clients/codecatalystClient' import { pushIf } from '../shared/utilities/collectionUtils' @@ -55,6 +55,6 @@ export function openCodeCatalystUrl(o: CodeCatalystResource) { } /** Returns true if the dev env has a "vscode" IDE runtime. */ -export function isDevenvVscode(ides: Ides | undefined): boolean { +export function isDevenvVscode(ides: Ide[] | undefined): boolean { return ides !== undefined && ides.some((ide) => ide.name === 'VSCode') } diff --git a/packages/core/src/codecatalyst/vue/create/backend.ts b/packages/core/src/codecatalyst/vue/create/backend.ts index bdf49419243..102c6329653 100644 --- a/packages/core/src/codecatalyst/vue/create/backend.ts +++ b/packages/core/src/codecatalyst/vue/create/backend.ts @@ -32,7 +32,7 @@ import { CancellationError } from '../../../shared/utilities/timeoutUtils' import { telemetry } from '../../../shared/telemetry/telemetry' import { isNonNullable } from '../../../shared/utilities/tsUtils' import { createOrgPrompter, createProjectPrompter } from '../../wizards/selectResource' -import { GetSourceRepositoryCloneUrlsRequest } from 'aws-sdk/clients/codecatalyst' +import { GetSourceRepositoryCloneUrlsRequest } from '@aws-sdk/client-codecatalyst' import { QuickPickPrompter } from '../../../shared/ui/pickerPrompter' interface LinkedResponse { diff --git a/packages/core/src/shared/clients/codecatalystClient.ts b/packages/core/src/shared/clients/codecatalystClient.ts index 2fa9f7b31a2..45d123b36c4 100644 --- a/packages/core/src/shared/clients/codecatalystClient.ts +++ b/packages/core/src/shared/clients/codecatalystClient.ts @@ -24,10 +24,8 @@ import { } from '../utilities/tsUtils' import { AsyncCollection, toCollection } from '../utilities/asyncCollection' import { joinAll, pageableToCollection } from '../utilities/collectionUtils' -import { CodeCatalyst } from 'aws-sdk' import { ToolkitError } from '../errors' import { Uri } from 'vscode' -import { GetSourceRepositoryCloneUrlsRequest } from 'aws-sdk/clients/codecatalyst' import { CodeCatalystClient as CodeCatalystSDKClient, CreateAccessTokenCommand, @@ -53,15 +51,18 @@ import { GetProjectCommandOutput, GetProjectRequest, GetSourceRepositoryCloneUrlsCommand, + GetSourceRepositoryCloneUrlsRequest, GetSourceRepositoryCloneUrlsResponse, GetSpaceCommand, GetSpaceCommandOutput, GetSpaceRequest, GetSubscriptionCommand, GetSubscriptionRequest, + GetSubscriptionResponse, GetUserDetailsCommand, GetUserDetailsCommandOutput, GetUserDetailsRequest, + GetUserDetailsResponse, ListDevEnvironmentsCommand, ListDevEnvironmentsRequest, ListDevEnvironmentsResponse, @@ -73,6 +74,7 @@ import { ListSourceRepositoriesRequest, ListSourceRepositoriesResponse, ListSourceRepositoryBranchesCommand, + ListSourceRepositoryBranchesItem, ListSourceRepositoryBranchesRequest, ListSpacesCommand, ListSpacesRequest, @@ -152,14 +154,14 @@ export interface DevEnvironment extends CodeCatalystDevEnvironmentSummary { /** CodeCatalyst developer environment session. */ // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface CodeCatalystDevEnvSession extends CodeCatalyst.StartDevEnvironmentResponse {} +export interface CodeCatalystDevEnvSession extends StartDevEnvironmentResponse {} export interface CodeCatalystOrg extends SpaceSummary { readonly type: 'org' readonly name: string } -export interface CodeCatalystProject extends CodeCatalyst.ProjectSummary { +export interface CodeCatalystProject extends ProjectSummary { readonly type: 'project' readonly name: string readonly org: Pick @@ -172,7 +174,7 @@ export interface CodeCatalystRepo extends ListSourceRepositoriesItem { readonly project: Pick } -export interface CodeCatalystBranch extends CodeCatalyst.ListSourceRepositoryBranchesItem { +export interface CodeCatalystBranch extends ListSourceRepositoryBranchesItem { readonly type: 'branch' readonly name: string readonly repo: Pick @@ -200,7 +202,7 @@ function toBranch( org: string, project: string, repo: string, - branch: CodeCatalyst.ListSourceRepositoryBranchesItem + branch: ListSourceRepositoryBranchesItem ): CodeCatalystBranch { assertHasProps(branch, 'name') @@ -229,10 +231,7 @@ function createCodeCatalystClient( }) } -export type UserDetails = RequiredProps< - CodeCatalyst.GetUserDetailsResponse, - 'userId' | 'userName' | 'displayName' | 'primaryEmail' -> +export type UserDetails = RequiredProps // CodeCatalyst client has two variants: 'logged-in' and 'not logged-in' // The 'not logged-in' variant is a subtype and has restricted functionality @@ -421,7 +420,7 @@ class CodeCatalystClientInternal extends ClientWrapper { } } - public async getSubscription(request: GetSubscriptionRequest): Promise { + public async getSubscription(request: GetSubscriptionRequest): Promise { return this.call(GetSubscriptionCommand, request, false) } diff --git a/packages/core/src/test/shared/sshConfig.test.ts b/packages/core/src/test/shared/sshConfig.test.ts index 03841644e24..b828859586b 100644 --- a/packages/core/src/test/shared/sshConfig.test.ts +++ b/packages/core/src/test/shared/sshConfig.test.ts @@ -17,7 +17,7 @@ import { connectScriptPrefix, getCodeCatalystSsmEnv, } from '../../codecatalyst/model' -import { StartDevEnvironmentSessionRequest } from 'aws-sdk/clients/codecatalyst' +import { StartDevEnvironmentSessionRequest } from '@aws-sdk/client-codecatalyst' import { mkdir, readFile } from 'fs/promises' import fs from '../../shared/fs/fs' import { globals } from '../../shared' diff --git a/packages/core/src/testE2E/codecatalyst/client.test.ts b/packages/core/src/testE2E/codecatalyst/client.test.ts index 0356e3041c1..84e9309120c 100644 --- a/packages/core/src/testE2E/codecatalyst/client.test.ts +++ b/packages/core/src/testE2E/codecatalyst/client.test.ts @@ -20,7 +20,7 @@ import globals from '../../shared/extensionGlobals' import { CodeCatalystCreateWebview, SourceResponse } from '../../codecatalyst/vue/create/backend' import { waitUntil } from '../../shared/utilities/timeoutUtils' import { AccessDeniedException } from '@aws-sdk/client-sso-oidc' -import { GetDevEnvironmentRequest } from 'aws-sdk/clients/codecatalyst' +import { GetDevEnvironmentRequest, _InstanceType } from '@aws-sdk/client-codecatalyst' import { getTestWindow } from '../../test/shared/vscode/window' import { patchObject, registerAuthHook, skipTest, using } from '../../test/setupUtil' import { isExtensionInstalled } from '../../shared/utilities/vsCodeUtils' @@ -37,7 +37,6 @@ import { SsoConnection, } from '../../auth/connection' import { hasKey } from '../../shared/utilities/tsUtils' -import { _InstanceType } from '@aws-sdk/client-codecatalyst' let spaceName: CodeCatalystOrg['name'] let projectName: CodeCatalystProject['name'] @@ -615,6 +614,9 @@ describe('Test how this codebase uses the CodeCatalyst API', function () { ): Promise { const result = await waitUntil( async function () { + if (!devEnv.spaceName || !devEnv.projectName) { + return false + } const devEnvData = await client.getDevEnvironment({ spaceName: devEnv.spaceName, projectName: devEnv.projectName,