@go-to-k/cdkd 0.231.5 → 0.231.7

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.5";
1448
+ return "0.231.7";
1449
1449
  }
1450
1450
  /**
1451
1451
  * Generate a time-sortable unique run id, e.g.
@@ -10091,6 +10091,7 @@ var DynamoDBTableProvider = class {
10091
10091
  this.logger.debug(`Updating DynamoDB table ${logicalId}: ${physicalId}`);
10092
10092
  try {
10093
10093
  const table = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table;
10094
+ let latestStreamArn = table?.LatestStreamArn;
10094
10095
  if (table?.TableArn) await this.applyTagDiff(table.TableArn, previousProperties["Tags"], properties["Tags"]);
10095
10096
  const normalizeTableClass = (v) => typeof v === "string" && v.length > 0 ? v : "STANDARD";
10096
10097
  const tableClassChanged = normalizeTableClass(properties["TableClass"]) !== normalizeTableClass(previousProperties["TableClass"]);
@@ -10140,6 +10141,46 @@ var DynamoDBTableProvider = class {
10140
10141
  this.logger.debug(`Updated SSESpecification on DynamoDB table ${physicalId}`);
10141
10142
  }
10142
10143
  }
10144
+ if (JSON.stringify(properties["StreamSpecification"]) !== JSON.stringify(previousProperties["StreamSpecification"])) {
10145
+ const newViewType = this.extractStreamViewType(properties["StreamSpecification"]);
10146
+ const prevViewType = this.extractStreamViewType(previousProperties["StreamSpecification"]);
10147
+ if (newViewType && prevViewType && newViewType !== prevViewType) {
10148
+ await this.dynamoDBClient.send(new UpdateTableCommand({
10149
+ TableName: physicalId,
10150
+ StreamSpecification: { StreamEnabled: false }
10151
+ }));
10152
+ await this.waitForTableActiveAfterUpdate(physicalId);
10153
+ const reenable = await this.dynamoDBClient.send(new UpdateTableCommand({
10154
+ TableName: physicalId,
10155
+ StreamSpecification: {
10156
+ StreamEnabled: true,
10157
+ StreamViewType: newViewType
10158
+ }
10159
+ }));
10160
+ await this.waitForTableActiveAfterUpdate(physicalId);
10161
+ latestStreamArn = reenable.TableDescription?.LatestStreamArn ?? await this.describeLatestStreamArn(physicalId);
10162
+ this.logger.debug(`Changed StreamViewType on DynamoDB table ${physicalId} to ${newViewType}`);
10163
+ } else if (newViewType) {
10164
+ const enable = await this.dynamoDBClient.send(new UpdateTableCommand({
10165
+ TableName: physicalId,
10166
+ StreamSpecification: {
10167
+ StreamEnabled: true,
10168
+ StreamViewType: newViewType
10169
+ }
10170
+ }));
10171
+ await this.waitForTableActiveAfterUpdate(physicalId);
10172
+ latestStreamArn = enable.TableDescription?.LatestStreamArn ?? await this.describeLatestStreamArn(physicalId);
10173
+ this.logger.debug(`Enabled DynamoDB Stream on table ${physicalId} (${newViewType})`);
10174
+ } else {
10175
+ await this.dynamoDBClient.send(new UpdateTableCommand({
10176
+ TableName: physicalId,
10177
+ StreamSpecification: { StreamEnabled: false }
10178
+ }));
10179
+ await this.waitForTableActiveAfterUpdate(physicalId);
10180
+ latestStreamArn = void 0;
10181
+ this.logger.debug(`Disabled DynamoDB Stream on table ${physicalId}`);
10182
+ }
10183
+ }
10143
10184
  if (JSON.stringify(properties["GlobalSecondaryIndexes"]) !== JSON.stringify(previousProperties["GlobalSecondaryIndexes"])) await this.applyGsiUpdates(physicalId, resourceType, logicalId, previousProperties["GlobalSecondaryIndexes"], properties["GlobalSecondaryIndexes"], properties["AttributeDefinitions"]);
10144
10185
  if (JSON.stringify(properties["PointInTimeRecoverySpecification"]) !== JSON.stringify(previousProperties["PointInTimeRecoverySpecification"])) await this.applyPointInTimeRecovery(physicalId, properties["PointInTimeRecoverySpecification"], previousProperties["PointInTimeRecoverySpecification"]);
10145
10186
  if (JSON.stringify(properties["TimeToLiveSpecification"]) !== JSON.stringify(previousProperties["TimeToLiveSpecification"])) {
@@ -10158,7 +10199,7 @@ var DynamoDBTableProvider = class {
10158
10199
  attributes: {
10159
10200
  Arn: table?.TableArn,
10160
10201
  TableId: table?.TableId,
10161
- StreamArn: table?.LatestStreamArn,
10202
+ StreamArn: latestStreamArn,
10162
10203
  TableName: physicalId
10163
10204
  }
10164
10205
  };
@@ -10445,6 +10486,28 @@ var DynamoDBTableProvider = class {
10445
10486
  return typeof arn === "string" ? arn : void 0;
10446
10487
  }
10447
10488
  /**
10489
+ * Extract the `StreamViewType` from a CFn `StreamSpecification` block. Returns
10490
+ * undefined when the spec is absent (no stream) — which is how update() tells
10491
+ * an enable / disable apart from a view-type change. CDK always emits a
10492
+ * StreamViewType when a stream is enabled (there is no valid enabled stream
10493
+ * without one), so a present spec implies a present view type; defensively
10494
+ * returns undefined for a malformed spec with no StreamViewType.
10495
+ */
10496
+ extractStreamViewType(spec) {
10497
+ if (spec === void 0 || spec === null) return void 0;
10498
+ const viewType = spec["StreamViewType"];
10499
+ return typeof viewType === "string" && viewType.length > 0 ? viewType : void 0;
10500
+ }
10501
+ /**
10502
+ * Fetch the table's current `LatestStreamArn` via DescribeTable. Used as a
10503
+ * fallback when an UpdateTable that enabled a stream did not echo the ARN
10504
+ * back in its TableDescription, so `Fn::GetAtt [Table, StreamArn]` still
10505
+ * resolves after an update-time enable.
10506
+ */
10507
+ async describeLatestStreamArn(tableName) {
10508
+ return (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: tableName }))).Table?.LatestStreamArn;
10509
+ }
10510
+ /**
10448
10511
  * Apply the table's `ContributorInsightsSpecification` via the separate
10449
10512
  * `UpdateContributorInsights` API (NOT a field on CreateTable). CFn shape is
10450
10513
  * `{ Enabled: boolean, Mode?: 'ACCESSED_AND_THROTTLED_KEYS' | 'THROTTLED_KEYS' }`.
@@ -20068,9 +20131,9 @@ var StepFunctionsProvider = class {
20068
20131
  this.logger.debug(`Updating Step Functions state machine ${logicalId}: ${physicalId}`);
20069
20132
  try {
20070
20133
  const definitionString = await this.buildDefinitionString(properties);
20071
- const encryptionConfiguration = mapEncryptionConfiguration(properties["EncryptionConfiguration"]);
20072
- const loggingConfiguration = mapLoggingConfiguration(properties["LoggingConfiguration"]);
20073
- const tracingConfiguration = mapTracingConfiguration(properties["TracingConfiguration"]);
20134
+ const encryptionConfiguration = mapEncryptionConfiguration(properties["EncryptionConfiguration"]) ?? disabledEncryptionConfigurationOnRemoval(previousProperties["EncryptionConfiguration"], properties["EncryptionConfiguration"]);
20135
+ const loggingConfiguration = mapLoggingConfiguration(properties["LoggingConfiguration"]) ?? disabledLoggingConfigurationOnRemoval(previousProperties["LoggingConfiguration"], properties["LoggingConfiguration"]);
20136
+ const tracingConfiguration = mapTracingConfiguration(properties["TracingConfiguration"]) ?? disabledTracingConfigurationOnRemoval(previousProperties["TracingConfiguration"], properties["TracingConfiguration"]);
20074
20137
  await this.getClient().send(new UpdateStateMachineCommand({
20075
20138
  stateMachineArn: physicalId,
20076
20139
  definition: definitionString,
@@ -20394,6 +20457,59 @@ function mapTracingConfiguration(value) {
20394
20457
  if (cfg["Enabled"] === void 0) return void 0;
20395
20458
  return { enabled: cfg["Enabled"] };
20396
20459
  }
20460
+ /**
20461
+ * Return the SDK disable payload for `EncryptionConfiguration` when it was
20462
+ * present+configured in the previous properties but is absent/placeholder in
20463
+ * the new ones; otherwise `undefined` (no clear needed). `AWS_OWNED_KEY` is
20464
+ * the AWS default, so this resets a customer-managed-key config back to default.
20465
+ */
20466
+ function disabledEncryptionConfigurationOnRemoval(previous, next) {
20467
+ if (!wasMeaningfullyConfigured(previous, "Type")) return void 0;
20468
+ if (mapEncryptionConfiguration(next) !== void 0) return void 0;
20469
+ return { type: "AWS_OWNED_KEY" };
20470
+ }
20471
+ /**
20472
+ * Return the SDK disable payload for `LoggingConfiguration` when it was
20473
+ * present+configured in the previous properties but is absent/placeholder in
20474
+ * the new ones; otherwise `undefined`. `level: OFF` disables logging;
20475
+ * `destinations: []` clears the log destinations (only required when level is
20476
+ * not OFF, so an empty list is accepted alongside OFF).
20477
+ */
20478
+ function disabledLoggingConfigurationOnRemoval(previous, next) {
20479
+ if (!wasMeaningfullyConfigured(previous, "Level")) return void 0;
20480
+ if (mapLoggingConfiguration(next) !== void 0) return void 0;
20481
+ return {
20482
+ level: "OFF",
20483
+ includeExecutionData: false,
20484
+ destinations: []
20485
+ };
20486
+ }
20487
+ /**
20488
+ * Return the SDK disable payload for `TracingConfiguration` when it was
20489
+ * present+enabled in the previous properties but is absent/placeholder in the
20490
+ * new ones; otherwise `undefined`. `enabled: false` turns X-Ray tracing off.
20491
+ *
20492
+ * Unlike logging/encryption, the "meaningful" signal here is `Enabled === true`
20493
+ * (a previous `{ Enabled: false }` is already the AWS default, so there is
20494
+ * nothing to clear).
20495
+ */
20496
+ function disabledTracingConfigurationOnRemoval(previous, next) {
20497
+ if (previous === null || typeof previous !== "object") return void 0;
20498
+ if (previous["Enabled"] !== true) return void 0;
20499
+ if (mapTracingConfiguration(next) !== void 0) return void 0;
20500
+ return { enabled: false };
20501
+ }
20502
+ /**
20503
+ * True when `value` is an object that carries a defined `discriminatorKey`
20504
+ * field (`Level` for logging, `Type` for encryption) — i.e. it was a real,
20505
+ * non-placeholder config in the previous properties. The empty-placeholder
20506
+ * shape `{}` that `readCurrentState` emits has no discriminator, so it returns
20507
+ * false and no clear is emitted.
20508
+ */
20509
+ function wasMeaningfullyConfigured(value, discriminatorKey) {
20510
+ if (value === null || typeof value !== "object") return false;
20511
+ return value[discriminatorKey] !== void 0;
20512
+ }
20397
20513
 
20398
20514
  //#endregion
20399
20515
  //#region src/provisioning/providers/ecs-provider.ts
@@ -55531,7 +55647,7 @@ function reorderArgs(argv) {
55531
55647
  async function main() {
55532
55648
  installPipeCloseHandler();
55533
55649
  const program = new Command();
55534
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.5");
55650
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.7");
55535
55651
  program.addCommand(createBootstrapCommand());
55536
55652
  program.addCommand(createSynthCommand());
55537
55653
  program.addCommand(createListCommand());