@go-to-k/cdkd 0.230.4 → 0.230.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
@@ -49,12 +49,12 @@ import { CreateClusterCommand, CreateServiceCommand, DeleteClusterCommand, Delet
49
49
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBClusterCommand as CreateDBClusterCommand$1, CreateDBInstanceCommand as CreateDBInstanceCommand$1, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$1, DeleteDBClusterCommand as DeleteDBClusterCommand$1, DeleteDBInstanceCommand as DeleteDBInstanceCommand$1, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$1, DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$12, ModifyDBClusterCommand as ModifyDBClusterCommand$1, ModifyDBInstanceCommand as ModifyDBInstanceCommand$1, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$1, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$3 } from "@aws-sdk/client-docdb";
50
50
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$4, CreateDBClusterCommand as CreateDBClusterCommand$2, CreateDBInstanceCommand as CreateDBInstanceCommand$2, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$2, DeleteDBClusterCommand as DeleteDBClusterCommand$2, DeleteDBInstanceCommand as DeleteDBInstanceCommand$2, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$2, DescribeDBClustersCommand as DescribeDBClustersCommand$2, DescribeDBInstancesCommand as DescribeDBInstancesCommand$2, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$2, ListTagsForResourceCommand as ListTagsForResourceCommand$13, ModifyDBClusterCommand as ModifyDBClusterCommand$2, ModifyDBInstanceCommand as ModifyDBInstanceCommand$2, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$2, NeptuneClient, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$4 } from "@aws-sdk/client-neptune";
51
51
  import { CreateWebACLCommand, DeleteWebACLCommand, GetWebACLCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListWebACLsCommand, TagResourceCommand as TagResourceCommand$13, UntagResourceCommand as UntagResourceCommand$12, UpdateWebACLCommand, WAFNonexistentItemException, WAFV2Client } from "@aws-sdk/client-wafv2";
52
- import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
52
+ import { AddCustomAttributesCommand, CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
53
53
  import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceAttributesCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceAttributesCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceAttributesCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
54
54
  import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$13, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
55
55
  import { parse, print } from "graphql";
56
56
  import { CrawlerRunningException, CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetDatabasesCommand, GetJobCommand, GetSecurityConfigurationCommand, GetSecurityConfigurationsCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, ListWorkflowsCommand, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
57
- import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListStreamsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$8, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$14, UpdateShardCountCommand } from "@aws-sdk/client-kinesis";
57
+ import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, DescribeStreamSummaryCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListStreamsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$8, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$14, UpdateShardCountCommand, UpdateStreamModeCommand } from "@aws-sdk/client-kinesis";
58
58
  import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand, CreateMountTargetCommand, DeleteAccessPointCommand, DeleteFileSystemCommand, DeleteMountTargetCommand, DescribeAccessPointsCommand, DescribeBackupPolicyCommand, DescribeFileSystemPolicyCommand, DescribeFileSystemsCommand, DescribeLifecycleConfigurationCommand, DescribeMountTargetSecurityGroupsCommand, DescribeMountTargetsCommand, EFSClient, FileSystemNotFound, ModifyMountTargetSecurityGroupsCommand, MountTargetNotFound, PutBackupPolicyCommand, PutFileSystemPolicyCommand, PutLifecycleConfigurationCommand, UpdateFileSystemCommand, UpdateFileSystemProtectionCommand } from "@aws-sdk/client-efs";
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";
@@ -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.230.4";
1448
+ return "0.230.6";
1449
1449
  }
1450
1450
  /**
1451
1451
  * Generate a time-sortable unique run id, e.g.
@@ -26102,6 +26102,35 @@ var WAFv2WebACLProvider = class {
26102
26102
  //#endregion
26103
26103
  //#region src/provisioning/providers/cognito-provider.ts
26104
26104
  /**
26105
+ * The standard (OIDC) Cognito User Pool attribute names. A Schema entry whose
26106
+ * Name is NOT in this set is a custom attribute (AWS stores it as
26107
+ * `custom:<name>`). Used by the update path to tell which added Schema entries
26108
+ * can be added in place via AddCustomAttributes (custom only) versus which
26109
+ * require replacement (standard attributes are immutable on update).
26110
+ */
26111
+ const STANDARD_USER_POOL_ATTRIBUTES = new Set([
26112
+ "address",
26113
+ "birthdate",
26114
+ "email",
26115
+ "email_verified",
26116
+ "family_name",
26117
+ "gender",
26118
+ "given_name",
26119
+ "locale",
26120
+ "middle_name",
26121
+ "name",
26122
+ "nickname",
26123
+ "phone_number",
26124
+ "phone_number_verified",
26125
+ "picture",
26126
+ "preferred_username",
26127
+ "profile",
26128
+ "sub",
26129
+ "updated_at",
26130
+ "website",
26131
+ "zoneinfo"
26132
+ ]);
26133
+ /**
26105
26134
  * Class 2 sanitize: empty `{}` placeholders that `readCurrentState` emits
26106
26135
  * for sub-objects whose AWS schema requires a sub-field would be rejected
26107
26136
  * by `UpdateUserPool` if shipped as-is. The known-rejected shapes:
@@ -26348,10 +26377,13 @@ var CognitoUserPoolProvider = class {
26348
26377
  /**
26349
26378
  * Update a Cognito User Pool
26350
26379
  *
26351
- * Note: PoolName (UserPoolName) and Schema are immutable and cannot be changed after creation.
26352
- * Changes to these properties require resource replacement.
26380
+ * Note: PoolName (UserPoolName) is immutable and cannot be changed after
26381
+ * creation. The Schema (custom attributes) is partly mutable: AWS supports
26382
+ * ADDING new custom attributes in place via AddCustomAttributes, but cannot
26383
+ * modify or remove an existing attribute — those changes require replacement
26384
+ * and are rejected with ResourceUpdateNotSupportedError.
26353
26385
  */
26354
- async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
26386
+ async update(logicalId, physicalId, resourceType, properties, previousProperties) {
26355
26387
  this.logger.debug(`Updating Cognito User Pool ${logicalId}: ${physicalId}`);
26356
26388
  try {
26357
26389
  const updateParams = { UserPoolId: physicalId };
@@ -26378,6 +26410,7 @@ var CognitoUserPoolProvider = class {
26378
26410
  if (properties["SmsVerificationMessage"] !== void 0) updateParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
26379
26411
  if (properties["UserPoolTier"]) updateParams.UserPoolTier = properties["UserPoolTier"];
26380
26412
  await this.getClient().send(new UpdateUserPoolCommand(updateParams));
26413
+ await this.reconcileSchemaCustomAttributes(logicalId, physicalId, resourceType, properties["Schema"], previousProperties["Schema"]);
26381
26414
  await this.applyMfaConfig(physicalId, properties);
26382
26415
  this.logger.debug(`Successfully updated Cognito User Pool ${logicalId}`);
26383
26416
  const userPool = (await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }))).UserPool;
@@ -26395,11 +26428,56 @@ var CognitoUserPoolProvider = class {
26395
26428
  }
26396
26429
  };
26397
26430
  } catch (error) {
26431
+ if (error instanceof ResourceUpdateNotSupportedError) throw error;
26398
26432
  const cause = error instanceof Error ? error : void 0;
26399
26433
  throw new ProvisioningError(`Failed to update Cognito User Pool ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
26400
26434
  }
26401
26435
  }
26402
26436
  /**
26437
+ * Reconcile a user pool's Schema custom attributes on update.
26438
+ *
26439
+ * AWS supports ADDING new custom attributes in place (AddCustomAttributes)
26440
+ * but cannot modify or remove an existing attribute. Standard attributes are
26441
+ * fully immutable. So:
26442
+ * - attributes present only in the new Schema (and custom) are added;
26443
+ * - removing or modifying an existing attribute, or adding a standard
26444
+ * attribute, requires replacement -> ResourceUpdateNotSupportedError.
26445
+ * A byte-identical Schema is a no-op (no AddCustomAttributes call).
26446
+ */
26447
+ async reconcileSchemaCustomAttributes(logicalId, physicalId, resourceType, newSchema, oldSchema) {
26448
+ const newAttrs = newSchema ?? [];
26449
+ const oldAttrs = oldSchema ?? [];
26450
+ const byName = (attrs) => {
26451
+ const map = /* @__PURE__ */ new Map();
26452
+ for (const attr of attrs) if (attr.Name !== void 0) map.set(attr.Name, attr);
26453
+ return map;
26454
+ };
26455
+ const oldByName = byName(oldAttrs);
26456
+ const newByName = byName(newAttrs);
26457
+ const added = [];
26458
+ const modified = [];
26459
+ for (const [name, attr] of newByName) {
26460
+ const prev = oldByName.get(name);
26461
+ if (!prev) added.push(attr);
26462
+ else if (JSON.stringify(prev) !== JSON.stringify(attr)) modified.push(name);
26463
+ }
26464
+ const removed = [...oldByName.keys()].filter((n) => !newByName.has(n));
26465
+ const addedStandard = added.filter((a) => a.Name !== void 0 && STANDARD_USER_POOL_ATTRIBUTES.has(a.Name)).map((a) => a.Name);
26466
+ const immutableChanges = [
26467
+ ...removed.map((n) => `removed attribute '${n}'`),
26468
+ ...modified.map((n) => `modified attribute '${n}'`),
26469
+ ...addedStandard.map((n) => `added standard attribute '${n}'`)
26470
+ ];
26471
+ if (immutableChanges.length > 0) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `the Schema change (${immutableChanges.join("; ")}) is immutable on AWS — AWS can only ADD custom attributes in place, so removing or modifying an attribute requires recreating the pool. Re-run with cdkd deploy --replace to recreate it (this deletes all users in the pool)`);
26472
+ const addedCustom = added.filter((a) => a.Name !== void 0 && !STANDARD_USER_POOL_ATTRIBUTES.has(a.Name));
26473
+ if (addedCustom.length === 0) return;
26474
+ this.logger.debug(`Adding ${addedCustom.length} custom attribute(s) to ${physicalId}: ` + addedCustom.map((a) => a.Name).join(", "));
26475
+ await this.getClient().send(new AddCustomAttributesCommand({
26476
+ UserPoolId: physicalId,
26477
+ CustomAttributes: addedCustom
26478
+ }));
26479
+ }
26480
+ /**
26403
26481
  * Delete a Cognito User Pool.
26404
26482
  *
26405
26483
  * When `context.removeProtection === true`, `DeletionProtection` is flipped
@@ -30918,15 +30996,29 @@ var KinesisStreamProvider = class {
30918
30996
  /**
30919
30997
  * Update a Kinesis stream
30920
30998
  *
30921
- * Supports updating ShardCount for PROVISIONED mode streams.
30922
- * StreamMode and Name changes require replacement (handled by deployment layer).
30999
+ * Supports switching StreamMode (PROVISIONED <-> ON_DEMAND, via
31000
+ * UpdateStreamMode), updating ShardCount for PROVISIONED mode streams,
31001
+ * RetentionPeriodHours, StreamEncryption, and Tags. Name changes require
31002
+ * replacement (handled by the deployment layer).
30923
31003
  */
30924
31004
  async update(logicalId, physicalId, resourceType, properties, previousProperties) {
30925
31005
  this.logger.debug(`Updating Kinesis stream ${logicalId}: ${physicalId}`);
30926
31006
  try {
30927
- if ((properties["StreamModeDetails"]?.["StreamMode"] || "PROVISIONED") === "PROVISIONED") {
31007
+ const streamMode = properties["StreamModeDetails"]?.["StreamMode"] || "PROVISIONED";
31008
+ const oldStreamMode = previousProperties["StreamModeDetails"]?.["StreamMode"] || "PROVISIONED";
31009
+ const modeChanged = oldStreamMode !== streamMode;
31010
+ if (modeChanged) {
31011
+ const streamArn = await this.resolveStreamArn(physicalId);
31012
+ this.logger.debug(`Switching stream mode for ${physicalId}: ${oldStreamMode} -> ${streamMode}`);
31013
+ await this.getClient().send(new UpdateStreamModeCommand({
31014
+ StreamARN: streamArn,
31015
+ StreamModeDetails: { StreamMode: streamMode }
31016
+ }));
31017
+ await this.waitForStreamActive(physicalId);
31018
+ }
31019
+ if (streamMode === "PROVISIONED") {
30928
31020
  const newShardCount = Number(properties["ShardCount"] ?? 1);
30929
- const oldShardCount = Number(previousProperties["ShardCount"] ?? 1);
31021
+ const oldShardCount = modeChanged ? await this.getOpenShardCount(physicalId) : Number(previousProperties["ShardCount"] ?? 1);
30930
31022
  if (newShardCount !== oldShardCount) {
30931
31023
  this.logger.debug(`Updating shard count for ${physicalId}: ${oldShardCount} -> ${newShardCount}`);
30932
31024
  await this.getClient().send(new UpdateShardCountCommand({
@@ -31146,6 +31238,26 @@ var KinesisStreamProvider = class {
31146
31238
  }
31147
31239
  throw new Error(`Stream ${streamName} did not reach ACTIVE status within ${maxAttempts * 2} seconds`);
31148
31240
  }
31241
+ /**
31242
+ * Resolve a stream's ARN from its name. UpdateStreamMode is one of the few
31243
+ * Kinesis APIs that takes a StreamARN rather than a StreamName, so an
31244
+ * update that switches StreamModeDetails needs the ARN.
31245
+ */
31246
+ async resolveStreamArn(streamName) {
31247
+ const arn = (await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: streamName }))).StreamDescriptionSummary?.StreamARN;
31248
+ if (!arn) throw new Error(`Unable to resolve StreamARN for stream ${streamName}`);
31249
+ return arn;
31250
+ }
31251
+ /**
31252
+ * Read the stream's current open shard count. Used after an
31253
+ * ON_DEMAND -> PROVISIONED mode switch, where previousProperties carries no
31254
+ * ShardCount and AWS has assigned its own count, so reconciling against the
31255
+ * live count (not the absent state value) is the only correct base.
31256
+ */
31257
+ async getOpenShardCount(streamName) {
31258
+ const response = await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: streamName }));
31259
+ return Number(response.StreamDescriptionSummary?.OpenShardCount ?? 1);
31260
+ }
31149
31261
  };
31150
31262
 
31151
31263
  //#endregion
@@ -55195,7 +55307,7 @@ function reorderArgs(argv) {
55195
55307
  async function main() {
55196
55308
  installPipeCloseHandler();
55197
55309
  const program = new Command();
55198
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.4");
55310
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.6");
55199
55311
  program.addCommand(createBootstrapCommand());
55200
55312
  program.addCommand(createSynthCommand());
55201
55313
  program.addCommand(createListCommand());