@go-to-k/cdkd 0.109.1 → 0.111.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
@@ -30,7 +30,7 @@ import { CreateAliasCommand, CreateKeyCommand, DeleteAliasCommand, DescribeKeyCo
30
30
  import { promisify } from "node:util";
31
31
  import { CreateRepositoryCommand, DeleteLifecyclePolicyCommand, DeleteRepositoryCommand, DeleteRepositoryPolicyCommand, DescribeRepositoriesCommand, ECRClient, GetAuthorizationTokenCommand, GetLifecyclePolicyCommand, LifecyclePolicyNotFoundException, ListTagsForResourceCommand as ListTagsForResourceCommand$7, PutImageScanningConfigurationCommand, PutImageTagMutabilityCommand, PutLifecyclePolicyCommand, RepositoryNotFoundException, SetRepositoryPolicyCommand, TagResourceCommand as TagResourceCommand$9 } from "@aws-sdk/client-ecr";
32
32
  import graphlib from "graphlib";
33
- import { AddTagsToResourceCommand as AddTagsToResourceCommand$1, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBProxyCommand, CreateDBProxyEndpointCommand, CreateDBSubnetGroupCommand, DBProxyEndpointNotFoundFault, DBProxyNotFoundFault, DBProxyTargetGroupNotFoundFault, DBProxyTargetNotFoundFault, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBProxyCommand, DeleteDBProxyEndpointCommand, DeleteDBSubnetGroupCommand, DeregisterDBProxyTargetsCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeDBProxiesCommand, DescribeDBProxyEndpointsCommand, DescribeDBProxyTargetGroupsCommand, DescribeDBSubnetGroupsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$8, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBProxyCommand, ModifyDBProxyEndpointCommand, ModifyDBProxyTargetGroupCommand, ModifyDBSubnetGroupCommand, RDSClient, RegisterDBProxyTargetsCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$1 } from "@aws-sdk/client-rds";
33
+ import { AddTagsToResourceCommand as AddTagsToResourceCommand$1, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBProxyCommand, CreateDBProxyEndpointCommand, CreateDBSubnetGroupCommand, DBProxyEndpointNotFoundFault, DBProxyNotFoundFault, DBProxyTargetGroupNotFoundFault, DBProxyTargetNotFoundFault, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBProxyCommand, DeleteDBProxyEndpointCommand, DeleteDBSubnetGroupCommand, DeregisterDBProxyTargetsCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeDBProxiesCommand, DescribeDBProxyEndpointsCommand, DescribeDBProxyTargetGroupsCommand, DescribeDBProxyTargetsCommand, DescribeDBSubnetGroupsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$8, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBProxyCommand, ModifyDBProxyEndpointCommand, ModifyDBProxyTargetGroupCommand, ModifyDBSubnetGroupCommand, RDSClient, RegisterDBProxyTargetsCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$1 } from "@aws-sdk/client-rds";
34
34
  import { Command, Option } from "commander";
35
35
  import { writeFileSync as writeFileSync$1 } from "fs";
36
36
  import { join as join$1 } from "path";
@@ -8074,7 +8074,10 @@ var DynamoDBGlobalTableProvider = class {
8074
8074
  if (sse["SSEType"]) sseInput.SSEType = sse["SSEType"];
8075
8075
  createParams.SSESpecification = sseInput;
8076
8076
  }
8077
- if (properties["DeletionProtectionEnabled"] !== void 0) createParams.DeletionProtectionEnabled = properties["DeletionProtectionEnabled"];
8077
+ const dpePerReplica = replicas.find((r) => r["Region"] === currentRegion)?.["DeletionProtectionEnabled"];
8078
+ const dpeTopLevel = properties["DeletionProtectionEnabled"];
8079
+ const dpeResolved = typeof dpePerReplica === "boolean" ? dpePerReplica : typeof dpeTopLevel === "boolean" ? dpeTopLevel : void 0;
8080
+ if (dpeResolved !== void 0) createParams.DeletionProtectionEnabled = dpeResolved;
8078
8081
  if (properties["TableClass"]) createParams.TableClass = properties["TableClass"];
8079
8082
  const wodts = properties["WriteOnDemandThroughputSettings"];
8080
8083
  if (wodts?.["MaxWriteRequestUnits"] !== void 0) createParams.OnDemandThroughput = { MaxWriteRequestUnits: Number(wodts["MaxWriteRequestUnits"]) };
@@ -8204,10 +8207,18 @@ var DynamoDBGlobalTableProvider = class {
8204
8207
  return (props["Replicas"] ?? []).find((r) => r["Region"] === currentRegion)?.["Tags"];
8205
8208
  };
8206
8209
  if (tableArn) await this.applyTagDiff(tableArn, extractLocalTags(previousProperties), extractLocalTags(properties));
8210
+ const extractLocalDP = (props) => {
8211
+ const perReplica = (props["Replicas"] ?? []).find((r) => r["Region"] === currentRegion)?.["DeletionProtectionEnabled"];
8212
+ if (typeof perReplica === "boolean") return perReplica;
8213
+ const topLevel = props["DeletionProtectionEnabled"];
8214
+ return typeof topLevel === "boolean" ? topLevel : void 0;
8215
+ };
8216
+ const newDpe = extractLocalDP(properties);
8217
+ const oldDpe = extractLocalDP(previousProperties);
8207
8218
  const flatUpdate = { TableName: physicalId };
8208
8219
  let flatChanged = false;
8209
- if (properties["DeletionProtectionEnabled"] !== previousProperties["DeletionProtectionEnabled"]) {
8210
- flatUpdate.DeletionProtectionEnabled = Boolean(properties["DeletionProtectionEnabled"] ?? false);
8220
+ if (newDpe !== oldDpe) {
8221
+ flatUpdate.DeletionProtectionEnabled = Boolean(newDpe ?? false);
8211
8222
  flatChanged = true;
8212
8223
  }
8213
8224
  if (properties["TableClass"] !== void 0 && properties["TableClass"] !== previousProperties["TableClass"]) {
@@ -19472,6 +19483,66 @@ var RDSDBProxyTargetGroupProvider = class {
19472
19483
  };
19473
19484
  return null;
19474
19485
  }
19486
+ /**
19487
+ * Read the AWS-current configuration as CFn property shape. Used by
19488
+ * `cdkd drift` for the SDK-provider path (without it the comparator
19489
+ * falls back to CC API, which is broken on this type — Issue #385 the
19490
+ * SDK provider was added to fix in the first place).
19491
+ *
19492
+ * Maps:
19493
+ * - `DescribeDBProxyTargetGroups` → `ConnectionPoolConfigurationInfo`
19494
+ * (the connection pool config CFn template carries).
19495
+ * - `DescribeDBProxyTargets` → `DBClusterIdentifiers` /
19496
+ * `DBInstanceIdentifiers` reverse-mapped from the AWS-side target
19497
+ * list via `Type` discriminator. The full target list also carries
19498
+ * per-target Endpoint / Port / TargetHealth but those are read-only
19499
+ * AWS-managed fields, intentionally not surfaced.
19500
+ *
19501
+ * Best-effort: a missing parent DBProxyName (state corruption) or any
19502
+ * AWS API failure surfaces as `undefined` (drift comparator skips the
19503
+ * resource), not a crash.
19504
+ */
19505
+ async readCurrentState(_physicalId, _logicalId, _resourceType, properties) {
19506
+ const dbProxyName = properties["DBProxyName"];
19507
+ const targetGroupName = properties["TargetGroupName"] ?? "default";
19508
+ if (!dbProxyName) return;
19509
+ const client = this.getClient();
19510
+ let connectionPoolConfig;
19511
+ try {
19512
+ connectionPoolConfig = ((await client.send(new DescribeDBProxyTargetGroupsCommand({
19513
+ DBProxyName: dbProxyName,
19514
+ TargetGroupName: targetGroupName
19515
+ }))).TargetGroups?.[0])?.ConnectionPoolConfig;
19516
+ } catch (error) {
19517
+ if (error instanceof DBProxyNotFoundFault || error instanceof DBProxyTargetGroupNotFoundFault) return;
19518
+ throw error;
19519
+ }
19520
+ const dbClusterIdentifiers = [];
19521
+ const dbInstanceIdentifiers = [];
19522
+ try {
19523
+ const targetsResp = await client.send(new DescribeDBProxyTargetsCommand({
19524
+ DBProxyName: dbProxyName,
19525
+ TargetGroupName: targetGroupName
19526
+ }));
19527
+ for (const target of targetsResp.Targets ?? []) {
19528
+ const id = target.RdsResourceId;
19529
+ if (!id) continue;
19530
+ if (target.Type === "TRACKED_CLUSTER") dbClusterIdentifiers.push(id);
19531
+ else if (target.Type === "RDS_INSTANCE") dbInstanceIdentifiers.push(id);
19532
+ }
19533
+ } catch (error) {
19534
+ if (error instanceof DBProxyNotFoundFault || error instanceof DBProxyTargetGroupNotFoundFault || error instanceof DBProxyTargetNotFoundFault) return;
19535
+ throw error;
19536
+ }
19537
+ const result = {
19538
+ DBProxyName: dbProxyName,
19539
+ TargetGroupName: targetGroupName,
19540
+ DBClusterIdentifiers: dbClusterIdentifiers,
19541
+ DBInstanceIdentifiers: dbInstanceIdentifiers
19542
+ };
19543
+ if (connectionPoolConfig !== void 0) result["ConnectionPoolConfigurationInfo"] = connectionPoolConfig;
19544
+ return result;
19545
+ }
19475
19546
  wrapError(error, op, resourceType, logicalId, physicalId) {
19476
19547
  const message = error instanceof Error ? error.message : String(error);
19477
19548
  const cause = error instanceof Error ? error : void 0;
@@ -45186,7 +45257,7 @@ function reorderArgs(argv) {
45186
45257
  */
45187
45258
  async function main() {
45188
45259
  const program = new Command();
45189
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.109.1");
45260
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.111.0");
45190
45261
  program.addCommand(createBootstrapCommand());
45191
45262
  program.addCommand(createSynthCommand());
45192
45263
  program.addCommand(createListCommand());