@go-to-k/cdkd 0.230.5 → 0.230.7

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.7";
1449
1449
  }
1450
1450
  /**
1451
1451
  * Generate a time-sortable unique run id, e.g.
@@ -26102,6 +26102,41 @@ 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
+ * This list is a snapshot of AWS's standard claim set and may lag AWS. If AWS
26112
+ * ever adds a new standard attribute, a user adding it would be misclassified
26113
+ * as custom and routed to AddCustomAttributes — which AWS rejects with a clear
26114
+ * error (surfaced as a ProvisioningError, never a silent drop), so the failure
26115
+ * is loud and the fix is to append the new name here.
26116
+ */
26117
+ const STANDARD_USER_POOL_ATTRIBUTES = new Set([
26118
+ "address",
26119
+ "birthdate",
26120
+ "email",
26121
+ "email_verified",
26122
+ "family_name",
26123
+ "gender",
26124
+ "given_name",
26125
+ "locale",
26126
+ "middle_name",
26127
+ "name",
26128
+ "nickname",
26129
+ "phone_number",
26130
+ "phone_number_verified",
26131
+ "picture",
26132
+ "preferred_username",
26133
+ "profile",
26134
+ "sub",
26135
+ "updated_at",
26136
+ "website",
26137
+ "zoneinfo"
26138
+ ]);
26139
+ /**
26105
26140
  * Class 2 sanitize: empty `{}` placeholders that `readCurrentState` emits
26106
26141
  * for sub-objects whose AWS schema requires a sub-field would be rejected
26107
26142
  * by `UpdateUserPool` if shipped as-is. The known-rejected shapes:
@@ -26348,10 +26383,13 @@ var CognitoUserPoolProvider = class {
26348
26383
  /**
26349
26384
  * Update a Cognito User Pool
26350
26385
  *
26351
- * Note: PoolName (UserPoolName) and Schema are immutable and cannot be changed after creation.
26352
- * Changes to these properties require resource replacement.
26386
+ * Note: PoolName (UserPoolName) is immutable and cannot be changed after
26387
+ * creation. The Schema (custom attributes) is partly mutable: AWS supports
26388
+ * ADDING new custom attributes in place via AddCustomAttributes, but cannot
26389
+ * modify or remove an existing attribute — those changes require replacement
26390
+ * and are rejected with ResourceUpdateNotSupportedError.
26353
26391
  */
26354
- async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
26392
+ async update(logicalId, physicalId, resourceType, properties, previousProperties) {
26355
26393
  this.logger.debug(`Updating Cognito User Pool ${logicalId}: ${physicalId}`);
26356
26394
  try {
26357
26395
  const updateParams = { UserPoolId: physicalId };
@@ -26378,6 +26416,7 @@ var CognitoUserPoolProvider = class {
26378
26416
  if (properties["SmsVerificationMessage"] !== void 0) updateParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
26379
26417
  if (properties["UserPoolTier"]) updateParams.UserPoolTier = properties["UserPoolTier"];
26380
26418
  await this.getClient().send(new UpdateUserPoolCommand(updateParams));
26419
+ await this.reconcileSchemaCustomAttributes(logicalId, physicalId, resourceType, properties["Schema"], previousProperties["Schema"]);
26381
26420
  await this.applyMfaConfig(physicalId, properties);
26382
26421
  this.logger.debug(`Successfully updated Cognito User Pool ${logicalId}`);
26383
26422
  const userPool = (await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }))).UserPool;
@@ -26395,11 +26434,57 @@ var CognitoUserPoolProvider = class {
26395
26434
  }
26396
26435
  };
26397
26436
  } catch (error) {
26437
+ if (error instanceof ResourceUpdateNotSupportedError || error instanceof ProvisioningError) throw error;
26398
26438
  const cause = error instanceof Error ? error : void 0;
26399
26439
  throw new ProvisioningError(`Failed to update Cognito User Pool ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
26400
26440
  }
26401
26441
  }
26402
26442
  /**
26443
+ * Reconcile a user pool's Schema custom attributes on update.
26444
+ *
26445
+ * AWS supports ADDING new custom attributes in place (AddCustomAttributes)
26446
+ * but cannot modify or remove an existing attribute. Standard attributes are
26447
+ * fully immutable. So:
26448
+ * - attributes present only in the new Schema (and custom) are added;
26449
+ * - removing or modifying an existing attribute, or adding a standard
26450
+ * attribute, requires replacement -> ResourceUpdateNotSupportedError.
26451
+ * A byte-identical Schema is a no-op (no AddCustomAttributes call).
26452
+ */
26453
+ async reconcileSchemaCustomAttributes(logicalId, physicalId, resourceType, newSchema, oldSchema) {
26454
+ const newAttrs = newSchema ?? [];
26455
+ const oldAttrs = oldSchema ?? [];
26456
+ for (const attr of newAttrs) if (attr.Name === void 0) throw new ProvisioningError(`Cognito User Pool ${logicalId} has a Schema attribute with no Name — every Schema entry must have a Name`, resourceType, logicalId, physicalId);
26457
+ const byName = (attrs) => {
26458
+ const map = /* @__PURE__ */ new Map();
26459
+ for (const attr of attrs) if (attr.Name !== void 0) map.set(attr.Name, attr);
26460
+ return map;
26461
+ };
26462
+ const oldByName = byName(oldAttrs);
26463
+ const newByName = byName(newAttrs);
26464
+ const added = [];
26465
+ const modified = [];
26466
+ for (const [name, attr] of newByName) {
26467
+ const prev = oldByName.get(name);
26468
+ if (!prev) added.push(attr);
26469
+ else if (JSON.stringify(prev) !== JSON.stringify(attr)) modified.push(name);
26470
+ }
26471
+ const removed = [...oldByName.keys()].filter((n) => !newByName.has(n));
26472
+ const addedStandard = added.filter((a) => a.Name !== void 0 && STANDARD_USER_POOL_ATTRIBUTES.has(a.Name)).map((a) => a.Name);
26473
+ const immutableChanges = [
26474
+ ...removed.map((n) => `removed attribute '${n}'`),
26475
+ ...modified.map((n) => `modified attribute '${n}'`),
26476
+ ...addedStandard.map((n) => `added standard attribute '${n}'`)
26477
+ ];
26478
+ 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. AWS::Cognito::UserPool is a stateful type, so re-run with cdkd deploy --replace --force-stateful-recreation to recreate it (this deletes all users in the pool)`);
26479
+ const addedCustom = added.filter((a) => a.Name !== void 0 && !STANDARD_USER_POOL_ATTRIBUTES.has(a.Name));
26480
+ if (addedCustom.length === 0) return;
26481
+ this.logger.debug(`Adding ${addedCustom.length} custom attribute(s) to ${physicalId}: ` + addedCustom.map((a) => a.Name).join(", "));
26482
+ await this.getClient().send(new AddCustomAttributesCommand({
26483
+ UserPoolId: physicalId,
26484
+ CustomAttributes: addedCustom
26485
+ }));
26486
+ }
26487
+ /**
26403
26488
  * Delete a Cognito User Pool.
26404
26489
  *
26405
26490
  * When `context.removeProtection === true`, `DeletionProtection` is flipped
@@ -55229,7 +55314,7 @@ function reorderArgs(argv) {
55229
55314
  async function main() {
55230
55315
  installPipeCloseHandler();
55231
55316
  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");
55317
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.7");
55233
55318
  program.addCommand(createBootstrapCommand());
55234
55319
  program.addCommand(createSynthCommand());
55235
55320
  program.addCommand(createListCommand());