@go-to-k/cdkd 0.221.14 → 0.221.16

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
@@ -59,8 +59,8 @@ import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand,
59
59
  import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListDeliveryStreamsCommand, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$9, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
60
60
  import { AddTagsCommand as AddTagsCommand$1, CloudTrailClient, CreateTrailCommand, DeleteTrailCommand, GetEventSelectorsCommand, GetInsightSelectorsCommand, GetTrailCommand, GetTrailStatusCommand, ListTagsCommand as ListTagsCommand$1, ListTrailsCommand, PutEventSelectorsCommand, PutInsightSelectorsCommand, RemoveTagsCommand as RemoveTagsCommand$1, StartLoggingCommand, StopLoggingCommand, TrailNotFoundException, UpdateTrailCommand } from "@aws-sdk/client-cloudtrail";
61
61
  import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ListProjectsCommand, ResourceNotFoundException as ResourceNotFoundException$10, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
62
- import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketCommand, GetVectorBucketCommand, ListIndexesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$18, ListVectorBucketsCommand, S3VectorsClient } from "@aws-sdk/client-s3vectors";
63
- import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$15 } from "@aws-sdk/client-s3tables";
62
+ import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketCommand, GetVectorBucketCommand, ListIndexesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$18, ListVectorBucketsCommand, S3VectorsClient, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$15 } from "@aws-sdk/client-s3vectors";
63
+ import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient, TagResourceCommand as TagResourceCommand$17, UntagResourceCommand as UntagResourceCommand$16 } from "@aws-sdk/client-s3tables";
64
64
  import { Document, Pair, Scalar, YAMLMap, YAMLSeq, parse as parse$1, stringify } from "yaml";
65
65
  import { createLocalStartAgentCoreCommand, createLocalStartCloudFrontCommand, createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
66
66
  import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, addAlbSpecificOptions, addCommonEcsServiceOptions, addStartServiceSpecificOptions, albStrategy, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, classifySourceChange, createAuthorizerCache, createFileWatcher, createFileWatcher as createFileWatcher$1, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, pickAgentCoreCandidateStack as pickAgentCoreCandidateStack$1, probeHostGatewaySupport, readMtlsMaterialsFromDisk, resolveAgentCoreTarget, resolveEnvVars, resolveHostGatewayExtraHosts, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, runEcsServiceEmulator, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing } from "cdk-local/internal";
@@ -1553,7 +1553,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1553
1553
  const FLUSH_EVENT_THRESHOLD = 50;
1554
1554
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1555
1555
  function getCdkdVersion() {
1556
- return "0.221.14";
1556
+ return "0.221.16";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -9579,6 +9579,21 @@ var DynamoDBTableProvider = class {
9579
9579
  try {
9580
9580
  const table = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table;
9581
9581
  if (table?.TableArn) await this.applyTagDiff(table.TableArn, previousProperties["Tags"], properties["Tags"]);
9582
+ if (JSON.stringify(properties["BillingMode"]) !== JSON.stringify(previousProperties["BillingMode"]) || JSON.stringify(properties["ProvisionedThroughput"]) !== JSON.stringify(previousProperties["ProvisionedThroughput"])) {
9583
+ const billingMode = properties["BillingMode"];
9584
+ const updateInput = { TableName: physicalId };
9585
+ if (billingMode) updateInput.BillingMode = billingMode;
9586
+ if (billingMode !== "PAY_PER_REQUEST" && properties["ProvisionedThroughput"]) {
9587
+ const pt = properties["ProvisionedThroughput"];
9588
+ updateInput.ProvisionedThroughput = {
9589
+ ReadCapacityUnits: Number(pt["ReadCapacityUnits"] ?? 5),
9590
+ WriteCapacityUnits: Number(pt["WriteCapacityUnits"] ?? 5)
9591
+ };
9592
+ }
9593
+ await this.dynamoDBClient.send(new UpdateTableCommand(updateInput));
9594
+ await this.waitForTableActiveAfterUpdate(physicalId);
9595
+ this.logger.debug(`Updated BillingMode/ProvisionedThroughput on DynamoDB table ${physicalId}`);
9596
+ }
9582
9597
  if (JSON.stringify(properties["OnDemandThroughput"]) !== JSON.stringify(previousProperties["OnDemandThroughput"])) {
9583
9598
  if (properties["OnDemandThroughput"]) {
9584
9599
  await this.dynamoDBClient.send(new UpdateTableCommand({
@@ -33133,15 +33148,79 @@ var S3VectorsProvider = class {
33133
33148
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
33134
33149
  }
33135
33150
  }
33136
- update(logicalId, _physicalId, resourceType, _properties, _previousProperties) {
33151
+ async update(logicalId, physicalId, resourceType, properties, previousProperties) {
33137
33152
  switch (resourceType) {
33138
- case "AWS::S3Vectors::VectorBucket": return Promise.resolve({
33139
- physicalId: _physicalId,
33140
- wasReplaced: false
33141
- });
33142
- default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, _physicalId);
33153
+ case "AWS::S3Vectors::VectorBucket": return this.updateVectorBucket(logicalId, physicalId, resourceType, properties, previousProperties);
33154
+ default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
33143
33155
  }
33144
33156
  }
33157
+ /**
33158
+ * The ONLY in-place-updatable property of `AWS::S3Vectors::VectorBucket` is
33159
+ * `Tags` — `VectorBucketName` and `EncryptionConfiguration` are create-only
33160
+ * (per the CFn registry schema), so a change to either drives a replacement
33161
+ * (handled by the deploy engine, not here). Reaching `update()` therefore
33162
+ * means a non-create-only diff, which can only be `Tags`.
33163
+ *
33164
+ * Pre-fix this method was a silent no-op (`return { wasReplaced: false }`),
33165
+ * so a tag change was dropped while cdkd recorded the new Tags into state as
33166
+ * if applied — the next deploy then saw no diff and the AWS-side tags stayed
33167
+ * stale forever (the exact silent-drift failure mode documented in
33168
+ * `feedback_tags_on_update_must_throw`). We now diff old vs new tags and
33169
+ * apply them via TagResource / UntagResource, and any tag-API failure THROWS
33170
+ * (state is NOT written, so the next deploy retries) rather than being
33171
+ * swallowed. A non-Tags diff that somehow reaches here (immutable property)
33172
+ * is surfaced as `ResourceUpdateNotSupportedError`.
33173
+ */
33174
+ async updateVectorBucket(logicalId, physicalId, resourceType, properties, previousProperties) {
33175
+ for (const createOnly of ["VectorBucketName", "EncryptionConfiguration"]) if (JSON.stringify(properties[createOnly]) !== JSON.stringify(previousProperties[createOnly])) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `'${createOnly}' is immutable (create-only) on VectorBucket '${physicalId}'; a change requires replacement (cdkd deploy --replace)`);
33176
+ const oldTags = this.cfnTagsToRecord(previousProperties["Tags"]);
33177
+ const newTags = this.cfnTagsToRecord(properties["Tags"]);
33178
+ const toSet = {};
33179
+ for (const [k, v] of Object.entries(newTags)) if (oldTags[k] !== v) toSet[k] = v;
33180
+ const toRemove = Object.keys(oldTags).filter((k) => !(k in newTags));
33181
+ if (Object.keys(toSet).length === 0 && toRemove.length === 0) return {
33182
+ physicalId,
33183
+ wasReplaced: false
33184
+ };
33185
+ let resourceArn;
33186
+ try {
33187
+ resourceArn = (await this.getClient().send(new GetVectorBucketCommand({ vectorBucketName: physicalId }))).vectorBucket?.vectorBucketArn;
33188
+ } catch (error) {
33189
+ const cause = error instanceof Error ? error : void 0;
33190
+ throw new ProvisioningError(`Failed to resolve ARN for S3 VectorBucket ${logicalId} (${physicalId}) before tag update: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
33191
+ }
33192
+ if (!resourceArn) throw new ProvisioningError(`Could not resolve ARN for S3 VectorBucket ${logicalId} (${physicalId}); cannot apply tag update.`, resourceType, logicalId, physicalId);
33193
+ try {
33194
+ if (Object.keys(toSet).length > 0) await this.getClient().send(new TagResourceCommand$16({
33195
+ resourceArn,
33196
+ tags: toSet
33197
+ }));
33198
+ if (toRemove.length > 0) await this.getClient().send(new UntagResourceCommand$15({
33199
+ resourceArn,
33200
+ tagKeys: toRemove
33201
+ }));
33202
+ } catch (error) {
33203
+ const cause = error instanceof Error ? error : void 0;
33204
+ throw new ProvisioningError(`Failed to update tags for S3 VectorBucket ${logicalId} (${physicalId}): ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
33205
+ }
33206
+ this.logger.debug(`Updated tags for S3 VectorBucket ${logicalId} (${physicalId}): set ${Object.keys(toSet).length}, removed ${toRemove.length}`);
33207
+ return {
33208
+ physicalId,
33209
+ wasReplaced: false
33210
+ };
33211
+ }
33212
+ /**
33213
+ * Convert a CFn `Tags: [{ Key, Value }]` list to the SDK
33214
+ * `Record<string, string>` shape. Tolerates undefined / non-array input
33215
+ * (returns an empty record) and skips entries missing Key or Value.
33216
+ */
33217
+ cfnTagsToRecord(tags) {
33218
+ if (!Array.isArray(tags)) return {};
33219
+ return tags.reduce((acc, t) => {
33220
+ if (t.Key !== void 0 && t.Value !== void 0) acc[t.Key] = t.Value;
33221
+ return acc;
33222
+ }, {});
33223
+ }
33145
33224
  async delete(logicalId, physicalId, resourceType, _properties, context) {
33146
33225
  switch (resourceType) {
33147
33226
  case "AWS::S3Vectors::VectorBucket": return this.deleteVectorBucket(logicalId, physicalId, resourceType, context);
@@ -33153,11 +33232,8 @@ var S3VectorsProvider = class {
33153
33232
  const vectorBucketName = properties["VectorBucketName"];
33154
33233
  if (!vectorBucketName) throw new ProvisioningError(`VectorBucketName is required for S3 VectorBucket ${logicalId}`, resourceType, logicalId);
33155
33234
  const encryptionConfiguration = properties["EncryptionConfiguration"];
33156
- const tagsArray = properties["Tags"];
33157
- const tags = tagsArray && tagsArray.length > 0 ? tagsArray.reduce((acc, t) => {
33158
- if (t.Key !== void 0 && t.Value !== void 0) acc[t.Key] = t.Value;
33159
- return acc;
33160
- }, {}) : void 0;
33235
+ const tagRecord = this.cfnTagsToRecord(properties["Tags"]);
33236
+ const tags = Object.keys(tagRecord).length > 0 ? tagRecord : void 0;
33161
33237
  try {
33162
33238
  const vectorBucketArn = (await this.getClient().send(new CreateVectorBucketCommand({
33163
33239
  vectorBucketName,
@@ -34110,7 +34186,7 @@ var S3TablesProvider = class {
34110
34186
  const resourceArn = await this.lookupTableArn(tableBucketARN, namespace, name);
34111
34187
  if (!resourceArn) throw new ProvisioningError(`applyTableTagsDiff: GetTable returned no tableARN for ${physicalId} — table is gone or state is out-of-sync. Refusing to silently drop the tag update (run 'cdkd state orphan ${logicalId}' to clean up if the table was deleted out-of-band).`, resourceType, logicalId, physicalId);
34112
34188
  if (removedKeys.length > 0) try {
34113
- await this.getClient().send(new UntagResourceCommand$15({
34189
+ await this.getClient().send(new UntagResourceCommand$16({
34114
34190
  resourceArn,
34115
34191
  tagKeys: removedKeys
34116
34192
  }));
@@ -34119,7 +34195,7 @@ var S3TablesProvider = class {
34119
34195
  throw new ProvisioningError(`applyTableTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
34120
34196
  }
34121
34197
  if (Object.keys(upserts).length > 0) try {
34122
- await this.getClient().send(new TagResourceCommand$16({
34198
+ await this.getClient().send(new TagResourceCommand$17({
34123
34199
  resourceArn,
34124
34200
  tags: upserts
34125
34201
  }));
@@ -34151,7 +34227,7 @@ var S3TablesProvider = class {
34151
34227
  if (removedKeys.length === 0 && Object.keys(upserts).length === 0) return;
34152
34228
  const resourceArn = physicalId;
34153
34229
  if (removedKeys.length > 0) try {
34154
- await this.getClient().send(new UntagResourceCommand$15({
34230
+ await this.getClient().send(new UntagResourceCommand$16({
34155
34231
  resourceArn,
34156
34232
  tagKeys: removedKeys
34157
34233
  }));
@@ -34160,7 +34236,7 @@ var S3TablesProvider = class {
34160
34236
  throw new ProvisioningError(`applyTableBucketTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
34161
34237
  }
34162
34238
  if (Object.keys(upserts).length > 0) try {
34163
- await this.getClient().send(new TagResourceCommand$16({
34239
+ await this.getClient().send(new TagResourceCommand$17({
34164
34240
  resourceArn,
34165
34241
  tags: upserts
34166
34242
  }));
@@ -54024,7 +54100,7 @@ function reorderArgs(argv) {
54024
54100
  async function main() {
54025
54101
  installPipeCloseHandler();
54026
54102
  const program = new Command();
54027
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.14");
54103
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.16");
54028
54104
  program.addCommand(createBootstrapCommand());
54029
54105
  program.addCommand(createSynthCommand());
54030
54106
  program.addCommand(createListCommand());