@go-to-k/cdkd 0.159.3 → 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-BzrECC3i.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";
@@ -32190,7 +32190,10 @@ async function runDestroyForStack(stackName, state, ctx) {
32190
32190
  const baseLabel = `Deleting ${logicalId} (${resource.resourceType})`;
32191
32191
  renderer.addTask(logicalId, baseLabel);
32192
32192
  try {
32193
- const provider = destroyProviderRegistry.getProvider(resource.resourceType);
32193
+ const provider = destroyProviderRegistry.getProviderFor({
32194
+ resourceType: resource.resourceType,
32195
+ provisionedBy: resource.provisionedBy
32196
+ }).provider;
32194
32197
  const providerMinTimeoutMs = provider.getMinResourceTimeoutMs?.() ?? 0;
32195
32198
  const warnAfterMs = ctx.resourceWarnAfterByType?.[resource.resourceType] ?? ctx.resourceWarnAfterMs ?? 3e5;
32196
32199
  const globalTimeoutMs = ctx.resourceTimeoutMs ?? 18e5;
@@ -34306,7 +34309,7 @@ async function loadStateOrEmpty(stackName, region, stateBackend) {
34306
34309
  region,
34307
34310
  resources: {},
34308
34311
  outputs: {},
34309
- version: 6,
34312
+ version: 7,
34310
34313
  lastModified: Date.now()
34311
34314
  };
34312
34315
  }
@@ -34357,6 +34360,7 @@ async function buildDiffTree(args) {
34357
34360
  displayName,
34358
34361
  region,
34359
34362
  changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator),
34363
+ ccApiRoutes: collectCcApiRoutes(template, state),
34360
34364
  children: []
34361
34365
  };
34362
34366
  if (!recursive) return node;
@@ -34400,6 +34404,7 @@ async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculat
34400
34404
  displayName: stackName,
34401
34405
  region,
34402
34406
  changes: await computeStackDiff(state, EMPTY_TEMPLATE, region, stackName, stateBackend, diffCalculator),
34407
+ ccApiRoutes: /* @__PURE__ */ new Map(),
34403
34408
  children: []
34404
34409
  };
34405
34410
  for (const [logicalId, resource] of Object.entries(state.resources)) {
@@ -34408,6 +34413,52 @@ async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculat
34408
34413
  }
34409
34414
  return node;
34410
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
+ }
34411
34462
  /** True when this node has at least one real (non-`NO_CHANGE`) change. */
34412
34463
  function nodeHasChanges(node) {
34413
34464
  for (const change of node.changes.values()) if (change.changeType !== "NO_CHANGE") return true;
@@ -34428,12 +34479,14 @@ function diffTreeToJson(node) {
34428
34479
  const changes = [];
34429
34480
  for (const change of node.changes.values()) {
34430
34481
  if (change.changeType === "NO_CHANGE") continue;
34482
+ const ccApi = node.ccApiRoutes.get(change.logicalId);
34431
34483
  changes.push({
34432
34484
  logicalId: change.logicalId,
34433
34485
  changeType: change.changeType,
34434
34486
  resourceType: change.resourceType,
34435
34487
  ...change.propertyChanges && change.propertyChanges.length > 0 ? { propertyChanges: change.propertyChanges } : {},
34436
- ...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 } : {}
34437
34490
  });
34438
34491
  }
34439
34492
  return {
@@ -34497,19 +34550,30 @@ function stripUnchangedValues(value, other) {
34497
34550
  * Render one resource-change map into human-readable diff lines via `logFn`,
34498
34551
  * returning the per-type counts. Shared by the root stack block and every
34499
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.
34500
34559
  */
34501
- function renderChangeLines(changes, logFn) {
34560
+ function renderChangeLines(changes, logFn, ccApiRoutes) {
34502
34561
  let createCount = 0;
34503
34562
  let updateCount = 0;
34504
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
+ };
34505
34569
  for (const [logicalId, change] of changes.entries()) switch (change.changeType) {
34506
34570
  case "CREATE":
34507
34571
  createCount++;
34508
- logFn(` [+] ${logicalId} (${change.resourceType})`);
34572
+ logFn(` [+] ${logicalId} (${change.resourceType})${annotateRouting(logicalId)}`);
34509
34573
  break;
34510
34574
  case "UPDATE":
34511
34575
  updateCount++;
34512
- logFn(` [~] ${logicalId} (${change.resourceType})`);
34576
+ logFn(` [~] ${logicalId} (${change.resourceType})${annotateRouting(logicalId)}`);
34513
34577
  if (change.propertyChanges && change.propertyChanges.length > 0) for (const propChange of change.propertyChanges) {
34514
34578
  const requiresReplace = propChange.requiresReplacement ? " [requires replacement]" : "";
34515
34579
  const oldFiltered = stripUnchangedValues(propChange.oldValue, propChange.newValue);
@@ -34549,7 +34613,7 @@ function renderChangeLines(changes, logFn) {
34549
34613
  function renderDiffTree(node, isRoot, logFn) {
34550
34614
  if (nodeHasChanges(node)) {
34551
34615
  logFn(isRoot ? `\nStack ${node.stackName}:` : `\nNested stack: ${node.displayName}`);
34552
- const { create, update, delete: del } = renderChangeLines(node.changes, logFn);
34616
+ const { create, update, delete: del } = renderChangeLines(node.changes, logFn, node.ccApiRoutes);
34553
34617
  logFn(`\n${create} to create, ${update} to update, ${del} to delete`);
34554
34618
  }
34555
34619
  for (const child of node.children) renderDiffTree(child, false, logFn);
@@ -35078,7 +35142,10 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
35078
35142
  }
35079
35143
  let provider;
35080
35144
  try {
35081
- provider = providerRegistry.getProvider(resource.resourceType);
35145
+ provider = providerRegistry.getProviderFor({
35146
+ resourceType: resource.resourceType,
35147
+ provisionedBy: resource.provisionedBy
35148
+ }).provider;
35082
35149
  } catch {
35083
35150
  outcomes.push({
35084
35151
  kind: "unsupported",
@@ -35355,7 +35422,10 @@ async function runRevert(reports, providerRegistry, stateConfig, awsClients, opt
35355
35422
  logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): resource missing from state; skipped.`);
35356
35423
  return;
35357
35424
  }
35358
- const provider = providerRegistry.getProvider(outcome.resourceType);
35425
+ const provider = providerRegistry.getProviderFor({
35426
+ resourceType: outcome.resourceType,
35427
+ provisionedBy: stateResource.provisionedBy
35428
+ }).provider;
35359
35429
  const desiredProperties = stateResource.observedProperties ?? stateResource.properties ?? {};
35360
35430
  const newProperties = buildRevertNewProperties(outcome.changes, desiredProperties, outcome.awsProperties);
35361
35431
  try {
@@ -35871,7 +35941,10 @@ var AttributeFetcher = class {
35871
35941
  };
35872
35942
  let provider;
35873
35943
  try {
35874
- provider = this.providerRegistry.getProvider(orphan.resourceType);
35944
+ provider = this.providerRegistry.getProviderFor({
35945
+ resourceType: orphan.resourceType,
35946
+ provisionedBy: orphan.provisionedBy
35947
+ }).provider;
35875
35948
  } catch (err) {
35876
35949
  return {
35877
35950
  ok: false,
@@ -39741,6 +39814,8 @@ function renderStateBlock(state, lockInfo) {
39741
39814
  lines.push(logicalId);
39742
39815
  lines.push(` Type: ${resource.resourceType}`);
39743
39816
  lines.push(` PhysicalID: ${resource.physicalId}`);
39817
+ const provisionedBy = resource.provisionedBy ?? "(sdk, legacy default)";
39818
+ lines.push(` ProvisionedBy: ${provisionedBy}`);
39744
39819
  const deps = resource.dependencies ?? [];
39745
39820
  lines.push(` Dependencies: ${deps.length > 0 ? deps.join(", ") : "(none)"}`);
39746
39821
  const attrEntries = Object.entries(resource.attributes ?? {});
@@ -40371,7 +40446,10 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
40371
40446
  for (const [, resource] of entries) {
40372
40447
  let provider;
40373
40448
  try {
40374
- provider = providerRegistry.getProvider(resource.resourceType);
40449
+ provider = providerRegistry.getProviderFor({
40450
+ resourceType: resource.resourceType,
40451
+ provisionedBy: resource.provisionedBy
40452
+ }).provider;
40375
40453
  } catch {
40376
40454
  wouldUnsupported++;
40377
40455
  continue;
@@ -40400,7 +40478,10 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
40400
40478
  }
40401
40479
  let provider;
40402
40480
  try {
40403
- provider = providerRegistry.getProvider(resource.resourceType);
40481
+ provider = providerRegistry.getProviderFor({
40482
+ resourceType: resource.resourceType,
40483
+ provisionedBy: resource.provisionedBy
40484
+ }).provider;
40404
40485
  } catch {
40405
40486
  unsupported++;
40406
40487
  return;
@@ -40939,11 +41020,12 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
40939
41020
  resourceType: row.resourceType,
40940
41021
  properties: tmplResource.Properties ?? {},
40941
41022
  attributes: {},
40942
- dependencies: [...deps]
41023
+ dependencies: [...deps],
41024
+ provisionedBy: "sdk"
40943
41025
  };
40944
41026
  }
40945
41027
  return {
40946
- version: 6,
41028
+ version: 7,
40947
41029
  stackName,
40948
41030
  region,
40949
41031
  resources,
@@ -41136,7 +41218,10 @@ async function captureObservedForImportedResources(stackState, providerRegistry,
41136
41218
  if (entries.length === 0) return;
41137
41219
  await Promise.all(entries.map(async ([logicalId, resource]) => {
41138
41220
  try {
41139
- const provider = providerRegistry.getProvider(resource.resourceType);
41221
+ const provider = providerRegistry.getProviderFor({
41222
+ resourceType: resource.resourceType,
41223
+ provisionedBy: resource.provisionedBy
41224
+ }).provider;
41140
41225
  if (!provider.readCurrentState) return;
41141
41226
  const observed = await provider.readCurrentState(resource.physicalId, logicalId, resource.resourceType, resource.properties ?? {}, buildReadCurrentStateContext(stackState, logicalId));
41142
41227
  if (observed !== void 0) resource.observedProperties = observed;
@@ -59513,7 +59598,7 @@ function reorderArgs(argv) {
59513
59598
  */
59514
59599
  async function main() {
59515
59600
  const program = new Command();
59516
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.159.3");
59601
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.161.0");
59517
59602
  program.addCommand(createBootstrapCommand());
59518
59603
  program.addCommand(createSynthCommand());
59519
59604
  program.addCommand(createListCommand());