@go-to-k/cdkd 0.231.5 → 0.231.6

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.6";
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' }`.
@@ -55531,7 +55594,7 @@ function reorderArgs(argv) {
55531
55594
  async function main() {
55532
55595
  installPipeCloseHandler();
55533
55596
  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");
55597
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.231.6");
55535
55598
  program.addCommand(createBootstrapCommand());
55536
55599
  program.addCommand(createSynthCommand());
55537
55600
  program.addCommand(createListCommand());