@go-to-k/cdkd 0.260.4 → 0.260.6

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
@@ -1901,7 +1901,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1901
1901
  const FLUSH_EVENT_THRESHOLD = 50;
1902
1902
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1903
1903
  function getCdkdVersion() {
1904
- return "0.260.4";
1904
+ return "0.260.6";
1905
1905
  }
1906
1906
  /**
1907
1907
  * Generate a time-sortable unique run id, e.g.
@@ -21867,6 +21867,30 @@ function convertTags(tags) {
21867
21867
  */
21868
21868
  const DEPLOYMENT_CONFIG_PRESERVE_KEYS = /* @__PURE__ */ new Set(["HookDetails"]);
21869
21869
  /**
21870
+ * Read-side (camelCase -> PascalCase) counterpart of
21871
+ * `DEPLOYMENT_CONFIG_PRESERVE_KEYS` for `readCurrentState` (issue #1165 /
21872
+ * #1167). The SDK response carries the free-form document under the camelCase
21873
+ * key `hookDetails`, so the reverse key-flip must copy its value subtree
21874
+ * verbatim (the key itself is still flipped to `HookDetails`).
21875
+ */
21876
+ const DEPLOYMENT_CONFIG_PRESERVE_KEYS_CAMEL = /* @__PURE__ */ new Set(["hookDetails"]);
21877
+ /**
21878
+ * Derive the cluster name from a long-format ECS Service ARN
21879
+ * (`arn:<partition>:ecs:<region>:<account>:service/<clusterName>/<serviceName>`)
21880
+ * so `DescribeServices` can be scoped to the right cluster (issue #1170).
21881
+ * Returns `undefined` for the legacy short-format ARN
21882
+ * (`.../service/<serviceName>`, which does not encode a cluster) or any input
21883
+ * that does not match the ARN shape — the caller then falls back to the default
21884
+ * cluster, matching what the short-format ARN implies.
21885
+ */
21886
+ function clusterNameFromServiceArn(arn) {
21887
+ const resource = arn.split(":")[5];
21888
+ if (!resource) return void 0;
21889
+ const segments = resource.split("/");
21890
+ if (segments[0] !== "service") return void 0;
21891
+ return segments.length >= 3 ? segments[1] : void 0;
21892
+ }
21893
+ /**
21870
21894
  * AWS ECS Provider
21871
21895
  *
21872
21896
  * Implements resource provisioning for ECS resources:
@@ -22269,7 +22293,10 @@ var ECSProvider = class {
22269
22293
  }
22270
22294
  }
22271
22295
  async getServiceAttribute(physicalId, attributeName) {
22272
- const service = (await this.getClient().send(new DescribeServicesCommand({ services: [physicalId] }))).services?.[0];
22296
+ const service = (await this.getClient().send(new DescribeServicesCommand({
22297
+ cluster: clusterNameFromServiceArn(physicalId),
22298
+ services: [physicalId]
22299
+ }))).services?.[0];
22273
22300
  if (!service) return void 0;
22274
22301
  switch (attributeName) {
22275
22302
  case "ServiceArn": return service.serviceArn;
@@ -22649,6 +22676,25 @@ var ECSProvider = class {
22649
22676
  });
22650
22677
  }
22651
22678
  /**
22679
+ * Reverse of `convertProxyConfiguration` for `readCurrentState` (issue
22680
+ * #1167): map the SDK camelCase `ProxyConfiguration` back to the CFn
22681
+ * PascalCase shape so the drift baseline (state `properties`, PascalCase)
22682
+ * and the AWS-current read compare apples-to-apples. Unlike the pure
22683
+ * first-letter flips, the SDK field `properties` maps back to the CFn key
22684
+ * `ProxyConfigurationProperties` (a `{Name,Value}[]`), so it needs an
22685
+ * explicit remap rather than `camelToPascalCaseKeys`.
22686
+ */
22687
+ proxyConfigurationToCfn(config) {
22688
+ const out = {};
22689
+ if (config.type !== void 0) out["Type"] = config.type;
22690
+ if (config.containerName !== void 0) out["ContainerName"] = config.containerName;
22691
+ if (config.properties !== void 0) out["ProxyConfigurationProperties"] = config.properties.map((p) => ({
22692
+ Name: p.name,
22693
+ Value: p.value
22694
+ }));
22695
+ return out;
22696
+ }
22697
+ /**
22652
22698
  * Coerce a CFn boolean property to a real boolean at the wire boundary.
22653
22699
  * CFn templates can carry booleans as the strings "true" / "false"
22654
22700
  * (e.g. via Fn::Sub / parameter plumbing), so the SDK input must
@@ -22851,8 +22897,9 @@ var ECSProvider = class {
22851
22897
  *
22852
22898
  * Dispatches by resource type:
22853
22899
  * - `AWS::ECS::Cluster` → `DescribeClusters`
22854
- * - `AWS::ECS::Service` → `DescribeServices`. Service physicalIds use
22855
- * the composite form `<clusterArn>|<serviceName>`; we split on `|`.
22900
+ * - `AWS::ECS::Service` → `DescribeServices`. Service physicalIds come in
22901
+ * two forms — the service ARN (what `createService` stores) and the
22902
+ * composite `<clusterArn>|<serviceName>` — and both are accepted (#1170).
22856
22903
  * - `AWS::ECS::TaskDefinition` → `DescribeTaskDefinition`
22857
22904
  *
22858
22905
  * Each branch surfaces only the keys cdkd's `create()` accepts, mapping
@@ -22888,8 +22935,8 @@ var ECSProvider = class {
22888
22935
  if (!c || !c.clusterName) return void 0;
22889
22936
  const result = { ClusterName: c.clusterName };
22890
22937
  result["CapacityProviders"] = c.capacityProviders ? [...c.capacityProviders] : [];
22891
- result["DefaultCapacityProviderStrategy"] = c.defaultCapacityProviderStrategy ?? [];
22892
- if (c.configuration) result["Configuration"] = c.configuration;
22938
+ result["DefaultCapacityProviderStrategy"] = camelToPascalCaseKeys(c.defaultCapacityProviderStrategy ?? []);
22939
+ if (c.configuration) result["Configuration"] = camelToPascalCaseKeys(c.configuration);
22893
22940
  result["ClusterSettings"] = (c.settings ?? []).map((s) => ({
22894
22941
  Name: s.name,
22895
22942
  Value: s.value
@@ -22899,14 +22946,20 @@ var ECSProvider = class {
22899
22946
  return result;
22900
22947
  }
22901
22948
  async readCurrentStateService(physicalId) {
22949
+ let cluster;
22950
+ let serviceName;
22902
22951
  const sep = physicalId.indexOf("|");
22903
- if (sep < 0) return void 0;
22904
- const clusterArn = physicalId.substring(0, sep);
22905
- const serviceName = physicalId.substring(sep + 1);
22952
+ if (sep >= 0) {
22953
+ cluster = physicalId.substring(0, sep);
22954
+ serviceName = physicalId.substring(sep + 1);
22955
+ } else {
22956
+ serviceName = physicalId;
22957
+ cluster = clusterNameFromServiceArn(physicalId);
22958
+ }
22906
22959
  let resp;
22907
22960
  try {
22908
22961
  resp = await this.getClient().send(new DescribeServicesCommand({
22909
- cluster: clusterArn,
22962
+ cluster,
22910
22963
  services: [serviceName],
22911
22964
  include: ["TAGS"]
22912
22965
  }));
@@ -22927,21 +22980,22 @@ var ECSProvider = class {
22927
22980
  if (s.enableECSManagedTags !== void 0) result["EnableECSManagedTags"] = s.enableECSManagedTags;
22928
22981
  if (s.enableExecuteCommand !== void 0) result["EnableExecuteCommand"] = s.enableExecuteCommand;
22929
22982
  if (s.healthCheckGracePeriodSeconds !== void 0) result["HealthCheckGracePeriodSeconds"] = s.healthCheckGracePeriodSeconds;
22930
- if (s.networkConfiguration) result["NetworkConfiguration"] = s.networkConfiguration;
22931
- result["LoadBalancers"] = s.loadBalancers ?? [];
22932
- if (s.capacityProviderStrategy && s.capacityProviderStrategy.length > 0) result["CapacityProviderStrategy"] = s.capacityProviderStrategy;
22983
+ if (s.networkConfiguration) result["NetworkConfiguration"] = camelToPascalCaseKeys(s.networkConfiguration);
22984
+ result["LoadBalancers"] = camelToPascalCaseKeys(s.loadBalancers ?? []);
22985
+ if (s.capacityProviderStrategy && s.capacityProviderStrategy.length > 0) result["CapacityProviderStrategy"] = camelToPascalCaseKeys(s.capacityProviderStrategy);
22933
22986
  else if (!s.launchType) result["CapacityProviderStrategy"] = [];
22934
- if (s.deploymentConfiguration) result["DeploymentConfiguration"] = s.deploymentConfiguration;
22935
- result["PlacementConstraints"] = s.placementConstraints ?? [];
22987
+ if (s.deploymentConfiguration) result["DeploymentConfiguration"] = camelToPascalCaseKeys(s.deploymentConfiguration, DEPLOYMENT_CONFIG_PRESERVE_KEYS_CAMEL);
22988
+ result["PlacementConstraints"] = camelToPascalCaseKeys(s.placementConstraints ?? []);
22936
22989
  if (s.launchType === "EC2" || s.launchType === "EXTERNAL") {
22937
- const strategy = s.placementStrategy ?? [];
22990
+ const strategy = camelToPascalCaseKeys(s.placementStrategy ?? []);
22938
22991
  result["PlacementStrategy"] = strategy;
22939
22992
  result["PlacementStrategies"] = strategy;
22940
22993
  } else if (s.placementStrategy && s.placementStrategy.length > 0) {
22941
- result["PlacementStrategy"] = s.placementStrategy;
22942
- result["PlacementStrategies"] = s.placementStrategy;
22994
+ const strategy = camelToPascalCaseKeys(s.placementStrategy);
22995
+ result["PlacementStrategy"] = strategy;
22996
+ result["PlacementStrategies"] = strategy;
22943
22997
  }
22944
- result["ServiceRegistries"] = s.serviceRegistries ?? [];
22998
+ result["ServiceRegistries"] = camelToPascalCaseKeys(s.serviceRegistries ?? []);
22945
22999
  result["Tags"] = normalizeAwsTagsToCfn(s.tags);
22946
23000
  return result;
22947
23001
  }
@@ -22966,9 +23020,9 @@ var ECSProvider = class {
22966
23020
  if (td.executionRoleArn !== void 0) result["ExecutionRoleArn"] = td.executionRoleArn;
22967
23021
  if (td.taskRoleArn !== void 0) result["TaskRoleArn"] = td.taskRoleArn;
22968
23022
  result["Volumes"] = this.volumesToCfn(td.volumes);
22969
- result["PlacementConstraints"] = td.placementConstraints ?? [];
22970
- if (td.runtimePlatform) result["RuntimePlatform"] = td.runtimePlatform;
22971
- if (td.proxyConfiguration) result["ProxyConfiguration"] = td.proxyConfiguration;
23023
+ result["PlacementConstraints"] = camelToPascalCaseKeys(td.placementConstraints ?? []);
23024
+ if (td.runtimePlatform) result["RuntimePlatform"] = camelToPascalCaseKeys(td.runtimePlatform);
23025
+ if (td.proxyConfiguration) result["ProxyConfiguration"] = this.proxyConfigurationToCfn(td.proxyConfiguration);
22972
23026
  if (td.pidMode !== void 0) result["PidMode"] = td.pidMode;
22973
23027
  if (td.ipcMode !== void 0) result["IpcMode"] = td.ipcMode;
22974
23028
  if (td.ephemeralStorage?.sizeInGiB !== void 0) result["EphemeralStorage"] = { SizeInGiB: td.ephemeralStorage.sizeInGiB };
@@ -22984,10 +23038,11 @@ var ECSProvider = class {
22984
23038
  * `AWS::ECS::TaskDefinition` — all explicit-override only (see the
22985
23039
  * per-branch notes on why the `aws:cdk:path` tag walk was removed).
22986
23040
  *
22987
- * Service has a composite physical id of `<clusterArn>|<serviceName>`
22988
- * (the form ECSProvider uses internally for mutation operations),
22989
- * so the explicit-override path takes that composite form when
22990
- * supplied.
23041
+ * `createService` stores the service ARN as the Service physical id (and
23042
+ * the mutation ops pass it straight through as the `service` argument, with
23043
+ * the cluster read from the template `Cluster` property). The explicit
23044
+ * `--resource` override is honored verbatim, so a caller may also supply the
23045
+ * composite `<clusterArn>|<serviceName>` form that `readCurrentState` accepts.
22991
23046
  */
22992
23047
  async import(input) {
22993
23048
  switch (input.resourceType) {
@@ -61652,7 +61707,7 @@ function createMigrateCommand() {
61652
61707
  */
61653
61708
  function buildProgram() {
61654
61709
  const program = new Command();
61655
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.4");
61710
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.6");
61656
61711
  program.addCommand(createBootstrapCommand());
61657
61712
  program.addCommand(createSynthCommand());
61658
61713
  program.addCommand(createListCommand());