@go-to-k/cdkd 0.227.0 → 0.227.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { A as withErrorHandling, B as generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
|
|
3
3
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
|
|
4
|
-
import { $ as findLargeInlineResources, A as shouldRetainResource, B as getDockerImageBySourceHash, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveCaptureObservedState, H as getDefaultStateBucketName, I as getDockerCmd, J as resolveStateBucketWithDefaultAndSource, K as resolveSkipPrefix, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as MIGRATE_TMP_PREFIX, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as getLegacyStateBucketName, V as Synthesizer, W as resolveApp, X as CFN_TEMPLATE_BODY_LIMIT, Y as warnDeprecatedNoPrefixCliFlag, Z as CFN_TEMPLATE_URL_LIMIT, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, et as uploadCfnTemplate, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as resolveStateBucketWithDefault, r as DeployEngine, rt as resolveBucketRegion, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as AssemblyReader, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as AssetManifestLoader } from "./deploy-engine-
|
|
4
|
+
import { $ as findLargeInlineResources, A as shouldRetainResource, B as getDockerImageBySourceHash, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveCaptureObservedState, H as getDefaultStateBucketName, I as getDockerCmd, J as resolveStateBucketWithDefaultAndSource, K as resolveSkipPrefix, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as MIGRATE_TMP_PREFIX, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as getLegacyStateBucketName, V as Synthesizer, W as resolveApp, X as CFN_TEMPLATE_BODY_LIMIT, Y as warnDeprecatedNoPrefixCliFlag, Z as CFN_TEMPLATE_URL_LIMIT, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, et as uploadCfnTemplate, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as resolveStateBucketWithDefault, r as DeployEngine, rt as resolveBucketRegion, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as AssemblyReader, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as AssetManifestLoader } from "./deploy-engine-Bl_Ka0hj.js";
|
|
5
5
|
import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
@@ -1552,7 +1552,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1552
1552
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1553
1553
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1554
1554
|
function getCdkdVersion() {
|
|
1555
|
-
return "0.227.
|
|
1555
|
+
return "0.227.1";
|
|
1556
1556
|
}
|
|
1557
1557
|
/**
|
|
1558
1558
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -9757,6 +9757,7 @@ var DynamoDBTableProvider = class {
|
|
|
9757
9757
|
this.logger.debug(`Updated WarmThroughput on DynamoDB table ${physicalId}`);
|
|
9758
9758
|
}
|
|
9759
9759
|
}
|
|
9760
|
+
if (JSON.stringify(properties["GlobalSecondaryIndexes"]) !== JSON.stringify(previousProperties["GlobalSecondaryIndexes"])) await this.applyGsiUpdates(physicalId, resourceType, logicalId, previousProperties["GlobalSecondaryIndexes"], properties["GlobalSecondaryIndexes"], properties["AttributeDefinitions"]);
|
|
9760
9761
|
if (JSON.stringify(properties["PointInTimeRecoverySpecification"]) !== JSON.stringify(previousProperties["PointInTimeRecoverySpecification"])) await this.applyPointInTimeRecovery(physicalId, properties["PointInTimeRecoverySpecification"], previousProperties["PointInTimeRecoverySpecification"]);
|
|
9761
9762
|
if (JSON.stringify(properties["TimeToLiveSpecification"]) !== JSON.stringify(previousProperties["TimeToLiveSpecification"])) await this.applyTimeToLive(physicalId, properties["TimeToLiveSpecification"], previousProperties["TimeToLiveSpecification"]);
|
|
9762
9763
|
if (JSON.stringify(properties["ResourcePolicy"]) !== JSON.stringify(previousProperties["ResourcePolicy"])) {
|
|
@@ -10082,6 +10083,79 @@ var DynamoDBTableProvider = class {
|
|
|
10082
10083
|
throw new Error(`Table ${tableName} did not reach ACTIVE status within ${maxAttempts} seconds after UpdateTable`);
|
|
10083
10084
|
}
|
|
10084
10085
|
/**
|
|
10086
|
+
* Poll DescribeTable until the table is ACTIVE AND every Global Secondary
|
|
10087
|
+
* Index is ACTIVE (not CREATING / UPDATING / DELETING / BACKFILLING). Used
|
|
10088
|
+
* between GSI mutations because a freshly-created index keeps backfilling
|
|
10089
|
+
* after the table itself returns to ACTIVE, and AWS rejects the next GSI op
|
|
10090
|
+
* until the prior index settles.
|
|
10091
|
+
*/
|
|
10092
|
+
async waitForTableAndIndexesActive(tableName, maxAttempts = 1800) {
|
|
10093
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
10094
|
+
const table = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: tableName }))).Table;
|
|
10095
|
+
const tableActive = table?.TableStatus === "ACTIVE";
|
|
10096
|
+
const indexesActive = (table?.GlobalSecondaryIndexes ?? []).every((gsi) => gsi.IndexStatus === "ACTIVE");
|
|
10097
|
+
if (tableActive && indexesActive) return;
|
|
10098
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
10099
|
+
}
|
|
10100
|
+
throw new Error(`Table ${tableName} and its global secondary indexes did not reach ACTIVE within ${maxAttempts} seconds after UpdateTable`);
|
|
10101
|
+
}
|
|
10102
|
+
/**
|
|
10103
|
+
* Apply Global Secondary Index add / remove / per-index throughput changes
|
|
10104
|
+
* via UpdateTable's `GlobalSecondaryIndexUpdates`.
|
|
10105
|
+
*
|
|
10106
|
+
* AWS constraints mirrored here:
|
|
10107
|
+
* - At most ONE GSI Create or Delete per UpdateTable call; a second
|
|
10108
|
+
* mutation while the table / an index is still building is rejected. Each
|
|
10109
|
+
* op therefore runs in its own UpdateTable and waits for ACTIVE before the
|
|
10110
|
+
* next (creating GSIs also go through a BACKFILLING phase that ACTIVE
|
|
10111
|
+
* covers).
|
|
10112
|
+
* - A GSI `Create` must carry the AttributeDefinitions for the new index's
|
|
10113
|
+
* key attributes — the full desired AttributeDefinitions array is passed
|
|
10114
|
+
* so every newly-referenced attribute is defined.
|
|
10115
|
+
* - On an existing same-name index, only a PROVISIONED `ProvisionedThroughput`
|
|
10116
|
+
* (RCU/WCU) change is mutable in place and is issued as an `Update`. A
|
|
10117
|
+
* `KeySchema` / `Projection` change is immutable in place (AWS models it as
|
|
10118
|
+
* a delete + re-create); since the diff keys GSIs by name it would not emit
|
|
10119
|
+
* a remove-then-add pair, so this method throws on such a change rather than
|
|
10120
|
+
* silently dropping it.
|
|
10121
|
+
*/
|
|
10122
|
+
async applyGsiUpdates(physicalId, resourceType, logicalId, previousGsis, desiredGsis, desiredAttributeDefinitions) {
|
|
10123
|
+
const prev = previousGsis ?? [];
|
|
10124
|
+
const desired = desiredGsis ?? [];
|
|
10125
|
+
const prevByName = new Map(prev.filter((g) => g.IndexName).map((g) => [g.IndexName, g]));
|
|
10126
|
+
const desiredByName = new Map(desired.filter((g) => g.IndexName).map((g) => [g.IndexName, g]));
|
|
10127
|
+
const ops = [];
|
|
10128
|
+
for (const name of prevByName.keys()) if (!desiredByName.has(name)) ops.push({ Delete: { IndexName: name } });
|
|
10129
|
+
for (const [name, gsi] of desiredByName) if (!prevByName.has(name)) {
|
|
10130
|
+
if (!gsi.KeySchema) throw new ProvisioningError(`GlobalSecondaryIndex ${name} on DynamoDB table ${logicalId} is missing KeySchema`, resourceType, logicalId, physicalId);
|
|
10131
|
+
ops.push({ Create: {
|
|
10132
|
+
IndexName: name,
|
|
10133
|
+
KeySchema: gsi.KeySchema,
|
|
10134
|
+
Projection: gsi.Projection,
|
|
10135
|
+
...gsi.ProvisionedThroughput ? { ProvisionedThroughput: gsi.ProvisionedThroughput } : {},
|
|
10136
|
+
...gsi.OnDemandThroughput ? { OnDemandThroughput: gsi.OnDemandThroughput } : {}
|
|
10137
|
+
} });
|
|
10138
|
+
} else {
|
|
10139
|
+
const before = prevByName.get(name);
|
|
10140
|
+
if (JSON.stringify(before.KeySchema) !== JSON.stringify(gsi.KeySchema) || JSON.stringify(before.Projection) !== JSON.stringify(gsi.Projection)) throw new ProvisioningError(`GlobalSecondaryIndex ${name} on DynamoDB table ${logicalId} changed its KeySchema or Projection, which DynamoDB cannot modify in place. Rename the index (so it is dropped and re-created) or replace the table.`, resourceType, logicalId, physicalId);
|
|
10141
|
+
if (gsi.ProvisionedThroughput && JSON.stringify(before.ProvisionedThroughput) !== JSON.stringify(gsi.ProvisionedThroughput)) ops.push({ Update: {
|
|
10142
|
+
IndexName: name,
|
|
10143
|
+
ProvisionedThroughput: gsi.ProvisionedThroughput
|
|
10144
|
+
} });
|
|
10145
|
+
}
|
|
10146
|
+
for (const op of ops) {
|
|
10147
|
+
const input = {
|
|
10148
|
+
TableName: physicalId,
|
|
10149
|
+
GlobalSecondaryIndexUpdates: [op]
|
|
10150
|
+
};
|
|
10151
|
+
if (op.Create && desiredAttributeDefinitions) input.AttributeDefinitions = desiredAttributeDefinitions;
|
|
10152
|
+
await this.dynamoDBClient.send(new UpdateTableCommand(input));
|
|
10153
|
+
await this.waitForTableAndIndexesActive(physicalId);
|
|
10154
|
+
const verb = op.Create ? "created" : op.Delete ? "deleted" : "updated";
|
|
10155
|
+
this.logger.debug(`${verb} GSI ${op.Create?.IndexName ?? op.Delete?.IndexName ?? op.Update?.IndexName} on DynamoDB table ${physicalId}`);
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
/**
|
|
10085
10159
|
* Resolve a single `Fn::GetAtt` attribute for an existing DynamoDB table.
|
|
10086
10160
|
*
|
|
10087
10161
|
* CloudFormation's `AWS::DynamoDB::Table` exposes `Arn`, `StreamArn`
|
|
@@ -54622,7 +54696,7 @@ function reorderArgs(argv) {
|
|
|
54622
54696
|
async function main() {
|
|
54623
54697
|
installPipeCloseHandler();
|
|
54624
54698
|
const program = new Command();
|
|
54625
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.227.
|
|
54699
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.227.1");
|
|
54626
54700
|
program.addCommand(createBootstrapCommand());
|
|
54627
54701
|
program.addCommand(createSynthCommand());
|
|
54628
54702
|
program.addCommand(createListCommand());
|