@go-to-k/cdkd 0.160.0 → 0.161.0

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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { _ as withSkipPrefix, a as runDockerStreaming, c as getLogger, d as getLiveRenderer, f as PATTERN_B_NAME_PROPERTIES, g as generateResourceNameWithFallback, h as generateResourceName, i as runDockerForeground, n as formatDockerLoginError, p as PATTERN_B_RESOURCE_TYPES, r as getDockerCmd, u as runStackBuffered, v as withStackName } from "./docker-cmd-iDMcWcre.js";
3
- import { $ as CdkdError, A as shouldRetainResource, B as resolveSkipPrefix, C as IntrinsicFunctionResolver, D as TemplateParser, E as DagBuilder, F as Synthesizer, G as CFN_TEMPLATE_URL_LIMIT, H as resolveStateBucketWithDefaultAndSource, I as getDefaultStateBucketName, J as uploadCfnTemplate, K as MIGRATE_TMP_PREFIX, L as getLegacyStateBucketName, M as stringifyValue, N as WorkGraph, O as LockManager, P as buildDockerImage, R as resolveApp, S as assertRegionMatch, T as DiffCalculator, U as warnDeprecatedNoPrefixCliFlag, V as resolveStateBucketWithDefault, W as CFN_TEMPLATE_BODY_LIMIT, Y as AssemblyReader, Z as resolveBucketRegion, _ as matchesCdkPath, a as withRetry, b as ProviderRegistry, bt as withErrorHandling, c as bold, ct as PartialFailureError, d as green, dt as ResourceUpdateNotSupportedError, f as red, ft as RouteDiscoveryError, g as CDK_PATH_TAG, h as collectInlinePolicyNamesManagedBySiblings, i as withResourceDeadline, it as LocalStartServiceError, j as AssetPublisher, k as S3StateBackend, l as cyan, lt as ProvisioningError, m as IAMRoleProvider, mt as StackTerminationProtectionError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as LocalInvokeBuildError, o as IMPLICIT_DELETE_DEPENDENCIES, ot as MissingCdkCliError, p as yellow, pt as StackHasActiveImportsError, q as findLargeInlineResources, r as DeployEngine, rt as LocalMigrateError, s as formatResourceLine, st as NestedStackChildDirectDestroyError, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, ut as ResourceTimeoutError, v as normalizeAwsTagsToCfn, w as applyRoleArnIfSet, x as CloudControlProvider, y as resolveExplicitPhysicalId, yt as normalizeAwsError, z as resolveCaptureObservedState } from "./deploy-engine-BXWv-yRb.js";
3
+ import { A as S3StateBackend, B as resolveCaptureObservedState, C as assertRegionMatch, D as DagBuilder, E as DiffCalculator, F as buildDockerImage, G as CFN_TEMPLATE_BODY_LIMIT, H as resolveStateBucketWithDefault, I as Synthesizer, J as findLargeInlineResources, K as CFN_TEMPLATE_URL_LIMIT, L as getDefaultStateBucketName, M as AssetPublisher, N as stringifyValue, O as TemplateParser, P as WorkGraph, Q as resolveBucketRegion, R as getLegacyStateBucketName, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveStateBucketWithDefaultAndSource, V as resolveSkipPrefix, W as warnDeprecatedNoPrefixCliFlag, X as AssemblyReader, Y as uploadCfnTemplate, _ as matchesCdkPath, a as withRetry, at as LocalStartServiceError, b as ProviderRegistry, bt as normalizeAwsError, c as bold, ct as NestedStackChildDirectDestroyError, d as green, dt as ResourceTimeoutError, et as CdkdError, f as red, ft as ResourceUpdateNotSupportedError, g as CDK_PATH_TAG, h as collectInlinePolicyNamesManagedBySiblings, ht as StackTerminationProtectionError, i as withResourceDeadline, it as LocalMigrateError, j as shouldRetainResource, k as LockManager, l as cyan, lt as PartialFailureError, m as IAMRoleProvider, mt as StackHasActiveImportsError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as RouteDiscoveryError, q as MIGRATE_TMP_PREFIX, r as DeployEngine, rt as LocalInvokeBuildError, s as formatResourceLine, st as MissingCdkCliError, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, ut as ProvisioningError, v as normalizeAwsTagsToCfn, w as IntrinsicFunctionResolver, x as findActionableSilentDrops, xt as withErrorHandling, y as resolveExplicitPhysicalId, z as resolveApp } from "./deploy-engine-BC1Z7ABm.js";
4
4
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-B15NAPbL.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, createHmac, createPublicKey, createVerify, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -34360,6 +34360,7 @@ async function buildDiffTree(args) {
34360
34360
  displayName,
34361
34361
  region,
34362
34362
  changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator),
34363
+ ccApiRoutes: collectCcApiRoutes(template, state),
34363
34364
  children: []
34364
34365
  };
34365
34366
  if (!recursive) return node;
@@ -34403,6 +34404,7 @@ async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculat
34403
34404
  displayName: stackName,
34404
34405
  region,
34405
34406
  changes: await computeStackDiff(state, EMPTY_TEMPLATE, region, stackName, stateBackend, diffCalculator),
34407
+ ccApiRoutes: /* @__PURE__ */ new Map(),
34406
34408
  children: []
34407
34409
  };
34408
34410
  for (const [logicalId, resource] of Object.entries(state.resources)) {
@@ -34411,6 +34413,52 @@ async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculat
34411
34413
  }
34412
34414
  return node;
34413
34415
  }
34416
+ const EMPTY_ALLOW_SET = /* @__PURE__ */ new Set();
34417
+ /**
34418
+ * Walk every resource in `template` and return the logicalId → annotation
34419
+ * source map that #614's auto-fallback would route via Cloud Control API.
34420
+ *
34421
+ * Two annotation sources are merged into one map so the diff renderer
34422
+ * matches the live-progress label and the design §8 statement that the
34423
+ * `[via CC API: ...]` tag "stays visible whenever the resource has the
34424
+ * `provisionedBy: 'cc-api'` state field set OR is being introduced via the
34425
+ * auto-route":
34426
+ *
34427
+ * - **Fresh hits**: a resource whose template uses one or more
34428
+ * silent-drop top-level CFn properties. Annotation value is the list
34429
+ * of property names (e.g. `LoggingConfig`).
34430
+ * - **Sticky hits**: a resource whose deployed state records
34431
+ * `provisionedBy: 'cc-api'` (from a prior deploy) even when the
34432
+ * current template's silent-drop set is empty. Annotation value is
34433
+ * the single token `sticky` so the renderer prints `[via CC API:
34434
+ * sticky]` — the routing decision is unchanged but the tag stays
34435
+ * visible per #614's sticky-state semantics.
34436
+ *
34437
+ * When both sources fire on the same resource, the fresh-hit prop list
34438
+ * wins (more informative). Empty allow-set:
34439
+ * `--allow-unsupported-properties` is a deploy-only flag, so diff
34440
+ * renders every actionable drop as an auto-route hint.
34441
+ *
34442
+ * Excludes `AWS::CDK::Metadata` (filtered like the deploy pre-flight); also
34443
+ * excludes `AWS::CloudFormation::Stack` rows since nested-stack children
34444
+ * recurse through their own templates rather than carrying CC-routable
34445
+ * properties on the parent's row.
34446
+ */
34447
+ function collectCcApiRoutes(template, state) {
34448
+ const hits = /* @__PURE__ */ new Map();
34449
+ for (const [logicalId, resource] of Object.entries(template.Resources ?? {})) {
34450
+ if (!resource) continue;
34451
+ if (resource.Type === "AWS::CDK::Metadata") continue;
34452
+ if (resource.Type === "AWS::CloudFormation::Stack") continue;
34453
+ const drops = findActionableSilentDrops(resource.Type, resource.Properties, EMPTY_ALLOW_SET);
34454
+ if (drops.length > 0) {
34455
+ hits.set(logicalId, drops.map((d) => d.property));
34456
+ continue;
34457
+ }
34458
+ if (state.resources[logicalId]?.provisionedBy === "cc-api") hits.set(logicalId, ["sticky"]);
34459
+ }
34460
+ return hits;
34461
+ }
34414
34462
  /** True when this node has at least one real (non-`NO_CHANGE`) change. */
34415
34463
  function nodeHasChanges(node) {
34416
34464
  for (const change of node.changes.values()) if (change.changeType !== "NO_CHANGE") return true;
@@ -34431,12 +34479,14 @@ function diffTreeToJson(node) {
34431
34479
  const changes = [];
34432
34480
  for (const change of node.changes.values()) {
34433
34481
  if (change.changeType === "NO_CHANGE") continue;
34482
+ const ccApi = node.ccApiRoutes.get(change.logicalId);
34434
34483
  changes.push({
34435
34484
  logicalId: change.logicalId,
34436
34485
  changeType: change.changeType,
34437
34486
  resourceType: change.resourceType,
34438
34487
  ...change.propertyChanges && change.propertyChanges.length > 0 ? { propertyChanges: change.propertyChanges } : {},
34439
- ...change.attributeChanges && change.attributeChanges.length > 0 ? { attributeChanges: change.attributeChanges } : {}
34488
+ ...change.attributeChanges && change.attributeChanges.length > 0 ? { attributeChanges: change.attributeChanges } : {},
34489
+ ...ccApi && ccApi.length > 0 ? { ccApi } : {}
34440
34490
  });
34441
34491
  }
34442
34492
  return {
@@ -34500,19 +34550,30 @@ function stripUnchangedValues(value, other) {
34500
34550
  * Render one resource-change map into human-readable diff lines via `logFn`,
34501
34551
  * returning the per-type counts. Shared by the root stack block and every
34502
34552
  * nested-stack block.
34553
+ *
34554
+ * When `ccApiRoutes` is supplied, every CREATE / UPDATE line whose logical ID
34555
+ * appears in the map gets a `[via CC API: <props>]` suffix so the user sees
34556
+ * #614's auto-fallback decision at plan time. DELETE lines are not annotated
34557
+ * — the delete routing is recorded on each resource's `provisionedBy` state
34558
+ * field rather than re-derived from the template.
34503
34559
  */
34504
- function renderChangeLines(changes, logFn) {
34560
+ function renderChangeLines(changes, logFn, ccApiRoutes) {
34505
34561
  let createCount = 0;
34506
34562
  let updateCount = 0;
34507
34563
  let deleteCount = 0;
34564
+ const annotateRouting = (logicalId) => {
34565
+ const props = ccApiRoutes?.get(logicalId);
34566
+ if (!props || props.length === 0) return "";
34567
+ return ` [via CC API: ${props.join(", ")}]`;
34568
+ };
34508
34569
  for (const [logicalId, change] of changes.entries()) switch (change.changeType) {
34509
34570
  case "CREATE":
34510
34571
  createCount++;
34511
- logFn(` [+] ${logicalId} (${change.resourceType})`);
34572
+ logFn(` [+] ${logicalId} (${change.resourceType})${annotateRouting(logicalId)}`);
34512
34573
  break;
34513
34574
  case "UPDATE":
34514
34575
  updateCount++;
34515
- logFn(` [~] ${logicalId} (${change.resourceType})`);
34576
+ logFn(` [~] ${logicalId} (${change.resourceType})${annotateRouting(logicalId)}`);
34516
34577
  if (change.propertyChanges && change.propertyChanges.length > 0) for (const propChange of change.propertyChanges) {
34517
34578
  const requiresReplace = propChange.requiresReplacement ? " [requires replacement]" : "";
34518
34579
  const oldFiltered = stripUnchangedValues(propChange.oldValue, propChange.newValue);
@@ -34552,7 +34613,7 @@ function renderChangeLines(changes, logFn) {
34552
34613
  function renderDiffTree(node, isRoot, logFn) {
34553
34614
  if (nodeHasChanges(node)) {
34554
34615
  logFn(isRoot ? `\nStack ${node.stackName}:` : `\nNested stack: ${node.displayName}`);
34555
- const { create, update, delete: del } = renderChangeLines(node.changes, logFn);
34616
+ const { create, update, delete: del } = renderChangeLines(node.changes, logFn, node.ccApiRoutes);
34556
34617
  logFn(`\n${create} to create, ${update} to update, ${del} to delete`);
34557
34618
  }
34558
34619
  for (const child of node.children) renderDiffTree(child, false, logFn);
@@ -59537,7 +59598,7 @@ function reorderArgs(argv) {
59537
59598
  */
59538
59599
  async function main() {
59539
59600
  const program = new Command();
59540
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.160.0");
59601
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.161.0");
59541
59602
  program.addCommand(createBootstrapCommand());
59542
59603
  program.addCommand(createSynthCommand());
59543
59604
  program.addCommand(createListCommand());