@go-to-k/cdkd 0.223.3 → 0.224.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as withErrorHandling, B as generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-OWyKAOyJ.js";
4
+ import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-DZGYMsjN.js";
5
5
  import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
@@ -30,7 +30,7 @@ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
30
30
  import { execFile, spawn } from "node:child_process";
31
31
  import { tmpdir } from "node:os";
32
32
  import { AssociateVPCWithHostedZoneCommand, ChangeResourceRecordSetsCommand, ChangeTagsForResourceCommand, CreateHostedZoneCommand, CreateQueryLoggingConfigCommand, DeleteHostedZoneCommand, DeleteQueryLoggingConfigCommand, DisassociateVPCFromHostedZoneCommand, GetHostedZoneCommand, ListHostedZonesByNameCommand, ListHostedZonesCommand, ListQueryLoggingConfigsCommand, ListResourceRecordSetsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$6, Route53Client, UpdateHostedZoneCommentCommand, UpdateHostedZoneFeaturesCommand } from "@aws-sdk/client-route-53";
33
- import { AddTagsCommand, CreateListenerCommand, CreateLoadBalancerCommand, CreateTargetGroupCommand, DeleteListenerCommand, DeleteLoadBalancerCommand, DeleteTargetGroupCommand, DescribeListenersCommand, DescribeLoadBalancerAttributesCommand, DescribeLoadBalancersCommand, DescribeTagsCommand, DescribeTargetGroupsCommand, ElasticLoadBalancingV2Client, ModifyListenerCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupCommand, RemoveTagsCommand, SetIpAddressTypeCommand, SetSecurityGroupsCommand, SetSubnetsCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
33
+ import { AddTagsCommand, CreateListenerCommand, CreateLoadBalancerCommand, CreateTargetGroupCommand, DeleteListenerCommand, DeleteLoadBalancerCommand, DeleteTargetGroupCommand, DescribeListenerAttributesCommand, DescribeListenersCommand, DescribeLoadBalancerAttributesCommand, DescribeLoadBalancersCommand, DescribeTagsCommand, DescribeTargetGroupsCommand, ElasticLoadBalancingV2Client, ModifyListenerAttributesCommand, ModifyListenerCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupCommand, RemoveTagsCommand, SetIpAddressTypeCommand, SetSecurityGroupsCommand, SetSubnetsCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
34
34
  import { CreateAliasCommand, CreateKeyCommand, DeleteAliasCommand, DescribeKeyCommand, DisableKeyCommand, DisableKeyRotationCommand, EnableKeyCommand, EnableKeyRotationCommand, GetKeyPolicyCommand, GetKeyRotationStatusCommand, KMSClient, ListAliasesCommand, ListKeysCommand, ListResourceTagsCommand, NotFoundException as NotFoundException$2, PutKeyPolicyCommand, ScheduleKeyDeletionCommand, TagResourceCommand as TagResourceCommand$9, UntagResourceCommand as UntagResourceCommand$9, UpdateAliasCommand, UpdateKeyDescriptionCommand } from "@aws-sdk/client-kms";
35
35
  import { CreateRepositoryCommand, DeleteLifecyclePolicyCommand, DeleteRepositoryCommand, DeleteRepositoryPolicyCommand, DescribeRepositoriesCommand, ECRClient, GetAuthorizationTokenCommand, GetLifecyclePolicyCommand, LifecyclePolicyNotFoundException, ListTagsForResourceCommand as ListTagsForResourceCommand$7, PutImageScanningConfigurationCommand, PutImageTagMutabilityCommand, PutLifecyclePolicyCommand, RepositoryNotFoundException, SetRepositoryPolicyCommand, TagResourceCommand as TagResourceCommand$10 } from "@aws-sdk/client-ecr";
36
36
  import graphlib from "graphlib";
@@ -1553,7 +1553,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1553
1553
  const FLUSH_EVENT_THRESHOLD = 50;
1554
1554
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1555
1555
  function getCdkdVersion() {
1556
- return "0.223.3";
1556
+ return "0.224.0";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -20743,7 +20743,8 @@ var ELBv2Provider = class {
20743
20743
  "Protocol",
20744
20744
  "SslPolicy",
20745
20745
  "AlpnPolicy",
20746
- "MutualAuthentication"
20746
+ "MutualAuthentication",
20747
+ "ListenerAttributes"
20747
20748
  ])]
20748
20749
  ]);
20749
20750
  getClient() {
@@ -21035,10 +21036,29 @@ var ELBv2Provider = class {
21035
21036
  ...tags.length > 0 && { Tags: tags }
21036
21037
  }))).Listeners?.[0];
21037
21038
  if (!listener || !listener.ListenerArn) throw new Error("CreateListener did not return Listener ARN");
21038
- this.logger.debug(`Successfully created Listener ${logicalId}: ${listener.ListenerArn}`);
21039
+ const listenerArn = listener.ListenerArn;
21040
+ this.logger.debug(`Successfully created Listener ${logicalId}: ${listenerArn}`);
21041
+ try {
21042
+ const listenerAttributes = this.normalizeAttributes(properties["ListenerAttributes"]);
21043
+ if (listenerAttributes.length > 0) {
21044
+ await withRetry(() => this.getClient().send(new ModifyListenerAttributesCommand({
21045
+ ListenerArn: listenerArn,
21046
+ Attributes: listenerAttributes
21047
+ })), logicalId, { logger: this.logger });
21048
+ this.logger.debug(`Applied ${listenerAttributes.length} ListenerAttribute(s) for ${logicalId}`);
21049
+ }
21050
+ } catch (innerError) {
21051
+ try {
21052
+ await this.getClient().send(new DeleteListenerCommand({ ListenerArn: listenerArn }));
21053
+ this.logger.debug(`Cleaned up partially-created Listener ${logicalId} (${listenerArn}) after attributes-wiring failure`);
21054
+ } catch (cleanupError) {
21055
+ this.logger.warn(`Failed to clean up partially-created Listener ${logicalId} (${listenerArn}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws elbv2 delete-listener --listener-arn ${listenerArn}`);
21056
+ }
21057
+ throw innerError;
21058
+ }
21039
21059
  return {
21040
- physicalId: listener.ListenerArn,
21041
- attributes: { ListenerArn: listener.ListenerArn }
21060
+ physicalId: listenerArn,
21061
+ attributes: { ListenerArn: listenerArn }
21042
21062
  };
21043
21063
  } catch (error) {
21044
21064
  const cause = error instanceof Error ? error : void 0;
@@ -21062,6 +21082,26 @@ var ELBv2Provider = class {
21062
21082
  ...alpnPolicy && alpnPolicy.length > 0 && { AlpnPolicy: alpnPolicy },
21063
21083
  ...mutualAuth !== void 0 && { MutualAuthentication: mutualAuth }
21064
21084
  }));
21085
+ const newAttrs = this.normalizeAttributes(properties["ListenerAttributes"]);
21086
+ const oldAttrs = this.normalizeAttributes(previousProperties["ListenerAttributes"]);
21087
+ const newAttrMap = new Map(newAttrs.map((a) => [a.Key, a.Value]));
21088
+ const oldAttrMap = new Map(oldAttrs.map((a) => [a.Key, a.Value]));
21089
+ const submittedAttrs = [];
21090
+ for (const [k, v] of newAttrMap) if (oldAttrMap.get(k) !== v) submittedAttrs.push({
21091
+ Key: k,
21092
+ Value: v
21093
+ });
21094
+ for (const [k] of oldAttrMap) if (!newAttrMap.has(k)) submittedAttrs.push({
21095
+ Key: k,
21096
+ Value: ""
21097
+ });
21098
+ if (submittedAttrs.length > 0) {
21099
+ await withRetry(() => this.getClient().send(new ModifyListenerAttributesCommand({
21100
+ ListenerArn: physicalId,
21101
+ Attributes: submittedAttrs
21102
+ })), logicalId, { logger: this.logger });
21103
+ this.logger.debug(`Applied ${submittedAttrs.length} ListenerAttributes change(s) for ${logicalId}`);
21104
+ }
21065
21105
  await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
21066
21106
  this.logger.debug(`Successfully updated Listener ${logicalId}`);
21067
21107
  return {
@@ -21098,6 +21138,38 @@ var ELBv2Provider = class {
21098
21138
  return properties["Tags"];
21099
21139
  }
21100
21140
  /**
21141
+ * Normalize a CFn `ListenerAttributes` value (an array of `{ Key, Value }`
21142
+ * objects) into the SDK's `Attributes` shape. CFn emits the `Value` as a
21143
+ * string (e.g. `"3600"`, `"false"`) — pass it through verbatim; the
21144
+ * `ModifyListenerAttributes` API takes string Key/Value pairs. Entries
21145
+ * missing a `Key` are dropped (an empty `Value` is a valid "clear the
21146
+ * override" signal, so only `Key` is required). Returns `[]` for an
21147
+ * absent / non-array value so callers can branch on `.length`.
21148
+ *
21149
+ * Values are coerced only from `string` / `number` / `boolean` — never
21150
+ * `String()`-coerced from an arbitrary object (which would yield
21151
+ * `[object Object]`); CFn emits these as strings already, so a non-scalar
21152
+ * value is malformed input and is dropped rather than silently stringified.
21153
+ */
21154
+ normalizeAttributes(raw) {
21155
+ if (!Array.isArray(raw)) return [];
21156
+ const out = [];
21157
+ for (const entry of raw) {
21158
+ if (entry === null || typeof entry !== "object") continue;
21159
+ const e = entry;
21160
+ if (typeof e.Key !== "string") continue;
21161
+ let value;
21162
+ if (e.Value === void 0 || e.Value === null) value = "";
21163
+ else if (typeof e.Value === "string" || typeof e.Value === "number" || typeof e.Value === "boolean") value = String(e.Value);
21164
+ else continue;
21165
+ out.push({
21166
+ Key: e.Key,
21167
+ Value: value
21168
+ });
21169
+ }
21170
+ return out;
21171
+ }
21172
+ /**
21101
21173
  * Apply a diff between old and new CFn-shape Tags arrays via ELBv2's
21102
21174
  * `AddTags` / `RemoveTags` APIs. Both accept `ResourceArns: [arn]`
21103
21175
  * (single ARN), `Tags: [{Key, Value}]` for AddTags, and
@@ -21260,6 +21332,14 @@ var ELBv2Provider = class {
21260
21332
  result["DefaultActions"] = (listener.DefaultActions ?? []).map((a) => a);
21261
21333
  result["AlpnPolicy"] = listener.AlpnPolicy ?? [];
21262
21334
  result["MutualAuthentication"] = listener.MutualAuthentication ?? {};
21335
+ try {
21336
+ result["ListenerAttributes"] = ((await this.getClient().send(new DescribeListenerAttributesCommand({ ListenerArn: physicalId }))).Attributes ?? []).filter((a) => typeof a.Key === "string" && typeof a.Value === "string").map((a) => ({
21337
+ Key: a.Key,
21338
+ Value: a.Value
21339
+ })).sort((a, b) => a.Key.localeCompare(b.Key));
21340
+ } catch (err) {
21341
+ if (this.isNotFoundError(err)) return void 0;
21342
+ }
21263
21343
  await this.attachTags(result, physicalId);
21264
21344
  return result;
21265
21345
  }
@@ -54528,7 +54608,7 @@ function reorderArgs(argv) {
54528
54608
  async function main() {
54529
54609
  installPipeCloseHandler();
54530
54610
  const program = new Command();
54531
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.223.3");
54611
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.224.0");
54532
54612
  program.addCommand(createBootstrapCommand());
54533
54613
  program.addCommand(createSynthCommand());
54534
54614
  program.addCommand(createListCommand());