@go-to-k/cdkd 0.221.14 → 0.221.15

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.15";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -33133,15 +33133,79 @@ var S3VectorsProvider = class {
33133
33133
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
33134
33134
  }
33135
33135
  }
33136
- update(logicalId, _physicalId, resourceType, _properties, _previousProperties) {
33136
+ async update(logicalId, physicalId, resourceType, properties, previousProperties) {
33137
33137
  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);
33138
+ case "AWS::S3Vectors::VectorBucket": return this.updateVectorBucket(logicalId, physicalId, resourceType, properties, previousProperties);
33139
+ default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
33143
33140
  }
33144
33141
  }
33142
+ /**
33143
+ * The ONLY in-place-updatable property of `AWS::S3Vectors::VectorBucket` is
33144
+ * `Tags` — `VectorBucketName` and `EncryptionConfiguration` are create-only
33145
+ * (per the CFn registry schema), so a change to either drives a replacement
33146
+ * (handled by the deploy engine, not here). Reaching `update()` therefore
33147
+ * means a non-create-only diff, which can only be `Tags`.
33148
+ *
33149
+ * Pre-fix this method was a silent no-op (`return { wasReplaced: false }`),
33150
+ * so a tag change was dropped while cdkd recorded the new Tags into state as
33151
+ * if applied — the next deploy then saw no diff and the AWS-side tags stayed
33152
+ * stale forever (the exact silent-drift failure mode documented in
33153
+ * `feedback_tags_on_update_must_throw`). We now diff old vs new tags and
33154
+ * apply them via TagResource / UntagResource, and any tag-API failure THROWS
33155
+ * (state is NOT written, so the next deploy retries) rather than being
33156
+ * swallowed. A non-Tags diff that somehow reaches here (immutable property)
33157
+ * is surfaced as `ResourceUpdateNotSupportedError`.
33158
+ */
33159
+ async updateVectorBucket(logicalId, physicalId, resourceType, properties, previousProperties) {
33160
+ 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)`);
33161
+ const oldTags = this.cfnTagsToRecord(previousProperties["Tags"]);
33162
+ const newTags = this.cfnTagsToRecord(properties["Tags"]);
33163
+ const toSet = {};
33164
+ for (const [k, v] of Object.entries(newTags)) if (oldTags[k] !== v) toSet[k] = v;
33165
+ const toRemove = Object.keys(oldTags).filter((k) => !(k in newTags));
33166
+ if (Object.keys(toSet).length === 0 && toRemove.length === 0) return {
33167
+ physicalId,
33168
+ wasReplaced: false
33169
+ };
33170
+ let resourceArn;
33171
+ try {
33172
+ resourceArn = (await this.getClient().send(new GetVectorBucketCommand({ vectorBucketName: physicalId }))).vectorBucket?.vectorBucketArn;
33173
+ } catch (error) {
33174
+ const cause = error instanceof Error ? error : void 0;
33175
+ 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);
33176
+ }
33177
+ if (!resourceArn) throw new ProvisioningError(`Could not resolve ARN for S3 VectorBucket ${logicalId} (${physicalId}); cannot apply tag update.`, resourceType, logicalId, physicalId);
33178
+ try {
33179
+ if (Object.keys(toSet).length > 0) await this.getClient().send(new TagResourceCommand$16({
33180
+ resourceArn,
33181
+ tags: toSet
33182
+ }));
33183
+ if (toRemove.length > 0) await this.getClient().send(new UntagResourceCommand$15({
33184
+ resourceArn,
33185
+ tagKeys: toRemove
33186
+ }));
33187
+ } catch (error) {
33188
+ const cause = error instanceof Error ? error : void 0;
33189
+ throw new ProvisioningError(`Failed to update tags for S3 VectorBucket ${logicalId} (${physicalId}): ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
33190
+ }
33191
+ this.logger.debug(`Updated tags for S3 VectorBucket ${logicalId} (${physicalId}): set ${Object.keys(toSet).length}, removed ${toRemove.length}`);
33192
+ return {
33193
+ physicalId,
33194
+ wasReplaced: false
33195
+ };
33196
+ }
33197
+ /**
33198
+ * Convert a CFn `Tags: [{ Key, Value }]` list to the SDK
33199
+ * `Record<string, string>` shape. Tolerates undefined / non-array input
33200
+ * (returns an empty record) and skips entries missing Key or Value.
33201
+ */
33202
+ cfnTagsToRecord(tags) {
33203
+ if (!Array.isArray(tags)) return {};
33204
+ return tags.reduce((acc, t) => {
33205
+ if (t.Key !== void 0 && t.Value !== void 0) acc[t.Key] = t.Value;
33206
+ return acc;
33207
+ }, {});
33208
+ }
33145
33209
  async delete(logicalId, physicalId, resourceType, _properties, context) {
33146
33210
  switch (resourceType) {
33147
33211
  case "AWS::S3Vectors::VectorBucket": return this.deleteVectorBucket(logicalId, physicalId, resourceType, context);
@@ -33153,11 +33217,8 @@ var S3VectorsProvider = class {
33153
33217
  const vectorBucketName = properties["VectorBucketName"];
33154
33218
  if (!vectorBucketName) throw new ProvisioningError(`VectorBucketName is required for S3 VectorBucket ${logicalId}`, resourceType, logicalId);
33155
33219
  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;
33220
+ const tagRecord = this.cfnTagsToRecord(properties["Tags"]);
33221
+ const tags = Object.keys(tagRecord).length > 0 ? tagRecord : void 0;
33161
33222
  try {
33162
33223
  const vectorBucketArn = (await this.getClient().send(new CreateVectorBucketCommand({
33163
33224
  vectorBucketName,
@@ -34110,7 +34171,7 @@ var S3TablesProvider = class {
34110
34171
  const resourceArn = await this.lookupTableArn(tableBucketARN, namespace, name);
34111
34172
  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
34173
  if (removedKeys.length > 0) try {
34113
- await this.getClient().send(new UntagResourceCommand$15({
34174
+ await this.getClient().send(new UntagResourceCommand$16({
34114
34175
  resourceArn,
34115
34176
  tagKeys: removedKeys
34116
34177
  }));
@@ -34119,7 +34180,7 @@ var S3TablesProvider = class {
34119
34180
  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
34181
  }
34121
34182
  if (Object.keys(upserts).length > 0) try {
34122
- await this.getClient().send(new TagResourceCommand$16({
34183
+ await this.getClient().send(new TagResourceCommand$17({
34123
34184
  resourceArn,
34124
34185
  tags: upserts
34125
34186
  }));
@@ -34151,7 +34212,7 @@ var S3TablesProvider = class {
34151
34212
  if (removedKeys.length === 0 && Object.keys(upserts).length === 0) return;
34152
34213
  const resourceArn = physicalId;
34153
34214
  if (removedKeys.length > 0) try {
34154
- await this.getClient().send(new UntagResourceCommand$15({
34215
+ await this.getClient().send(new UntagResourceCommand$16({
34155
34216
  resourceArn,
34156
34217
  tagKeys: removedKeys
34157
34218
  }));
@@ -34160,7 +34221,7 @@ var S3TablesProvider = class {
34160
34221
  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
34222
  }
34162
34223
  if (Object.keys(upserts).length > 0) try {
34163
- await this.getClient().send(new TagResourceCommand$16({
34224
+ await this.getClient().send(new TagResourceCommand$17({
34164
34225
  resourceArn,
34165
34226
  tags: upserts
34166
34227
  }));
@@ -54024,7 +54085,7 @@ function reorderArgs(argv) {
54024
54085
  async function main() {
54025
54086
  installPipeCloseHandler();
54026
54087
  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");
54088
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.15");
54028
54089
  program.addCommand(createBootstrapCommand());
54029
54090
  program.addCommand(createSynthCommand());
54030
54091
  program.addCommand(createListCommand());