@go-to-k/cdkd 0.231.1 → 0.231.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
@@ -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.2";
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}`);
@@ -55457,7 +55514,7 @@ function reorderArgs(argv) {
55457
55514
  async function main() {
55458
55515
  installPipeCloseHandler();
55459
55516
  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");
55517
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.2");
55461
55518
  program.addCommand(createBootstrapCommand());
55462
55519
  program.addCommand(createSynthCommand());
55463
55520
  program.addCommand(createListCommand());