@go-to-k/cdkd 0.50.9 → 0.50.11

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
@@ -19412,7 +19412,11 @@ var EC2Provider = class {
19412
19412
  case "AWS::EC2::NetworkAcl":
19413
19413
  case "AWS::EC2::NetworkAclEntry":
19414
19414
  case "AWS::EC2::SubnetNetworkAclAssociation":
19415
- return { physicalId, wasReplaced: false };
19415
+ throw new ResourceUpdateNotSupportedError(
19416
+ resourceType,
19417
+ logicalId,
19418
+ "destroy + redeploy. The property surface for this resource type is effectively immutable in cdkd today."
19419
+ );
19416
19420
  default:
19417
19421
  throw new ProvisioningError(
19418
19422
  `Unsupported resource type: ${resourceType}`,
@@ -19557,21 +19561,28 @@ var EC2Provider = class {
19557
19561
  async updateVpc(logicalId, physicalId, resourceType, properties, previousProperties) {
19558
19562
  this.logger.debug(`Updating VPC ${logicalId}: ${physicalId}`);
19559
19563
  try {
19560
- if (properties["EnableDnsHostnames"] !== void 0) {
19561
- const value = properties["EnableDnsHostnames"] === true || properties["EnableDnsHostnames"] === "true";
19564
+ const asBool = (v) => {
19565
+ if (v === void 0)
19566
+ return void 0;
19567
+ return v === true || v === "true";
19568
+ };
19569
+ const newDnsHostnames = asBool(properties["EnableDnsHostnames"]);
19570
+ const oldDnsHostnames = asBool(previousProperties["EnableDnsHostnames"]);
19571
+ if (newDnsHostnames !== void 0 && newDnsHostnames !== oldDnsHostnames) {
19562
19572
  await this.ec2Client.send(
19563
19573
  new ModifyVpcAttributeCommand({
19564
19574
  VpcId: physicalId,
19565
- EnableDnsHostnames: { Value: value }
19575
+ EnableDnsHostnames: { Value: newDnsHostnames }
19566
19576
  })
19567
19577
  );
19568
19578
  }
19569
- if (properties["EnableDnsSupport"] !== void 0) {
19570
- const value = properties["EnableDnsSupport"] === true || properties["EnableDnsSupport"] === "true";
19579
+ const newDnsSupport = asBool(properties["EnableDnsSupport"]);
19580
+ const oldDnsSupport = asBool(previousProperties["EnableDnsSupport"]);
19581
+ if (newDnsSupport !== void 0 && newDnsSupport !== oldDnsSupport) {
19571
19582
  await this.ec2Client.send(
19572
19583
  new ModifyVpcAttributeCommand({
19573
19584
  VpcId: physicalId,
19574
- EnableDnsSupport: { Value: value }
19585
+ EnableDnsSupport: { Value: newDnsSupport }
19575
19586
  })
19576
19587
  );
19577
19588
  }
@@ -19754,8 +19765,13 @@ var EC2Provider = class {
19754
19765
  }
19755
19766
  }
19756
19767
  updateSubnet(logicalId, physicalId) {
19757
- this.logger.debug(`Updating Subnet ${logicalId}: ${physicalId} (no-op, immutable properties)`);
19758
- return Promise.resolve({ physicalId, wasReplaced: false });
19768
+ return Promise.reject(
19769
+ new ResourceUpdateNotSupportedError(
19770
+ "AWS::EC2::Subnet",
19771
+ logicalId,
19772
+ "destroy + redeploy the Subnet (and the resources that depend on it). Subnet properties are immutable in AWS."
19773
+ )
19774
+ );
19759
19775
  }
19760
19776
  async deleteSubnet(logicalId, physicalId, resourceType, context) {
19761
19777
  this.logger.debug(`Deleting Subnet ${logicalId}: ${physicalId}`);
@@ -19890,8 +19906,13 @@ var EC2Provider = class {
19890
19906
  }
19891
19907
  }
19892
19908
  updateInternetGateway(logicalId, physicalId) {
19893
- this.logger.debug(`Updating InternetGateway ${logicalId}: ${physicalId} (no-op)`);
19894
- return Promise.resolve({ physicalId, wasReplaced: false });
19909
+ return Promise.reject(
19910
+ new ResourceUpdateNotSupportedError(
19911
+ "AWS::EC2::InternetGateway",
19912
+ logicalId,
19913
+ "destroy + redeploy the InternetGateway. IGW properties are immutable in AWS."
19914
+ )
19915
+ );
19895
19916
  }
19896
19917
  async deleteInternetGateway(logicalId, physicalId, resourceType, context) {
19897
19918
  this.logger.debug(`Deleting InternetGateway ${logicalId}: ${physicalId}`);
@@ -19960,8 +19981,13 @@ var EC2Provider = class {
19960
19981
  }
19961
19982
  }
19962
19983
  updateVpcGatewayAttachment(logicalId, physicalId) {
19963
- this.logger.debug(`Updating VPCGatewayAttachment ${logicalId}: ${physicalId} (no-op)`);
19964
- return Promise.resolve({ physicalId, wasReplaced: false });
19984
+ return Promise.reject(
19985
+ new ResourceUpdateNotSupportedError(
19986
+ "AWS::EC2::VPCGatewayAttachment",
19987
+ logicalId,
19988
+ "destroy + redeploy the VPCGatewayAttachment. The (VpcId, InternetGatewayId) pair is immutable."
19989
+ )
19990
+ );
19965
19991
  }
19966
19992
  async deleteVpcGatewayAttachment(logicalId, physicalId, resourceType, context) {
19967
19993
  this.logger.debug(`Deleting VPCGatewayAttachment ${logicalId}: ${physicalId}`);
@@ -20076,8 +20102,13 @@ var EC2Provider = class {
20076
20102
  }
20077
20103
  }
20078
20104
  updateNatGateway(logicalId, physicalId) {
20079
- this.logger.debug(`Updating NatGateway ${logicalId}: ${physicalId} (no-op)`);
20080
- return Promise.resolve({ physicalId, wasReplaced: false });
20105
+ return Promise.reject(
20106
+ new ResourceUpdateNotSupportedError(
20107
+ "AWS::EC2::NatGateway",
20108
+ logicalId,
20109
+ "destroy + redeploy the NatGateway (and the dependent Routes). NAT Gateway properties are immutable in AWS."
20110
+ )
20111
+ );
20081
20112
  }
20082
20113
  async deleteNatGateway(logicalId, physicalId, resourceType, context) {
20083
20114
  this.logger.debug(`Deleting NatGateway ${logicalId}: ${physicalId}`);
@@ -20152,8 +20183,13 @@ var EC2Provider = class {
20152
20183
  }
20153
20184
  }
20154
20185
  updateRouteTable(logicalId, physicalId) {
20155
- this.logger.debug(`Updating RouteTable ${logicalId}: ${physicalId} (no-op)`);
20156
- return Promise.resolve({ physicalId, wasReplaced: false });
20186
+ return Promise.reject(
20187
+ new ResourceUpdateNotSupportedError(
20188
+ "AWS::EC2::RouteTable",
20189
+ logicalId,
20190
+ "destroy + redeploy the RouteTable (and its associated Routes / SubnetRouteTableAssociations). VpcId is immutable."
20191
+ )
20192
+ );
20157
20193
  }
20158
20194
  async deleteRouteTable(logicalId, physicalId, resourceType, context) {
20159
20195
  this.logger.debug(`Deleting RouteTable ${logicalId}: ${physicalId}`);
@@ -20228,8 +20264,11 @@ var EC2Provider = class {
20228
20264
  );
20229
20265
  }
20230
20266
  }
20231
- async updateRoute(logicalId, physicalId, resourceType, properties, _previousProperties) {
20267
+ async updateRoute(logicalId, physicalId, resourceType, properties, previousProperties) {
20232
20268
  this.logger.debug(`Updating Route ${logicalId}: ${physicalId}`);
20269
+ if (JSON.stringify(properties) === JSON.stringify(previousProperties)) {
20270
+ return { physicalId, wasReplaced: false };
20271
+ }
20233
20272
  try {
20234
20273
  await this.deleteRoute(logicalId, physicalId, resourceType);
20235
20274
  const createResult = await this.createRoute(logicalId, resourceType, properties);
@@ -20332,10 +20371,13 @@ var EC2Provider = class {
20332
20371
  }
20333
20372
  }
20334
20373
  updateSubnetRouteTableAssociation(logicalId, physicalId) {
20335
- this.logger.debug(
20336
- `Updating SubnetRouteTableAssociation ${logicalId}: ${physicalId} (no-op, requires replacement)`
20374
+ return Promise.reject(
20375
+ new ResourceUpdateNotSupportedError(
20376
+ "AWS::EC2::SubnetRouteTableAssociation",
20377
+ logicalId,
20378
+ "destroy + redeploy the association. (SubnetId, RouteTableId) is immutable."
20379
+ )
20337
20380
  );
20338
- return Promise.resolve({ physicalId, wasReplaced: false });
20339
20381
  }
20340
20382
  async deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType, context) {
20341
20383
  this.logger.debug(`Deleting SubnetRouteTableAssociation ${logicalId}: ${physicalId}`);
@@ -20633,6 +20675,9 @@ var EC2Provider = class {
20633
20675
  }
20634
20676
  async updateSecurityGroupIngress(logicalId, physicalId, resourceType, properties, previousProperties) {
20635
20677
  this.logger.debug(`Updating SecurityGroupIngress ${logicalId}: ${physicalId}`);
20678
+ if (JSON.stringify(properties) === JSON.stringify(previousProperties)) {
20679
+ return { physicalId, wasReplaced: false };
20680
+ }
20636
20681
  try {
20637
20682
  await this.deleteSecurityGroupIngress(
20638
20683
  logicalId,
@@ -21943,7 +21988,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
21943
21988
  * the IAM trust relationship hasn't fully propagated yet.
21944
21989
  */
21945
21990
  async updateAccountWithRetry(cloudWatchRoleArn, logicalId, _resourceType) {
21946
- const patchOperations = cloudWatchRoleArn ? [
21991
+ const patchOperations = cloudWatchRoleArn !== void 0 ? [
21947
21992
  {
21948
21993
  op: "replace",
21949
21994
  path: "/cloudwatchRoleArn",
@@ -22887,7 +22932,10 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
22887
22932
  if (resp.authorizationType !== void 0) {
22888
22933
  result["AuthorizationType"] = resp.authorizationType;
22889
22934
  }
22890
- result["AuthorizerId"] = resp.authorizerId ?? "";
22935
+ const authType = resp.authorizationType;
22936
+ if (authType === "CUSTOM" || authType === "COGNITO_USER_POOLS") {
22937
+ result["AuthorizerId"] = resp.authorizerId ?? "";
22938
+ }
22891
22939
  result["Integration"] = resp.methodIntegration ?? {};
22892
22940
  result["MethodResponses"] = resp.methodResponses ?? {};
22893
22941
  return result;
@@ -23523,7 +23571,12 @@ var ApiGatewayV2Provider = class {
23523
23571
  if (resp.ProtocolType !== void 0)
23524
23572
  result["ProtocolType"] = resp.ProtocolType;
23525
23573
  result["Description"] = resp.Description ?? "";
23526
- result["CorsConfiguration"] = resp.CorsConfiguration ?? {};
23574
+ if (resp.ProtocolType === "HTTP") {
23575
+ result["CorsConfiguration"] = resp.CorsConfiguration ?? {};
23576
+ }
23577
+ if (resp.ProtocolType === "WEBSOCKET" && resp.RouteSelectionExpression !== void 0) {
23578
+ result["RouteSelectionExpression"] = resp.RouteSelectionExpression;
23579
+ }
23527
23580
  const tags = normalizeAwsTagsToCfn(resp.Tags);
23528
23581
  result["Tags"] = tags;
23529
23582
  return result;
@@ -23564,7 +23617,10 @@ var ApiGatewayV2Provider = class {
23564
23617
  const result = { ApiId: apiId };
23565
23618
  if (resp.IntegrationType !== void 0)
23566
23619
  result["IntegrationType"] = resp.IntegrationType;
23567
- result["IntegrationUri"] = resp.IntegrationUri ?? "";
23620
+ const uriRequired = resp.IntegrationType === "AWS" || resp.IntegrationType === "AWS_PROXY" || resp.IntegrationType === "HTTP" || resp.IntegrationType === "HTTP_PROXY";
23621
+ if (uriRequired) {
23622
+ result["IntegrationUri"] = resp.IntegrationUri ?? "";
23623
+ }
23568
23624
  result["IntegrationMethod"] = resp.IntegrationMethod ?? "";
23569
23625
  result["PayloadFormatVersion"] = resp.PayloadFormatVersion ?? "";
23570
23626
  return result;
@@ -23586,8 +23642,11 @@ var ApiGatewayV2Provider = class {
23586
23642
  if (resp.RouteKey !== void 0)
23587
23643
  result["RouteKey"] = resp.RouteKey;
23588
23644
  result["Target"] = resp.Target ?? "";
23589
- result["AuthorizationType"] = resp.AuthorizationType ?? "";
23590
- result["AuthorizerId"] = resp.AuthorizerId ?? "";
23645
+ result["AuthorizationType"] = resp.AuthorizationType ?? "NONE";
23646
+ if (resp.AuthorizationType && resp.AuthorizationType !== "NONE") {
23647
+ result["AuthorizerId"] = resp.AuthorizerId ?? "";
23648
+ result["AuthorizationScopes"] = resp.AuthorizationScopes ? [...resp.AuthorizationScopes] : [];
23649
+ }
23591
23650
  return result;
23592
23651
  } catch (err) {
23593
23652
  if (err instanceof NotFoundException4)
@@ -23608,9 +23667,12 @@ var ApiGatewayV2Provider = class {
23608
23667
  result["AuthorizerType"] = resp.AuthorizerType;
23609
23668
  result["Name"] = resp.Name ?? "";
23610
23669
  result["IdentitySource"] = resp.IdentitySource ? [...resp.IdentitySource] : [];
23611
- result["JwtConfiguration"] = resp.JwtConfiguration ?? {};
23612
- result["AuthorizerUri"] = resp.AuthorizerUri ?? "";
23613
- result["AuthorizerPayloadFormatVersion"] = resp.AuthorizerPayloadFormatVersion ?? "";
23670
+ if (resp.AuthorizerType === "JWT") {
23671
+ result["JwtConfiguration"] = resp.JwtConfiguration ?? {};
23672
+ } else if (resp.AuthorizerType === "REQUEST") {
23673
+ result["AuthorizerUri"] = resp.AuthorizerUri ?? "";
23674
+ result["AuthorizerPayloadFormatVersion"] = resp.AuthorizerPayloadFormatVersion ?? "";
23675
+ }
23614
23676
  return result;
23615
23677
  } catch (err) {
23616
23678
  if (err instanceof NotFoundException4)
@@ -23906,6 +23968,24 @@ var CloudFrontOAIProvider = class {
23906
23968
  throw err;
23907
23969
  }
23908
23970
  }
23971
+ /**
23972
+ * State property paths the comparator must skip during drift detection.
23973
+ *
23974
+ * `CloudFrontOriginAccessIdentityConfig.CallerReference` is set by cdkd
23975
+ * to `logicalId` at create time regardless of what the CDK template
23976
+ * specified, so it ends up in `state.properties` (from the resolved
23977
+ * template) but is intentionally not surfaced by `readCurrentState`. A
23978
+ * keys-from-state walk would otherwise compare `state.CallerReference`
23979
+ * against `aws=undefined` and fire a guaranteed false positive on every
23980
+ * clean run for any stack whose template templated CallerReference.
23981
+ *
23982
+ * The field is also immutable in AWS — the OAI's CallerReference cannot
23983
+ * change post-create — so omitting it from drift is also semantically
23984
+ * correct.
23985
+ */
23986
+ getDriftUnknownPaths() {
23987
+ return ["CloudFrontOriginAccessIdentityConfig.CallerReference"];
23988
+ }
23909
23989
  /**
23910
23990
  * Adopt an existing CloudFront Origin Access Identity into cdkd state.
23911
23991
  *
@@ -25520,23 +25600,14 @@ var ECSProvider = class {
25520
25600
  );
25521
25601
  }
25522
25602
  }
25523
- async updateTaskDefinition(logicalId, physicalId, resourceType, properties) {
25524
- this.logger.debug(`Updating ECS task definition ${logicalId}: ${physicalId}`);
25525
- const result = await this.createTaskDefinition(logicalId, resourceType, properties);
25526
- try {
25527
- const client = this.getClient();
25528
- await client.send(new DeregisterTaskDefinitionCommand({ taskDefinition: physicalId }));
25529
- this.logger.debug(`Deregistered old task definition revision: ${physicalId}`);
25530
- } catch (error) {
25531
- this.logger.debug(
25532
- `Failed to deregister old task definition ${physicalId}: ${error instanceof Error ? error.message : String(error)}`
25533
- );
25534
- }
25535
- return {
25536
- physicalId: result.physicalId,
25537
- wasReplaced: false,
25538
- attributes: result.attributes ?? {}
25539
- };
25603
+ async updateTaskDefinition(logicalId, _physicalId, _resourceType, _properties) {
25604
+ return Promise.reject(
25605
+ new ResourceUpdateNotSupportedError(
25606
+ "AWS::ECS::TaskDefinition",
25607
+ logicalId,
25608
+ "TaskDefinition revisions are immutable; re-deploy with cdkd deploy --replace, or destroy + redeploy the stack"
25609
+ )
25610
+ );
25540
25611
  }
25541
25612
  async deleteTaskDefinition(logicalId, physicalId, resourceType, context) {
25542
25613
  this.logger.debug(`Deleting ECS task definition ${logicalId}: ${physicalId}`);
@@ -26075,11 +26146,19 @@ var ECSProvider = class {
26075
26146
  if (s.networkConfiguration)
26076
26147
  result["NetworkConfiguration"] = s.networkConfiguration;
26077
26148
  result["LoadBalancers"] = s.loadBalancers ?? [];
26078
- result["CapacityProviderStrategy"] = s.capacityProviderStrategy ?? [];
26149
+ if (s.capacityProviderStrategy && s.capacityProviderStrategy.length > 0) {
26150
+ result["CapacityProviderStrategy"] = s.capacityProviderStrategy;
26151
+ } else if (!s.launchType) {
26152
+ result["CapacityProviderStrategy"] = [];
26153
+ }
26079
26154
  if (s.deploymentConfiguration)
26080
26155
  result["DeploymentConfiguration"] = s.deploymentConfiguration;
26081
26156
  result["PlacementConstraints"] = s.placementConstraints ?? [];
26082
- result["PlacementStrategy"] = s.placementStrategy ?? [];
26157
+ if (s.launchType === "EC2" || s.launchType === "EXTERNAL") {
26158
+ result["PlacementStrategy"] = s.placementStrategy ?? [];
26159
+ } else if (s.placementStrategy && s.placementStrategy.length > 0) {
26160
+ result["PlacementStrategy"] = s.placementStrategy;
26161
+ }
26083
26162
  result["ServiceRegistries"] = s.serviceRegistries ?? [];
26084
26163
  const tags = normalizeAwsTagsToCfn(s.tags);
26085
26164
  result["Tags"] = tags;
@@ -26549,7 +26628,8 @@ var ELBv2Provider = class {
26549
26628
  async updateTargetGroup(logicalId, physicalId, resourceType, properties, previousProperties) {
26550
26629
  this.logger.debug(`Updating TargetGroup ${logicalId}: ${physicalId}`);
26551
26630
  try {
26552
- const matcher = properties["Matcher"];
26631
+ const rawMatcher = properties["Matcher"];
26632
+ const matcher = rawMatcher && (rawMatcher.HttpCode !== void 0 || rawMatcher.GrpcCode !== void 0) ? rawMatcher : void 0;
26553
26633
  await this.getClient().send(
26554
26634
  new ModifyTargetGroupCommand({
26555
26635
  TargetGroupArn: physicalId,
@@ -28527,7 +28607,7 @@ var Route53Provider = class {
28527
28607
  }
28528
28608
  }
28529
28609
  const setIdentifier = properties["SetIdentifier"];
28530
- if (setIdentifier) {
28610
+ if (setIdentifier !== void 0) {
28531
28611
  recordSet.SetIdentifier = setIdentifier;
28532
28612
  }
28533
28613
  const weight = properties["Weight"];
@@ -28535,11 +28615,11 @@ var Route53Provider = class {
28535
28615
  recordSet.Weight = Number(weight);
28536
28616
  }
28537
28617
  const region = properties["Region"];
28538
- if (region) {
28618
+ if (region !== void 0) {
28539
28619
  recordSet.Region = region;
28540
28620
  }
28541
28621
  const failover = properties["Failover"];
28542
- if (failover) {
28622
+ if (failover !== void 0) {
28543
28623
  recordSet.Failover = failover;
28544
28624
  }
28545
28625
  const multiValueAnswer = properties["MultiValueAnswer"];
@@ -28547,15 +28627,15 @@ var Route53Provider = class {
28547
28627
  recordSet.MultiValueAnswer = typeof multiValueAnswer === "string" ? multiValueAnswer.toLowerCase() === "true" : multiValueAnswer;
28548
28628
  }
28549
28629
  const healthCheckId = properties["HealthCheckId"];
28550
- if (healthCheckId) {
28630
+ if (healthCheckId !== void 0) {
28551
28631
  recordSet.HealthCheckId = healthCheckId;
28552
28632
  }
28553
28633
  const geoLocation = properties["GeoLocation"];
28554
28634
  if (geoLocation) {
28555
28635
  recordSet.GeoLocation = {
28556
- ...geoLocation["ContinentCode"] ? { ContinentCode: geoLocation["ContinentCode"] } : {},
28557
- ...geoLocation["CountryCode"] ? { CountryCode: geoLocation["CountryCode"] } : {},
28558
- ...geoLocation["SubdivisionCode"] ? { SubdivisionCode: geoLocation["SubdivisionCode"] } : {}
28636
+ ...geoLocation["ContinentCode"] !== void 0 ? { ContinentCode: geoLocation["ContinentCode"] } : {},
28637
+ ...geoLocation["CountryCode"] !== void 0 ? { CountryCode: geoLocation["CountryCode"] } : {},
28638
+ ...geoLocation["SubdivisionCode"] !== void 0 ? { SubdivisionCode: geoLocation["SubdivisionCode"] } : {}
28559
28639
  };
28560
28640
  }
28561
28641
  return recordSet;
@@ -28785,14 +28865,16 @@ var Route53Provider = class {
28785
28865
  }
28786
28866
  result["HostedZoneConfig"] = cfg;
28787
28867
  }
28788
- result["VPCs"] = (resp.VPCs ?? []).map((v) => {
28789
- const out = {};
28790
- if (v.VPCId !== void 0)
28791
- out["VPCId"] = v.VPCId;
28792
- if (v.VPCRegion !== void 0)
28793
- out["VPCRegion"] = v.VPCRegion;
28794
- return out;
28795
- });
28868
+ if (resp.HostedZone.Config?.PrivateZone === true) {
28869
+ result["VPCs"] = (resp.VPCs ?? []).map((v) => {
28870
+ const out = {};
28871
+ if (v.VPCId !== void 0)
28872
+ out["VPCId"] = v.VPCId;
28873
+ if (v.VPCRegion !== void 0)
28874
+ out["VPCRegion"] = v.VPCRegion;
28875
+ return out;
28876
+ });
28877
+ }
28796
28878
  const idTail = physicalId.replace(/^\/hostedzone\//, "");
28797
28879
  try {
28798
28880
  const tagsResp = await this.getClient().send(
@@ -28837,9 +28919,11 @@ var Route53Provider = class {
28837
28919
  Name: name,
28838
28920
  Type: type
28839
28921
  };
28840
- if (recordSet.TTL !== void 0)
28841
- result["TTL"] = recordSet.TTL;
28842
- result["ResourceRecords"] = (recordSet.ResourceRecords ?? []).map((r) => r.Value).filter((v) => typeof v === "string");
28922
+ if (!recordSet.AliasTarget) {
28923
+ if (recordSet.TTL !== void 0)
28924
+ result["TTL"] = recordSet.TTL;
28925
+ result["ResourceRecords"] = (recordSet.ResourceRecords ?? []).map((r) => r.Value).filter((v) => typeof v === "string");
28926
+ }
28843
28927
  if (recordSet.AliasTarget) {
28844
28928
  const at = {};
28845
28929
  if (recordSet.AliasTarget.HostedZoneId !== void 0) {
@@ -31738,7 +31822,9 @@ var AppSyncProvider = class {
31738
31822
  if (ds.type !== void 0)
31739
31823
  result["Type"] = ds.type;
31740
31824
  result["Description"] = ds.description ?? "";
31741
- result["ServiceRoleArn"] = ds.serviceRoleArn ?? "";
31825
+ if (ds.serviceRoleArn !== void 0 && ds.serviceRoleArn !== "") {
31826
+ result["ServiceRoleArn"] = ds.serviceRoleArn;
31827
+ }
31742
31828
  if (ds.dynamodbConfig) {
31743
31829
  const dynamo = {};
31744
31830
  if (ds.dynamodbConfig.tableName !== void 0)
@@ -31784,24 +31870,29 @@ var AppSyncProvider = class {
31784
31870
  result["TypeName"] = resolver.typeName;
31785
31871
  if (resolver.fieldName !== void 0)
31786
31872
  result["FieldName"] = resolver.fieldName;
31787
- result["DataSourceName"] = resolver.dataSourceName ?? "";
31788
- result["RequestMappingTemplate"] = resolver.requestMappingTemplate ?? "";
31789
- result["ResponseMappingTemplate"] = resolver.responseMappingTemplate ?? "";
31790
31873
  if (resolver.kind !== void 0)
31791
31874
  result["Kind"] = resolver.kind;
31792
- result["PipelineConfig"] = {
31793
- Functions: resolver.pipelineConfig?.functions ? [...resolver.pipelineConfig.functions] : []
31794
- };
31795
- {
31796
- const runtime = {};
31797
- if (resolver.runtime?.name !== void 0)
31798
- runtime["Name"] = resolver.runtime.name;
31799
- if (resolver.runtime?.runtimeVersion !== void 0) {
31875
+ const kind = resolver.kind ?? "UNIT";
31876
+ if (kind === "PIPELINE") {
31877
+ result["PipelineConfig"] = {
31878
+ Functions: resolver.pipelineConfig?.functions ? [...resolver.pipelineConfig.functions] : []
31879
+ };
31880
+ } else {
31881
+ if (resolver.dataSourceName !== void 0 && resolver.dataSourceName !== "") {
31882
+ result["DataSourceName"] = resolver.dataSourceName;
31883
+ }
31884
+ }
31885
+ if (resolver.runtime?.name) {
31886
+ result["Code"] = resolver.code ?? "";
31887
+ const runtime = { Name: resolver.runtime.name };
31888
+ if (resolver.runtime.runtimeVersion !== void 0) {
31800
31889
  runtime["RuntimeVersion"] = resolver.runtime.runtimeVersion;
31801
31890
  }
31802
31891
  result["Runtime"] = runtime;
31892
+ } else {
31893
+ result["RequestMappingTemplate"] = resolver.requestMappingTemplate ?? "";
31894
+ result["ResponseMappingTemplate"] = resolver.responseMappingTemplate ?? "";
31803
31895
  }
31804
- result["Code"] = resolver.code ?? "";
31805
31896
  return result;
31806
31897
  }
31807
31898
  async readApiKey(physicalId) {
@@ -36914,7 +37005,9 @@ var S3TablesProvider = class {
36914
37005
  import {
36915
37006
  ECRClient as ECRClient2,
36916
37007
  CreateRepositoryCommand,
37008
+ DeleteLifecyclePolicyCommand,
36917
37009
  DeleteRepositoryCommand,
37010
+ DeleteRepositoryPolicyCommand,
36918
37011
  DescribeRepositoriesCommand,
36919
37012
  GetLifecyclePolicyCommand,
36920
37013
  PutLifecyclePolicyCommand,
@@ -37064,19 +37157,42 @@ var ECRProvider = class {
37064
37157
  })
37065
37158
  );
37066
37159
  this.logger.debug(`Updated lifecycle policy for ${physicalId}`);
37160
+ } else if (oldLifecycle?.LifecyclePolicyText) {
37161
+ try {
37162
+ await this.getClient().send(
37163
+ new DeleteLifecyclePolicyCommand({ repositoryName: physicalId })
37164
+ );
37165
+ this.logger.debug(`Deleted lifecycle policy for ${physicalId}`);
37166
+ } catch (err) {
37167
+ if (!(err instanceof LifecyclePolicyNotFoundException))
37168
+ throw err;
37169
+ }
37067
37170
  }
37068
37171
  }
37069
37172
  const newPolicy = properties["RepositoryPolicyText"];
37070
37173
  const oldPolicy = previousProperties["RepositoryPolicyText"];
37071
- if (JSON.stringify(newPolicy) !== JSON.stringify(oldPolicy) && newPolicy) {
37072
- const policyText = typeof newPolicy === "string" ? newPolicy : JSON.stringify(newPolicy);
37073
- await this.getClient().send(
37074
- new SetRepositoryPolicyCommand({
37075
- repositoryName: physicalId,
37076
- policyText
37077
- })
37078
- );
37079
- this.logger.debug(`Updated repository policy for ${physicalId}`);
37174
+ if (JSON.stringify(newPolicy) !== JSON.stringify(oldPolicy)) {
37175
+ if (newPolicy !== void 0 && newPolicy !== null && newPolicy !== "") {
37176
+ const policyText = typeof newPolicy === "string" ? newPolicy : JSON.stringify(newPolicy);
37177
+ await this.getClient().send(
37178
+ new SetRepositoryPolicyCommand({
37179
+ repositoryName: physicalId,
37180
+ policyText
37181
+ })
37182
+ );
37183
+ this.logger.debug(`Updated repository policy for ${physicalId}`);
37184
+ } else if (oldPolicy !== void 0 && oldPolicy !== null && oldPolicy !== "") {
37185
+ try {
37186
+ await this.getClient().send(
37187
+ new DeleteRepositoryPolicyCommand({ repositoryName: physicalId })
37188
+ );
37189
+ this.logger.debug(`Deleted repository policy for ${physicalId}`);
37190
+ } catch (err) {
37191
+ const code = err?.name ?? err?.__type ?? "";
37192
+ if (!code.includes("RepositoryPolicyNotFound"))
37193
+ throw err;
37194
+ }
37195
+ }
37080
37196
  }
37081
37197
  const newTags = properties["Tags"];
37082
37198
  const oldTags = previousProperties["Tags"];
@@ -37207,10 +37323,9 @@ var ECRProvider = class {
37207
37323
  ScanOnPush: r.imageScanningConfiguration?.scanOnPush ?? false
37208
37324
  };
37209
37325
  {
37210
- const enc = {
37211
- EncryptionType: r.encryptionConfiguration?.encryptionType ?? "AES256"
37212
- };
37213
- if (r.encryptionConfiguration?.kmsKey !== void 0) {
37326
+ const encType = r.encryptionConfiguration?.encryptionType ?? "AES256";
37327
+ const enc = { EncryptionType: encType };
37328
+ if (encType === "KMS" && r.encryptionConfiguration?.kmsKey) {
37214
37329
  enc["KmsKey"] = r.encryptionConfiguration.kmsKey;
37215
37330
  }
37216
37331
  result["EncryptionConfiguration"] = enc;
@@ -43669,7 +43784,7 @@ function reorderArgs(argv) {
43669
43784
  }
43670
43785
  async function main() {
43671
43786
  const program = new Command14();
43672
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.9");
43787
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.11");
43673
43788
  program.addCommand(createBootstrapCommand());
43674
43789
  program.addCommand(createSynthCommand());
43675
43790
  program.addCommand(createListCommand());