diff --git a/.projenrc.ts b/.projenrc.ts index f9bd1646c..8e15b9d29 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -676,16 +676,54 @@ const tmpToolkitHelpers = configureProject( devDeps: [ '@types/archiver', '@types/semver', + 'aws-sdk-client-mock', + 'aws-sdk-client-mock-jest', 'fast-check', + 'nock', + '@smithy/util-stream', + 'xml-js', ], deps: [ cloudAssemblySchema.name, cloudFormationDiff, cxApi, + `@aws-sdk/client-appsync@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-cloudcontrol@${CLI_SDK_V3_RANGE}`, `@aws-sdk/client-cloudformation@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-cloudwatch-logs@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-codebuild@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-ec2@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-ecr@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-ecs@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-elastic-load-balancing-v2@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-iam@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-kms@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-lambda@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-route-53@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-s3@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-secrets-manager@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-sfn@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-ssm@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/client-sts@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/credential-providers@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/lib-storage@${CLI_SDK_V3_RANGE}`, + `@aws-sdk/ec2-metadata-service@${CLI_SDK_V3_RANGE}`, + '@smithy/middleware-endpoint', + '@smithy/node-http-handler', + '@smithy/property-provider', + '@smithy/shared-ini-file-loader', + '@smithy/types', + '@smithy/util-retry', + '@smithy/util-waiter', + cdkAssets, 'archiver', 'chalk@4', + 'fs-extra@^9', 'glob', + 'minimatch', + 'p-limit@^3', + 'promptly', // @todo remove this should only be in CLI + 'proxy-agent', // @todo remove this should only be in CLI 'semver', 'uuid', 'wrap-ansi@^7', // Last non-ESM version @@ -870,9 +908,6 @@ const cli = configureProject( // We have many tests here that commonly time out testTimeout: 60_000, coveragePathIgnorePatterns: [ - // Mostly wrappers around the SDK, which get mocked in unit tests - '/lib/api/aws-auth/sdk.ts', - // Files generated by cli-args-gen '/lib/cli/parse-command-line-arguments.ts', '/lib/cli/user-input.ts', @@ -1187,7 +1222,7 @@ const toolkitLib = configureProject( tmpToolkitHelpers, 'aws-cdk-lib', 'aws-sdk-client-mock', - 'dts-bundle-generator', + 'dts-bundle-generator@9.3.1', // use this specific version because newer versions are much slower. This is a temporary arrangement we hope to remove soon anyway. 'esbuild', 'typedoc', ], diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/.projen/deps.json b/packages/@aws-cdk/tmp-toolkit-helpers/.projen/deps.json index 4af6f4ece..be14db4f6 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/.projen/deps.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/.projen/deps.json @@ -4,6 +4,10 @@ "name": "@cdklabs/eslint-plugin", "type": "build" }, + { + "name": "@smithy/util-stream", + "type": "build" + }, { "name": "@stylistic/eslint-plugin", "version": "^3", @@ -36,6 +40,14 @@ "version": "^8", "type": "build" }, + { + "name": "aws-sdk-client-mock", + "type": "build" + }, + { + "name": "aws-sdk-client-mock-jest", + "type": "build" + }, { "name": "constructs", "version": "^10.0.0", @@ -83,6 +95,10 @@ "version": "^16", "type": "build" }, + { + "name": "nock", + "type": "build" + }, { "name": "prettier", "version": "^2.8", @@ -101,6 +117,10 @@ "version": "5.6", "type": "build" }, + { + "name": "xml-js", + "type": "build" + }, { "name": "@aws-cdk/cloud-assembly-schema", "type": "runtime" @@ -113,24 +133,178 @@ "name": "@aws-cdk/cx-api", "type": "runtime" }, + { + "name": "@aws-sdk/client-appsync", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-cloudcontrol", + "version": "^3", + "type": "runtime" + }, { "name": "@aws-sdk/client-cloudformation", "version": "^3", "type": "runtime" }, + { + "name": "@aws-sdk/client-cloudwatch-logs", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-codebuild", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-ec2", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-ecr", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-ecs", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-elastic-load-balancing-v2", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-iam", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-kms", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-lambda", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-route-53", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-s3", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-secrets-manager", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-sfn", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-ssm", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/client-sts", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/credential-providers", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/ec2-metadata-service", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/lib-storage", + "version": "^3", + "type": "runtime" + }, + { + "name": "@smithy/middleware-endpoint", + "type": "runtime" + }, + { + "name": "@smithy/node-http-handler", + "type": "runtime" + }, + { + "name": "@smithy/property-provider", + "type": "runtime" + }, + { + "name": "@smithy/shared-ini-file-loader", + "type": "runtime" + }, + { + "name": "@smithy/types", + "type": "runtime" + }, + { + "name": "@smithy/util-retry", + "type": "runtime" + }, + { + "name": "@smithy/util-waiter", + "type": "runtime" + }, { "name": "archiver", "type": "runtime" }, + { + "name": "cdk-assets", + "type": "runtime" + }, { "name": "chalk", "version": "4", "type": "runtime" }, + { + "name": "fs-extra", + "version": "^9", + "type": "runtime" + }, { "name": "glob", "type": "runtime" }, + { + "name": "minimatch", + "type": "runtime" + }, + { + "name": "p-limit", + "version": "^3", + "type": "runtime" + }, + { + "name": "promptly", + "type": "runtime" + }, + { + "name": "proxy-agent", + "type": "runtime" + }, { "name": "semver", "type": "runtime" diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/.projen/tasks.json b/packages/@aws-cdk/tmp-toolkit-helpers/.projen/tasks.json index 328be7de6..3da0bc06f 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/.projen/tasks.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/.projen/tasks.json @@ -37,7 +37,7 @@ }, "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@cdklabs/eslint-plugin,@types/archiver,@types/jest,@types/semver,eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-jest,eslint-plugin-jsdoc,eslint-plugin-prettier,fast-check,jest,projen,ts-jest,@aws-cdk/cloud-assembly-schema,@aws-cdk/cx-api,archiver,glob,semver,uuid" + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@cdklabs/eslint-plugin,@smithy/util-stream,@types/archiver,@types/jest,@types/semver,aws-sdk-client-mock,aws-sdk-client-mock-jest,eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-jest,eslint-plugin-jsdoc,eslint-plugin-prettier,fast-check,jest,nock,projen,ts-jest,xml-js,@aws-cdk/cloud-assembly-schema,@aws-cdk/cx-api,@smithy/middleware-endpoint,@smithy/node-http-handler,@smithy/property-provider,@smithy/shared-ini-file-loader,@smithy/types,@smithy/util-retry,@smithy/util-waiter,archiver,glob,minimatch,promptly,proxy-agent,semver,uuid" } ] }, @@ -77,7 +77,7 @@ "name": "gather-versions", "steps": [ { - "exec": "node -e \"require(require.resolve('cdklabs-projen-project-types/lib/yarn/gather-versions.exec.js')).cliMain()\" @aws-cdk/cloudformation-diff=major", + "exec": "node -e \"require(require.resolve('cdklabs-projen-project-types/lib/yarn/gather-versions.exec.js')).cliMain()\" @aws-cdk/cloudformation-diff=major cdk-assets=major", "receiveArgs": true } ] diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/package.json b/packages/@aws-cdk/tmp-toolkit-helpers/package.json index 5106ec8c0..88ea7a9ec 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/package.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@cdklabs/eslint-plugin": "^1.3.2", + "@smithy/util-stream": "^4.2.0", "@stylistic/eslint-plugin": "^3", "@types/archiver": "^6.0.3", "@types/jest": "^29.5.14", @@ -38,6 +39,8 @@ "@types/semver": "^7.7.0", "@typescript-eslint/eslint-plugin": "^8", "@typescript-eslint/parser": "^8", + "aws-sdk-client-mock": "^4.1.0", + "aws-sdk-client-mock-jest": "^4.1.0", "constructs": "^10.0.0", "eslint": "^9", "eslint-config-prettier": "^10.1.1", @@ -49,19 +52,54 @@ "fast-check": "^3.23.2", "jest": "^29.7.0", "jest-junit": "^16", + "nock": "^14.0.2", "prettier": "^2.8", "projen": "^0.91.18", "ts-jest": "^29.3.1", - "typescript": "5.6" + "typescript": "5.6", + "xml-js": "^1.6.11" }, "dependencies": { "@aws-cdk/cloud-assembly-schema": "^0.0.0", "@aws-cdk/cloudformation-diff": "^0.0.0", "@aws-cdk/cx-api": "^2.187.0", + "@aws-sdk/client-appsync": "^3", + "@aws-sdk/client-cloudcontrol": "^3", "@aws-sdk/client-cloudformation": "^3", + "@aws-sdk/client-cloudwatch-logs": "^3", + "@aws-sdk/client-codebuild": "^3", + "@aws-sdk/client-ec2": "^3", + "@aws-sdk/client-ecr": "^3", + "@aws-sdk/client-ecs": "^3", + "@aws-sdk/client-elastic-load-balancing-v2": "^3", + "@aws-sdk/client-iam": "^3", + "@aws-sdk/client-kms": "^3", + "@aws-sdk/client-lambda": "^3", + "@aws-sdk/client-route-53": "^3", + "@aws-sdk/client-s3": "^3", + "@aws-sdk/client-secrets-manager": "^3", + "@aws-sdk/client-sfn": "^3", + "@aws-sdk/client-ssm": "^3", + "@aws-sdk/client-sts": "^3", + "@aws-sdk/credential-providers": "^3", + "@aws-sdk/ec2-metadata-service": "^3", + "@aws-sdk/lib-storage": "^3", + "@smithy/middleware-endpoint": "^4.1.0", + "@smithy/node-http-handler": "^4.0.4", + "@smithy/property-provider": "^4.0.2", + "@smithy/shared-ini-file-loader": "^4.0.2", + "@smithy/types": "^4.2.0", + "@smithy/util-retry": "^4.0.2", + "@smithy/util-waiter": "^4.0.3", "archiver": "^7.0.1", + "cdk-assets": "^0.0.0", "chalk": "4", + "fs-extra": "^9", "glob": "^11.0.1", + "minimatch": "^10.0.1", + "p-limit": "^3", + "promptly": "^3.2.0", + "proxy-agent": "^6.5.0", "semver": "^7.7.1", "uuid": "^11.1.0", "wrap-ansi": "^7", diff --git a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/account-cache.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/account-cache.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/account-cache.ts diff --git a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/awscli-compatible.ts similarity index 98% rename from packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/awscli-compatible.ts index 5c12ce48e..1ff4ae2a2 100644 --- a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/awscli-compatible.ts @@ -8,8 +8,8 @@ import * as promptly from 'promptly'; import { makeCachingProvider } from './provider-caching'; import { ProxyAgentProvider } from './proxy-agent'; import type { SdkHttpOptions } from './sdk-provider'; -import { AuthenticationError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import { IO, type IoHelper } from '../io/private'; +import { AuthenticationError } from '../toolkit-error'; const DEFAULT_CONNECTION_TIMEOUT = 10000; const DEFAULT_TIMEOUT = 300000; diff --git a/packages/aws-cdk/lib/api/aws-auth/cached.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/cached.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/cached.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/cached.ts diff --git a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/credential-plugins.ts similarity index 97% rename from packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/credential-plugins.ts index 09f5029f1..453c2d6ad 100644 --- a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/credential-plugins.ts @@ -2,11 +2,11 @@ import { inspect } from 'util'; import type { CredentialProviderSource, ForReading, ForWriting, PluginProviderResult, SDKv2CompatibleCredentials, SDKv3CompatibleCredentialProvider, SDKv3CompatibleCredentials } from '@aws-cdk/cli-plugin-contract'; import type { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@smithy/types'; import { credentialsAboutToExpire, makeCachingProvider } from './provider-caching'; -import { AuthenticationError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; +import { IO, type IoHelper } from '../io/private'; import type { Mode } from '../plugin/mode'; import type { PluginHost } from '../plugin/plugin'; +import { AuthenticationError } from '../toolkit-error'; /** * Cache for credential providers. diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/index.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/index.ts new file mode 100644 index 000000000..ba9570a08 --- /dev/null +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/index.ts @@ -0,0 +1,13 @@ +export * from './proxy-agent'; +export * from './sdk'; +export * from './sdk-provider'; +export * from './sdk-logger'; + +// temporary testing exports +export { AccountAccessKeyCache } from './account-cache'; +export { cached } from './cached'; +export { AwsCliCompatible } from './awscli-compatible'; +export { setSdkTracing } from './tracing'; +export { CredentialPlugins } from './credential-plugins'; +export { credentialsAboutToExpire } from './provider-caching'; +export { defaultCliUserAgent } from './user-agent'; diff --git a/packages/aws-cdk/lib/api/aws-auth/provider-caching.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/provider-caching.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/provider-caching.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/provider-caching.ts diff --git a/packages/aws-cdk/lib/api/aws-auth/proxy-agent.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/proxy-agent.ts similarity index 94% rename from packages/aws-cdk/lib/api/aws-auth/proxy-agent.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/proxy-agent.ts index 6392828cb..f514028aa 100644 --- a/packages/aws-cdk/lib/api/aws-auth/proxy-agent.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/proxy-agent.ts @@ -1,7 +1,7 @@ import * as fs from 'fs-extra'; import { ProxyAgent } from 'proxy-agent'; import type { SdkHttpOptions } from './sdk-provider'; -import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; +import { IO, type IoHelper } from '../io/private'; export class ProxyAgentProvider { private readonly ioHelper: IoHelper; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-logger.ts similarity index 95% rename from packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-logger.ts index 55a9b9866..6ee6000c0 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk-logger.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-logger.ts @@ -1,8 +1,8 @@ import { inspect, format } from 'util'; import type { Logger } from '@smithy/types'; -import type { IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; -import { IO } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { replacerBufferWithInfo } from '../../util'; +import type { IoHelper } from '../io/private'; +import { IO } from '../io/private'; export class SdkToCliLogger implements Logger { private readonly ioHelper: IoHelper; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-provider.ts similarity index 99% rename from packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-provider.ts index eb54bb073..2146e8cc7 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk-provider.ts @@ -12,10 +12,10 @@ import { CredentialPlugins } from './credential-plugins'; import { makeCachingProvider } from './provider-caching'; import { SDK } from './sdk'; import { callTrace, traceMemberMethods } from './tracing'; -import { AuthenticationError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; +import { IO, type IoHelper } from '../io/private'; import { Mode, PluginHost } from '../plugin'; +import { AuthenticationError } from '../toolkit-error'; export type AssumeRoleAdditionalOptions = Partial>; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk.ts similarity index 99% rename from packages/aws-cdk/lib/api/aws-auth/sdk.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk.ts index 39e6814ef..6ef156c4b 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/sdk.ts @@ -346,9 +346,9 @@ import { cachedAsync } from './cached'; import type { Account } from './sdk-provider'; import { traceMemberMethods } from './tracing'; import { defaultCliUserAgent } from './user-agent'; -import { AuthenticationError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; +import { IO, type IoHelper } from '../io/private'; +import { AuthenticationError } from '../toolkit-error'; export interface S3ClientOptions { /** diff --git a/packages/aws-cdk/lib/api/aws-auth/tracing.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/tracing.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/tracing.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/tracing.ts diff --git a/packages/aws-cdk/lib/api/aws-auth/user-agent.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/user-agent.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/user-agent.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/user-agent.ts diff --git a/packages/aws-cdk/lib/api/aws-auth/util.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/util.ts similarity index 100% rename from packages/aws-cdk/lib/api/aws-auth/util.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth/util.ts diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/src/api/index.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/index.ts index b4b30e2f6..f6caf572a 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/src/api/index.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/index.ts @@ -1,7 +1,9 @@ +export * from './aws-auth'; export * from './cloud-assembly'; export * from './cloudformation'; export * from './diff'; export * from './io'; -export * from './toolkit-error'; +export * from './plugin'; export * from './require-approval'; export * from './resource-import'; +export * from './toolkit-error'; diff --git a/packages/aws-cdk/lib/api/plugin/context-provider-plugin.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/context-provider-plugin.ts similarity index 100% rename from packages/aws-cdk/lib/api/plugin/context-provider-plugin.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/context-provider-plugin.ts diff --git a/packages/aws-cdk/lib/api/plugin/index.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/index.ts similarity index 100% rename from packages/aws-cdk/lib/api/plugin/index.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/index.ts diff --git a/packages/aws-cdk/lib/api/plugin/mode.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/mode.ts similarity index 100% rename from packages/aws-cdk/lib/api/plugin/mode.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/mode.ts diff --git a/packages/aws-cdk/lib/api/plugin/plugin.ts b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/plugin.ts similarity index 97% rename from packages/aws-cdk/lib/api/plugin/plugin.ts rename to packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/plugin.ts index 9c6aeb086..ac9c7cb79 100644 --- a/packages/aws-cdk/lib/api/plugin/plugin.ts +++ b/packages/@aws-cdk/tmp-toolkit-helpers/src/api/plugin/plugin.ts @@ -1,7 +1,7 @@ import { inspect } from 'util'; import type { CredentialProviderSource, IPluginHost, Plugin } from '@aws-cdk/cli-plugin-contract'; import { type ContextProviderPlugin, isContextProviderPlugin } from './context-provider-plugin'; -import { ToolkitError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; +import { ToolkitError } from '../toolkit-error'; export let TESTING = false; diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.dev.json b/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.dev.json index c4f3846f5..4d5b4c04d 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.dev.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.dev.json @@ -41,6 +41,9 @@ "references": [ { "path": "../cloudformation-diff" + }, + { + "path": "../../cdk-assets" } ] } diff --git a/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.json b/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.json index ba0ead515..5bb516730 100644 --- a/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.json +++ b/packages/@aws-cdk/tmp-toolkit-helpers/tsconfig.json @@ -39,6 +39,9 @@ "references": [ { "path": "../cloudformation-diff" + }, + { + "path": "../../cdk-assets" } ] } diff --git a/packages/@aws-cdk/toolkit-lib/.projen/deps.json b/packages/@aws-cdk/toolkit-lib/.projen/deps.json index ea7f39a0c..3e0fe18b8 100644 --- a/packages/@aws-cdk/toolkit-lib/.projen/deps.json +++ b/packages/@aws-cdk/toolkit-lib/.projen/deps.json @@ -68,6 +68,7 @@ }, { "name": "dts-bundle-generator", + "version": "9.3.1", "type": "build" }, { diff --git a/packages/@aws-cdk/toolkit-lib/.projen/tasks.json b/packages/@aws-cdk/toolkit-lib/.projen/tasks.json index 4a441a685..a5b584560 100644 --- a/packages/@aws-cdk/toolkit-lib/.projen/tasks.json +++ b/packages/@aws-cdk/toolkit-lib/.projen/tasks.json @@ -51,7 +51,7 @@ }, "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@cdklabs/eslint-plugin,@smithy/types,@types/fs-extra,@types/jest,@types/split2,aws-cdk-lib,aws-sdk-client-mock,dts-bundle-generator,esbuild,eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-jest,eslint-plugin-jsdoc,eslint-plugin-prettier,jest,license-checker,projen,ts-jest,typedoc,@aws-cdk/cx-api,@aws-cdk/region-info,@smithy/middleware-endpoint,@smithy/node-http-handler,@smithy/property-provider,@smithy/shared-ini-file-loader,@smithy/util-retry,@smithy/util-stream,@smithy/util-waiter,archiver,cdk-from-cfn,glob,json-diff,minimatch,promptly,proxy-agent,semver,split2,uuid" + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --no-deprecated --dep=dev,peer,prod,optional --filter=@cdklabs/eslint-plugin,@smithy/types,@types/fs-extra,@types/jest,@types/split2,aws-cdk-lib,aws-sdk-client-mock,esbuild,eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-jest,eslint-plugin-jsdoc,eslint-plugin-prettier,jest,license-checker,projen,ts-jest,typedoc,@aws-cdk/cx-api,@aws-cdk/region-info,@smithy/middleware-endpoint,@smithy/node-http-handler,@smithy/property-provider,@smithy/shared-ini-file-loader,@smithy/util-retry,@smithy/util-stream,@smithy/util-waiter,archiver,cdk-from-cfn,glob,json-diff,minimatch,promptly,proxy-agent,semver,split2,uuid" } ] }, diff --git a/packages/@aws-cdk/toolkit-lib/build-tools/bundle.mjs b/packages/@aws-cdk/toolkit-lib/build-tools/bundle.mjs index 2c3c14dea..af799ed35 100644 --- a/packages/@aws-cdk/toolkit-lib/build-tools/bundle.mjs +++ b/packages/@aws-cdk/toolkit-lib/build-tools/bundle.mjs @@ -12,6 +12,7 @@ const copyFromCli = (from, to = undefined) => { }; // declaration bundling +dtsBundleLogging(false); const bundleDeclarations = async (entryPoints) => { const results = generateDtsBundle(entryPoints.map(filePath => ({ filePath, @@ -68,3 +69,11 @@ await Promise.all([ resources, declarations ]); + + +function dtsBundleLogging(enable) { + if (enable) { + const { enableVerbose } = require('dts-bundle-generator/dist/logger'); + enableVerbose(); + } +} diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/shared-public.ts b/packages/@aws-cdk/toolkit-lib/lib/api/shared-public.ts index 62aec99a2..4e046903f 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/shared-public.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/shared-public.ts @@ -4,18 +4,21 @@ export { ToolkitError, AuthenticationError, AssemblyError, +} from '../../../tmp-toolkit-helpers/src/api/toolkit-error'; + +export { ExpandStackSelection, StackSelectionStrategy, -} from '../../../tmp-toolkit-helpers/src/api'; + StackSelector, +} from '../../../tmp-toolkit-helpers/src/api/cloud-assembly/stack-selector'; export type { IoMessageLevel, IoMessageCode, - IIoHost, IoMessage, IoRequest, - ToolkitAction, - StackSelector, -} from '../../../tmp-toolkit-helpers/src/api'; +} from '../../../tmp-toolkit-helpers/src/api/io/io-message'; +export type { IIoHost } from '../../../tmp-toolkit-helpers/src/api/io/io-host'; +export type { ToolkitAction } from '../../../tmp-toolkit-helpers/src/api/io/toolkit-action'; export * from '../../../tmp-toolkit-helpers/src/payloads'; diff --git a/packages/@aws-cdk/toolkit-lib/package.json b/packages/@aws-cdk/toolkit-lib/package.json index 02fdc75e1..08422cd83 100644 --- a/packages/@aws-cdk/toolkit-lib/package.json +++ b/packages/@aws-cdk/toolkit-lib/package.json @@ -49,7 +49,7 @@ "aws-sdk-client-mock": "^4.1.0", "commit-and-tag-version": "^12", "constructs": "^10.0.0", - "dts-bundle-generator": "^9.5.1", + "dts-bundle-generator": "9.3.1", "esbuild": "^0.25.2", "eslint": "^9", "eslint-config-prettier": "^10.1.1", diff --git a/packages/aws-cdk/jest.config.json b/packages/aws-cdk/jest.config.json index eb826d6b6..cd985c55d 100644 --- a/packages/aws-cdk/jest.config.json +++ b/packages/aws-cdk/jest.config.json @@ -35,7 +35,6 @@ "/test/", ".warnings.jsii.js$", "/node_modules/", - "/lib/api/aws-auth/sdk.ts", "/lib/cli/parse-command-line-arguments.ts", "/lib/cli/user-input.ts", "/lib/cli/convert-to-user-input.ts" diff --git a/packages/aws-cdk/lib/api/aws-auth.ts b/packages/aws-cdk/lib/api/aws-auth.ts new file mode 100644 index 000000000..f72063b75 --- /dev/null +++ b/packages/aws-cdk/lib/api/aws-auth.ts @@ -0,0 +1 @@ +export * from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth'; diff --git a/packages/aws-cdk/lib/api/aws-auth/index.ts b/packages/aws-cdk/lib/api/aws-auth/index.ts deleted file mode 100644 index 602b17bac..000000000 --- a/packages/aws-cdk/lib/api/aws-auth/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './sdk'; -export * from './sdk-provider'; -export * from './sdk-logger'; -export * from './proxy-agent'; diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts index 7a731974f..bcf6c1d60 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts @@ -8,7 +8,7 @@ import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/ import { bundledPackageRootDir, loadStructuredFile, serializeStructure } from '../../util'; import type { SDK, SdkProvider } from '../aws-auth'; import type { SuccessfulDeployStackResult } from '../deployments'; -import { Mode } from '../plugin/mode'; +import { Mode } from '../plugin'; import { DEFAULT_TOOLKIT_STACK_NAME } from '../toolkit-info'; export type BootstrapSource = { source: 'legacy' } | { source: 'default' } | { source: 'custom'; templateFile: string }; diff --git a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts index 08a13c1e5..dc7245a82 100644 --- a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts +++ b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts @@ -17,7 +17,7 @@ import type { SuccessfulDeployStackResult } from '../deployments'; import { assertIsSuccessfulDeployStackResult } from '../deployments'; import { deployStack } from '../deployments/deploy-stack'; import { NoBootstrapStackEnvironmentResources } from '../environment'; -import { Mode } from '../plugin/mode'; +import { Mode } from '../plugin'; import { DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo } from '../toolkit-info'; /** diff --git a/packages/aws-cdk/lib/api/deployments/deployments.ts b/packages/aws-cdk/lib/api/deployments/deployments.ts index bca4bd1aa..8cb6b4b17 100644 --- a/packages/aws-cdk/lib/api/deployments/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments/deployments.ts @@ -19,7 +19,7 @@ import type { DeployStackResult } from './deployment-result'; import { ToolkitError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; -import type { SdkProvider } from '../aws-auth/sdk-provider'; +import type { SdkProvider } from '../aws-auth'; import type { Template, RootTemplateWithNestedStacks, diff --git a/packages/aws-cdk/lib/api/environment/environment-access.ts b/packages/aws-cdk/lib/api/environment/environment-access.ts index fc0382fc3..920bfdf04 100644 --- a/packages/aws-cdk/lib/api/environment/environment-access.ts +++ b/packages/aws-cdk/lib/api/environment/environment-access.ts @@ -1,5 +1,4 @@ import type * as cxapi from '@aws-cdk/cx-api'; -import type { SDK } from '../aws-auth'; import type { EnvironmentResources } from './environment-resources'; import { EnvironmentResourcesRegistry } from './environment-resources'; import type { StringWithoutPlaceholders } from './placeholders'; @@ -7,8 +6,8 @@ import { replaceEnvPlaceholders } from './placeholders'; import { ToolkitError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; import { formatErrorMessage } from '../../util'; -import type { CredentialsOptions, SdkForEnvironment, SdkProvider } from '../aws-auth/sdk-provider'; -import { Mode } from '../plugin/mode'; +import type { SDK, CredentialsOptions, SdkForEnvironment, SdkProvider } from '../aws-auth'; +import { Mode } from '../plugin'; /** * Access particular AWS resources, based on information from the CX manifest diff --git a/packages/aws-cdk/lib/api/environment/placeholders.ts b/packages/aws-cdk/lib/api/environment/placeholders.ts index ef17bae17..4c5690626 100644 --- a/packages/aws-cdk/lib/api/environment/placeholders.ts +++ b/packages/aws-cdk/lib/api/environment/placeholders.ts @@ -1,7 +1,7 @@ import { type Environment, EnvironmentPlaceholders } from '@aws-cdk/cx-api'; import type { Branded } from '../../util'; -import type { SdkProvider } from '../aws-auth/sdk-provider'; -import { Mode } from '../plugin/mode'; +import type { SdkProvider } from '../aws-auth'; +import { Mode } from '../plugin'; /** * Replace the {ACCOUNT} and {REGION} placeholders in all strings found in a complex object. diff --git a/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts b/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts index b4be1e1b7..da8916a0a 100644 --- a/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts +++ b/packages/aws-cdk/lib/api/garbage-collection/garbage-collector.ts @@ -9,7 +9,7 @@ import { ProgressPrinter } from './progress-printer'; import { ActiveAssetCache, BackgroundStackRefresh, refreshStacks } from './stack-refresh'; import { ToolkitError } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import { IO, type IoHelper } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; -import { Mode } from '../plugin/mode'; +import { Mode } from '../plugin'; // Must use a require() otherwise esbuild complains // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/consistent-type-imports diff --git a/packages/aws-cdk/lib/api/logs-monitor/find-cloudwatch-logs.ts b/packages/aws-cdk/lib/api/logs-monitor/find-cloudwatch-logs.ts index 88c9ec866..7afc469e5 100644 --- a/packages/aws-cdk/lib/api/logs-monitor/find-cloudwatch-logs.ts +++ b/packages/aws-cdk/lib/api/logs-monitor/find-cloudwatch-logs.ts @@ -6,7 +6,7 @@ import { formatErrorMessage } from '../../util'; import type { SDK, SdkProvider } from '../aws-auth'; import { EvaluateCloudFormationTemplate, LazyListStackResources } from '../cloudformation'; import { EnvironmentAccess } from '../environment'; -import { Mode } from '../plugin/mode'; +import { Mode } from '../plugin'; import { DEFAULT_TOOLKIT_STACK_NAME } from '../toolkit-info'; // resource types that have associated CloudWatch Log Groups that should _not_ be monitored diff --git a/packages/aws-cdk/lib/api/plugin.ts b/packages/aws-cdk/lib/api/plugin.ts new file mode 100644 index 000000000..3edd0b214 --- /dev/null +++ b/packages/aws-cdk/lib/api/plugin.ts @@ -0,0 +1 @@ +export * from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/plugin'; diff --git a/packages/aws-cdk/lib/cli/cli.ts b/packages/aws-cdk/lib/cli/cli.ts index 2ac6cf779..7720f67f5 100644 --- a/packages/aws-cdk/lib/cli/cli.ts +++ b/packages/aws-cdk/lib/cli/cli.ts @@ -12,9 +12,7 @@ import { Configuration } from './user-configuration'; import * as version from './version'; import { ToolkitError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import { asIoHelper } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private'; -import { SdkProvider } from '../api/aws-auth'; -import { SdkToCliLogger } from '../api/aws-auth/sdk-logger'; -import { setSdkTracing } from '../api/aws-auth/tracing'; +import { SdkProvider, SdkToCliLogger, setSdkTracing } from '../api/aws-auth'; import type { BootstrapSource } from '../api/bootstrap'; import { Bootstrapper } from '../api/bootstrap'; import type { StackSelector } from '../api/cxapp/cloud-assembly'; diff --git a/packages/aws-cdk/lib/context-providers/ami.ts b/packages/aws-cdk/lib/context-providers/ami.ts index e9ff3292b..eb8dff322 100644 --- a/packages/aws-cdk/lib/context-providers/ami.ts +++ b/packages/aws-cdk/lib/context-providers/ami.ts @@ -1,7 +1,7 @@ import type { AmiContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { IContextProviderMessages } from '.'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; /** diff --git a/packages/aws-cdk/lib/context-providers/availability-zones.ts b/packages/aws-cdk/lib/context-providers/availability-zones.ts index 83bd520f0..9905226d4 100644 --- a/packages/aws-cdk/lib/context-providers/availability-zones.ts +++ b/packages/aws-cdk/lib/context-providers/availability-zones.ts @@ -1,7 +1,7 @@ import type { AvailabilityZonesContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { AvailabilityZone } from '@aws-sdk/client-ec2'; import type { IContextProviderMessages } from '.'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; /** diff --git a/packages/aws-cdk/lib/context-providers/cc-api-provider.ts b/packages/aws-cdk/lib/context-providers/cc-api-provider.ts index d57a992c7..6bf713e3e 100644 --- a/packages/aws-cdk/lib/context-providers/cc-api-provider.ts +++ b/packages/aws-cdk/lib/context-providers/cc-api-provider.ts @@ -3,7 +3,7 @@ import type { ResourceDescription } from '@aws-sdk/client-cloudcontrol'; import { ResourceNotFoundException } from '@aws-sdk/client-cloudcontrol'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import type { ICloudControlClient } from '../api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; import { findJsonValue, getResultObj } from '../util'; diff --git a/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts b/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts index 533c04db8..9302f217d 100644 --- a/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts +++ b/packages/aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts @@ -1,6 +1,6 @@ import type { EndpointServiceAvailabilityZonesContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { IContextProviderMessages } from '.'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; /** diff --git a/packages/aws-cdk/lib/context-providers/hosted-zones.ts b/packages/aws-cdk/lib/context-providers/hosted-zones.ts index 3c09ad944..d167e29b5 100644 --- a/packages/aws-cdk/lib/context-providers/hosted-zones.ts +++ b/packages/aws-cdk/lib/context-providers/hosted-zones.ts @@ -3,7 +3,7 @@ import type { HostedZone } from '@aws-sdk/client-route-53'; import type { IContextProviderMessages } from '.'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import type { IRoute53Client } from '../api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; export class HostedZoneContextProviderPlugin implements ContextProviderPlugin { diff --git a/packages/aws-cdk/lib/context-providers/index.ts b/packages/aws-cdk/lib/context-providers/index.ts index c964690eb..7d87677a2 100644 --- a/packages/aws-cdk/lib/context-providers/index.ts +++ b/packages/aws-cdk/lib/context-providers/index.ts @@ -18,7 +18,7 @@ import type { Context } from '../api/context'; import { TRANSIENT_CONTEXT_KEY } from '../api/context'; import { replaceEnvPlaceholders } from '../api/environment'; import { PluginHost } from '../api/plugin'; -import type { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; +import type { ContextProviderPlugin } from '../api/plugin'; import { formatErrorMessage } from '../util'; type ContextProviderFactory = ((sdk: SdkProvider, io: IContextProviderMessages) => ContextProviderPlugin); diff --git a/packages/aws-cdk/lib/context-providers/keys.ts b/packages/aws-cdk/lib/context-providers/keys.ts index a95d2a55c..a0e5759f9 100644 --- a/packages/aws-cdk/lib/context-providers/keys.ts +++ b/packages/aws-cdk/lib/context-providers/keys.ts @@ -4,7 +4,7 @@ import type { AliasListEntry, ListAliasesCommandOutput } from '@aws-sdk/client-k import type { IContextProviderMessages } from '.'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import type { IKMSClient } from '../api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; export class KeyContextProviderPlugin implements ContextProviderPlugin { diff --git a/packages/aws-cdk/lib/context-providers/load-balancers.ts b/packages/aws-cdk/lib/context-providers/load-balancers.ts index f10cb99b7..8c0a25bb0 100644 --- a/packages/aws-cdk/lib/context-providers/load-balancers.ts +++ b/packages/aws-cdk/lib/context-providers/load-balancers.ts @@ -9,7 +9,7 @@ import { import type { LoadBalancer, Listener, TagDescription } from '@aws-sdk/client-elastic-load-balancing-v2'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import type { IElasticLoadBalancingV2Client } from '../api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; /** diff --git a/packages/aws-cdk/lib/context-providers/security-groups.ts b/packages/aws-cdk/lib/context-providers/security-groups.ts index 6168d3052..a6f4be92a 100644 --- a/packages/aws-cdk/lib/context-providers/security-groups.ts +++ b/packages/aws-cdk/lib/context-providers/security-groups.ts @@ -2,7 +2,7 @@ import type { SecurityGroupContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { SecurityGroupContextResponse } from '@aws-cdk/cx-api'; import type { Filter, SecurityGroup } from '@aws-sdk/client-ec2'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; export class SecurityGroupContextProviderPlugin implements ContextProviderPlugin { diff --git a/packages/aws-cdk/lib/context-providers/ssm-parameters.ts b/packages/aws-cdk/lib/context-providers/ssm-parameters.ts index f05ce8e72..0d66b930b 100644 --- a/packages/aws-cdk/lib/context-providers/ssm-parameters.ts +++ b/packages/aws-cdk/lib/context-providers/ssm-parameters.ts @@ -2,7 +2,7 @@ import type { SSMParameterContextQuery } from '@aws-cdk/cloud-assembly-schema'; import type { GetParameterCommandOutput } from '@aws-sdk/client-ssm'; import type { IContextProviderMessages } from '.'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; /** diff --git a/packages/aws-cdk/lib/context-providers/vpcs.ts b/packages/aws-cdk/lib/context-providers/vpcs.ts index b149985e4..36c87e149 100644 --- a/packages/aws-cdk/lib/context-providers/vpcs.ts +++ b/packages/aws-cdk/lib/context-providers/vpcs.ts @@ -4,7 +4,7 @@ import type { Filter, RouteTable, Tag, Vpc } from '@aws-sdk/client-ec2'; import type { IContextProviderMessages } from '.'; import { ContextProviderError } from '../../../@aws-cdk/tmp-toolkit-helpers/src/api'; import type { IEC2Client } from '../api'; -import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth/sdk-provider'; +import { type SdkProvider, initContextProviderSdk } from '../api/aws-auth'; import type { ContextProviderPlugin } from '../api/plugin'; export class VpcNetworkContextProviderPlugin implements ContextProviderPlugin { diff --git a/packages/aws-cdk/lib/legacy-aws-auth.ts b/packages/aws-cdk/lib/legacy-aws-auth.ts index 927eee1d2..893dad825 100644 --- a/packages/aws-cdk/lib/legacy-aws-auth.ts +++ b/packages/aws-cdk/lib/legacy-aws-auth.ts @@ -2,15 +2,26 @@ // We generally use two different patterns here: // - make a copy of the old code as is // - wrap the old code and add a deprecation warning +// - make a no-op copy that preserves the previous interface but doesn't do anything // This way we can keep the old code running until the new code is fully ready // and can be used by the users that are ready to migrate // The old code will be removed in a future version of aws-cdk import type { AwsCredentialIdentityProvider, Logger, NodeHttpHandlerOptions } from '@smithy/types'; -import { SdkProvider as SdkProviderCurrentVersion } from './api/aws-auth/sdk-provider'; +import { SdkProvider as SdkProviderCurrentVersion } from './api/aws-auth'; import { CliIoHost } from './cli/io-host'; +/** + * Enable tracing in the CDK + * + * @deprecated cannot be enabled from outside the CDK + */ +export function enableTracing(_enabled: boolean) { + // noop +} + /** * Options for individual SDKs + * @deprecated */ interface SdkHttpOptions { /** @@ -30,6 +41,7 @@ interface SdkHttpOptions { /** * Options for the default SDK provider + * @deprecated */ interface SdkProviderOptions { /** @@ -50,6 +62,9 @@ interface SdkProviderOptions { readonly logger?: Logger; } +/** + * @deprecated + */ export class SdkProvider { public static async withAwsCliCompatibleDefaults(options: SdkProviderOptions = {}) { return SdkProviderCurrentVersion.withAwsCliCompatibleDefaults({ diff --git a/packages/aws-cdk/lib/legacy-exports-source.ts b/packages/aws-cdk/lib/legacy-exports-source.ts index 0c21809b7..dcc46df8e 100644 --- a/packages/aws-cdk/lib/legacy-exports-source.ts +++ b/packages/aws-cdk/lib/legacy-exports-source.ts @@ -7,9 +7,8 @@ export * from './legacy-logging-source'; // API -export { SdkProvider } from './legacy-aws-auth'; -export { setSdkTracing as enableTracing } from './api/aws-auth/tracing'; -export { cached } from './api/aws-auth/cached'; +export { enableTracing, SdkProvider } from './legacy-aws-auth'; +export { cached } from './api/aws-auth'; export { CfnEvaluationException } from './api/cloudformation'; export { CloudExecutable } from './api/cxapp/cloud-executable'; export { execProgram } from './api/cxapp/exec'; diff --git a/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts b/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts index 7a3b69911..3561b2ec0 100644 --- a/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import bockfs from '../../_helpers/bockfs'; import * as fs from 'fs-extra'; -import { AccountAccessKeyCache } from '../../../lib/api/aws-auth/account-cache'; +import { AccountAccessKeyCache } from '../../../lib/api/aws-auth'; import { withMocked } from '../../_helpers/as-mock'; const noOp = async () => { diff --git a/packages/aws-cdk/test/api/aws-auth/awscli-compatible.test.ts b/packages/aws-cdk/test/api/aws-auth/awscli-compatible.test.ts index 9168f3226..50680e336 100644 --- a/packages/aws-cdk/test/api/aws-auth/awscli-compatible.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/awscli-compatible.test.ts @@ -1,7 +1,7 @@ import * as os from 'os'; import * as path from 'path'; import * as fs from 'fs-extra'; -import { AwsCliCompatible } from '../../../lib/api/aws-auth/awscli-compatible'; +import { AwsCliCompatible } from '../../../lib/api/aws-auth'; import { TestIoHost } from '../../_helpers/io-host'; const ioHost = new TestIoHost(); diff --git a/packages/aws-cdk/test/api/aws-auth/credential-plugins.test.ts b/packages/aws-cdk/test/api/aws-auth/credential-plugins.test.ts index 124272f95..da90ffde8 100644 --- a/packages/aws-cdk/test/api/aws-auth/credential-plugins.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/credential-plugins.test.ts @@ -1,7 +1,7 @@ import type { PluginProviderResult, SDKv2CompatibleCredentials } from '@aws-cdk/cli-plugin-contract'; -import { CredentialPlugins } from '../../../lib/api/aws-auth/credential-plugins'; +import { CredentialPlugins } from '../../../lib/api/aws-auth'; import { PluginHost } from '../../../lib/api/plugin'; -import { Mode } from '../../../lib/api/plugin/mode'; +import { Mode } from '../../../lib/api/plugin'; import { TestIoHost } from '../../_helpers/io-host'; const ioHost = new TestIoHost(); diff --git a/packages/aws-cdk/test/api/aws-auth/sdk-logger.test.ts b/packages/aws-cdk/test/api/aws-auth/sdk-logger.test.ts index da08bcaef..0ab033baf 100644 --- a/packages/aws-cdk/test/api/aws-auth/sdk-logger.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/sdk-logger.test.ts @@ -1,4 +1,4 @@ -import { formatSdkLoggerContent, SdkToCliLogger } from '../../../lib/api/aws-auth/sdk-logger'; +import { formatSdkLoggerContent, SdkToCliLogger } from '../../../lib/api/aws-auth'; describe(SdkToCliLogger, () => { const ioHost = { diff --git a/packages/aws-cdk/test/api/aws-auth/sdk-provider.test.ts b/packages/aws-cdk/test/api/aws-auth/sdk-provider.test.ts index dbaad36c4..daa6b11e8 100644 --- a/packages/aws-cdk/test/api/aws-auth/sdk-provider.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/sdk-provider.test.ts @@ -20,10 +20,10 @@ import * as promptly from 'promptly'; import * as uuid from 'uuid'; import { FakeSts, RegisterRoleOptions, RegisterUserOptions } from './fake-sts'; import { ConfigurationOptions, CredentialsOptions, SDK, SdkProvider } from '../../../lib/api/aws-auth'; -import { AwsCliCompatible } from '../../../lib/api/aws-auth/awscli-compatible'; -import { defaultCliUserAgent } from '../../../lib/api/aws-auth/user-agent'; +import { AwsCliCompatible } from '../../../lib/api/aws-auth'; +import { defaultCliUserAgent } from '../../../lib/api/aws-auth'; import { PluginHost } from '../../../lib/api/plugin'; -import { Mode } from '../../../lib/api/plugin/mode'; +import { Mode } from '../../../lib/api/plugin'; import { instanceMockFrom, withMocked } from '../../_helpers/as-mock'; import { undoAllSdkMocks } from '../../_helpers/mock-sdk'; import { TestIoHost } from '../../_helpers/io-host'; diff --git a/packages/aws-cdk/test/api/plugin/credential-plugin.test.ts b/packages/aws-cdk/test/api/plugin/credential-plugin.test.ts index 68487457b..003e32d3a 100644 --- a/packages/aws-cdk/test/api/plugin/credential-plugin.test.ts +++ b/packages/aws-cdk/test/api/plugin/credential-plugin.test.ts @@ -1,8 +1,8 @@ import { CredentialProviderSource, SDKv3CompatibleCredentials } from '@aws-cdk/cli-plugin-contract'; -import { CredentialPlugins } from '../../../lib/api/aws-auth/credential-plugins'; -import { credentialsAboutToExpire } from '../../../lib/api/aws-auth/provider-caching'; -import { Mode } from '../../../lib/api/plugin/mode'; -import { PluginHost, markTesting } from '../../../lib/api/plugin/plugin'; +import { CredentialPlugins } from '../../../lib/api/aws-auth'; +import { credentialsAboutToExpire } from '../../../lib/api/aws-auth'; +import { Mode } from '../../../lib/api/plugin'; +import { PluginHost, markTesting } from '../../../lib/api/plugin'; import { TestIoHost } from '../../../../@aws-cdk/tmp-toolkit-helpers/src/api/io/private/testing'; markTesting(); diff --git a/yarn.lock b/yarn.lock index 5008252f3..d71bc9d3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5639,10 +5639,10 @@ dreamopt@~0.8.0: dependencies: wordwrap ">=0.0.2" -dts-bundle-generator@^9.5.1: - version "9.5.1" - resolved "https://registry.yarnpkg.com/dts-bundle-generator/-/dts-bundle-generator-9.5.1.tgz#7eac7f47a2d5b51bdaf581843e7f969b88bfc225" - integrity sha512-DxpJOb2FNnEyOzMkG11sxO2dmxPjthoVWxfKqWYJ/bI/rT1rvTMktF5EKjAYrRZu6Z6t3NhOUZ0sZ5ZXevOfbA== +dts-bundle-generator@9.3.1: + version "9.3.1" + resolved "https://registry.yarnpkg.com/dts-bundle-generator/-/dts-bundle-generator-9.3.1.tgz#dfc2b20b2ceb5afe4b3deed516b997e8782219df" + integrity sha512-1/nMT7LFOkXbrL1ZvLpzrjNbfX090LZ64nLIXVmet557mshFCGP/oTiQiZenafJZ6GsmRQLTYKSlQnkxK8tsTw== dependencies: typescript ">=5.0.2" yargs "^17.6.0"