@go-to-k/cdkd 0.260.5 → 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.5";
1904
+ return "0.260.6";
1905
1905
  }
1906
1906
  /**
1907
1907
  * Generate a time-sortable unique run id, e.g.
@@ -21875,6 +21875,22 @@ const DEPLOYMENT_CONFIG_PRESERVE_KEYS = /* @__PURE__ */ new Set(["HookDetails"])
21875
21875
  */
21876
21876
  const DEPLOYMENT_CONFIG_PRESERVE_KEYS_CAMEL = /* @__PURE__ */ new Set(["hookDetails"]);
21877
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
+ /**
21878
21894
  * AWS ECS Provider
21879
21895
  *
21880
21896
  * Implements resource provisioning for ECS resources:
@@ -22277,7 +22293,10 @@ var ECSProvider = class {
22277
22293
  }
22278
22294
  }
22279
22295
  async getServiceAttribute(physicalId, attributeName) {
22280
- 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];
22281
22300
  if (!service) return void 0;
22282
22301
  switch (attributeName) {
22283
22302
  case "ServiceArn": return service.serviceArn;
@@ -22878,8 +22897,9 @@ var ECSProvider = class {
22878
22897
  *
22879
22898
  * Dispatches by resource type:
22880
22899
  * - `AWS::ECS::Cluster` → `DescribeClusters`
22881
- * - `AWS::ECS::Service` → `DescribeServices`. Service physicalIds use
22882
- * 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).
22883
22903
  * - `AWS::ECS::TaskDefinition` → `DescribeTaskDefinition`
22884
22904
  *
22885
22905
  * Each branch surfaces only the keys cdkd's `create()` accepts, mapping
@@ -22926,14 +22946,20 @@ var ECSProvider = class {
22926
22946
  return result;
22927
22947
  }
22928
22948
  async readCurrentStateService(physicalId) {
22949
+ let cluster;
22950
+ let serviceName;
22929
22951
  const sep = physicalId.indexOf("|");
22930
- if (sep < 0) return void 0;
22931
- const clusterArn = physicalId.substring(0, sep);
22932
- 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
+ }
22933
22959
  let resp;
22934
22960
  try {
22935
22961
  resp = await this.getClient().send(new DescribeServicesCommand({
22936
- cluster: clusterArn,
22962
+ cluster,
22937
22963
  services: [serviceName],
22938
22964
  include: ["TAGS"]
22939
22965
  }));
@@ -23012,10 +23038,11 @@ var ECSProvider = class {
23012
23038
  * `AWS::ECS::TaskDefinition` — all explicit-override only (see the
23013
23039
  * per-branch notes on why the `aws:cdk:path` tag walk was removed).
23014
23040
  *
23015
- * Service has a composite physical id of `<clusterArn>|<serviceName>`
23016
- * (the form ECSProvider uses internally for mutation operations),
23017
- * so the explicit-override path takes that composite form when
23018
- * 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.
23019
23046
  */
23020
23047
  async import(input) {
23021
23048
  switch (input.resourceType) {
@@ -61680,7 +61707,7 @@ function createMigrateCommand() {
61680
61707
  */
61681
61708
  function buildProgram() {
61682
61709
  const program = new Command();
61683
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.5");
61710
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.6");
61684
61711
  program.addCommand(createBootstrapCommand());
61685
61712
  program.addCommand(createSynthCommand());
61686
61713
  program.addCommand(createListCommand());