@go-to-k/cdkd 0.257.1 → 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.1";
1902
+ return "0.257.2";
1903
1903
  }
1904
1904
  /**
1905
1905
  * Generate a time-sortable unique run id, e.g.
@@ -41901,7 +41901,8 @@ async function runDestroyForStack(stackName, state, ctx) {
41901
41901
  const providerMinTimeoutMs = provider.getMinResourceTimeoutMs?.() ?? 0;
41902
41902
  const warnAfterMs = ctx.resourceWarnAfterByType?.[resource.resourceType] ?? ctx.resourceWarnAfterMs ?? 3e5;
41903
41903
  const globalTimeoutMs = ctx.resourceTimeoutMs ?? 18e5;
41904
- 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);
41905
41906
  await withResourceDeadline(async () => {
41906
41907
  const maxAttempts = provider.disableOuterRetry ? 0 : 3;
41907
41908
  let lastDeleteError;
@@ -52003,30 +52004,13 @@ async function importCommand(stackArg, options) {
52003
52004
  if (migrationCfnStackName) {
52004
52005
  logger.info(`Resolving physical IDs from CloudFormation stack '${migrationCfnStackName}' (recursive)...`);
52005
52006
  migrationTree = await getCloudFormationResourceTree(migrationCfnStackName, awsClients.cloudFormation);
52006
- const cfnMapping = migrationTree.resources;
52007
- let derived = 0;
52008
- let skippedNonImportable = 0;
52009
- let skippedNestedStackRow = 0;
52010
- for (const [logicalId, physicalId] of cfnMapping) {
52011
- if (!templateLogicalIds.has(logicalId)) {
52012
- skippedNonImportable++;
52013
- continue;
52014
- }
52015
- if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") {
52016
- skippedNestedStackRow++;
52017
- continue;
52018
- }
52019
- if (!overrides.has(logicalId)) {
52020
- overrides.set(logicalId, physicalId);
52021
- derived++;
52022
- }
52023
- }
52024
- const overriddenByUser = cfnMapping.size - derived - skippedNonImportable - skippedNestedStackRow;
52025
- const detail = [];
52026
- if (overriddenByUser > 0) detail.push(`${overriddenByUser} already overridden by --resource`);
52027
- if (skippedNonImportable > 0) detail.push(`${skippedNonImportable} non-importable (e.g. CDKMetadata)`);
52028
- if (skippedNestedStackRow > 0) detail.push(`${skippedNestedStackRow} nested-stack row(s) handled separately`);
52029
- 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));
52030
52014
  validateNestedStackShape(template, migrationTree, stackInfo.stackName, stackInfo.nestedTemplates ?? {});
52031
52015
  }
52032
52016
  let accountIdForNestedSynth;
@@ -52041,15 +52025,13 @@ async function importCommand(stackArg, options) {
52041
52025
  if (!selectiveMode && !migrationCfnStackName) {
52042
52026
  const cfnResources = await tryGetCloudFormationResourceMap(stackInfo.stackName, awsClients.cloudFormation);
52043
52027
  if (cfnResources) {
52044
- let derived = 0;
52045
- for (const [logicalId, physicalId] of cfnResources) {
52046
- if (!templateLogicalIds.has(logicalId)) continue;
52047
- if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") continue;
52048
- if (overrides.has(logicalId)) continue;
52049
- overrides.set(logicalId, physicalId);
52050
- derived++;
52051
- }
52052
- if (derived > 0) logger.info(`Resolved ${derived} physical ID(s) from CloudFormation stack '${stackInfo.stackName}'. To adopt AND retire that stack, use --migrate-from-cloudformation.`);
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.`);
52053
52035
  else logger.debug(`CloudFormation stack '${stackInfo.stackName}' contributed no new physical IDs.`);
52054
52036
  } else logger.debug(`No CloudFormation stack named '${stackInfo.stackName}' — resolving physical IDs per provider.`);
52055
52037
  }
@@ -52166,6 +52148,79 @@ async function importCommand(stackArg, options) {
52166
52148
  }
52167
52149
  }
52168
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
+ /**
52169
52224
  * Recursively substitute `{Ref: <LogicalId>}` shapes in an arbitrary value
52170
52225
  * tree with the matching entry from `overrides`. Used to bridge the gap
52171
52226
  * between CDK synth's template (which carries raw intrinsics) and what a
@@ -52714,11 +52769,12 @@ async function importNestedStackChildrenRecursive(args) {
52714
52769
  const childResources = collectImportableResources(childTemplate);
52715
52770
  const childTemplateLogicalIds = new Set(childResources.map((r) => r.logicalId));
52716
52771
  const childOverrides = /* @__PURE__ */ new Map();
52717
- for (const [logicalId, physicalId] of childTreeNode.resources) {
52718
- if (!childTemplateLogicalIds.has(logicalId)) continue;
52719
- if (childTemplate.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") continue;
52720
- childOverrides.set(logicalId, physicalId);
52721
- }
52772
+ mergeCfnDerivedOverrides({
52773
+ cfnMapping: childTreeNode.resources,
52774
+ template: childTemplate,
52775
+ templateLogicalIds: childTemplateLogicalIds,
52776
+ overrides: childOverrides
52777
+ });
52722
52778
  const rows = [];
52723
52779
  for (const { logicalId, resource } of childResources) {
52724
52780
  if (resource.Type === "AWS::CloudFormation::Stack" && childTreeNode.nested.has(logicalId)) {
@@ -62320,7 +62376,7 @@ function createMigrateCommand() {
62320
62376
  */
62321
62377
  function buildProgram() {
62322
62378
  const program = new Command();
62323
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.1");
62379
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.2");
62324
62380
  program.addCommand(createBootstrapCommand());
62325
62381
  program.addCommand(createSynthCommand());
62326
62382
  program.addCommand(createListCommand());