@go-to-k/cdkd 0.230.32 → 0.231.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 generateResourceName, C as StackHasActiveImportsError, F as getLiveRenderer, H as withSkipPrefix, I as PATTERN_B_NAME_OPTIONS, L as PATTERN_B_NAME_PROPERTIES, M as getLogger, P as runStackBuffered, R as PATTERN_B_RESOURCE_TYPES, S as ResourceUpdateNotSupportedError, U as withStackName, V as generateResourceNameWithFallback, _ 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 } from "./import-helpers-DayvBD4T.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as resolveStateBucketWithDefaultAndSource, A as TemplateParser, B as getDockerCmd, C as findActionableSilentDrops, D as applyRoleArnIfSet, E as cfnRefValueFromPhysicalId, F as AssetPublisher, G as Synthesizer, H as runDockerStreaming, I as stringifyValue, J as getLegacyStateBucketName, K as synthesisStatusMessage, L as WorkGraph, M as S3StateBackend, N as rebuildClientForBucketRegion, O as DiffCalculator, P as shouldRetainResource, Q as resolveStateBucketWithDefault, R as buildDockerImage, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as AssetManifestLoader, V as runDockerForeground, W as getDockerImageBySourceHash, X as resolveCaptureObservedState, Y as resolveApp, Z as resolveSkipPrefix, _ as green, a as withRetry, at as uploadCfnTemplate, b as IAMRoleProvider, c as computeImplicitDeleteEdges, ct as resolveBucketRegion, d as isStatefulRecreateTargetSync, et as warnDeprecatedNoPrefixCliFlag, f as renderStatefulReason, g as gray, h as cyan, i as withResourceDeadline, it as findLargeInlineResources, j as LockManager, k as DagBuilder, l as extractDeploymentEventError, m as bold, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as CFN_TEMPLATE_URL_LIMIT, o as isRetryableTransientError, ot as AssemblyReader, p as formatResourceLine, q as getDefaultStateBucketName, r as DeployEngine, rt as MIGRATE_TMP_PREFIX, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as CFN_TEMPLATE_BODY_LIMIT, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, v as red, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as formatDockerLoginError } from "./deploy-engine-EV5BfAvn.js";
4
+ import { $ as resolveStateBucketWithDefaultAndSource, A as TemplateParser, B as getDockerCmd, C as findActionableSilentDrops, D as applyRoleArnIfSet, E as cfnRefValueFromPhysicalId, F as AssetPublisher, G as Synthesizer, H as runDockerStreaming, I as stringifyValue, J as getLegacyStateBucketName, K as synthesisStatusMessage, L as WorkGraph, M as S3StateBackend, N as rebuildClientForBucketRegion, O as DiffCalculator, P as shouldRetainResource, Q as resolveStateBucketWithDefault, R as buildDockerImage, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as AssetManifestLoader, V as runDockerForeground, W as getDockerImageBySourceHash, X as resolveCaptureObservedState, Y as resolveApp, Z as resolveSkipPrefix, _ as green, a as withRetry, at as uploadCfnTemplate, b as IAMRoleProvider, c as computeImplicitDeleteEdges, ct as resolveBucketRegion, d as isStatefulRecreateTargetSync, et as warnDeprecatedNoPrefixCliFlag, f as renderStatefulReason, g as gray, h as cyan, i as withResourceDeadline, it as findLargeInlineResources, j as LockManager, k as DagBuilder, l as extractDeploymentEventError, m as bold, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as CFN_TEMPLATE_URL_LIMIT, o as isRetryableTransientError, ot as AssemblyReader, p as formatResourceLine, q as getDefaultStateBucketName, r as DeployEngine, rt as MIGRATE_TMP_PREFIX, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as CFN_TEMPLATE_BODY_LIMIT, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, v as red, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as formatDockerLoginError } from "./deploy-engine-IqXCHYxE.js";
5
5
  import { t as ASGProvider } from "./asg-provider-Dgj3loIG.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -1446,7 +1446,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1446
1446
  const FLUSH_EVENT_THRESHOLD = 50;
1447
1447
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1448
1448
  function getCdkdVersion() {
1449
- return "0.230.32";
1449
+ return "0.231.0";
1450
1450
  }
1451
1451
  /**
1452
1452
  * Generate a time-sortable unique run id, e.g.
@@ -16603,7 +16603,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
16603
16603
  "Description",
16604
16604
  "Tags",
16605
16605
  "TracingEnabled",
16606
- "Variables"
16606
+ "Variables",
16607
+ "MethodSettings"
16607
16608
  ])],
16608
16609
  ["AWS::ApiGateway::Method", new Set([
16609
16610
  "RestApiId",
@@ -17096,6 +17097,25 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17096
17097
  variables: properties["Variables"],
17097
17098
  tags: this.cfnTagsToRecord(properties["Tags"])
17098
17099
  }));
17100
+ const methodSettings = properties["MethodSettings"];
17101
+ const methodSettingsOps = buildMethodSettingsPatchOps(void 0, methodSettings);
17102
+ if (methodSettingsOps.length > 0) try {
17103
+ await this.apiGatewayClient.send(new UpdateStageCommand({
17104
+ restApiId,
17105
+ stageName,
17106
+ patchOperations: methodSettingsOps
17107
+ }));
17108
+ } catch (patchError) {
17109
+ try {
17110
+ await this.apiGatewayClient.send(new DeleteStageCommand({
17111
+ restApiId,
17112
+ stageName
17113
+ }));
17114
+ } catch (cleanupError) {
17115
+ this.logger.warn(`Failed to clean up stage ${stageName} after a MethodSettings patch failure: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
17116
+ }
17117
+ throw patchError;
17118
+ }
17099
17119
  this.logger.debug(`Successfully created API Gateway Stage ${logicalId}: ${stageName}`);
17100
17120
  return {
17101
17121
  physicalId: stageName,
@@ -17146,6 +17166,7 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17146
17166
  op: "remove",
17147
17167
  path: `/variables/${key}`
17148
17168
  });
17169
+ patchOperations.push(...buildMethodSettingsPatchOps(previousProperties["MethodSettings"], properties["MethodSettings"]));
17149
17170
  try {
17150
17171
  if (patchOperations.length > 0) await this.apiGatewayClient.send(new UpdateStageCommand({
17151
17172
  restApiId,
@@ -17650,6 +17671,15 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17650
17671
  result["Description"] = resp.description ?? "";
17651
17672
  if (resp.tracingEnabled !== void 0) result["TracingEnabled"] = resp.tracingEnabled;
17652
17673
  if (resp.variables !== void 0) result["Variables"] = resp.variables;
17674
+ const stateMethodSettings = properties?.["MethodSettings"];
17675
+ if (stateMethodSettings && stateMethodSettings.length > 0) result["MethodSettings"] = stateMethodSettings.map((stateEntry) => {
17676
+ const awsEntry = (resp.methodSettings ?? {})[methodSettingKey(stateEntry)];
17677
+ const entry = {};
17678
+ if (stateEntry.ResourcePath !== void 0) entry["ResourcePath"] = stateEntry.ResourcePath;
17679
+ if (stateEntry.HttpMethod !== void 0) entry["HttpMethod"] = stateEntry.HttpMethod;
17680
+ for (const { cfnKey, responseKey } of METHOD_SETTING_PATCH_FIELDS) if (stateEntry[cfnKey] !== void 0 && awsEntry?.[responseKey] !== void 0) entry[cfnKey] = awsEntry[responseKey];
17681
+ return entry;
17682
+ });
17653
17683
  return result;
17654
17684
  } catch (err) {
17655
17685
  if (err instanceof NotFoundException$1) return void 0;
@@ -17720,6 +17750,122 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17720
17750
  }
17721
17751
  };
17722
17752
  /**
17753
+ * CFn MethodSetting field → UpdateStage patch-path suffix under
17754
+ * `/{method_setting_key}/`. The get-stage response field for each is the
17755
+ * camelCase of the CFn name (used by the drift readback).
17756
+ */
17757
+ const METHOD_SETTING_PATCH_FIELDS = [
17758
+ {
17759
+ cfnKey: "ThrottlingRateLimit",
17760
+ patchSuffix: "throttling/rateLimit",
17761
+ responseKey: "throttlingRateLimit"
17762
+ },
17763
+ {
17764
+ cfnKey: "ThrottlingBurstLimit",
17765
+ patchSuffix: "throttling/burstLimit",
17766
+ responseKey: "throttlingBurstLimit"
17767
+ },
17768
+ {
17769
+ cfnKey: "MetricsEnabled",
17770
+ patchSuffix: "metrics/enabled",
17771
+ responseKey: "metricsEnabled"
17772
+ },
17773
+ {
17774
+ cfnKey: "LoggingLevel",
17775
+ patchSuffix: "logging/loglevel",
17776
+ responseKey: "loggingLevel"
17777
+ },
17778
+ {
17779
+ cfnKey: "DataTraceEnabled",
17780
+ patchSuffix: "logging/dataTrace",
17781
+ responseKey: "dataTraceEnabled"
17782
+ },
17783
+ {
17784
+ cfnKey: "CachingEnabled",
17785
+ patchSuffix: "caching/enabled",
17786
+ responseKey: "cachingEnabled"
17787
+ },
17788
+ {
17789
+ cfnKey: "CacheTtlInSeconds",
17790
+ patchSuffix: "caching/ttlInSeconds",
17791
+ responseKey: "cacheTtlInSeconds"
17792
+ },
17793
+ {
17794
+ cfnKey: "CacheDataEncrypted",
17795
+ patchSuffix: "caching/dataEncrypted",
17796
+ responseKey: "cacheDataEncrypted"
17797
+ },
17798
+ {
17799
+ cfnKey: "RequireAuthorizationForCacheControl",
17800
+ patchSuffix: "caching/requireAuthorizationForCacheControl",
17801
+ responseKey: "requireAuthorizationForCacheControl"
17802
+ },
17803
+ {
17804
+ cfnKey: "UnauthorizedCacheControlHeaderStrategy",
17805
+ patchSuffix: "caching/unauthorizedCacheControlHeaderStrategy",
17806
+ responseKey: "unauthorizedCacheControlHeaderStrategy"
17807
+ }
17808
+ ];
17809
+ /**
17810
+ * The `{method_setting_key}` API Gateway keys a stage's method settings by:
17811
+ * `{resource_path}/{http_method}` with the resource path's leading slash
17812
+ * stripped — CDK's stage-level `deployOptions` (`ResourcePath: '/*',
17813
+ * HttpMethod: '*'`) keys as the star-slash-star wildcard (the get-stage
17814
+ * `methodSettings` map key and the UpdateStage patch-path segment are the
17815
+ * same string).
17816
+ */
17817
+ function methodSettingKey(setting) {
17818
+ const resourcePath = setting.ResourcePath ?? "/*";
17819
+ const httpMethod = setting.HttpMethod ?? "*";
17820
+ return `${resourcePath === "/" ? "~1" : resourcePath.replace(/^\//, "")}/${httpMethod}`;
17821
+ }
17822
+ /**
17823
+ * Build the UpdateStage patch operations that take a stage's method settings
17824
+ * from `previous` to `next` (both in the CFn `MethodSettings` list shape):
17825
+ * - an entry present only in `next`: `replace` each specified field
17826
+ * (`replace` both adds and changes a method-setting override)
17827
+ * - an entry present in both with NO fields dropped: `replace` only the
17828
+ * changed fields
17829
+ * - an entry present in both with a field DROPPED: `remove /{key}` then
17830
+ * `replace` every remaining specified field — API Gateway REJECTS a
17831
+ * field-level `remove` (`remove <key>/throttling/rateLimit` fails with
17832
+ * "Cannot remove method setting ... because there is no method setting
17833
+ * for this method"), while whole-key remove followed by field replaces
17834
+ * in the SAME UpdateStage call applies sequentially (both verified live
17835
+ * 2026-07-03), so the dropped field reverts to its default (CFn
17836
+ * absent-field semantics)
17837
+ * - an entry present only in `previous`: `remove /{key}` — drops every
17838
+ * override for that method path at once (CFn absent-entry semantics)
17839
+ * Values are rendered as strings (the UpdateStage wire format).
17840
+ */
17841
+ function buildMethodSettingsPatchOps(previous, next) {
17842
+ const ops = [];
17843
+ const prevByKey = new Map((previous ?? []).map((s) => [methodSettingKey(s), s]));
17844
+ const nextByKey = new Map((next ?? []).map((s) => [methodSettingKey(s), s]));
17845
+ for (const key of prevByKey.keys()) if (!nextByKey.has(key)) ops.push({
17846
+ op: "remove",
17847
+ path: `/${key}`
17848
+ });
17849
+ for (const [key, setting] of nextByKey) {
17850
+ const prevSetting = prevByKey.get(key);
17851
+ const fieldDropped = prevSetting !== void 0 && METHOD_SETTING_PATCH_FIELDS.some(({ cfnKey }) => prevSetting[cfnKey] !== void 0 && setting[cfnKey] === void 0);
17852
+ if (fieldDropped) ops.push({
17853
+ op: "remove",
17854
+ path: `/${key}`
17855
+ });
17856
+ for (const { cfnKey, patchSuffix } of METHOD_SETTING_PATCH_FIELDS) {
17857
+ const nextValue = setting[cfnKey];
17858
+ const prevValue = fieldDropped ? void 0 : prevSetting?.[cfnKey];
17859
+ if (nextValue !== void 0 && String(nextValue) !== String(prevValue ?? "")) ops.push({
17860
+ op: "replace",
17861
+ path: `/${key}/${patchSuffix}`,
17862
+ value: String(nextValue)
17863
+ });
17864
+ }
17865
+ }
17866
+ return ops;
17867
+ }
17868
+ /**
17723
17869
  * Append RFC 6902 patch operations describing the diff between two map-shaped
17724
17870
  * properties (e.g. API Gateway Method `RequestParameters` /
17725
17871
  * `RequestModels`). For each key:
@@ -55650,7 +55796,7 @@ function reorderArgs(argv) {
55650
55796
  async function main() {
55651
55797
  installPipeCloseHandler();
55652
55798
  const program = new Command();
55653
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.32");
55799
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.0");
55654
55800
  program.addCommand(createBootstrapCommand());
55655
55801
  program.addCommand(createSynthCommand());
55656
55802
  program.addCommand(createListCommand());