@go-to-k/cdkd 0.109.0 → 0.110.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";
@@ -18557,7 +18557,7 @@ var RDSProvider = class {
18557
18557
  //#endregion
18558
18558
  //#region src/provisioning/providers/rds-dbproxy-provider.ts
18559
18559
  const POLL_INTERVAL_MS$1 = 5e3;
18560
- const POLL_TIMEOUT_MS$1 = 900 * 1e3;
18560
+ const POLL_TIMEOUT_MS$1 = 1800 * 1e3;
18561
18561
  /**
18562
18562
  * AWS RDS DBProxy Provider
18563
18563
  *
@@ -18702,8 +18702,8 @@ var RDSDBProxyProvider = class {
18702
18702
  throw this.wrapError(error, "UPDATE", resourceType, logicalId, physicalId);
18703
18703
  }
18704
18704
  }
18705
- await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"], resourceType, logicalId);
18706
18705
  this.invalidateAttributeCache(physicalId);
18706
+ await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"], resourceType, logicalId);
18707
18707
  return {
18708
18708
  physicalId,
18709
18709
  wasReplaced: false
@@ -18825,6 +18825,9 @@ var RDSDBProxyProvider = class {
18825
18825
  return result;
18826
18826
  }
18827
18827
  async applyTagDiff(physicalId, oldTags, newTags, resourceType, logicalId) {
18828
+ const oldMap = this.toTagMap(oldTags);
18829
+ const newMap = this.toTagMap(newTags);
18830
+ if (oldMap.size === newMap.size && [...oldMap.keys()].every((k) => newMap.has(k)) && [...oldMap.entries()].every(([k, v]) => newMap.get(k) === v)) return;
18828
18831
  const client = this.getClient();
18829
18832
  const arnCacheKey = `${physicalId}:DBProxyArn`;
18830
18833
  let arn = this.attributeCache.get(arnCacheKey);
@@ -18836,8 +18839,6 @@ var RDSDBProxyProvider = class {
18836
18839
  return;
18837
18840
  }
18838
18841
  if (!arn) return;
18839
- const oldMap = this.toTagMap(oldTags);
18840
- const newMap = this.toTagMap(newTags);
18841
18842
  const toRemove = [];
18842
18843
  const toAdd = [];
18843
18844
  for (const k of oldMap.keys()) if (!newMap.has(k)) toRemove.push(k);
@@ -18911,7 +18912,7 @@ var RDSDBProxyProvider = class {
18911
18912
  //#endregion
18912
18913
  //#region src/provisioning/providers/rds-dbproxy-endpoint-provider.ts
18913
18914
  const POLL_INTERVAL_MS = 5e3;
18914
- const POLL_TIMEOUT_MS = 900 * 1e3;
18915
+ const POLL_TIMEOUT_MS = 1800 * 1e3;
18915
18916
  /**
18916
18917
  * AWS RDS DBProxyEndpoint Provider
18917
18918
  *
@@ -18993,11 +18994,9 @@ var RDSDBProxyEndpointProvider = class {
18993
18994
  let status;
18994
18995
  while (Date.now() < deadline) {
18995
18996
  try {
18996
- const ep = (await client.send(new DescribeDBProxyEndpointsCommand({
18997
- DBProxyName: dbProxyName,
18998
- DBProxyEndpointName: dbProxyEndpointName
18999
- }))).DBProxyEndpoints?.[0];
18997
+ const ep = (await client.send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: dbProxyEndpointName }))).DBProxyEndpoints?.[0];
19000
18998
  status = ep?.Status;
18999
+ this.logger.debug(`DBProxyEndpoint ${dbProxyEndpointName} poll: status=${status ?? "not-yet-visible"}`);
19001
19000
  if (status === "available") {
19002
19001
  endpoint = ep?.Endpoint;
19003
19002
  arn = ep?.DBProxyEndpointArn;
@@ -19044,8 +19043,8 @@ var RDSDBProxyEndpointProvider = class {
19044
19043
  throw this.wrapError(error, "UPDATE", resourceType, logicalId, physicalId);
19045
19044
  }
19046
19045
  }
19047
- await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"], resourceType, logicalId);
19048
19046
  this.invalidateAttributeCache(physicalId);
19047
+ await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"], resourceType, logicalId);
19049
19048
  return {
19050
19049
  physicalId,
19051
19050
  wasReplaced: false
@@ -19473,6 +19472,66 @@ var RDSDBProxyTargetGroupProvider = class {
19473
19472
  };
19474
19473
  return null;
19475
19474
  }
19475
+ /**
19476
+ * Read the AWS-current configuration as CFn property shape. Used by
19477
+ * `cdkd drift` for the SDK-provider path (without it the comparator
19478
+ * falls back to CC API, which is broken on this type — Issue #385 the
19479
+ * SDK provider was added to fix in the first place).
19480
+ *
19481
+ * Maps:
19482
+ * - `DescribeDBProxyTargetGroups` → `ConnectionPoolConfigurationInfo`
19483
+ * (the connection pool config CFn template carries).
19484
+ * - `DescribeDBProxyTargets` → `DBClusterIdentifiers` /
19485
+ * `DBInstanceIdentifiers` reverse-mapped from the AWS-side target
19486
+ * list via `Type` discriminator. The full target list also carries
19487
+ * per-target Endpoint / Port / TargetHealth but those are read-only
19488
+ * AWS-managed fields, intentionally not surfaced.
19489
+ *
19490
+ * Best-effort: a missing parent DBProxyName (state corruption) or any
19491
+ * AWS API failure surfaces as `undefined` (drift comparator skips the
19492
+ * resource), not a crash.
19493
+ */
19494
+ async readCurrentState(_physicalId, _logicalId, _resourceType, properties) {
19495
+ const dbProxyName = properties["DBProxyName"];
19496
+ const targetGroupName = properties["TargetGroupName"] ?? "default";
19497
+ if (!dbProxyName) return;
19498
+ const client = this.getClient();
19499
+ let connectionPoolConfig;
19500
+ try {
19501
+ connectionPoolConfig = ((await client.send(new DescribeDBProxyTargetGroupsCommand({
19502
+ DBProxyName: dbProxyName,
19503
+ TargetGroupName: targetGroupName
19504
+ }))).TargetGroups?.[0])?.ConnectionPoolConfig;
19505
+ } catch (error) {
19506
+ if (error instanceof DBProxyNotFoundFault || error instanceof DBProxyTargetGroupNotFoundFault) return;
19507
+ throw error;
19508
+ }
19509
+ const dbClusterIdentifiers = [];
19510
+ const dbInstanceIdentifiers = [];
19511
+ try {
19512
+ const targetsResp = await client.send(new DescribeDBProxyTargetsCommand({
19513
+ DBProxyName: dbProxyName,
19514
+ TargetGroupName: targetGroupName
19515
+ }));
19516
+ for (const target of targetsResp.Targets ?? []) {
19517
+ const id = target.RdsResourceId;
19518
+ if (!id) continue;
19519
+ if (target.Type === "TRACKED_CLUSTER") dbClusterIdentifiers.push(id);
19520
+ else if (target.Type === "RDS_INSTANCE") dbInstanceIdentifiers.push(id);
19521
+ }
19522
+ } catch (error) {
19523
+ if (error instanceof DBProxyNotFoundFault || error instanceof DBProxyTargetGroupNotFoundFault || error instanceof DBProxyTargetNotFoundFault) return;
19524
+ throw error;
19525
+ }
19526
+ const result = {
19527
+ DBProxyName: dbProxyName,
19528
+ TargetGroupName: targetGroupName,
19529
+ DBClusterIdentifiers: dbClusterIdentifiers,
19530
+ DBInstanceIdentifiers: dbInstanceIdentifiers
19531
+ };
19532
+ if (connectionPoolConfig !== void 0) result["ConnectionPoolConfigurationInfo"] = connectionPoolConfig;
19533
+ return result;
19534
+ }
19476
19535
  wrapError(error, op, resourceType, logicalId, physicalId) {
19477
19536
  const message = error instanceof Error ? error.message : String(error);
19478
19537
  const cause = error instanceof Error ? error : void 0;
@@ -45187,7 +45246,7 @@ function reorderArgs(argv) {
45187
45246
  */
45188
45247
  async function main() {
45189
45248
  const program = new Command();
45190
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.109.0");
45249
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.110.0");
45191
45250
  program.addCommand(createBootstrapCommand());
45192
45251
  program.addCommand(createSynthCommand());
45193
45252
  program.addCommand(createListCommand());