@go-to-k/cdkd 0.230.5 → 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,7 +49,7 @@ 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";
@@ -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.5";
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
@@ -55229,7 +55307,7 @@ function reorderArgs(argv) {
55229
55307
  async function main() {
55230
55308
  installPipeCloseHandler();
55231
55309
  const program = new Command();
55232
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.5");
55310
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.6");
55233
55311
  program.addCommand(createBootstrapCommand());
55234
55312
  program.addCommand(createSynthCommand());
55235
55313
  program.addCommand(createListCommand());