Skip to content

Commit e6c875f

Browse files
committed
refactor: remove v2 workaround, document v3 impl
1 parent 11d6cf5 commit e6c875f

File tree

2 files changed

+11
-63
lines changed

2 files changed

+11
-63
lines changed

packages/core/src/auth/sso/sdkV2Compat.ts

-57
This file was deleted.

packages/core/src/shared/clients/codecatalystClient.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import {
9898
import { SsoConnection } from '../../auth/connection'
9999
import { DevSettings } from '../settings'
100100
import { getServiceEnvVarConfig } from '../vscode/env'
101-
import { AwsCommand } from '../awsClientBuilderV3'
101+
import { AwsCommand, AwsCommandConstructor } from '../awsClientBuilderV3'
102102
import { ClientWrapper } from './clientWrapper'
103103
import { ServiceException } from '@aws-sdk/smithy-client'
104104
import { AccessDeniedException } from '@aws-sdk/client-sso-oidc'
@@ -218,6 +218,7 @@ function createCodeCatalystClient(
218218
regionCode: string,
219219
endpoint: string
220220
): CodeCatalystSDKClient {
221+
// Avoid using cached client so that we can inject fresh bearer token provider.
221222
return globals.sdkClientBuilderV3.createAwsService({
222223
serviceClient: CodeCatalystSDKClient,
223224
clientOptions: {
@@ -276,7 +277,7 @@ export async function createClient(
276277

277278
// TODO: move this to sso auth folder?
278279
function getTokenProvider(connection: SsoConnection): TokenIdentityProvider {
279-
return async (_props) => {
280+
return async (_) => {
280281
const token = await connection.getToken()
281282
return {
282283
token: token.accessToken,
@@ -322,7 +323,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
322323
this.log = logger.getLogger()
323324
}
324325

325-
protected override getClient(ignoreCache?: boolean): CodeCatalystSDKClient {
326+
protected override getClient(): CodeCatalystSDKClient {
326327
return this.sdkClientV3
327328
}
328329

@@ -340,7 +341,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
340341
CommandOptions extends CommandInput,
341342
Command extends AwsCommand<CommandInput, CommandOutput>,
342343
>(
343-
cmd: new (o: CommandInput) => Command,
344+
cmd: AwsCommandConstructor<CommandInput, Command>,
344345
commandOptions: CommandOptions,
345346
silent: true,
346347
defaultVal: CommandOutput
@@ -350,14 +351,18 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
350351
CommandOutput extends object,
351352
CommandOptions extends CommandInput,
352353
Command extends AwsCommand<CommandInput, CommandOutput>,
353-
>(cmd: new (o: CommandInput) => Command, commandOptions: CommandOptions, silent: false): Promise<CommandOutput>
354+
>(
355+
cmd: AwsCommandConstructor<CommandInput, Command>,
356+
commandOptions: CommandOptions,
357+
silent: false
358+
): Promise<CommandOutput>
354359
private async call<
355360
CommandInput extends object,
356361
CommandOutput extends object,
357362
CommandOptions extends CommandInput,
358363
Command extends AwsCommand<CommandInput, CommandOutput>,
359364
>(
360-
cmd: new (o: CommandInput) => Command,
365+
cmd: AwsCommandConstructor<CommandInput, Command>,
361366
commandOptions: CommandOptions,
362367
silent: boolean,
363368
defaultVal?: CommandOutput

0 commit comments

Comments
 (0)