@go-to-k/cdkd 0.260.1 → 0.260.2

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
@@ -43,7 +43,7 @@ import readline from "node:readline/promises";
43
43
  import { writeFileSync as writeFileSync$1 } from "fs";
44
44
  import * as zlib from "node:zlib";
45
45
  import { ApplicationAutoScalingClient, DeleteScalingPolicyCommand, DeregisterScalableTargetCommand, DescribeScalableTargetsCommand, DescribeScalingPoliciesCommand, PutScalingPolicyCommand, RegisterScalableTargetCommand } from "@aws-sdk/client-application-auto-scaling";
46
- import { ApiGatewayV2Client, CreateApiCommand, CreateAuthorizerCommand as CreateAuthorizerCommand$1, CreateIntegrationCommand, CreateRouteCommand as CreateRouteCommand$1, CreateStageCommand as CreateStageCommand$1, DeleteApiCommand, DeleteAuthorizerCommand as DeleteAuthorizerCommand$1, DeleteIntegrationCommand, DeleteRouteCommand as DeleteRouteCommand$1, DeleteStageCommand as DeleteStageCommand$1, GetApiCommand, GetAuthorizerCommand as GetAuthorizerCommand$1, GetIntegrationCommand, GetRouteCommand, GetStageCommand as GetStageCommand$1, NotFoundException as NotFoundException$3, UpdateApiCommand, UpdateAuthorizerCommand as UpdateAuthorizerCommand$1, UpdateIntegrationCommand, UpdateRouteCommand, UpdateStageCommand as UpdateStageCommand$1 } from "@aws-sdk/client-apigatewayv2";
46
+ import { ApiGatewayV2Client, CreateApiCommand, CreateAuthorizerCommand as CreateAuthorizerCommand$1, CreateIntegrationCommand, CreateRouteCommand as CreateRouteCommand$1, CreateStageCommand as CreateStageCommand$1, DeleteApiCommand, DeleteAuthorizerCommand as DeleteAuthorizerCommand$1, DeleteCorsConfigurationCommand, DeleteIntegrationCommand, DeleteRouteCommand as DeleteRouteCommand$1, DeleteStageCommand as DeleteStageCommand$1, GetApiCommand, GetAuthorizerCommand as GetAuthorizerCommand$1, GetIntegrationCommand, GetRouteCommand, GetStageCommand as GetStageCommand$1, NotFoundException as NotFoundException$3, UpdateApiCommand, UpdateAuthorizerCommand as UpdateAuthorizerCommand$1, UpdateIntegrationCommand, UpdateRouteCommand, UpdateStageCommand as UpdateStageCommand$1 } from "@aws-sdk/client-apigatewayv2";
47
47
  import { CreateStateMachineCommand, DeleteStateMachineCommand, DescribeStateMachineCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$11, SFNClient, StateMachineDoesNotExist, TagResourceCommand as TagResourceCommand$13, UntagResourceCommand as UntagResourceCommand$13, UpdateStateMachineCommand } from "@aws-sdk/client-sfn";
48
48
  import { CreateClusterCommand, CreateServiceCommand, DeleteClusterCommand, DeleteServiceCommand, DeregisterTaskDefinitionCommand, DescribeClustersCommand, DescribeServicesCommand, DescribeTaskDefinitionCommand, ECSClient, PutClusterCapacityProvidersCommand, RegisterTaskDefinitionCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$14, UpdateClusterCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
49
49
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBClusterCommand as CreateDBClusterCommand$1, CreateDBInstanceCommand as CreateDBInstanceCommand$1, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$1, DeleteDBClusterCommand as DeleteDBClusterCommand$1, DeleteDBInstanceCommand as DeleteDBInstanceCommand$1, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$1, DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$12, ModifyDBClusterCommand as ModifyDBClusterCommand$1, ModifyDBInstanceCommand as ModifyDBInstanceCommand$1, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$1, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$3 } from "@aws-sdk/client-docdb";
@@ -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.1";
1904
+ return "0.260.2";
1905
1905
  }
1906
1906
  /**
1907
1907
  * Generate a time-sortable unique run id, e.g.
@@ -19351,35 +19351,51 @@ var ApiGatewayV2Provider = class {
19351
19351
  input.Name = properties["Name"];
19352
19352
  changed = true;
19353
19353
  }
19354
- if (properties["Description"] !== void 0 && properties["Description"] !== previousProperties["Description"]) {
19355
- input.Description = properties["Description"];
19356
- changed = true;
19354
+ {
19355
+ const r = this.clearableUpdate(properties["Description"], previousProperties["Description"], "");
19356
+ if (r.changed) {
19357
+ input.Description = r.value;
19358
+ changed = true;
19359
+ }
19357
19360
  }
19358
19361
  if (properties["CorsConfiguration"] !== void 0 && !this.deepEqual(properties["CorsConfiguration"], previousProperties["CorsConfiguration"])) {
19359
19362
  input.CorsConfiguration = properties["CorsConfiguration"];
19360
19363
  changed = true;
19361
19364
  }
19362
- if (properties["DisableExecuteApiEndpoint"] !== void 0 && properties["DisableExecuteApiEndpoint"] !== previousProperties["DisableExecuteApiEndpoint"]) {
19363
- input.DisableExecuteApiEndpoint = properties["DisableExecuteApiEndpoint"];
19364
- changed = true;
19365
+ const corsRemoved = properties["CorsConfiguration"] === void 0 && previousProperties["CorsConfiguration"] !== void 0;
19366
+ {
19367
+ const r = this.clearableUpdate(properties["DisableExecuteApiEndpoint"], previousProperties["DisableExecuteApiEndpoint"], false);
19368
+ if (r.changed) {
19369
+ input.DisableExecuteApiEndpoint = r.value;
19370
+ changed = true;
19371
+ }
19365
19372
  }
19366
- if (properties["Version"] !== void 0 && properties["Version"] !== previousProperties["Version"]) {
19367
- input.Version = properties["Version"];
19368
- changed = true;
19373
+ {
19374
+ const r = this.clearableUpdate(properties["Version"], previousProperties["Version"], "");
19375
+ if (r.changed) {
19376
+ input.Version = r.value;
19377
+ changed = true;
19378
+ }
19369
19379
  }
19370
19380
  if (properties["RouteSelectionExpression"] !== void 0 && properties["RouteSelectionExpression"] !== previousProperties["RouteSelectionExpression"]) {
19371
19381
  input.RouteSelectionExpression = properties["RouteSelectionExpression"];
19372
19382
  changed = true;
19373
19383
  }
19374
- if (properties["ApiKeySelectionExpression"] !== void 0 && properties["ApiKeySelectionExpression"] !== previousProperties["ApiKeySelectionExpression"]) {
19375
- input.ApiKeySelectionExpression = properties["ApiKeySelectionExpression"];
19376
- changed = true;
19384
+ {
19385
+ const r = this.clearableUpdate(properties["ApiKeySelectionExpression"], previousProperties["ApiKeySelectionExpression"], "$request.header.x-api-key");
19386
+ if (r.changed) {
19387
+ input.ApiKeySelectionExpression = r.value;
19388
+ changed = true;
19389
+ }
19377
19390
  }
19378
- if (properties["IpAddressType"] !== void 0 && properties["IpAddressType"] !== previousProperties["IpAddressType"]) {
19379
- input.IpAddressType = properties["IpAddressType"];
19380
- changed = true;
19391
+ {
19392
+ const r = this.clearableUpdate(properties["IpAddressType"], previousProperties["IpAddressType"], "ipv4");
19393
+ if (r.changed) {
19394
+ input.IpAddressType = r.value;
19395
+ changed = true;
19396
+ }
19381
19397
  }
19382
- if (!changed) {
19398
+ if (!changed && !corsRemoved) {
19383
19399
  this.logger.debug(`No mutable Api fields changed for ${logicalId}; skipping UpdateApi`);
19384
19400
  return {
19385
19401
  physicalId,
@@ -19388,7 +19404,11 @@ var ApiGatewayV2Provider = class {
19388
19404
  }
19389
19405
  this.logger.debug(`Updating API Gateway V2 Api ${logicalId}: ${physicalId}`);
19390
19406
  try {
19391
- await this.getClient().send(new UpdateApiCommand(input));
19407
+ if (changed) await this.getClient().send(new UpdateApiCommand(input));
19408
+ if (corsRemoved) {
19409
+ this.logger.debug(`Clearing CORS configuration for Api ${logicalId}: ${physicalId}`);
19410
+ await this.getClient().send(new DeleteCorsConfigurationCommand({ ApiId: physicalId }));
19411
+ }
19392
19412
  return {
19393
19413
  physicalId,
19394
19414
  wasReplaced: false
@@ -19415,17 +19435,23 @@ var ApiGatewayV2Provider = class {
19415
19435
  StageName: physicalId
19416
19436
  };
19417
19437
  let changed = false;
19418
- if (properties["AutoDeploy"] !== void 0 && properties["AutoDeploy"] !== previousProperties["AutoDeploy"]) {
19419
- input.AutoDeploy = properties["AutoDeploy"];
19420
- changed = true;
19438
+ {
19439
+ const r = this.clearableUpdate(properties["AutoDeploy"], previousProperties["AutoDeploy"], false);
19440
+ if (r.changed) {
19441
+ input.AutoDeploy = r.value;
19442
+ changed = true;
19443
+ }
19421
19444
  }
19422
19445
  if (properties["Description"] !== void 0 && properties["Description"] !== previousProperties["Description"]) {
19423
19446
  input.Description = properties["Description"];
19424
19447
  changed = true;
19425
19448
  }
19426
- if (properties["StageVariables"] !== void 0 && !this.deepEqual(properties["StageVariables"], previousProperties["StageVariables"])) {
19427
- input.StageVariables = properties["StageVariables"];
19428
- changed = true;
19449
+ {
19450
+ const merged = this.mapWithRemovals(properties["StageVariables"], previousProperties["StageVariables"]);
19451
+ if (merged !== void 0) {
19452
+ input.StageVariables = merged;
19453
+ changed = true;
19454
+ }
19429
19455
  }
19430
19456
  if (properties["DefaultRouteSettings"] !== void 0 && !this.deepEqual(properties["DefaultRouteSettings"], previousProperties["DefaultRouteSettings"])) {
19431
19457
  input.DefaultRouteSettings = properties["DefaultRouteSettings"];
@@ -19485,13 +19511,19 @@ var ApiGatewayV2Provider = class {
19485
19511
  input.TimeoutInMillis = properties["TimeoutInMillis"];
19486
19512
  changed = true;
19487
19513
  }
19488
- if (properties["RequestParameters"] !== void 0 && !this.deepEqual(properties["RequestParameters"], previousProperties["RequestParameters"])) {
19489
- input.RequestParameters = properties["RequestParameters"];
19490
- changed = true;
19514
+ {
19515
+ const merged = this.mapWithRemovals(properties["RequestParameters"], previousProperties["RequestParameters"]);
19516
+ if (merged !== void 0) {
19517
+ input.RequestParameters = merged;
19518
+ changed = true;
19519
+ }
19491
19520
  }
19492
- if (properties["Description"] !== void 0 && properties["Description"] !== previousProperties["Description"]) {
19493
- input.Description = properties["Description"];
19494
- changed = true;
19521
+ {
19522
+ const r = this.clearableUpdate(properties["Description"], previousProperties["Description"], "");
19523
+ if (r.changed) {
19524
+ input.Description = r.value;
19525
+ changed = true;
19526
+ }
19495
19527
  }
19496
19528
  if (!changed) {
19497
19529
  this.logger.debug(`No mutable Integration fields changed for ${logicalId}; skipping UpdateIntegration`);
@@ -19534,21 +19566,33 @@ var ApiGatewayV2Provider = class {
19534
19566
  input.Target = properties["Target"];
19535
19567
  changed = true;
19536
19568
  }
19537
- if (properties["AuthorizationType"] !== void 0 && properties["AuthorizationType"] !== previousProperties["AuthorizationType"]) {
19538
- input.AuthorizationType = properties["AuthorizationType"];
19539
- changed = true;
19569
+ {
19570
+ const r = this.clearableUpdate(properties["AuthorizationType"], previousProperties["AuthorizationType"], "NONE");
19571
+ if (r.changed) {
19572
+ input.AuthorizationType = r.value;
19573
+ changed = true;
19574
+ }
19540
19575
  }
19541
- if (properties["AuthorizerId"] !== void 0 && properties["AuthorizerId"] !== previousProperties["AuthorizerId"]) {
19542
- input.AuthorizerId = properties["AuthorizerId"];
19543
- changed = true;
19576
+ {
19577
+ const r = this.clearableUpdate(properties["AuthorizerId"], previousProperties["AuthorizerId"], "");
19578
+ if (r.changed) {
19579
+ input.AuthorizerId = r.value;
19580
+ changed = true;
19581
+ }
19544
19582
  }
19545
- if (properties["AuthorizationScopes"] !== void 0 && !this.deepEqual(properties["AuthorizationScopes"], previousProperties["AuthorizationScopes"])) {
19546
- input.AuthorizationScopes = properties["AuthorizationScopes"];
19547
- changed = true;
19583
+ {
19584
+ const r = this.clearableUpdate(properties["AuthorizationScopes"], previousProperties["AuthorizationScopes"], []);
19585
+ if (r.changed) {
19586
+ input.AuthorizationScopes = r.value;
19587
+ changed = true;
19588
+ }
19548
19589
  }
19549
- if (properties["OperationName"] !== void 0 && properties["OperationName"] !== previousProperties["OperationName"]) {
19550
- input.OperationName = properties["OperationName"];
19551
- changed = true;
19590
+ {
19591
+ const r = this.clearableUpdate(properties["OperationName"], previousProperties["OperationName"], "");
19592
+ if (r.changed) {
19593
+ input.OperationName = r.value;
19594
+ changed = true;
19595
+ }
19552
19596
  }
19553
19597
  if (!changed) {
19554
19598
  this.logger.debug(`No mutable Route fields changed for ${logicalId}; skipping UpdateRoute`);
@@ -19609,25 +19653,37 @@ var ApiGatewayV2Provider = class {
19609
19653
  input.AuthorizerUri = properties["AuthorizerUri"];
19610
19654
  changed = true;
19611
19655
  }
19612
- if (properties["AuthorizerCredentialsArn"] !== void 0 && properties["AuthorizerCredentialsArn"] !== previousProperties["AuthorizerCredentialsArn"]) {
19613
- input.AuthorizerCredentialsArn = properties["AuthorizerCredentialsArn"];
19614
- changed = true;
19656
+ {
19657
+ const r = this.clearableUpdate(properties["AuthorizerCredentialsArn"], previousProperties["AuthorizerCredentialsArn"], "");
19658
+ if (r.changed) {
19659
+ input.AuthorizerCredentialsArn = r.value;
19660
+ changed = true;
19661
+ }
19615
19662
  }
19616
- if (properties["AuthorizerPayloadFormatVersion"] !== void 0 && properties["AuthorizerPayloadFormatVersion"] !== previousProperties["AuthorizerPayloadFormatVersion"]) {
19617
- input.AuthorizerPayloadFormatVersion = properties["AuthorizerPayloadFormatVersion"];
19618
- changed = true;
19663
+ {
19664
+ const r = this.clearableUpdate(properties["AuthorizerPayloadFormatVersion"], previousProperties["AuthorizerPayloadFormatVersion"], "");
19665
+ if (r.changed) {
19666
+ input.AuthorizerPayloadFormatVersion = r.value;
19667
+ changed = true;
19668
+ }
19619
19669
  }
19620
- if (properties["AuthorizerResultTtlInSeconds"] !== void 0 && properties["AuthorizerResultTtlInSeconds"] !== previousProperties["AuthorizerResultTtlInSeconds"]) {
19621
- input.AuthorizerResultTtlInSeconds = properties["AuthorizerResultTtlInSeconds"];
19622
- changed = true;
19670
+ {
19671
+ const r = this.clearableUpdate(properties["AuthorizerResultTtlInSeconds"], previousProperties["AuthorizerResultTtlInSeconds"], 0);
19672
+ if (r.changed) {
19673
+ input.AuthorizerResultTtlInSeconds = r.value;
19674
+ changed = true;
19675
+ }
19623
19676
  }
19624
19677
  if (properties["EnableSimpleResponses"] !== void 0 && properties["EnableSimpleResponses"] !== previousProperties["EnableSimpleResponses"]) {
19625
19678
  input.EnableSimpleResponses = properties["EnableSimpleResponses"];
19626
19679
  changed = true;
19627
19680
  }
19628
- if (properties["IdentityValidationExpression"] !== void 0 && properties["IdentityValidationExpression"] !== previousProperties["IdentityValidationExpression"]) {
19629
- input.IdentityValidationExpression = properties["IdentityValidationExpression"];
19630
- changed = true;
19681
+ {
19682
+ const r = this.clearableUpdate(properties["IdentityValidationExpression"], previousProperties["IdentityValidationExpression"], "");
19683
+ if (r.changed) {
19684
+ input.IdentityValidationExpression = r.value;
19685
+ changed = true;
19686
+ }
19631
19687
  }
19632
19688
  if (!changed) {
19633
19689
  this.logger.debug(`No mutable Authorizer fields changed for ${logicalId}; skipping UpdateAuthorizer`);
@@ -19649,6 +19705,65 @@ var ApiGatewayV2Provider = class {
19649
19705
  }
19650
19706
  }
19651
19707
  /**
19708
+ * Resolve an optional update field so that a property REMOVED from the
19709
+ * template is reset to its CloudFormation default instead of silently
19710
+ * retaining the old live value (issue #1160 — the absent-field removal
19711
+ * silent-drop bug class; reference fix `LambdaFunctionProvider`, #1157).
19712
+ *
19713
+ * Every API Gateway V2 `Update*` API uses PATCH / merge semantics: an
19714
+ * ABSENT input field means "no change", so passing `undefined` for a
19715
+ * field the user just dropped leaves the old value live on AWS while
19716
+ * CloudFormation resets it to the property default. For each removable
19717
+ * field we therefore send its explicit reset value (`resetValue`) when
19718
+ * it was present before and is now absent.
19719
+ *
19720
+ * The reset values below were live-probed against real AWS (2026-07-22):
19721
+ * string fields clear on `''`, boolean/enum fields on their CFn default,
19722
+ * `AuthorizationScopes` on `[]`, `AuthorizerResultTtlInSeconds` on `0`.
19723
+ * `CorsConfiguration` is the ONE exception — an empty `Cors` in
19724
+ * `UpdateApi` does NOT clear it, so removal is handled out-of-band via
19725
+ * `DeleteCorsConfiguration` (see `updateApi`). Fields that are required
19726
+ * per protocol/authorizer type (`Name`, `RouteKey`, `Target`,
19727
+ * `RouteSelectionExpression`, `IntegrationType`/`Uri`/`Method`,
19728
+ * `PayloadFormatVersion`, `IdentitySource`, `JwtConfiguration`,
19729
+ * `EnableSimpleResponses`) are NOT cleared: the underlying API rejects a
19730
+ * reset value for them, so CloudFormation faces the same constraint and
19731
+ * cdkd leaving them matches CFn. `Stage.Description` /
19732
+ * `DefaultRouteSettings` are likewise left alone — the API silently
19733
+ * ignores an empty-string / empty-object reset for them.
19734
+ *
19735
+ * Returns `{ changed, value }`: `changed` is true only when the resolved
19736
+ * value actually differs from the previous one (so a no-op field never
19737
+ * forces an Update call), and `value` is the value to place in the input.
19738
+ */
19739
+ clearableUpdate(next, previous, resetValue) {
19740
+ const resolved = next !== void 0 ? next : previous !== void 0 ? resetValue : void 0;
19741
+ return {
19742
+ changed: resolved !== void 0 && !this.deepEqual(resolved, previous),
19743
+ value: resolved
19744
+ };
19745
+ }
19746
+ /**
19747
+ * Resolve a `Record<string, string>` update field (`StageVariables`,
19748
+ * Integration `RequestParameters`) with per-key removal awareness.
19749
+ *
19750
+ * These maps also merge on the AWS side: sending `{}` (or a map missing
19751
+ * a previously-present key) does NOT delete the dropped key — it is kept
19752
+ * live. Live-probed 2026-07-22: a key is cleared only by sending it with
19753
+ * an empty-string value. So the resolved map is `next` plus every key
19754
+ * present in `previous` but absent from `next`, set to `''`. Whole-block
19755
+ * removal (next `undefined`, previous populated) therefore sends every
19756
+ * old key as `''`. Returns `undefined` when nothing changed.
19757
+ */
19758
+ mapWithRemovals(next, previous) {
19759
+ if (this.deepEqual(next, previous)) return void 0;
19760
+ const nextMap = next ?? {};
19761
+ const prevMap = previous ?? {};
19762
+ const merged = { ...nextMap };
19763
+ for (const key of Object.keys(prevMap)) if (!(key in nextMap)) merged[key] = "";
19764
+ return merged;
19765
+ }
19766
+ /**
19652
19767
  * Convert CloudFormation Tags (Array<{Key, Value}>) to SDK Tags (Record<string, string>).
19653
19768
  */
19654
19769
  cfnTagsToRecord(tags) {
@@ -61368,7 +61483,7 @@ function createMigrateCommand() {
61368
61483
  */
61369
61484
  function buildProgram() {
61370
61485
  const program = new Command();
61371
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.1");
61486
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.2");
61372
61487
  program.addCommand(createBootstrapCommand());
61373
61488
  program.addCommand(createSynthCommand());
61374
61489
  program.addCommand(createListCommand());