@go-to-k/cdkd 0.110.0 → 0.111.1
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 +41 -7
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8074,7 +8074,8 @@ var DynamoDBGlobalTableProvider = class {
|
|
|
8074
8074
|
if (sse["SSEType"]) sseInput.SSEType = sse["SSEType"];
|
|
8075
8075
|
createParams.SSESpecification = sseInput;
|
|
8076
8076
|
}
|
|
8077
|
-
|
|
8077
|
+
const dpeResolved = extractLocalDeletionProtection(properties, currentRegion);
|
|
8078
|
+
if (dpeResolved !== void 0) createParams.DeletionProtectionEnabled = dpeResolved;
|
|
8078
8079
|
if (properties["TableClass"]) createParams.TableClass = properties["TableClass"];
|
|
8079
8080
|
const wodts = properties["WriteOnDemandThroughputSettings"];
|
|
8080
8081
|
if (wodts?.["MaxWriteRequestUnits"] !== void 0) createParams.OnDemandThroughput = { MaxWriteRequestUnits: Number(wodts["MaxWriteRequestUnits"]) };
|
|
@@ -8199,15 +8200,19 @@ var DynamoDBGlobalTableProvider = class {
|
|
|
8199
8200
|
const currentRegion = await this.dynamoDBClient.config.region() ?? "";
|
|
8200
8201
|
try {
|
|
8201
8202
|
await this.waitForTableActiveAfterUpdate(physicalId, logicalId);
|
|
8202
|
-
const
|
|
8203
|
+
const describeResp = await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }));
|
|
8204
|
+
const tableArn = describeResp.Table?.TableArn;
|
|
8203
8205
|
const extractLocalTags = (props) => {
|
|
8204
8206
|
return (props["Replicas"] ?? []).find((r) => r["Region"] === currentRegion)?.["Tags"];
|
|
8205
8207
|
};
|
|
8206
8208
|
if (tableArn) await this.applyTagDiff(tableArn, extractLocalTags(previousProperties), extractLocalTags(properties));
|
|
8209
|
+
const newDpe = extractLocalDeletionProtection(properties, currentRegion);
|
|
8210
|
+
const oldDpe = extractLocalDeletionProtection(previousProperties, currentRegion);
|
|
8211
|
+
const awsDpe = describeResp.Table?.DeletionProtectionEnabled;
|
|
8207
8212
|
const flatUpdate = { TableName: physicalId };
|
|
8208
8213
|
let flatChanged = false;
|
|
8209
|
-
if (
|
|
8210
|
-
flatUpdate.DeletionProtectionEnabled = Boolean(
|
|
8214
|
+
if (newDpe !== oldDpe || newDpe !== void 0 && typeof awsDpe === "boolean" && Boolean(newDpe) !== awsDpe) {
|
|
8215
|
+
flatUpdate.DeletionProtectionEnabled = Boolean(newDpe ?? false);
|
|
8211
8216
|
flatChanged = true;
|
|
8212
8217
|
}
|
|
8213
8218
|
if (properties["TableClass"] !== void 0 && properties["TableClass"] !== previousProperties["TableClass"]) {
|
|
@@ -8357,8 +8362,17 @@ var DynamoDBGlobalTableProvider = class {
|
|
|
8357
8362
|
await this.waitForTableActiveAfterUpdate(physicalId, logicalId);
|
|
8358
8363
|
}
|
|
8359
8364
|
if (!deepEqual$1(properties["TimeToLiveSpecification"], previousProperties["TimeToLiveSpecification"])) {
|
|
8365
|
+
const sendTtl = async (cmd) => {
|
|
8366
|
+
try {
|
|
8367
|
+
await this.dynamoDBClient.send(cmd);
|
|
8368
|
+
} catch (ttlErr) {
|
|
8369
|
+
const msg = ttlErr instanceof Error ? ttlErr.message : String(ttlErr);
|
|
8370
|
+
if (msg.includes("Time to live has been modified multiple times")) throw new ProvisioningError(`AWS rejected TimeToLive update on ${physicalId}: ${msg}. AWS enforces a ~4-hour rate limit on TTL changes per table; wait and redeploy, or keep the previous TTL state in this deploy.`, resourceType, logicalId, physicalId, ttlErr instanceof Error ? ttlErr : void 0);
|
|
8371
|
+
throw ttlErr;
|
|
8372
|
+
}
|
|
8373
|
+
};
|
|
8360
8374
|
const ttl = properties["TimeToLiveSpecification"];
|
|
8361
|
-
if (ttl?.["AttributeName"]) await
|
|
8375
|
+
if (ttl?.["AttributeName"]) await sendTtl(new UpdateTimeToLiveCommand({
|
|
8362
8376
|
TableName: physicalId,
|
|
8363
8377
|
TimeToLiveSpecification: {
|
|
8364
8378
|
Enabled: ttl["Enabled"] !== void 0 ? Boolean(ttl["Enabled"]) : true,
|
|
@@ -8367,7 +8381,7 @@ var DynamoDBGlobalTableProvider = class {
|
|
|
8367
8381
|
}));
|
|
8368
8382
|
else if (previousProperties["TimeToLiveSpecification"]) {
|
|
8369
8383
|
const prevTtl = previousProperties["TimeToLiveSpecification"];
|
|
8370
|
-
if (prevTtl["AttributeName"]) await
|
|
8384
|
+
if (prevTtl["AttributeName"]) await sendTtl(new UpdateTimeToLiveCommand({
|
|
8371
8385
|
TableName: physicalId,
|
|
8372
8386
|
TimeToLiveSpecification: {
|
|
8373
8387
|
Enabled: false,
|
|
@@ -9087,6 +9101,26 @@ var DynamoDBGlobalTableProvider = class {
|
|
|
9087
9101
|
* (per-replica, the deploy region's setting). Same literal-vs-auto-
|
|
9088
9102
|
* scaling-vs-default-5 precedence.
|
|
9089
9103
|
*/
|
|
9104
|
+
/**
|
|
9105
|
+
* Extract the local replica's `DeletionProtectionEnabled` from a CFn
|
|
9106
|
+
* properties shape. The `AWS::DynamoDB::GlobalTable` CFn schema places
|
|
9107
|
+
* the field inside `Replicas[?Region==<region>].DeletionProtectionEnabled`;
|
|
9108
|
+
* CDK 2.x's `deletionProtection: true` synthesizes there. Falls back
|
|
9109
|
+
* to the top-level `DeletionProtectionEnabled` for legacy or
|
|
9110
|
+
* hand-authored templates (the property doesn't formally exist at
|
|
9111
|
+
* the top level in the CFn schema, but cdkd tolerates it as a
|
|
9112
|
+
* pass-through to avoid breaking older state files).
|
|
9113
|
+
*
|
|
9114
|
+
* Returns `undefined` when neither shape carries a boolean — the
|
|
9115
|
+
* caller treats that as "unset" and does not include the field in
|
|
9116
|
+
* the SDK call.
|
|
9117
|
+
*/
|
|
9118
|
+
function extractLocalDeletionProtection(props, region) {
|
|
9119
|
+
const perReplica = (props["Replicas"] ?? []).find((r) => r["Region"] === region)?.["DeletionProtectionEnabled"];
|
|
9120
|
+
if (typeof perReplica === "boolean") return perReplica;
|
|
9121
|
+
const topLevel = props["DeletionProtectionEnabled"];
|
|
9122
|
+
return typeof topLevel === "boolean" ? topLevel : void 0;
|
|
9123
|
+
}
|
|
9090
9124
|
function derivePerCallProvisionedThroughput(properties, region) {
|
|
9091
9125
|
const wps = properties["WriteProvisionedThroughputSettings"];
|
|
9092
9126
|
const writeAutoScaling = wps?.["WriteCapacityAutoScalingSettings"];
|
|
@@ -45246,7 +45280,7 @@ function reorderArgs(argv) {
|
|
|
45246
45280
|
*/
|
|
45247
45281
|
async function main() {
|
|
45248
45282
|
const program = new Command();
|
|
45249
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
45283
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.111.1");
|
|
45250
45284
|
program.addCommand(createBootstrapCommand());
|
|
45251
45285
|
program.addCommand(createSynthCommand());
|
|
45252
45286
|
program.addCommand(createListCommand());
|