@go-to-k/cdkd 0.257.0 → 0.257.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as BOOTSTRAP_MARKER_PREFIX, A as withRetry, At as AssemblyReader, B as TemplateParser, C as disableInstanceApiTermination, Ct as warnDeprecatedNoPrefixCliFlag, D as refStateLookupFromResource, Dt as findLargeInlineResources, E as cfnRefValueFromPhysicalId, Et as MIGRATE_TMP_PREFIX, F as resolveExplicitPhysicalId, Ft as resetAwsClients, G as AssetPublisher, Gt as MissingCdkCliError, H as S3StateBackend, Ht as LocalMigrateError, I as assertRegionMatch, It as setAwsClients, J as buildAssetRedirectMap, Jt as ProvisioningError, K as stringifyValue, Kt as NestedStackChildDirectDestroyError, L as applyRoleArnIfSet, M as CDK_PATH_TAG, Mt as resolveBucketRegion, N as matchesCdkPath, Nt as AwsClients, O as WAFv2WebACLProvider, Ot as uploadCfnTemplate, P as normalizeAwsTagsToCfn, Pt as getAwsClients, Q as AssetModeResolver, Qt as StackTerminationProtectionError, R as DiffCalculator, Rt as CdkdError, S as CloudControlProvider, St as resolveUseCdkBootstrapAssets, T as IntrinsicFunctionResolver, Tt as CFN_TEMPLATE_URL_LIMIT, U as rebuildClientForBucketRegion, Ut as LocalStartServiceError, V as LockManager, Vt as LocalInvokeBuildError$1, W as shouldRetainResource, X as loadPublishableAssetManifest, Xt as ResourceUpdateNotSupportedError, Y as createAssetRedirectResolver, Yt as ResourceTimeoutError, Z as rewriteTemplateAssetReferences, Zt as StackHasActiveImportsError, _ as yellow, _t as resolveAutoAssetStorage, a as IMPLICIT_DELETE_DEPENDENCIES, at as buildDockerImage, b as ProviderRegistry, bt as resolveStateBucketWithDefault, c as MULTI_REGION_RECREATE_BLOCKED_TYPES, ct as runDockerForeground, d as formatResourceLine, dt as getDockerImageBySourceHash, et as ensureAssetStorage, f as bold, ft as Synthesizer, g as red, gt as resolveApp, h as green, ht as getLegacyStateBucketName, i as withResourceDeadline, in as withErrorHandling, it as validateContainerRepoName, j as isRetryableTransientError, k as importTagWalk, kt as expectedOwnerParam, l as isStatefulRecreateTargetSync, lt as runDockerStreaming, m as gray, mt as getDefaultStateBucketName, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as parseBootstrapMarker, o as computeImplicitDeleteEdges, ot as formatDockerLoginError, p as cyan, pt as synthesisStatusMessage, q as WorkGraph, qt as PartialFailureError, r as DeployEngine, rn as normalizeAwsError, rt as validateAssetBucketName, s as extractDeploymentEventError, st as getDockerCmd, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as getBootstrapMarkerKey, u as renderStatefulReason, ut as AssetManifestLoader, v as IAMRoleProvider, vt as resolveCaptureObservedState, w as isTerminationProtectionPropagationError, wt as CFN_TEMPLATE_BODY_LIMIT, x as findActionableSilentDrops, xt as resolveStateBucketWithDefaultAndSource, y as collectInlinePolicyNamesManagedBySiblings, yt as resolveSkipPrefix, z as DagBuilder } from "./deploy-engine-DOPBIRKR.js";
2
+ import { $ as AssetModeResolver, $t as StackTerminationProtectionError, A as importTagWalk, At as expectedOwnerParam, B as DagBuilder, C as slowCcOperationTimeoutMs, Ct as resolveUseCdkBootstrapAssets, D as cfnRefValueFromPhysicalId, Dt as MIGRATE_TMP_PREFIX, E as IntrinsicFunctionResolver, Et as CFN_TEMPLATE_URL_LIMIT, F as normalizeAwsTagsToCfn, Ft as getAwsClients, G as shouldRetainResource, H as LockManager, Ht as LocalInvokeBuildError$1, I as resolveExplicitPhysicalId, It as resetAwsClients, J as WorkGraph, Jt as PartialFailureError, K as AssetPublisher, Kt as MissingCdkCliError, L as assertRegionMatch, Lt as setAwsClients, M as isRetryableTransientError, N as CDK_PATH_TAG, Nt as resolveBucketRegion, O as refStateLookupFromResource, Ot as findLargeInlineResources, P as matchesCdkPath, Pt as AwsClients, Q as rewriteTemplateAssetReferences, Qt as StackHasActiveImportsError, R as applyRoleArnIfSet, S as CloudControlProvider, St as resolveStateBucketWithDefaultAndSource, T as isTerminationProtectionPropagationError, Tt as CFN_TEMPLATE_BODY_LIMIT, U as S3StateBackend, Ut as LocalMigrateError, V as TemplateParser, W as rebuildClientForBucketRegion, Wt as LocalStartServiceError, X as createAssetRedirectResolver, Xt as ResourceTimeoutError, Y as buildAssetRedirectMap, Yt as ProvisioningError, Z as loadPublishableAssetManifest, Zt as ResourceUpdateNotSupportedError, _ as yellow, _t as resolveApp, a as IMPLICIT_DELETE_DEPENDENCIES, an as withErrorHandling, at as validateContainerRepoName, b as ProviderRegistry, bt as resolveSkipPrefix, c as MULTI_REGION_RECREATE_BLOCKED_TYPES, ct as getDockerCmd, d as formatResourceLine, dt as AssetManifestLoader, et as BOOTSTRAP_MARKER_PREFIX, f as bold, ft as getDockerImageBySourceHash, g as red, gt as getLegacyStateBucketName, h as green, ht as getDefaultStateBucketName, i as withResourceDeadline, in as normalizeAwsError, it as validateAssetBucketName, j as withRetry, jt as AssemblyReader, k as WAFv2WebACLProvider, kt as uploadCfnTemplate, l as isStatefulRecreateTargetSync, lt as runDockerForeground, m as gray, mt as synthesisStatusMessage, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as getBootstrapMarkerKey, o as computeImplicitDeleteEdges, ot as buildDockerImage, p as cyan, pt as Synthesizer, q as stringifyValue, qt as NestedStackChildDirectDestroyError, r as DeployEngine, rt as parseBootstrapMarker, s as extractDeploymentEventError, st as formatDockerLoginError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as ensureAssetStorage, u as renderStatefulReason, ut as runDockerStreaming, v as IAMRoleProvider, vt as resolveAutoAssetStorage, w as disableInstanceApiTermination, wt as warnDeprecatedNoPrefixCliFlag, x as findActionableSilentDrops, xt as resolveStateBucketWithDefault, y as collectInlinePolicyNamesManagedBySiblings, yt as resolveCaptureObservedState, z as DiffCalculator, zt as CdkdError } from "./deploy-engine-wmvXbyoB.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
4
- import { t as ASGProvider } from "./asg-provider-6IZKZOKp.js";
4
+ import { t as ASGProvider } from "./asg-provider-4KjJhMTY.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
7
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -1899,7 +1899,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1899
1899
  const FLUSH_EVENT_THRESHOLD = 50;
1900
1900
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1901
1901
  function getCdkdVersion() {
1902
- return "0.257.0";
1902
+ return "0.257.2";
1903
1903
  }
1904
1904
  /**
1905
1905
  * Generate a time-sortable unique run id, e.g.
@@ -3945,9 +3945,11 @@ var IAMInstanceProfileProvider = class {
3945
3945
  * Lookup order:
3946
3946
  * 1. `--resource` override or `Properties.InstanceProfileName` → verify
3947
3947
  * via `GetInstanceProfile`.
3948
- * 2. `ListInstanceProfiles` paginator + match `aws:cdk:path` against the
3949
- * `InstanceProfile.Tags` array returned inline (no separate
3950
- * `ListInstanceProfileTags` call needed).
3948
+ * 2. `ListInstanceProfiles` paginator + a per-candidate `GetInstanceProfile`
3949
+ * to read the tags, matched against `aws:cdk:path`. The list API does
3950
+ * NOT return tags (AWS documents this on the command) even though the
3951
+ * `InstanceProfile` type declares `Tags?`, so reading them off the
3952
+ * summary typechecks and never matches.
3951
3953
  *
3952
3954
  * IAM is global; this walks every instance profile in the account once.
3953
3955
  */
@@ -3963,20 +3965,32 @@ var IAMInstanceProfileProvider = class {
3963
3965
  if (err instanceof NoSuchEntityException) return null;
3964
3966
  throw err;
3965
3967
  }
3966
- if (!input.cdkPath) return null;
3967
- let marker;
3968
- do {
3969
- const list = await this.iamClient.send(new ListInstanceProfilesCommand({ ...marker && { Marker: marker } }));
3970
- for (const profile of list.InstanceProfiles ?? []) {
3971
- if (!profile.InstanceProfileName) continue;
3972
- if (matchesCdkPath(profile.Tags, input.cdkPath)) return {
3973
- physicalId: profile.InstanceProfileName,
3974
- attributes: {}
3968
+ const match = await importTagWalk({
3969
+ cdkPath: input.cdkPath,
3970
+ logicalId: input.logicalId,
3971
+ listPage: async (marker) => {
3972
+ const list = await this.iamClient.send(new ListInstanceProfilesCommand({ ...marker && { Marker: marker } }));
3973
+ return {
3974
+ items: list.InstanceProfiles,
3975
+ nextMarker: list.IsTruncated ? list.Marker : void 0
3975
3976
  };
3976
- }
3977
- marker = list.IsTruncated ? list.Marker : void 0;
3978
- } while (marker);
3979
- return null;
3977
+ },
3978
+ describe: async (profile) => {
3979
+ if (!profile.InstanceProfileName) return void 0;
3980
+ try {
3981
+ return (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: profile.InstanceProfileName }))).InstanceProfile;
3982
+ } catch (err) {
3983
+ if (err instanceof NoSuchEntityException) return void 0;
3984
+ throw err;
3985
+ }
3986
+ },
3987
+ tagsOf: (detail) => detail?.Tags
3988
+ });
3989
+ if (!match) return null;
3990
+ return {
3991
+ physicalId: match.summary.InstanceProfileName,
3992
+ attributes: {}
3993
+ };
3980
3994
  }
3981
3995
  };
3982
3996
 
@@ -10379,25 +10393,35 @@ var LambdaLayerVersionProvider = class {
10379
10393
  if (err instanceof ResourceNotFoundException) return null;
10380
10394
  throw err;
10381
10395
  }
10382
- if (!input.cdkPath) return null;
10383
- let marker;
10384
- do {
10385
- const list = await this.lambdaClient.send(new ListLayersCommand({ ...marker && { Marker: marker } }));
10386
- for (const layer of list.Layers ?? []) {
10387
- if (!layer.LayerArn || !layer.LatestMatchingVersion?.LayerVersionArn) continue;
10396
+ const match = await importTagWalk({
10397
+ cdkPath: input.cdkPath,
10398
+ logicalId: input.logicalId,
10399
+ listPage: async (marker) => {
10400
+ const list = await this.lambdaClient.send(new ListLayersCommand({ ...marker && { Marker: marker } }));
10401
+ return {
10402
+ items: list.Layers,
10403
+ nextMarker: list.NextMarker
10404
+ };
10405
+ },
10406
+ describe: async (layer) => {
10407
+ if (!layer.LayerArn || !layer.LatestMatchingVersion?.LayerVersionArn) return void 0;
10388
10408
  try {
10389
- if ((await this.lambdaClient.send(new ListTagsCommand({ Resource: layer.LayerArn }))).Tags?.["aws:cdk:path"] === input.cdkPath) return {
10390
- physicalId: layer.LatestMatchingVersion.LayerVersionArn,
10391
- attributes: {}
10392
- };
10409
+ return await this.lambdaClient.send(new ListTagsCommand({ Resource: layer.LayerArn }));
10393
10410
  } catch (err) {
10394
- if (err instanceof ResourceNotFoundException) continue;
10411
+ if (err instanceof ResourceNotFoundException) return void 0;
10395
10412
  throw err;
10396
10413
  }
10397
- }
10398
- marker = list.NextMarker;
10399
- } while (marker);
10400
- return null;
10414
+ },
10415
+ tagsOf: (tagsResp) => Object.entries(tagsResp.Tags ?? {}).map(([Key, Value]) => ({
10416
+ Key,
10417
+ Value
10418
+ }))
10419
+ });
10420
+ if (!match) return null;
10421
+ return {
10422
+ physicalId: match.summary.LatestMatchingVersion.LayerVersionArn,
10423
+ attributes: {}
10424
+ };
10401
10425
  }
10402
10426
  };
10403
10427
 
@@ -13940,17 +13964,24 @@ var SecretsManagerSecretProvider = class {
13940
13964
  if (err instanceof ResourceNotFoundException$3) return null;
13941
13965
  throw err;
13942
13966
  }
13943
- if (!input.cdkPath) return null;
13944
- let nextToken;
13945
- do {
13946
- const list = await this.smClient.send(new ListSecretsCommand({ ...nextToken && { NextToken: nextToken } }));
13947
- for (const s of list.SecretList ?? []) if (s.ARN && matchesCdkPath(s.Tags, input.cdkPath)) return {
13948
- physicalId: s.ARN,
13949
- attributes: {}
13950
- };
13951
- nextToken = list.NextToken;
13952
- } while (nextToken);
13953
- return null;
13967
+ const match = await importTagWalk({
13968
+ cdkPath: input.cdkPath,
13969
+ logicalId: input.logicalId,
13970
+ listPage: async (marker) => {
13971
+ const list = await this.smClient.send(new ListSecretsCommand({ ...marker && { NextToken: marker } }));
13972
+ return {
13973
+ items: list.SecretList,
13974
+ nextMarker: list.NextToken
13975
+ };
13976
+ },
13977
+ describe: async (secret) => secret.ARN ? secret : void 0,
13978
+ tagsOf: (secret) => secret.Tags
13979
+ });
13980
+ if (!match) return null;
13981
+ return {
13982
+ physicalId: match.summary.ARN,
13983
+ attributes: {}
13984
+ };
13954
13985
  }
13955
13986
  };
13956
13987
 
@@ -32552,25 +32583,35 @@ var KMSProvider = class {
32552
32583
  throw err;
32553
32584
  }
32554
32585
  if (!input.cdkPath) return null;
32555
- let marker;
32556
- do {
32557
- const list = await this.getClient().send(new ListKeysCommand({ ...marker && { Marker: marker } }));
32558
- for (const key of list.Keys ?? []) {
32559
- if (!key.KeyId) continue;
32586
+ const match = await importTagWalk({
32587
+ cdkPath: input.cdkPath,
32588
+ logicalId: input.logicalId,
32589
+ listPage: async (marker) => {
32590
+ const list = await this.getClient().send(new ListKeysCommand({ ...marker && { Marker: marker } }));
32591
+ return {
32592
+ items: list.Keys,
32593
+ nextMarker: list.NextMarker
32594
+ };
32595
+ },
32596
+ describe: async (key) => {
32597
+ if (!key.KeyId) return void 0;
32560
32598
  try {
32561
- const tagsResp = await this.getClient().send(new ListResourceTagsCommand({ KeyId: key.KeyId }));
32562
- for (const tag of tagsResp.Tags ?? []) if (tag.TagKey === "aws:cdk:path" && tag.TagValue === input.cdkPath) return {
32563
- physicalId: key.KeyId,
32564
- attributes: {}
32565
- };
32599
+ return await this.getClient().send(new ListResourceTagsCommand({ KeyId: key.KeyId }));
32566
32600
  } catch (err) {
32567
- if (err.name === "AccessDeniedException" || err instanceof NotFoundException$2) continue;
32601
+ if (err.name === "AccessDeniedException" || err instanceof NotFoundException$2) return void 0;
32568
32602
  throw err;
32569
32603
  }
32570
- }
32571
- marker = list.NextMarker;
32572
- } while (marker);
32573
- return null;
32604
+ },
32605
+ tagsOf: (tagsResp) => (tagsResp.Tags ?? []).map((t) => ({
32606
+ Key: t.TagKey,
32607
+ Value: t.TagValue
32608
+ }))
32609
+ });
32610
+ if (!match) return null;
32611
+ return {
32612
+ physicalId: match.summary.KeyId,
32613
+ attributes: {}
32614
+ };
32574
32615
  }
32575
32616
  };
32576
32617
 
@@ -39687,28 +39728,42 @@ var CodeCommitRepositoryProvider = class {
39687
39728
  if (err instanceof RepositoryDoesNotExistException) return null;
39688
39729
  throw err;
39689
39730
  }
39690
- if (!input.cdkPath) return null;
39691
- let nextToken;
39692
- do {
39693
- const list = await this.getClient().send(new ListRepositoriesCommand({ ...nextToken && { nextToken } }));
39694
- for (const repo of list.repositories ?? []) {
39695
- if (!repo.repositoryName) continue;
39731
+ const match = await importTagWalk({
39732
+ cdkPath: input.cdkPath,
39733
+ logicalId: input.logicalId,
39734
+ listPage: async (marker) => {
39735
+ const list = await this.getClient().send(new ListRepositoriesCommand({ ...marker && { nextToken: marker } }));
39736
+ return {
39737
+ items: list.repositories,
39738
+ nextMarker: list.nextToken
39739
+ };
39740
+ },
39741
+ describe: async (repo) => {
39742
+ if (!repo.repositoryName) return void 0;
39696
39743
  let metadata;
39697
39744
  try {
39698
39745
  metadata = await this.getRepositoryMetadata(repo.repositoryName);
39699
39746
  } catch (err) {
39700
- if (err instanceof RepositoryDoesNotExistException) continue;
39747
+ if (err instanceof RepositoryDoesNotExistException) return void 0;
39701
39748
  throw err;
39702
39749
  }
39703
- if (!metadata?.Arn) continue;
39704
- if ((await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn: metadata.Arn }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
39705
- physicalId: repo.repositoryName,
39706
- attributes: this.toAttributes(metadata)
39750
+ if (!metadata?.Arn) return void 0;
39751
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn: metadata.Arn }));
39752
+ return {
39753
+ metadata,
39754
+ tags: tagsResp.tags
39707
39755
  };
39708
- }
39709
- nextToken = list.nextToken;
39710
- } while (nextToken);
39711
- return null;
39756
+ },
39757
+ tagsOf: (detail) => Object.entries(detail.tags ?? {}).map(([Key, Value]) => ({
39758
+ Key,
39759
+ Value
39760
+ }))
39761
+ });
39762
+ if (!match) return null;
39763
+ return {
39764
+ physicalId: match.summary.repositoryName,
39765
+ attributes: this.toAttributes(match.detail.metadata)
39766
+ };
39712
39767
  }
39713
39768
  /**
39714
39769
  * Seed the repository's initial commit from the CFn `Code` property.
@@ -40038,16 +40093,23 @@ var DLMLifecyclePolicyProvider = class {
40038
40093
  if (err instanceof ResourceNotFoundException$12) return null;
40039
40094
  throw err;
40040
40095
  }
40041
- if (!input.cdkPath) return null;
40042
- const list = await this.getClient().send(new GetLifecyclePoliciesCommand({}));
40043
- for (const policy of list.Policies ?? []) {
40044
- if (!policy.PolicyId) continue;
40045
- if (policy.Tags?.["aws:cdk:path"] === input.cdkPath) return {
40046
- physicalId: policy.PolicyId,
40047
- attributes: {}
40048
- };
40049
- }
40050
- return null;
40096
+ const match = await importTagWalk({
40097
+ cdkPath: input.cdkPath,
40098
+ logicalId: input.logicalId,
40099
+ listPage: async () => {
40100
+ return { items: (await this.getClient().send(new GetLifecyclePoliciesCommand({}))).Policies };
40101
+ },
40102
+ describe: async (policy) => policy.PolicyId ? policy : void 0,
40103
+ tagsOf: (policy) => Object.entries(policy.Tags ?? {}).map(([Key, Value]) => ({
40104
+ Key,
40105
+ Value
40106
+ }))
40107
+ });
40108
+ if (!match) return null;
40109
+ return {
40110
+ physicalId: match.summary.PolicyId,
40111
+ attributes: {}
40112
+ };
40051
40113
  }
40052
40114
  };
40053
40115
 
@@ -40285,25 +40347,35 @@ var S3VectorsProvider = class {
40285
40347
  if (this.isNotFoundError(err)) return null;
40286
40348
  throw err;
40287
40349
  }
40288
- if (!input.cdkPath) return null;
40289
- let token;
40290
- do {
40291
- const list = await this.getClient().send(new ListVectorBucketsCommand({ ...token && { nextToken: token } }));
40292
- for (const bucket of list.vectorBuckets ?? []) {
40293
- if (!bucket.vectorBucketName || !bucket.vectorBucketArn) continue;
40350
+ const match = await importTagWalk({
40351
+ cdkPath: input.cdkPath,
40352
+ logicalId: input.logicalId,
40353
+ listPage: async (marker) => {
40354
+ const list = await this.getClient().send(new ListVectorBucketsCommand({ ...marker && { nextToken: marker } }));
40355
+ return {
40356
+ items: list.vectorBuckets,
40357
+ nextMarker: list.nextToken
40358
+ };
40359
+ },
40360
+ describe: async (bucket) => {
40361
+ if (!bucket.vectorBucketName || !bucket.vectorBucketArn) return void 0;
40294
40362
  try {
40295
- if ((await this.getClient().send(new ListTagsForResourceCommand$20({ resourceArn: bucket.vectorBucketArn }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
40296
- physicalId: bucket.vectorBucketName,
40297
- attributes: {}
40298
- };
40363
+ return await this.getClient().send(new ListTagsForResourceCommand$20({ resourceArn: bucket.vectorBucketArn }));
40299
40364
  } catch (err) {
40300
- if (this.isNotFoundError(err)) continue;
40365
+ if (this.isNotFoundError(err)) return void 0;
40301
40366
  throw err;
40302
40367
  }
40303
- }
40304
- token = list.nextToken;
40305
- } while (token);
40306
- return null;
40368
+ },
40369
+ tagsOf: (tagsResp) => Object.entries(tagsResp.tags ?? {}).map(([Key, Value]) => ({
40370
+ Key,
40371
+ Value
40372
+ }))
40373
+ });
40374
+ if (!match) return null;
40375
+ return {
40376
+ physicalId: match.summary.vectorBucketName,
40377
+ attributes: {}
40378
+ };
40307
40379
  }
40308
40380
  isNotFoundError(error) {
40309
40381
  if (error instanceof Error) {
@@ -41829,7 +41901,8 @@ async function runDestroyForStack(stackName, state, ctx) {
41829
41901
  const providerMinTimeoutMs = provider.getMinResourceTimeoutMs?.() ?? 0;
41830
41902
  const warnAfterMs = ctx.resourceWarnAfterByType?.[resource.resourceType] ?? ctx.resourceWarnAfterMs ?? 3e5;
41831
41903
  const globalTimeoutMs = ctx.resourceTimeoutMs ?? 18e5;
41832
- const timeoutMs = ctx.resourceTimeoutByType?.[resource.resourceType] ?? Math.max(providerMinTimeoutMs, globalTimeoutMs);
41904
+ const slowTypeMinTimeoutMs = slowCcOperationTimeoutMs(resource.resourceType, "DELETE");
41905
+ const timeoutMs = ctx.resourceTimeoutByType?.[resource.resourceType] ?? Math.max(providerMinTimeoutMs, slowTypeMinTimeoutMs, globalTimeoutMs);
41833
41906
  await withResourceDeadline(async () => {
41834
41907
  const maxAttempts = provider.disableOuterRetry ? 0 : 3;
41835
41908
  let lastDeleteError;
@@ -44179,6 +44252,67 @@ async function confirmPrompt$6(prompt) {
44179
44252
  rl.close();
44180
44253
  }
44181
44254
  }
44255
+ /**
44256
+ * Flat `logicalId -> physicalId` map for ONE CloudFormation stack, or `null`
44257
+ * when no stack of that name exists.
44258
+ *
44259
+ * This is the non-recursive, non-throwing sibling of
44260
+ * {@link getCloudFormationResourceTree}, used by `cdkd import`'s auto mode as
44261
+ * a best-effort lookup (issue #1128). The distinction matters:
44262
+ *
44263
+ * - the tree walk is for `--migrate-from-cloudformation`, where the stack is
44264
+ * known to exist and nested children must be walked so each child's state
44265
+ * can be written and the whole tree retired;
44266
+ * - this one runs speculatively on every auto-mode import, so a missing
44267
+ * stack is the NORMAL case (a cdkd-native stack has no CFn counterpart)
44268
+ * and must return `null` rather than abort the import.
44269
+ *
44270
+ * NO failure is fatal. The lookup is an OPTIMIZATION: when it cannot answer,
44271
+ * the caller falls through to the per-provider lookups, which is exactly the
44272
+ * behavior that shipped before this function existed. Throwing would convert a
44273
+ * missed improvement into a hard failure — and it would do so precisely for the
44274
+ * users least likely to benefit. A cdkd-native stack has no CloudFormation
44275
+ * counterpart, so an operator whose IAM policy is scoped to cdkd's actual needs
44276
+ * (no `cloudformation:DescribeStackResources`) would see `AccessDenied` abort an
44277
+ * import that worked fine the day before.
44278
+ *
44279
+ * A missing stack is the expected case and logs at debug. Anything else logs a
44280
+ * WARN naming the cause, so a permissions gap or a throttle is visible rather
44281
+ * than silent — the user learns why the ids were not resolved, and still gets
44282
+ * the pre-existing behavior instead of an abort.
44283
+ */
44284
+ async function tryGetCloudFormationResourceMap(stackName, cfnClient) {
44285
+ const logger = getLogger();
44286
+ let resp;
44287
+ try {
44288
+ resp = await cfnClient.send(new DescribeStackResourcesCommand({ StackName: stackName }));
44289
+ } catch (err) {
44290
+ if (isStackNotFoundError(err)) {
44291
+ logger.debug(`No CloudFormation stack named '${stackName}'.`);
44292
+ return null;
44293
+ }
44294
+ const reason = err instanceof Error ? err.message : String(err);
44295
+ logger.warn(`Could not read CloudFormation stack '${stackName}' to resolve physical IDs (${reason}). Falling back to per-resource lookup; resources whose physical name CloudFormation generated may be reported as not found. Grant cloudformation:DescribeStackResources, or pass --resource <LogicalId>=<physicalId> for those resources.`);
44296
+ return null;
44297
+ }
44298
+ const resources = /* @__PURE__ */ new Map();
44299
+ for (const r of resp.StackResources ?? []) {
44300
+ if (!r.LogicalResourceId || !r.PhysicalResourceId) continue;
44301
+ resources.set(r.LogicalResourceId, r.PhysicalResourceId);
44302
+ }
44303
+ return resources;
44304
+ }
44305
+ /**
44306
+ * CloudFormation reports an unknown stack as a `ValidationError` whose message
44307
+ * carries "does not exist" — there is no dedicated exception type to catch.
44308
+ * Matching the message is therefore required, but it is kept narrow so an
44309
+ * unrelated ValidationError (a malformed stack name, say) still surfaces.
44310
+ */
44311
+ function isStackNotFoundError(err) {
44312
+ const name = err?.name;
44313
+ const message = err?.message ?? "";
44314
+ return name === "ValidationError" && /does not exist/i.test(message);
44315
+ }
44182
44316
 
44183
44317
  //#endregion
44184
44318
  //#region src/cli/commands/diff-recursive.ts
@@ -51870,30 +52004,13 @@ async function importCommand(stackArg, options) {
51870
52004
  if (migrationCfnStackName) {
51871
52005
  logger.info(`Resolving physical IDs from CloudFormation stack '${migrationCfnStackName}' (recursive)...`);
51872
52006
  migrationTree = await getCloudFormationResourceTree(migrationCfnStackName, awsClients.cloudFormation);
51873
- const cfnMapping = migrationTree.resources;
51874
- let derived = 0;
51875
- let skippedNonImportable = 0;
51876
- let skippedNestedStackRow = 0;
51877
- for (const [logicalId, physicalId] of cfnMapping) {
51878
- if (!templateLogicalIds.has(logicalId)) {
51879
- skippedNonImportable++;
51880
- continue;
51881
- }
51882
- if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") {
51883
- skippedNestedStackRow++;
51884
- continue;
51885
- }
51886
- if (!overrides.has(logicalId)) {
51887
- overrides.set(logicalId, physicalId);
51888
- derived++;
51889
- }
51890
- }
51891
- const overriddenByUser = cfnMapping.size - derived - skippedNonImportable - skippedNestedStackRow;
51892
- const detail = [];
51893
- if (overriddenByUser > 0) detail.push(`${overriddenByUser} already overridden by --resource`);
51894
- if (skippedNonImportable > 0) detail.push(`${skippedNonImportable} non-importable (e.g. CDKMetadata)`);
51895
- if (skippedNestedStackRow > 0) detail.push(`${skippedNestedStackRow} nested-stack row(s) handled separately`);
51896
- logger.info(`Resolved ${derived} physical ID(s) from CloudFormation` + (detail.length > 0 ? ` (${detail.join(", ")})` : ""));
52007
+ const mergeStats = mergeCfnDerivedOverrides({
52008
+ cfnMapping: migrationTree.resources,
52009
+ template,
52010
+ templateLogicalIds,
52011
+ overrides
52012
+ });
52013
+ logger.info(`Resolved ${mergeStats.derived} physical ID(s) from CloudFormation` + formatCfnOverrideMergeDetail(mergeStats));
51897
52014
  validateNestedStackShape(template, migrationTree, stackInfo.stackName, stackInfo.nestedTemplates ?? {});
51898
52015
  }
51899
52016
  let accountIdForNestedSynth;
@@ -51905,6 +52022,19 @@ async function importCommand(stackArg, options) {
51905
52022
  }
51906
52023
  const selectiveMode = overrides.size > 0 && !options.auto && !options.migrateFromCloudformation;
51907
52024
  if (selectiveMode) logger.info(`Selective mode: only importing the ${overrides.size} resource(s) you listed (${[...overrides.keys()].join(", ")}). Pass --auto to also tag-import the rest.`);
52025
+ if (!selectiveMode && !migrationCfnStackName) {
52026
+ const cfnResources = await tryGetCloudFormationResourceMap(stackInfo.stackName, awsClients.cloudFormation);
52027
+ if (cfnResources) {
52028
+ const mergeStats = mergeCfnDerivedOverrides({
52029
+ cfnMapping: cfnResources,
52030
+ template,
52031
+ templateLogicalIds,
52032
+ overrides
52033
+ });
52034
+ if (mergeStats.derived > 0) logger.info(`Resolved ${mergeStats.derived} physical ID(s) from CloudFormation stack '${stackInfo.stackName}'. To adopt AND retire that stack, use --migrate-from-cloudformation.`);
52035
+ else logger.debug(`CloudFormation stack '${stackInfo.stackName}' contributed no new physical IDs.`);
52036
+ } else logger.debug(`No CloudFormation stack named '${stackInfo.stackName}' — resolving physical IDs per provider.`);
52037
+ }
51908
52038
  const existingResult = await stateBackend.getState(stackInfo.stackName, targetRegion);
51909
52039
  const existingState = existingResult?.state ?? null;
51910
52040
  const existingEtag = existingResult?.etag;
@@ -52018,6 +52148,79 @@ async function importCommand(stackArg, options) {
52018
52148
  }
52019
52149
  }
52020
52150
  /**
52151
+ * Merge a CloudFormation-derived `logicalId -> physicalId` map into the run's
52152
+ * `overrides`, applying the three filters every CFn-derived seed needs, and
52153
+ * report what each filter dropped.
52154
+ *
52155
+ * The filters, in order:
52156
+ * 1. **Not an importable template resource** — CFn knows about sentinel rows
52157
+ * like `AWS::CDK::Metadata` that cdkd silently skips on import. Merging
52158
+ * those would make the typo-validation step reject them.
52159
+ * 2. **Nested-stack row** — the AWS-side physical ID of an
52160
+ * `AWS::CloudFormation::Stack` row is the child stack ARN, which is NOT
52161
+ * what we want as an import override. The parent's state entry carries
52162
+ * the synthesized cdkd-local ARN (matching what `NestedStackProvider.create`
52163
+ * writes at deploy time — design §6), populated by `importOne`'s
52164
+ * short-circuit. Filtering here keeps the AWS ARN from overwriting it.
52165
+ * 3. **Already overridden** — user-supplied `--resource` /
52166
+ * `--resource-mapping` entries are inserted before any CFn lookup and
52167
+ * always win.
52168
+ *
52169
+ * Shared by all three CFn-derived seeding sites so a change to any filter
52170
+ * lands once: the `--migrate-from-cloudformation` root walk, the auto-mode
52171
+ * best-effort lookup (issue #1128), and the recursive nested-child walk.
52172
+ * The three differ only in their LOGGING, which stays at the call sites.
52173
+ *
52174
+ * **Second-order effect worth naming:** `overrides` is also consumed by
52175
+ * {@link substituteOverrideRefs}, so seeding it from CloudFormation means a
52176
+ * `{Ref: <X>}` in a resource's Properties pre-resolves to the CFn physical ID
52177
+ * before `provider.import()` sees it. That is intended — it is what makes
52178
+ * sub-resource providers (e.g. `SQSQueuePolicyProvider`, which reads
52179
+ * `properties.Queues[0]` as a literal queue URL) importable — but it is a
52180
+ * behavior beyond "resolve physical IDs", and it applies to every caller of
52181
+ * this helper, not just the migration path. See issue #1131.
52182
+ *
52183
+ * Mutates `overrides` in place; does not mutate `cfnMapping` or `template`.
52184
+ */
52185
+ function mergeCfnDerivedOverrides(params) {
52186
+ const { cfnMapping, template, templateLogicalIds, overrides } = params;
52187
+ const stats = {
52188
+ derived: 0,
52189
+ skippedNonImportable: 0,
52190
+ skippedNestedStackRow: 0,
52191
+ overriddenByUser: 0
52192
+ };
52193
+ for (const [logicalId, physicalId] of cfnMapping) {
52194
+ if (!templateLogicalIds.has(logicalId)) {
52195
+ stats.skippedNonImportable++;
52196
+ continue;
52197
+ }
52198
+ if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") {
52199
+ stats.skippedNestedStackRow++;
52200
+ continue;
52201
+ }
52202
+ if (overrides.has(logicalId)) {
52203
+ stats.overriddenByUser++;
52204
+ continue;
52205
+ }
52206
+ overrides.set(logicalId, physicalId);
52207
+ stats.derived++;
52208
+ }
52209
+ return stats;
52210
+ }
52211
+ /**
52212
+ * Render the human-readable breakdown of a {@link mergeCfnDerivedOverrides}
52213
+ * result — the parenthesized suffix of the `Resolved N physical ID(s)` line.
52214
+ * Returns `''` when nothing was dropped (no breakdown worth reporting).
52215
+ */
52216
+ function formatCfnOverrideMergeDetail(stats) {
52217
+ const detail = [];
52218
+ if (stats.overriddenByUser > 0) detail.push(`${stats.overriddenByUser} already overridden by --resource`);
52219
+ if (stats.skippedNonImportable > 0) detail.push(`${stats.skippedNonImportable} non-importable (e.g. CDKMetadata)`);
52220
+ if (stats.skippedNestedStackRow > 0) detail.push(`${stats.skippedNestedStackRow} nested-stack row(s) handled separately`);
52221
+ return detail.length > 0 ? ` (${detail.join(", ")})` : "";
52222
+ }
52223
+ /**
52021
52224
  * Recursively substitute `{Ref: <LogicalId>}` shapes in an arbitrary value
52022
52225
  * tree with the matching entry from `overrides`. Used to bridge the gap
52023
52226
  * between CDK synth's template (which carries raw intrinsics) and what a
@@ -52566,11 +52769,12 @@ async function importNestedStackChildrenRecursive(args) {
52566
52769
  const childResources = collectImportableResources(childTemplate);
52567
52770
  const childTemplateLogicalIds = new Set(childResources.map((r) => r.logicalId));
52568
52771
  const childOverrides = /* @__PURE__ */ new Map();
52569
- for (const [logicalId, physicalId] of childTreeNode.resources) {
52570
- if (!childTemplateLogicalIds.has(logicalId)) continue;
52571
- if (childTemplate.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") continue;
52572
- childOverrides.set(logicalId, physicalId);
52573
- }
52772
+ mergeCfnDerivedOverrides({
52773
+ cfnMapping: childTreeNode.resources,
52774
+ template: childTemplate,
52775
+ templateLogicalIds: childTemplateLogicalIds,
52776
+ overrides: childOverrides
52777
+ });
52574
52778
  const rows = [];
52575
52779
  for (const { logicalId, resource } of childResources) {
52576
52780
  if (resource.Type === "AWS::CloudFormation::Stack" && childTreeNode.nested.has(logicalId)) {
@@ -62172,7 +62376,7 @@ function createMigrateCommand() {
62172
62376
  */
62173
62377
  function buildProgram() {
62174
62378
  const program = new Command();
62175
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.0");
62379
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.2");
62176
62380
  program.addCommand(createBootstrapCommand());
62177
62381
  program.addCommand(createSynthCommand());
62178
62382
  program.addCommand(createListCommand());