@go-to-k/cdkd 0.231.1 → 0.231.3

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
@@ -1445,7 +1445,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1445
1445
  const FLUSH_EVENT_THRESHOLD = 50;
1446
1446
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1447
1447
  function getCdkdVersion() {
1448
- return "0.231.1";
1448
+ return "0.231.3";
1449
1449
  }
1450
1450
  /**
1451
1451
  * Generate a time-sortable unique run id, e.g.
@@ -9152,6 +9152,25 @@ function classifyEventSource(resp) {
9152
9152
  if (arn.startsWith("arn:aws:rds:") || arn.startsWith("arn:aws-cn:rds:")) return "documentdb";
9153
9153
  return "unknown";
9154
9154
  }
9155
+ /**
9156
+ * Classify an event source mapping from its CFn property bag (as opposed to
9157
+ * `classifyEventSource`, which reads an AWS `GetEventSourceMapping` response).
9158
+ * The discriminating keys are identical in both shapes (`EventSourceArn` plus
9159
+ * the four `*EventSourceConfig` / `SelfManagedEventSource` markers), so this
9160
+ * is a thin type-narrowing adapter over the same logic. Used by `update()`'s
9161
+ * removal-clear path (issue #976) to gate source-kind-specific clears
9162
+ * (`FunctionResponseTypes` / `SourceAccessConfigurations` /
9163
+ * `MaximumBatchingWindowInSeconds`).
9164
+ */
9165
+ function classifyEventSourceFromProperties(properties) {
9166
+ return classifyEventSource({
9167
+ EventSourceArn: properties["EventSourceArn"],
9168
+ SelfManagedEventSource: properties["SelfManagedEventSource"],
9169
+ AmazonManagedKafkaEventSourceConfig: properties["AmazonManagedKafkaEventSourceConfig"],
9170
+ SelfManagedKafkaEventSourceConfig: properties["SelfManagedKafkaEventSourceConfig"],
9171
+ DocumentDBEventSourceConfig: properties["DocumentDBEventSourceConfig"]
9172
+ });
9173
+ }
9155
9174
  const KINDS_WITH_FUNCTION_RESPONSE_TYPES = new Set([
9156
9175
  "sqs",
9157
9176
  "kinesis",
@@ -9163,6 +9182,28 @@ const KINDS_WITH_SOURCE_ACCESS_CONFIGURATIONS = new Set([
9163
9182
  "documentdb"
9164
9183
  ]);
9165
9184
  /**
9185
+ * Source kinds whose `MaximumBatchingWindowInSeconds` default is `0` seconds
9186
+ * (SQS / Kinesis / DynamoDB). The poll-based kinds (Kafka / MSK / MQ /
9187
+ * DocumentDB) default to 500 ms, which cannot be restored via
9188
+ * `UpdateEventSourceMapping` (the field only accepts whole-second increments),
9189
+ * so the removal-on-UPDATE path only restores `0` for these kinds — see the
9190
+ * comment at the `MaximumBatchingWindowInSeconds` clear in `update()`.
9191
+ */
9192
+ const KINDS_WITH_ZERO_BATCHING_WINDOW_DEFAULT = new Set([
9193
+ "sqs",
9194
+ "kinesis",
9195
+ "dynamodb"
9196
+ ]);
9197
+ /**
9198
+ * Source kinds that accept the stream-processing numeric parameters
9199
+ * (`MaximumRetryAttempts` / `MaximumRecordAgeInSeconds` /
9200
+ * `ParallelizationFactor` / `TumblingWindowInSeconds`) — Kinesis / DynamoDB
9201
+ * streams only. AWS rejects these on SQS / Kafka / MQ / DocumentDB, so the
9202
+ * removal-on-UPDATE default-restore path is gated on this set (see the numeric
9203
+ * restores in `update()`).
9204
+ */
9205
+ const KINDS_WITH_STREAM_NUMERICS = new Set(["kinesis", "dynamodb"]);
9206
+ /**
9166
9207
  * AWS Lambda Event Source Mapping Provider
9167
9208
  *
9168
9209
  * Implements resource provisioning for AWS::Lambda::EventSourceMapping using the Lambda SDK.
@@ -9287,6 +9328,22 @@ var LambdaEventSourceMappingProvider = class {
9287
9328
  if (properties["LoggingConfig"] !== void 0) updateParams.LoggingConfig = properties["LoggingConfig"];
9288
9329
  if (properties["MetricsConfig"] !== void 0) updateParams.MetricsConfig = properties["MetricsConfig"];
9289
9330
  if (properties["ProvisionedPollerConfig"] !== void 0) updateParams.ProvisionedPollerConfig = properties["ProvisionedPollerConfig"];
9331
+ const wasSet = (key) => previousProperties[key] !== void 0 && properties[key] === void 0;
9332
+ const prevKind = classifyEventSourceFromProperties(previousProperties);
9333
+ if (wasSet("FilterCriteria")) updateParams.FilterCriteria = {};
9334
+ if (wasSet("ScalingConfig")) updateParams.ScalingConfig = {};
9335
+ if (wasSet("DestinationConfig")) updateParams.DestinationConfig = {};
9336
+ if (wasSet("FunctionResponseTypes") && KINDS_WITH_FUNCTION_RESPONSE_TYPES.has(prevKind)) updateParams.FunctionResponseTypes = [];
9337
+ if (wasSet("SourceAccessConfigurations") && KINDS_WITH_SOURCE_ACCESS_CONFIGURATIONS.has(prevKind)) updateParams.SourceAccessConfigurations = [];
9338
+ if (wasSet("MetricsConfig")) updateParams.MetricsConfig = { Metrics: [] };
9339
+ if (wasSet("KmsKeyArn")) updateParams.KMSKeyArn = "";
9340
+ if (KINDS_WITH_STREAM_NUMERICS.has(prevKind)) {
9341
+ if (wasSet("MaximumRetryAttempts")) updateParams.MaximumRetryAttempts = -1;
9342
+ if (wasSet("MaximumRecordAgeInSeconds")) updateParams.MaximumRecordAgeInSeconds = -1;
9343
+ if (wasSet("ParallelizationFactor")) updateParams.ParallelizationFactor = 1;
9344
+ if (wasSet("TumblingWindowInSeconds")) updateParams.TumblingWindowInSeconds = 0;
9345
+ }
9346
+ if (wasSet("MaximumBatchingWindowInSeconds") && KINDS_WITH_ZERO_BATCHING_WINDOW_DEFAULT.has(prevKind)) updateParams.MaximumBatchingWindowInSeconds = 0;
9290
9347
  const eventSourceMappingArn = (await this.lambdaClient.send(new UpdateEventSourceMappingCommand(updateParams))).EventSourceMappingArn;
9291
9348
  if (eventSourceMappingArn) await this.applyTagDiff(eventSourceMappingArn, previousProperties["Tags"], properties["Tags"]);
9292
9349
  this.logger.debug(`Successfully updated event source mapping ${logicalId}`);
@@ -20654,6 +20711,13 @@ var ECSProvider = class {
20654
20711
  const newServiceName = properties["ServiceName"];
20655
20712
  const oldServiceName = previousProperties["ServiceName"];
20656
20713
  if (newServiceName && oldServiceName && newServiceName !== oldServiceName) throw new ProvisioningError(`Cannot update ServiceName for ECS service ${logicalId} (immutable property, requires replacement)`, resourceType, logicalId, physicalId);
20714
+ const deploymentControllerType = properties["DeploymentController"]?.["Type"] ?? "ECS";
20715
+ const isEcsController = deploymentControllerType === "ECS";
20716
+ const loadBalancersChanged = JSON.stringify(previousProperties["LoadBalancers"] ?? null) !== JSON.stringify(properties["LoadBalancers"] ?? null);
20717
+ const serviceRegistriesChanged = JSON.stringify(previousProperties["ServiceRegistries"] ?? null) !== JSON.stringify(properties["ServiceRegistries"] ?? null);
20718
+ if (!isEcsController && (loadBalancersChanged || serviceRegistriesChanged)) throw new ProvisioningError(`AWS::ECS::Service '${logicalId}' changes LoadBalancers/ServiceRegistries under the '${deploymentControllerType}' deployment controller, which applies them via a new CodeDeploy deployment / task set rather than UpdateService. cdkd does not support updating these under a non-ECS controller; recreate the service or manage the blue/green deployment out-of-band.`, resourceType, logicalId, physicalId);
20719
+ const loadBalancersInput = isEcsController && loadBalancersChanged ? this.convertLoadBalancers(properties["LoadBalancers"]) ?? [] : void 0;
20720
+ const serviceRegistriesInput = isEcsController && serviceRegistriesChanged ? properties["ServiceRegistries"] ?? [] : void 0;
20657
20721
  try {
20658
20722
  const service = (await client.send(new UpdateServiceCommand({
20659
20723
  cluster: properties["Cluster"],
@@ -20667,7 +20731,11 @@ var ECSProvider = class {
20667
20731
  placementStrategy: properties["PlacementStrategies"] ?? properties["PlacementStrategy"],
20668
20732
  platformVersion: properties["PlatformVersion"],
20669
20733
  healthCheckGracePeriodSeconds: properties["HealthCheckGracePeriodSeconds"],
20670
- enableExecuteCommand: properties["EnableExecuteCommand"]
20734
+ enableECSManagedTags: properties["EnableECSManagedTags"],
20735
+ propagateTags: properties["PropagateTags"],
20736
+ enableExecuteCommand: properties["EnableExecuteCommand"],
20737
+ loadBalancers: loadBalancersInput,
20738
+ serviceRegistries: serviceRegistriesInput
20671
20739
  }))).service;
20672
20740
  if (service?.serviceArn) await this.applyTagDiff(service.serviceArn, previousProperties["Tags"], properties["Tags"]);
20673
20741
  return {
@@ -55457,7 +55525,7 @@ function reorderArgs(argv) {
55457
55525
  async function main() {
55458
55526
  installPipeCloseHandler();
55459
55527
  const program = new Command();
55460
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.1");
55528
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.3");
55461
55529
  program.addCommand(createBootstrapCommand());
55462
55530
  program.addCommand(createSynthCommand());
55463
55531
  program.addCommand(createListCommand());