@go-to-k/cdkd 0.278.52 → 0.278.54

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as DiffCalculator, $t as resolveBucketRegion, A as red, At as getDockerImageBySourceHash, B as isTerminationProtectionPropagationError, Bt as resolveStateBucketWithDefaultAndSource, C as isStatefulRecreateTargetSync, Ct as validateContainerRepoName, D as cyan, Dt as runDockerForeground, E as bold, En as withErrorHandling, Et as getDockerCmd, F as ProviderRegistry, Ft as resolveApp, G as normalizeAwsTagsToCfn, Gt as CFN_TEMPLATE_URL_LIMIT, H as cfnRefValueFromPhysicalId, Ht as stateBucketExistenceConfirmed, I as findActionableSilentDrops, It as resolveAutoAssetStorage, J as readConfigString, Jt as uploadCfnTemplate, K as resolveExplicitPhysicalId, Kt as MIGRATE_TMP_PREFIX, L as CloudControlProvider, Lt as resolveCaptureObservedState, M as IAMRoleProvider, Mt as synthesisStatusMessage, N as collectInlinePolicyNamesManagedBySiblings, Nt as getDefaultStateBucketName, O as gray, Ot as runDockerStreaming, P as clearOnUpdateRemoval, Pt as getLegacyStateBucketName, Q as applyRoleArnIfSet, R as slowCcOperationTimeoutMs, Rt as resolveSkipPrefix, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, St as validateAssetBucketName, T as formatResourceLine, Tn as normalizeAwsError, Tt as formatDockerLoginError, U as refStateLookupFromResource, Ut as warnDeprecatedNoPrefixCliFlag, V as IntrinsicFunctionResolver, Vt as resolveUseCdkBootstrapAssets, W as WAFv2WebACLProvider, Wt as CFN_TEMPLATE_BODY_LIMIT, X as requireConfigArray, Xt as AssemblyReader, Y as replayWarn, Yt as expectedOwnerParam, Z as requireConfigString, Zt as processStackMessages, _ as createPreDeleteFinalSnapshot, _n as ResourceTimeoutError, _t as AssetModeResolver, a as DeploymentEventsStore, an as CdkdError, at as TemplateParser, b as unsupportedFinalSnapshotError, bn as StackTerminationProtectionError, bt as getBootstrapMarkerKey, c as replayFailedOperations, cn as DeployCancelledError, ct as rebuildClientForBucketRegion, d as IMPLICIT_DELETE_DEPENDENCIES, dn as LocalStartServiceError, dt as stringifyValue, en as AwsClients, et as describeTypeWithThrottleRetry, f as computeImplicitDeleteEdges, ft as WorkGraph, g as ccRoutedFinalSnapshotError, gn as ProvisioningError, gt as rewriteTemplateAssetReferences, h as buildFinalSnapshotIdentifier, hn as PartialFailureError, ht as loadPublishableAssetManifest, i as DeploymentEventsReader, it as DagBuilder, j as yellow, jt as Synthesizer, k as green, kt as AssetManifestLoader, l as replayRollback, ln as LocalInvokeBuildError$1, lt as shouldRetainResource, m as PRE_DELETE_SNAPSHOT_TYPES, mn as NestedStackChildDirectDestroyError, mt as createAssetRedirectResolver, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as resetAwsClients, nt as isRetryableTransientError, o as planFailedOps, ot as LockManager, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as MissingCdkCliError, pt as buildAssetRedirectMap, q as assertRegionMatch, qt as findLargeInlineResources, r as DeployEngine, rn as setAwsClients, rt as isThrottlingError, s as planRollback, st as S3StateBackend, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as getAwsClients, tt as withRetry, u as withResourceDeadline, un as LocalMigrateError, ut as AssetPublisher, v as isFinalSnapshotError, vn as ResourceUpdateNotSupportedError, vt as BOOTSTRAP_MARKER_PREFIX, w as renderStatefulReason, wt as buildDockerImage, x as extractDeploymentEventError, xt as parseBootstrapMarker, y as refusesFinalSnapshot, yn as StackHasActiveImportsError, yt as ensureAssetStorage, z as disableInstanceApiTermination, zt as resolveStateBucketWithDefault } from "./deploy-engine-64dVN8O1.js";
2
+ import { $ as DiffCalculator, $t as resolveBucketRegion, A as red, At as getDockerImageBySourceHash, B as isTerminationProtectionPropagationError, Bt as resolveStateBucketWithDefaultAndSource, C as isStatefulRecreateTargetSync, Ct as validateContainerRepoName, D as cyan, Dt as runDockerForeground, E as bold, En as withErrorHandling, Et as getDockerCmd, F as ProviderRegistry, Ft as resolveApp, G as normalizeAwsTagsToCfn, Gt as CFN_TEMPLATE_URL_LIMIT, H as cfnRefValueFromPhysicalId, Ht as stateBucketExistenceConfirmed, I as findActionableSilentDrops, It as resolveAutoAssetStorage, J as readConfigString, Jt as uploadCfnTemplate, K as resolveExplicitPhysicalId, Kt as MIGRATE_TMP_PREFIX, L as CloudControlProvider, Lt as resolveCaptureObservedState, M as IAMRoleProvider, Mt as synthesisStatusMessage, N as collectInlinePolicyNamesManagedBySiblings, Nt as getDefaultStateBucketName, O as gray, Ot as runDockerStreaming, P as clearOnUpdateRemoval, Pt as getLegacyStateBucketName, Q as applyRoleArnIfSet, R as slowCcOperationTimeoutMs, Rt as resolveSkipPrefix, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, St as validateAssetBucketName, T as formatResourceLine, Tn as normalizeAwsError, Tt as formatDockerLoginError, U as refStateLookupFromResource, Ut as warnDeprecatedNoPrefixCliFlag, V as IntrinsicFunctionResolver, Vt as resolveUseCdkBootstrapAssets, W as WAFv2WebACLProvider, Wt as CFN_TEMPLATE_BODY_LIMIT, X as requireConfigArray, Xt as AssemblyReader, Y as replayWarn, Yt as expectedOwnerParam, Z as requireConfigString, Zt as processStackMessages, _ as createPreDeleteFinalSnapshot, _n as ResourceTimeoutError, _t as AssetModeResolver, a as DeploymentEventsStore, an as CdkdError, at as TemplateParser, b as unsupportedFinalSnapshotError, bn as StackTerminationProtectionError, bt as getBootstrapMarkerKey, c as replayFailedOperations, cn as DeployCancelledError, ct as rebuildClientForBucketRegion, d as IMPLICIT_DELETE_DEPENDENCIES, dn as LocalStartServiceError, dt as stringifyValue, en as AwsClients, et as describeTypeWithThrottleRetry, f as computeImplicitDeleteEdges, ft as WorkGraph, g as ccRoutedFinalSnapshotError, gn as ProvisioningError, gt as rewriteTemplateAssetReferences, h as buildFinalSnapshotIdentifier, hn as PartialFailureError, ht as loadPublishableAssetManifest, i as DeploymentEventsReader, it as DagBuilder, j as yellow, jt as Synthesizer, k as green, kt as AssetManifestLoader, l as replayRollback, ln as LocalInvokeBuildError$1, lt as shouldRetainResource, m as PRE_DELETE_SNAPSHOT_TYPES, mn as NestedStackChildDirectDestroyError, mt as createAssetRedirectResolver, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as resetAwsClients, nt as isRetryableTransientError, o as planFailedOps, ot as LockManager, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as MissingCdkCliError, pt as buildAssetRedirectMap, q as assertRegionMatch, qt as findLargeInlineResources, r as DeployEngine, rn as setAwsClients, rt as isThrottlingError, s as planRollback, st as S3StateBackend, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as getAwsClients, tt as withRetry, u as withResourceDeadline, un as LocalMigrateError, ut as AssetPublisher, v as isFinalSnapshotError, vn as ResourceUpdateNotSupportedError, vt as BOOTSTRAP_MARKER_PREFIX, w as renderStatefulReason, wt as buildDockerImage, x as extractDeploymentEventError, xt as parseBootstrapMarker, y as refusesFinalSnapshot, yn as StackHasActiveImportsError, yt as ensureAssetStorage, z as disableInstanceApiTermination, zt as resolveStateBucketWithDefault } from "./deploy-engine-CEoy1_C7.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
4
- import { t as ASGProvider } from "./asg-provider-CjVpdcoW.js";
4
+ import { t as ASGProvider } from "./asg-provider-Ro9B_1Sy.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
7
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -50,7 +50,7 @@ import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBCluster
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 { AddCustomAttributesCommand, CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$9, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
52
52
  import { CreateHttpNamespaceCommand, CreatePrivateDnsNamespaceCommand, CreatePublicDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceAttributesCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceAttributesCommand, GetServiceCommand, ListNamespacesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$15, UpdateHttpNamespaceCommand, UpdatePrivateDnsNamespaceCommand, UpdatePublicDnsNamespaceCommand, UpdateServiceAttributesCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
53
- import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$16, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
53
+ import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetGraphqlApiEnvironmentVariablesCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, NotFoundException as NotFoundException$4, PutGraphqlApiEnvironmentVariablesCommand, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$16, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
54
54
  import { parse, print } from "graphql";
55
55
  import { ConcurrentModificationException, 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, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
56
56
  import { BudgetsClient, CreateBudgetCommand, CreateNotificationCommand, CreateSubscriberCommand, DeleteBudgetCommand, DeleteNotificationCommand, DeleteSubscriberCommand, DescribeBudgetCommand, DuplicateRecordException, NotFoundException as NotFoundException$5, TagResourceCommand as TagResourceCommand$17, UntagResourceCommand as UntagResourceCommand$17, UpdateBudgetCommand } from "@aws-sdk/client-budgets";
@@ -7775,8 +7775,20 @@ var SNSTopicProvider = class {
7775
7775
  }
7776
7776
  /**
7777
7777
  * Create an SNS topic
7778
+ *
7779
+ * `context.replayingState` (issue #1551) downgrades this method's one
7780
+ * template-shape refusal — `buildDeliveryStatusAttributeMap`'s `'throw'`
7781
+ * mode — to a warning. The rollback executor's
7782
+ * reverse-replacement arm revives the OLD topic with
7783
+ * `create(..., previousState.properties, REPLAYING_STATE_CREATE_CONTEXT)`,
7784
+ * so the properties bag can be a historical cdkd STATE record carrying a
7785
+ * shape this provider now refuses — and the user has no template-side
7786
+ * remedy for a state record. The parameter was previously absent, so that
7787
+ * 4th argument was silently ignored and `buildDeliveryStatusAttributeMap`'s
7788
+ * `'throw'` mode stranded the replay; issue #1538 fixed the update side
7789
+ * only.
7778
7790
  */
7779
- async create(logicalId, resourceType, properties) {
7791
+ async create(logicalId, resourceType, properties, context) {
7780
7792
  this.logger.debug(`Creating SNS topic ${logicalId}`);
7781
7793
  const topicName = properties["TopicName"] || generateResourceName(logicalId, { maxLength: 256 });
7782
7794
  try {
@@ -7814,7 +7826,7 @@ var SNSTopicProvider = class {
7814
7826
  AttributeValue: dataProtectionPolicy
7815
7827
  }));
7816
7828
  }
7817
- const deliveryStatusAttributes = buildDeliveryStatusAttributeMap(properties["DeliveryStatusLogging"], logicalId, "throw");
7829
+ const deliveryStatusAttributes = buildDeliveryStatusAttributeMap(properties["DeliveryStatusLogging"], logicalId, context?.replayingState === true ? "warn" : "throw");
7818
7830
  for (const [attributeName, attributeValue] of deliveryStatusAttributes) await this.snsClient.send(new SetTopicAttributesCommand({
7819
7831
  TopicArn: topicArn,
7820
7832
  AttributeName: attributeName,
@@ -8311,9 +8323,15 @@ const SNS_DELIVERY_STATUS_ATTRIBUTE_SUFFIXES = [
8311
8323
  * / unknown protocol, and encodes the create-vs-update distinction
8312
8324
  * (issue #1538):
8313
8325
  *
8314
- * - `'throw'` — the CREATE desired side, which is always template-borne:
8315
- * a template error must fail fast, naming the offending value.
8316
- * - `'warn'` — the UPDATE desired side, which is NOT always template-borne:
8326
+ * - `'throw'` — a TEMPLATE-borne desired side: an ordinary `create()`, where a
8327
+ * template error must fail fast, naming the offending value.
8328
+ * - `'warn'` — a desired side that is NOT template-borne. That is every
8329
+ * `update()`, and — since issue #1551 — a `create()` whose
8330
+ * `CreateContext.replayingState` is set (the rollback executor's
8331
+ * reverse-replacement arm, which revives the old topic from a state record).
8332
+ * The wording below is therefore operation-neutral: on a create there is no
8333
+ * previously-set attribute to reset, only one that is never applied. Same
8334
+ * reason as before:
8317
8335
  * the rollback executor's revert arm and `cdkd drift --revert` both call
8318
8336
  * `update()` with a state-derived bag as the DESIRED properties, so a
8319
8337
  * state record carrying an unsupported protocol / malformed shape (a
@@ -8346,8 +8364,9 @@ const SNS_DELIVERY_STATUS_ATTRIBUTE_SUFFIXES = [
8346
8364
  * protocol, non-array container, non-object entry) used to throw on that
8347
8365
  * side too, which made such a state record permanently unreplayable —
8348
8366
  * fixed by issue #1538, which moved `update()`'s desired side to `'warn'`
8349
- * while `create()` keeps `'throw'` (a template create must still fail
8350
- * fast; #1529 / #1536 deliberately left that contract unchanged).
8367
+ * while `create()` kept `'throw'`; issue #1551 then extended the downgrade to
8368
+ * a create that DECLARES a state replay, leaving the template-path create
8369
+ * strict (#1529 / #1536 deliberately left that contract unchanged).
8351
8370
  */
8352
8371
  function buildDeliveryStatusAttributeMap(logging, logicalId, onMalformed) {
8353
8372
  const map = /* @__PURE__ */ new Map();
@@ -8358,7 +8377,7 @@ function buildDeliveryStatusAttributeMap(logging, logicalId, onMalformed) {
8358
8377
  const seenProtocols = /* @__PURE__ */ new Set();
8359
8378
  if (!Array.isArray(logging)) {
8360
8379
  if (onMalformed === "throw") throw new Error(`SNS topic ${logicalId}: DeliveryStatusLogging must be an array of {Protocol, ...} objects, got ${JSON.stringify(logging)}`);
8361
- if (onMalformed === "warn") warn(`SNS topic ${logicalId}: DeliveryStatusLogging must be an array of {Protocol, ...} objects, got ${JSON.stringify(logging)} — treating it as empty for this update, so previously set delivery-status attributes are reset. The desired properties can come from a cdkd state record (rollback replay / drift --revert), so this does not fail the update; fix the template (or the state record on a replay) to clear this warning.`);
8380
+ if (onMalformed === "warn") warn(`SNS topic ${logicalId}: DeliveryStatusLogging must be an array of {Protocol, ...} objects, got ${JSON.stringify(logging)} — treating it as empty, so no delivery-status attribute is applied (on an update, any previously set one is reset). The desired properties can come from a cdkd state record (rollback replay / drift --revert), so this does not fail the operation; fix the template (or the state record on a replay) to clear this warning.`);
8362
8381
  return map;
8363
8382
  }
8364
8383
  for (const entry of logging) {
@@ -10083,9 +10102,16 @@ var LambdaUrlProvider = class {
10083
10102
  wasReplaced: false,
10084
10103
  attributes: {}
10085
10104
  };
10105
+ let authTypeUnusable = false;
10106
+ const requestedAuthType = requireConfigString(properties["AuthType"], "NONE", "AWS::Lambda::Url AuthType", { onUnusable: (message) => {
10107
+ authTypeUnusable = true;
10108
+ this.logger.warn(`${message} The function URL's existing auth type is kept for this update rather than reset to the default (NONE), which would make the URL public.`);
10109
+ } });
10110
+ const previousAuthType = previousProperties["AuthType"];
10111
+ const authType = authTypeUnusable ? typeof previousAuthType === "string" && previousAuthType.trim() !== "" ? previousAuthType : void 0 : requestedAuthType;
10086
10112
  const updateParams = {
10087
10113
  FunctionName: physicalId,
10088
- AuthType: requireConfigString(properties["AuthType"], "NONE", "AWS::Lambda::Url AuthType")
10114
+ ...authType !== void 0 && { AuthType: authType }
10089
10115
  };
10090
10116
  const invokeMode = clearOnUpdateRemoval(properties["InvokeMode"], previousProperties["InvokeMode"], "BUFFERED");
10091
10117
  if (invokeMode !== void 0) updateParams.InvokeMode = invokeMode;
@@ -11729,7 +11755,10 @@ var DynamoDBTableProvider = class {
11729
11755
  if (table?.TableArn) await this.applyTagDiff(table.TableArn, previousProperties["Tags"], properties["Tags"]);
11730
11756
  const normalizeTableClass = (v) => typeof v === "string" && v.length > 0 ? v : "STANDARD";
11731
11757
  const tableClassChanged = normalizeTableClass(properties["TableClass"]) !== normalizeTableClass(previousProperties["TableClass"]);
11732
- const prevBillingMode = previousProperties["BillingMode"];
11758
+ const recordedPrevBillingMode = previousProperties["BillingMode"];
11759
+ const recordedPrevBillingModeUsable = recordedPrevBillingMode === void 0 || typeof recordedPrevBillingMode === "string" && recordedPrevBillingMode.trim() !== "";
11760
+ const prevBillingMode = recordedPrevBillingModeUsable ? recordedPrevBillingMode : table?.BillingModeSummary?.BillingMode ?? "PROVISIONED";
11761
+ if (!recordedPrevBillingModeUsable) this.logger.warn(`AWS::DynamoDB::Table ${logicalId}: the recorded previous BillingMode is unusable (${JSON.stringify(recordedPrevBillingMode)}) — using the table's actual billing mode (${prevBillingMode}) as the comparison baseline for this update so a corrected template does not issue a same-mode UpdateTable.`);
11733
11762
  let billingModeUnusable = false;
11734
11763
  const requestedBillingMode = properties["BillingMode"] === void 0 ? void 0 : requireConfigString(properties["BillingMode"], "PROVISIONED", "AWS::DynamoDB::Table BillingMode", { onUnusable: (message) => {
11735
11764
  billingModeUnusable = true;
@@ -12707,7 +12736,8 @@ var DynamoDBGlobalTableProvider = class {
12707
12736
  }
12708
12737
  let sdkIndexes;
12709
12738
  try {
12710
- sdkIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, billingMode, "min", diagnostics, replayWarn(this.logger, context).onUnusable);
12739
+ const onUnusableCreateIndexes = replayWarn(this.logger, context).onUnusable;
12740
+ sdkIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, billingMode, "min", diagnostics, onUnusableCreateIndexes && ((message) => onUnusableCreateIndexes(`${message} Omitting the malformed block, so this create carries NO indexes; the same value is REFUSED on a template-path create`)));
12711
12741
  } catch (error) {
12712
12742
  throw new ProvisioningError(error instanceof Error ? error.message : String(error), resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
12713
12743
  }
@@ -12915,7 +12945,10 @@ var DynamoDBGlobalTableProvider = class {
12915
12945
  return (props["Replicas"] ?? []).find((r) => r["Region"] === currentRegion)?.["Tags"];
12916
12946
  };
12917
12947
  if (tableArn) await this.applyTagDiff(tableArn, extractLocalTags(previousProperties), extractLocalTags(properties));
12918
- const oldBilling = previousProperties["BillingMode"] ?? "PAY_PER_REQUEST";
12948
+ const recordedOldBilling = previousProperties["BillingMode"];
12949
+ const recordedOldBillingUsable = recordedOldBilling === void 0 || typeof recordedOldBilling === "string" && recordedOldBilling.trim() !== "";
12950
+ const oldBilling = recordedOldBillingUsable ? recordedOldBilling ?? "PAY_PER_REQUEST" : describeResp.Table?.BillingModeSummary?.BillingMode ?? "PROVISIONED";
12951
+ if (!recordedOldBillingUsable) this.logger.warn(`AWS::DynamoDB::GlobalTable ${logicalId}: the recorded previous BillingMode is unusable (${JSON.stringify(recordedOldBilling)}) — using the table's actual billing mode (${oldBilling}) as the comparison baseline for this update so a corrected template does not issue a same-mode UpdateTable.`);
12919
12952
  let billingUnusable = false;
12920
12953
  const requestedBilling = requireConfigString(properties["BillingMode"], "PAY_PER_REQUEST", "AWS::DynamoDB::GlobalTable BillingMode", { onUnusable: (message) => {
12921
12954
  billingUnusable = true;
@@ -12927,8 +12960,19 @@ var DynamoDBGlobalTableProvider = class {
12927
12960
  const desiredCeilings = collectTableOnDemandCeilings(properties, currentRegion, diagnostics);
12928
12961
  const flippingToProvisioned = oldBilling !== newBilling && newBilling === "PROVISIONED";
12929
12962
  if (flippingToProvisioned) derivePerCallProvisionedThroughput(properties, currentRegion, "seed", diagnostics);
12930
- const desiredSdkIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "min", flippingToProvisioned ? void 0 : diagnostics);
12931
- if (flippingToProvisioned) toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "seed", diagnostics);
12963
+ let desiredGsiUnusable = false;
12964
+ const onUnusableGsiBlock = (message) => {
12965
+ desiredGsiUnusable = true;
12966
+ this.logger.warn(`${message} No GlobalSecondaryIndexes change is applied by this update; the table's existing indexes are left untouched.`);
12967
+ };
12968
+ let previousGsiUnusable = false;
12969
+ const onUnusablePreviousGsiBlock = (message) => {
12970
+ previousGsiUnusable = true;
12971
+ this.logger.warn(`${message} (recorded in cdkd state, not in the template) — using the table's LIVE indexes as the comparison baseline for this update, so a corrected template still applies.`);
12972
+ };
12973
+ const liveIndexNames = new Set((describeResp.Table?.GlobalSecondaryIndexes ?? []).map((live) => live.IndexName).filter((name) => typeof name === "string"));
12974
+ const desiredSdkIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "min", flippingToProvisioned ? void 0 : diagnostics, onUnusableGsiBlock);
12975
+ if (flippingToProvisioned) toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "seed", diagnostics, onUnusableGsiBlock);
12932
12976
  for (const replica of properties["Replicas"] ?? []) {
12933
12977
  const replicaRegion = asRecord$1(replica)?.["Region"];
12934
12978
  if (typeof replicaRegion !== "string" || replicaRegion === currentRegion) continue;
@@ -12959,11 +13003,18 @@ var DynamoDBGlobalTableProvider = class {
12959
13003
  flatChanged = true;
12960
13004
  }
12961
13005
  if (properties["StreamSpecification"] !== void 0 && !deepEqual$1(properties["StreamSpecification"], previousProperties["StreamSpecification"])) {
12962
- flatUpdate.StreamSpecification = {
12963
- StreamEnabled: true,
12964
- StreamViewType: readConfigString(properties["StreamSpecification"], "StreamViewType", "NEW_AND_OLD_IMAGES", "AWS::DynamoDB::GlobalTable StreamSpecification")
12965
- };
12966
- flatChanged = true;
13006
+ let streamSpecUnusable = false;
13007
+ const streamViewType = readConfigString(properties["StreamSpecification"], "StreamViewType", "NEW_AND_OLD_IMAGES", "AWS::DynamoDB::GlobalTable StreamSpecification", { onUnusable: (message) => {
13008
+ streamSpecUnusable = true;
13009
+ this.logger.warn(`${message} The table's existing stream configuration is left untouched for this update rather than re-pointed at the default.`);
13010
+ } });
13011
+ if (!streamSpecUnusable) {
13012
+ flatUpdate.StreamSpecification = {
13013
+ StreamEnabled: true,
13014
+ StreamViewType: streamViewType
13015
+ };
13016
+ flatChanged = true;
13017
+ }
12967
13018
  }
12968
13019
  const awsOnDemand = describeResp.Table?.OnDemandThroughput;
12969
13020
  const onDemandPayload = {};
@@ -12995,11 +13046,13 @@ var DynamoDBGlobalTableProvider = class {
12995
13046
  };
12996
13047
  if (newBilling === "PROVISIONED") {
12997
13048
  billingUpdate.ProvisionedThroughput = derivePerCallProvisionedThroughput(properties, currentRegion, "seed");
12998
- const provisionedIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "seed");
13049
+ const provisionedIndexes = toSdkGlobalSecondaryIndexes(properties, currentRegion, newBilling, "seed", void 0, onUnusableGsiBlock);
13050
+ const previousFlipIndexes = toSdkGlobalSecondaryIndexes(previousProperties, currentRegion, newBilling, "seed", void 0, onUnusablePreviousGsiBlock);
13051
+ if (desiredGsiUnusable || previousGsiUnusable) throw new ProvisioningError(`Cannot flip AWS::DynamoDB::GlobalTable ${logicalId} to PROVISIONED while its GlobalSecondaryIndexes block is unusable: AWS requires per-index provisioned capacity in the same UpdateTable, and it cannot be derived from a malformed block (nor read from a table that is still on-demand). Fix the GlobalSecondaryIndexes value — in the template, or in the cdkd state record on a rollback / drift --revert replay — and re-deploy. The table is unchanged.`, resourceType, logicalId, physicalId);
13052
+ const previousByIndexName = /* @__PURE__ */ new Map();
13053
+ for (const gsi of previousFlipIndexes) if (gsi.IndexName) previousByIndexName.set(gsi.IndexName, gsi);
12999
13054
  const previousCfnIndexes = previousProperties["GlobalSecondaryIndexes"];
13000
13055
  const existingIndexNames = new Set((Array.isArray(previousCfnIndexes) ? previousCfnIndexes : []).map((entry) => entry?.["IndexName"]).filter((name) => typeof name === "string"));
13001
- const previousByIndexName = /* @__PURE__ */ new Map();
13002
- for (const gsi of toSdkGlobalSecondaryIndexes(previousProperties, currentRegion, newBilling, "seed")) if (gsi.IndexName) previousByIndexName.set(gsi.IndexName, gsi);
13003
13056
  const byIndexName = new Map(previousByIndexName);
13004
13057
  const survivingIndexNames = /* @__PURE__ */ new Set();
13005
13058
  for (const gsi of provisionedIndexes) {
@@ -13121,8 +13174,18 @@ var DynamoDBGlobalTableProvider = class {
13121
13174
  }));
13122
13175
  await this.waitForReplicaActive(physicalId, region, logicalId);
13123
13176
  }
13124
- const previousSdkIndexes = toSdkGlobalSecondaryIndexes(previousProperties, currentRegion, oldBilling);
13125
- const gsiDiff = diffGlobalSecondaryIndexes(previousSdkIndexes, desiredSdkIndexes);
13177
+ const previousTranslatedIndexes = toSdkGlobalSecondaryIndexes(previousProperties, currentRegion, oldBilling, "min", void 0, onUnusablePreviousGsiBlock);
13178
+ const previousSdkIndexes = previousGsiUnusable ? desiredSdkIndexes.filter((gsi) => typeof gsi.IndexName === "string" && liveIndexNames.has(gsi.IndexName)) : previousTranslatedIndexes;
13179
+ if (previousGsiUnusable) {
13180
+ const desiredNames = new Set(desiredSdkIndexes.map((gsi) => gsi.IndexName).filter((name) => typeof name === "string"));
13181
+ const liveOnly = [...liveIndexNames].filter((name) => !desiredNames.has(name));
13182
+ if (liveOnly.length > 0) this.logger.warn(`AWS::DynamoDB::GlobalTable ${logicalId}: ${liveOnly.join(", ")} exist(s) on the table but not in the template. No Delete is issued while the recorded GlobalSecondaryIndexes are unusable — a junk state record cannot prove cdkd created them. Re-deploy once state carries a valid block to remove them.`);
13183
+ }
13184
+ const gsiDiff = desiredGsiUnusable ? {
13185
+ added: [],
13186
+ removed: [],
13187
+ modified: []
13188
+ } : diffGlobalSecondaryIndexes(previousSdkIndexes, desiredSdkIndexes);
13126
13189
  const rawOnDemandDeclarations = collectRawOnDemandDeclarations(properties, currentRegion);
13127
13190
  const previousSdkByName = /* @__PURE__ */ new Map();
13128
13191
  for (const prev of previousSdkIndexes) if (prev.IndexName) previousSdkByName.set(prev.IndexName, prev);
@@ -13182,7 +13245,10 @@ var DynamoDBGlobalTableProvider = class {
13182
13245
  }));
13183
13246
  await this.waitForTableActiveAfterUpdate(physicalId, logicalId);
13184
13247
  }
13185
- if (newBilling === "PROVISIONED" || oldBilling === "PROVISIONED") {
13248
+ const skipAutoScalingForUnusableGsi = desiredGsiUnusable && newBilling !== "PAY_PER_REQUEST";
13249
+ const autoScalingMeaningfulForIndexes = (newBilling === "PROVISIONED" || oldBilling === "PROVISIONED") && !skipAutoScalingForUnusableGsi;
13250
+ if (skipAutoScalingForUnusableGsi && oldBilling === "PROVISIONED") this.logger.warn(`AWS::DynamoDB::GlobalTable ${logicalId}: skipping the auto-scaling target reconcile because the GlobalSecondaryIndexes block is unusable — the per-index targets are derived from it, so reconciling would deregister the live indexes' scalable targets. Existing targets are left untouched.`);
13251
+ if (autoScalingMeaningfulForIndexes) {
13186
13252
  if (gsiDiff.added.length > 0) await this.waitForIndexesActive(physicalId, logicalId);
13187
13253
  await this.reconcileAutoScalingTargets(physicalId, collectAutoScalingTargets(previousProperties, currentRegion), newBilling === "PAY_PER_REQUEST" ? [] : collectAutoScalingTargets(properties, currentRegion), currentRegion, autoScalingApplied);
13188
13254
  }
@@ -14692,7 +14758,7 @@ function toSdkGlobalSecondaryIndexes(properties, region, billingMode, source = "
14692
14758
  if (rawIndexes !== void 0 && !Array.isArray(rawIndexes)) {
14693
14759
  const shapeDetail = `AWS::DynamoDB::GlobalTable GlobalSecondaryIndexes must be an array, got ${typeof rawIndexes} (${JSON.stringify(rawIndexes)?.slice(0, 200)}).`;
14694
14760
  if (onUnusableIndexes) {
14695
- onUnusableIndexes(`${shapeDetail} Omitting the malformed block, so this create carries NO indexes; the same value is REFUSED on a template-path create`);
14761
+ onUnusableIndexes(shapeDetail);
14696
14762
  return [];
14697
14763
  }
14698
14764
  throw new Error(`${shapeDetail} An unresolved intrinsic here would otherwise deploy a table with no indexes.`);
@@ -33254,6 +33320,18 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
33254
33320
 
33255
33321
  //#endregion
33256
33322
  //#region src/provisioning/providers/appsync-provider.ts
33323
+ const MUTABLE_GRAPHQL_API_CONFIG_PROPERTIES = [
33324
+ "UserPoolConfig",
33325
+ "OpenIDConnectConfig",
33326
+ "LambdaAuthorizerConfig",
33327
+ "AdditionalAuthenticationProviders",
33328
+ "EnhancedMetricsConfig",
33329
+ "IntrospectionConfig",
33330
+ "QueryDepthLimit",
33331
+ "ResolverCountLimit",
33332
+ "OwnerContact",
33333
+ "MergedApiExecutionRoleArn"
33334
+ ];
33257
33335
  /**
33258
33336
  * SDK Provider for AWS AppSync resources
33259
33337
  *
@@ -33291,7 +33369,20 @@ var AppSyncProvider = class {
33291
33369
  "AuthenticationType",
33292
33370
  "XrayEnabled",
33293
33371
  "LogConfig",
33294
- "Tags"
33372
+ "Tags",
33373
+ "AdditionalAuthenticationProviders",
33374
+ "ApiType",
33375
+ "EnhancedMetricsConfig",
33376
+ "EnvironmentVariables",
33377
+ "IntrospectionConfig",
33378
+ "LambdaAuthorizerConfig",
33379
+ "MergedApiExecutionRoleArn",
33380
+ "OpenIDConnectConfig",
33381
+ "OwnerContact",
33382
+ "QueryDepthLimit",
33383
+ "ResolverCountLimit",
33384
+ "UserPoolConfig",
33385
+ "Visibility"
33295
33386
  ])],
33296
33387
  ["AWS::AppSync::GraphQLSchema", /* @__PURE__ */ new Set([
33297
33388
  "ApiId",
@@ -33331,9 +33422,9 @@ var AppSyncProvider = class {
33331
33422
  if (!this.client) this.client = new AppSyncClient(this.providerRegion ? { region: this.providerRegion } : {});
33332
33423
  return this.client;
33333
33424
  }
33334
- async create(logicalId, resourceType, properties) {
33425
+ async create(logicalId, resourceType, properties, context) {
33335
33426
  switch (resourceType) {
33336
- case "AWS::AppSync::GraphQLApi": return this.createGraphQLApi(logicalId, resourceType, properties);
33427
+ case "AWS::AppSync::GraphQLApi": return this.createGraphQLApi(logicalId, resourceType, properties, context);
33337
33428
  case "AWS::AppSync::GraphQLSchema": return this.createGraphQLSchema(logicalId, resourceType, properties);
33338
33429
  case "AWS::AppSync::DataSource": return this.createDataSource(logicalId, resourceType, properties);
33339
33430
  case "AWS::AppSync::Resolver": return this.createResolver(logicalId, resourceType, properties);
@@ -33389,6 +33480,7 @@ var AppSyncProvider = class {
33389
33480
  }
33390
33481
  async updateGraphQLApi(logicalId, physicalId, resourceType, properties, previousProperties) {
33391
33482
  if (properties["Name"] !== void 0 && previousProperties["Name"] !== void 0 && properties["Name"] !== previousProperties["Name"]) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "AWS AppSync GraphqlApi.Name is immutable — destroy + redeploy to rename");
33483
+ for (const immutable of ["ApiType", "Visibility"]) if (properties[immutable] !== void 0 && previousProperties[immutable] !== void 0 && properties[immutable] !== previousProperties[immutable]) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `AWS AppSync GraphqlApi.${immutable} is immutable — destroy + redeploy to change it`);
33392
33484
  const newAuthType = properties["AuthenticationType"];
33393
33485
  const oldAuthType = previousProperties["AuthenticationType"];
33394
33486
  const newXray = properties["XrayEnabled"];
@@ -33398,7 +33490,8 @@ var AppSyncProvider = class {
33398
33490
  const hasXrayDiff = ("XrayEnabled" in properties || "XrayEnabled" in previousProperties) && newXray !== oldXray;
33399
33491
  const hasAuthDiff = ("AuthenticationType" in properties || "AuthenticationType" in previousProperties) && newAuthType !== oldAuthType;
33400
33492
  const hasLogDiff = ("LogConfig" in properties || "LogConfig" in previousProperties) && !this.deepEqual(newLog, oldLog);
33401
- if (hasAuthDiff || hasXrayDiff || hasLogDiff) {
33493
+ const hasConfigDiff = MUTABLE_GRAPHQL_API_CONFIG_PROPERTIES.some((key) => (key in properties || key in previousProperties) && !this.deepEqual(properties[key], previousProperties[key]));
33494
+ if (hasAuthDiff || hasXrayDiff || hasLogDiff || hasConfigDiff) {
33402
33495
  const input = {
33403
33496
  apiId: physicalId,
33404
33497
  name: properties["Name"] ?? previousProperties["Name"],
@@ -33418,17 +33511,26 @@ var AppSyncProvider = class {
33418
33511
  };
33419
33512
  else this.logger.warn(`AppSync GraphqlApi ${logicalId}: cannot clear LogConfig — previous state has no CloudWatchLogsRoleArn to reuse for the disable call`);
33420
33513
  }
33514
+ this.applyGraphQLApiConfig(input, properties, {
33515
+ forUpdate: true,
33516
+ previousProperties,
33517
+ logicalId,
33518
+ shapeGuard: {
33519
+ logicalId,
33520
+ onUnusable: (message) => this.logger.warn(`${message} (leaving the live value untouched)`)
33521
+ }
33522
+ });
33421
33523
  try {
33422
33524
  await this.getClient().send(new UpdateGraphqlApiCommand(input));
33423
33525
  } catch (error) {
33424
33526
  throw this.wrapUpdateError(error, resourceType, logicalId, physicalId, "GraphqlApi");
33425
33527
  }
33426
33528
  }
33529
+ await this.applyEnvironmentVariables(physicalId, resourceType, logicalId, properties, previousProperties);
33427
33530
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
33428
33531
  return {
33429
33532
  physicalId,
33430
- wasReplaced: false,
33431
- attributes: {}
33533
+ wasReplaced: false
33432
33534
  };
33433
33535
  }
33434
33536
  async updateGraphQLSchema(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33436,8 +33538,7 @@ var AppSyncProvider = class {
33436
33538
  const oldDef = previousProperties["Definition"];
33437
33539
  if (newDef === void 0 || newDef === oldDef) return {
33438
33540
  physicalId,
33439
- wasReplaced: false,
33440
- attributes: {}
33541
+ wasReplaced: false
33441
33542
  };
33442
33543
  const apiId = properties["ApiId"] ?? physicalId;
33443
33544
  try {
@@ -33450,8 +33551,7 @@ var AppSyncProvider = class {
33450
33551
  }
33451
33552
  return {
33452
33553
  physicalId,
33453
- wasReplaced: false,
33454
- attributes: {}
33554
+ wasReplaced: false
33455
33555
  };
33456
33556
  }
33457
33557
  async updateDataSource(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33479,8 +33579,7 @@ var AppSyncProvider = class {
33479
33579
  const oldHttp = previousProperties["HttpConfig"];
33480
33580
  if (!(newDesc !== oldDesc || newRole !== oldRole || !this.deepEqual(newDDB, oldDDB) || !this.deepEqual(newLambda, oldLambda) || !this.deepEqual(newHttp, oldHttp))) return {
33481
33581
  physicalId,
33482
- wasReplaced: false,
33483
- attributes: {}
33582
+ wasReplaced: false
33484
33583
  };
33485
33584
  const input = {
33486
33585
  apiId,
@@ -33503,8 +33602,7 @@ var AppSyncProvider = class {
33503
33602
  }
33504
33603
  return {
33505
33604
  physicalId,
33506
- wasReplaced: false,
33507
- attributes: {}
33605
+ wasReplaced: false
33508
33606
  };
33509
33607
  }
33510
33608
  async updateResolver(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33530,8 +33628,7 @@ var AppSyncProvider = class {
33530
33628
  "Code"
33531
33629
  ].some((key) => !this.deepEqual(properties[key], previousProperties[key]))) return {
33532
33630
  physicalId,
33533
- wasReplaced: false,
33534
- attributes: {}
33631
+ wasReplaced: false
33535
33632
  };
33536
33633
  const input = {
33537
33634
  apiId,
@@ -33559,8 +33656,7 @@ var AppSyncProvider = class {
33559
33656
  }
33560
33657
  return {
33561
33658
  physicalId,
33562
- wasReplaced: false,
33563
- attributes: {}
33659
+ wasReplaced: false
33564
33660
  };
33565
33661
  }
33566
33662
  async updateApiKey(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33573,8 +33669,7 @@ var AppSyncProvider = class {
33573
33669
  const oldExp = previousProperties["Expires"];
33574
33670
  if (newDesc === oldDesc && newExp === oldExp) return {
33575
33671
  physicalId,
33576
- wasReplaced: false,
33577
- attributes: {}
33672
+ wasReplaced: false
33578
33673
  };
33579
33674
  const input = {
33580
33675
  apiId,
@@ -33589,8 +33684,7 @@ var AppSyncProvider = class {
33589
33684
  }
33590
33685
  return {
33591
33686
  physicalId,
33592
- wasReplaced: false,
33593
- attributes: {}
33687
+ wasReplaced: false
33594
33688
  };
33595
33689
  }
33596
33690
  /**
@@ -33677,11 +33771,212 @@ var AppSyncProvider = class {
33677
33771
  if (resourceType === "AWS::AppSync::GraphQLSchema") return ["DefinitionS3Location"];
33678
33772
  return [];
33679
33773
  }
33680
- async createGraphQLApi(logicalId, resourceType, properties) {
33774
+ /**
33775
+ * Read a nested config container.
33776
+ *
33777
+ * A present-but-NOT-an-object value (an unresolved intrinsic, a mis-nested
33778
+ * L1, a string where the template meant a block) must never fall through as
33779
+ * "absent" — that reintroduces the very silent-drop class this batch closes
33780
+ * (see `src/provisioning/config-shape.ts`'s "Never infer a default from a
33781
+ * possibly-malformed value"). An ABSENT container keeps returning
33782
+ * `undefined`, which is a legitimate "not configured".
33783
+ */
33784
+ asObject(value, path, options) {
33785
+ if (value == null) return void 0;
33786
+ if (typeof value === "object" && !Array.isArray(value)) return value;
33787
+ const message = `AWS::AppSync::GraphQLApi ${path} must be an object, got ${Array.isArray(value) ? "array" : typeof value} — cdkd refuses to drop it silently`;
33788
+ if (options?.onUnusable) {
33789
+ options.onUnusable(message);
33790
+ return;
33791
+ }
33792
+ throw new ProvisioningError(message, "AWS::AppSync::GraphQLApi", options?.logicalId ?? "");
33793
+ }
33794
+ /**
33795
+ * NOTE: `awsRegion` / `defaultAction` are passed through VERBATIM, including
33796
+ * when the template omits them. cdkd deliberately does NOT substitute a
33797
+ * default: `DefaultAction` decides whether an unauthenticated request is
33798
+ * ALLOWed or DENYed, so inventing one would be a security decision made on
33799
+ * the user's behalf, and what CloudFormation itself defaults here has not
33800
+ * been A/B-verified. An omitted required member reaches AWS as a LOUD
33801
+ * validation error naming the field — not a silent drop.
33802
+ */
33803
+ toSdkUserPoolConfig(value, path = "UserPoolConfig", options) {
33804
+ const cfn = this.asObject(value, path, options);
33805
+ if (!cfn) return void 0;
33806
+ return {
33807
+ userPoolId: cfn["UserPoolId"],
33808
+ awsRegion: cfn["AwsRegion"],
33809
+ defaultAction: cfn["DefaultAction"],
33810
+ ...cfn["AppIdClientRegex"] !== void 0 ? { appIdClientRegex: cfn["AppIdClientRegex"] } : {}
33811
+ };
33812
+ }
33813
+ /**
33814
+ * The `UserPoolConfig` nested under an ADDITIONAL auth provider is a
33815
+ * DIFFERENT shape from the top-level one — AWS models it as
33816
+ * `CognitoUserPoolConfig`, which has no `defaultAction` member.
33817
+ */
33818
+ toSdkCognitoUserPoolConfig(value, path = "UserPoolConfig", options) {
33819
+ const cfn = this.asObject(value, path, options);
33820
+ if (!cfn) return void 0;
33821
+ return {
33822
+ userPoolId: cfn["UserPoolId"],
33823
+ awsRegion: cfn["AwsRegion"],
33824
+ ...cfn["AppIdClientRegex"] !== void 0 ? { appIdClientRegex: cfn["AppIdClientRegex"] } : {}
33825
+ };
33826
+ }
33827
+ toSdkOpenIDConnectConfig(value, path = "OpenIDConnectConfig", options) {
33828
+ const cfn = this.asObject(value, path, options);
33829
+ if (!cfn) return void 0;
33830
+ return {
33831
+ issuer: cfn["Issuer"],
33832
+ ...cfn["ClientId"] !== void 0 ? { clientId: cfn["ClientId"] } : {},
33833
+ ...cfn["IatTTL"] !== void 0 ? { iatTTL: cfn["IatTTL"] } : {},
33834
+ ...cfn["AuthTTL"] !== void 0 ? { authTTL: cfn["AuthTTL"] } : {}
33835
+ };
33836
+ }
33837
+ toSdkLambdaAuthorizerConfig(value, path = "LambdaAuthorizerConfig", options) {
33838
+ const cfn = this.asObject(value, path, options);
33839
+ if (!cfn) return void 0;
33840
+ return {
33841
+ authorizerUri: cfn["AuthorizerUri"],
33842
+ ...cfn["AuthorizerResultTtlInSeconds"] !== void 0 ? { authorizerResultTtlInSeconds: cfn["AuthorizerResultTtlInSeconds"] } : {},
33843
+ ...cfn["IdentityValidationExpression"] !== void 0 ? { identityValidationExpression: cfn["IdentityValidationExpression"] } : {}
33844
+ };
33845
+ }
33846
+ toSdkAdditionalAuthProviders(value, options) {
33847
+ if (value == null) return void 0;
33848
+ let entries;
33849
+ try {
33850
+ entries = requireConfigArray(value, "AWS::AppSync::GraphQLApi AdditionalAuthenticationProviders");
33851
+ } catch (error) {
33852
+ const message = error instanceof Error ? error.message : String(error);
33853
+ if (options?.onUnusable) {
33854
+ options.onUnusable(message);
33855
+ return;
33856
+ }
33857
+ throw new ProvisioningError(message, "AWS::AppSync::GraphQLApi", options?.logicalId ?? "", void 0, error instanceof Error ? error : void 0);
33858
+ }
33859
+ return entries.map((entry, index) => {
33860
+ const at = `AdditionalAuthenticationProviders[${index}]`;
33861
+ const cfn = this.asObject(entry, at, options) ?? {};
33862
+ const provider = {};
33863
+ if (cfn["AuthenticationType"] !== void 0) provider.authenticationType = cfn["AuthenticationType"];
33864
+ const oidc = this.toSdkOpenIDConnectConfig(cfn["OpenIDConnectConfig"], `${at}.OpenIDConnectConfig`, options);
33865
+ if (oidc) provider.openIDConnectConfig = oidc;
33866
+ const pool = this.toSdkCognitoUserPoolConfig(cfn["UserPoolConfig"], `${at}.UserPoolConfig`);
33867
+ if (pool) provider.userPoolConfig = pool;
33868
+ const lambda = this.toSdkLambdaAuthorizerConfig(cfn["LambdaAuthorizerConfig"], `${at}.LambdaAuthorizerConfig`, options);
33869
+ if (lambda) provider.lambdaAuthorizerConfig = lambda;
33870
+ return provider;
33871
+ });
33872
+ }
33873
+ toSdkEnhancedMetricsConfig(value, options) {
33874
+ const cfn = this.asObject(value, "EnhancedMetricsConfig", options);
33875
+ if (!cfn) return void 0;
33876
+ return {
33877
+ resolverLevelMetricsBehavior: cfn["ResolverLevelMetricsBehavior"],
33878
+ dataSourceLevelMetricsBehavior: cfn["DataSourceLevelMetricsBehavior"],
33879
+ operationLevelMetricsConfig: cfn["OperationLevelMetricsConfig"]
33880
+ };
33881
+ }
33882
+ /**
33883
+ * Fill the config members shared by `CreateGraphqlApi` and
33884
+ * `UpdateGraphqlApi` from the CFn property bag.
33885
+ *
33886
+ * `ApiType` / `Visibility` are deliberately NOT here: the SDK's update
33887
+ * input has no member for either (they are create-only on AWS), so
33888
+ * `updateGraphQLApi` refuses the change and the replacement rule in
33889
+ * `src/analyzer/replacement-rules.ts` routes it through CREATE+DELETE.
33890
+ *
33891
+ * `forUpdate` turns on the removal sentinels: on UPDATE a property the
33892
+ * user DELETED from the template must be actively reset, because
33893
+ * AppSync treats an omitted member as "no change" (the same semantic
33894
+ * `LogConfig`'s clearing branch documents below). Only the members AWS
33895
+ * gives a sentinel for can be reset that way — `MergedApiExecutionRoleArn`
33896
+ * and the three auth-config blocks have none, so their removal is
33897
+ * reported to the user instead of silently no-op'ing.
33898
+ */
33899
+ applyGraphQLApiConfig(input, properties, options) {
33900
+ const forUpdate = options?.forUpdate === true;
33901
+ const previous = options?.previousProperties ?? {};
33902
+ const guard = options?.shapeGuard ?? (options?.logicalId !== void 0 ? { logicalId: options.logicalId } : {});
33903
+ const removed = (key) => forUpdate && properties[key] === void 0 && previous[key] !== void 0;
33904
+ const userPool = this.toSdkUserPoolConfig(properties["UserPoolConfig"], "UserPoolConfig", guard);
33905
+ if (userPool) input.userPoolConfig = userPool;
33906
+ const oidc = this.toSdkOpenIDConnectConfig(properties["OpenIDConnectConfig"], "OpenIDConnectConfig", guard);
33907
+ if (oidc) input.openIDConnectConfig = oidc;
33908
+ const lambdaAuth = this.toSdkLambdaAuthorizerConfig(properties["LambdaAuthorizerConfig"], "LambdaAuthorizerConfig", guard);
33909
+ if (lambdaAuth) input.lambdaAuthorizerConfig = lambdaAuth;
33910
+ const additional = this.toSdkAdditionalAuthProviders(properties["AdditionalAuthenticationProviders"], guard);
33911
+ if (additional) input.additionalAuthenticationProviders = additional;
33912
+ else if (removed("AdditionalAuthenticationProviders")) input.additionalAuthenticationProviders = [];
33913
+ const metrics = this.toSdkEnhancedMetricsConfig(properties["EnhancedMetricsConfig"], guard);
33914
+ if (metrics) input.enhancedMetricsConfig = metrics;
33915
+ if (properties["IntrospectionConfig"] !== void 0) input.introspectionConfig = properties["IntrospectionConfig"];
33916
+ else if (removed("IntrospectionConfig")) input.introspectionConfig = "ENABLED";
33917
+ if (properties["QueryDepthLimit"] !== void 0) input.queryDepthLimit = properties["QueryDepthLimit"];
33918
+ else if (removed("QueryDepthLimit")) input.queryDepthLimit = 0;
33919
+ if (properties["ResolverCountLimit"] !== void 0) input.resolverCountLimit = properties["ResolverCountLimit"];
33920
+ else if (removed("ResolverCountLimit")) input.resolverCountLimit = 0;
33921
+ if (properties["OwnerContact"] !== void 0) input.ownerContact = properties["OwnerContact"];
33922
+ else if (removed("OwnerContact")) input.ownerContact = "";
33923
+ if (properties["MergedApiExecutionRoleArn"] !== void 0) input.mergedApiExecutionRoleArn = properties["MergedApiExecutionRoleArn"];
33924
+ if (forUpdate) {
33925
+ for (const key of [
33926
+ "MergedApiExecutionRoleArn",
33927
+ "UserPoolConfig",
33928
+ "OpenIDConnectConfig",
33929
+ "LambdaAuthorizerConfig",
33930
+ "EnhancedMetricsConfig"
33931
+ ]) if (removed(key)) this.logger.warn(`AppSync GraphqlApi ${options?.logicalId ?? ""}: cannot clear ${key} on update — AppSync has no reset sentinel for it and treats an omitted member as "no change". Destroy + redeploy the API to drop it.`);
33932
+ }
33933
+ }
33934
+ /**
33935
+ * `EnvironmentVariables` lives on its OWN API pair
33936
+ * (`PutGraphqlApiEnvironmentVariables` / `Get...`), not on
33937
+ * Create/UpdateGraphqlApi. The PUT is whole-map replace, so a removed
33938
+ * key is cleared by re-putting the remaining map (and `{}` clears all).
33939
+ */
33940
+ async applyEnvironmentVariables(apiId, resourceType, logicalId, properties, previousProperties, replayingState = false) {
33941
+ const isUpdate = previousProperties !== void 0;
33942
+ let desired;
33943
+ try {
33944
+ desired = this.asObject(properties["EnvironmentVariables"], "EnvironmentVariables", { logicalId });
33945
+ } catch (error) {
33946
+ if (!isUpdate && !replayingState) throw error;
33947
+ this.logger.warn(`AppSync GraphqlApi ${logicalId}: ${error instanceof Error ? error.message : String(error)} — leaving the live environment variables untouched`);
33948
+ return;
33949
+ }
33950
+ let previous;
33951
+ if (previousProperties) {
33952
+ const raw = previousProperties["EnvironmentVariables"];
33953
+ previous = raw != null && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
33954
+ }
33955
+ if (desired === void 0 && previous === void 0) return;
33956
+ if (isUpdate && this.deepEqual(desired, previous)) return;
33957
+ const environmentVariables = {};
33958
+ for (const [key, value] of Object.entries(desired ?? {})) if (typeof value === "string") environmentVariables[key] = value;
33959
+ else if (typeof value === "number" && Number.isFinite(value) || typeof value === "boolean") environmentVariables[key] = String(value);
33960
+ else throw new ProvisioningError(`AWS::AppSync::GraphQLApi EnvironmentVariables.${key} must be a string, got ${Array.isArray(value) ? "array" : value === null ? "null" : typeof value}`, resourceType, logicalId, apiId);
33961
+ try {
33962
+ await this.getClient().send(new PutGraphqlApiEnvironmentVariablesCommand({
33963
+ apiId,
33964
+ environmentVariables
33965
+ }));
33966
+ } catch (error) {
33967
+ throw this.wrapUpdateError(error, resourceType, logicalId, apiId, isUpdate ? "GraphqlApi (env vars)" : "GraphqlApi (env vars, post-create)");
33968
+ }
33969
+ }
33970
+ async createGraphQLApi(logicalId, resourceType, properties, context) {
33681
33971
  this.logger.debug(`Creating GraphQL API ${logicalId}`);
33682
33972
  const name = properties["Name"];
33683
33973
  if (!name) throw new ProvisioningError(`Name is required for GraphQLApi ${logicalId}`, resourceType, logicalId);
33684
33974
  const authenticationType = properties["AuthenticationType"];
33975
+ let createdApiId;
33976
+ const shapeGuard = {
33977
+ logicalId,
33978
+ ...context?.replayingState === true ? { onUnusable: (message) => this.logger.warn(`${message} (state replay — proceeding without it)`) } : {}
33979
+ };
33685
33980
  try {
33686
33981
  const input = {
33687
33982
  name,
@@ -33702,10 +33997,18 @@ var AppSyncProvider = class {
33702
33997
  for (const tag of tags) tagMap[tag.Key] = tag.Value;
33703
33998
  input.tags = tagMap;
33704
33999
  }
34000
+ this.applyGraphQLApiConfig(input, properties, {
34001
+ logicalId,
34002
+ shapeGuard
34003
+ });
34004
+ if (properties["ApiType"] !== void 0) input.apiType = properties["ApiType"];
34005
+ if (properties["Visibility"] !== void 0) input.visibility = properties["Visibility"];
33705
34006
  const response = await this.getClient().send(new CreateGraphqlApiCommand(input));
34007
+ createdApiId = response.graphqlApi?.apiId;
33706
34008
  const apiId = response.graphqlApi.apiId;
33707
34009
  const arn = response.graphqlApi.arn;
33708
34010
  const graphQLUrl = response.graphqlApi.uris?.["GRAPHQL"] ?? "";
34011
+ await this.applyEnvironmentVariables(apiId, resourceType, logicalId, properties, void 0, context?.replayingState === true);
33709
34012
  this.logger.debug(`Successfully created GraphQL API ${logicalId}: ${apiId}`);
33710
34013
  return {
33711
34014
  physicalId: apiId,
@@ -33716,6 +34019,12 @@ var AppSyncProvider = class {
33716
34019
  }
33717
34020
  };
33718
34021
  } catch (error) {
34022
+ if (createdApiId) try {
34023
+ await this.getClient().send(new DeleteGraphqlApiCommand({ apiId: createdApiId }));
34024
+ this.logger.debug(`Rolled back partially-created GraphQL API ${createdApiId}`);
34025
+ } catch (rollbackError) {
34026
+ this.logger.warn(`Failed to roll back partially-created GraphQL API ${createdApiId}: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
34027
+ }
33719
34028
  const cause = error instanceof Error ? error : void 0;
33720
34029
  throw new ProvisioningError(`Failed to create GraphQL API ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
33721
34030
  }
@@ -34039,8 +34348,62 @@ var AppSyncProvider = class {
34039
34348
  result["LogConfig"] = log;
34040
34349
  }
34041
34350
  result["Tags"] = normalizeAwsTagsToCfn(api.tags);
34351
+ if (api.userPoolConfig) result["UserPoolConfig"] = this.userPoolConfigToCfn(api.userPoolConfig);
34352
+ if (api.openIDConnectConfig) result["OpenIDConnectConfig"] = this.openIDConnectConfigToCfn(api.openIDConnectConfig);
34353
+ if (api.lambdaAuthorizerConfig) result["LambdaAuthorizerConfig"] = this.lambdaAuthorizerConfigToCfn(api.lambdaAuthorizerConfig);
34354
+ if (api.additionalAuthenticationProviders) result["AdditionalAuthenticationProviders"] = api.additionalAuthenticationProviders.map((provider) => {
34355
+ const entry = {};
34356
+ if (provider.authenticationType !== void 0) entry["AuthenticationType"] = provider.authenticationType;
34357
+ if (provider.openIDConnectConfig) entry["OpenIDConnectConfig"] = this.openIDConnectConfigToCfn(provider.openIDConnectConfig);
34358
+ if (provider.userPoolConfig) entry["UserPoolConfig"] = this.userPoolConfigToCfn(provider.userPoolConfig);
34359
+ if (provider.lambdaAuthorizerConfig) entry["LambdaAuthorizerConfig"] = this.lambdaAuthorizerConfigToCfn(provider.lambdaAuthorizerConfig);
34360
+ return entry;
34361
+ });
34362
+ if (api.enhancedMetricsConfig) {
34363
+ const metrics = {};
34364
+ if (api.enhancedMetricsConfig.resolverLevelMetricsBehavior !== void 0) metrics["ResolverLevelMetricsBehavior"] = api.enhancedMetricsConfig.resolverLevelMetricsBehavior;
34365
+ if (api.enhancedMetricsConfig.dataSourceLevelMetricsBehavior !== void 0) metrics["DataSourceLevelMetricsBehavior"] = api.enhancedMetricsConfig.dataSourceLevelMetricsBehavior;
34366
+ if (api.enhancedMetricsConfig.operationLevelMetricsConfig !== void 0) metrics["OperationLevelMetricsConfig"] = api.enhancedMetricsConfig.operationLevelMetricsConfig;
34367
+ result["EnhancedMetricsConfig"] = metrics;
34368
+ }
34369
+ if (api.apiType !== void 0) result["ApiType"] = api.apiType;
34370
+ if (api.visibility !== void 0) result["Visibility"] = api.visibility;
34371
+ if (api.introspectionConfig !== void 0) result["IntrospectionConfig"] = api.introspectionConfig;
34372
+ if (api.queryDepthLimit !== void 0) result["QueryDepthLimit"] = api.queryDepthLimit;
34373
+ if (api.resolverCountLimit !== void 0) result["ResolverCountLimit"] = api.resolverCountLimit;
34374
+ if (api.ownerContact !== void 0) result["OwnerContact"] = api.ownerContact;
34375
+ if (api.mergedApiExecutionRoleArn !== void 0) result["MergedApiExecutionRoleArn"] = api.mergedApiExecutionRoleArn;
34376
+ try {
34377
+ const envResp = await this.getClient().send(new GetGraphqlApiEnvironmentVariablesCommand({ apiId: physicalId }));
34378
+ if (envResp.environmentVariables !== void 0) result["EnvironmentVariables"] = envResp.environmentVariables;
34379
+ } catch (err) {
34380
+ this.logger.warn(`Could not read AppSync GraphqlApi ${physicalId} environment variables (drift on that property will not be reported): ${err instanceof Error ? err.message : String(err)}`);
34381
+ }
34042
34382
  return result;
34043
34383
  }
34384
+ userPoolConfigToCfn(config) {
34385
+ const out = {};
34386
+ if (config.userPoolId !== void 0) out["UserPoolId"] = config.userPoolId;
34387
+ if (config.awsRegion !== void 0) out["AwsRegion"] = config.awsRegion;
34388
+ if ("defaultAction" in config && config.defaultAction !== void 0) out["DefaultAction"] = config.defaultAction;
34389
+ if (config.appIdClientRegex !== void 0) out["AppIdClientRegex"] = config.appIdClientRegex;
34390
+ return out;
34391
+ }
34392
+ openIDConnectConfigToCfn(config) {
34393
+ const out = {};
34394
+ if (config.issuer !== void 0) out["Issuer"] = config.issuer;
34395
+ if (config.clientId !== void 0) out["ClientId"] = config.clientId;
34396
+ if (config.iatTTL !== void 0) out["IatTTL"] = config.iatTTL;
34397
+ if (config.authTTL !== void 0) out["AuthTTL"] = config.authTTL;
34398
+ return out;
34399
+ }
34400
+ lambdaAuthorizerConfigToCfn(config) {
34401
+ const out = {};
34402
+ if (config.authorizerUri !== void 0) out["AuthorizerUri"] = config.authorizerUri;
34403
+ if (config.authorizerResultTtlInSeconds !== void 0) out["AuthorizerResultTtlInSeconds"] = config.authorizerResultTtlInSeconds;
34404
+ if (config.identityValidationExpression !== void 0) out["IdentityValidationExpression"] = config.identityValidationExpression;
34405
+ return out;
34406
+ }
34044
34407
  async readDataSource(physicalId) {
34045
34408
  const [apiId, name] = physicalId.split("|");
34046
34409
  if (!apiId || !name) return void 0;
@@ -67739,7 +68102,7 @@ function createMigrateCommand() {
67739
68102
  */
67740
68103
  function buildProgram() {
67741
68104
  const program = new Command();
67742
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.52");
68105
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.54");
67743
68106
  program.hook("preAction", (_thisCommand, actionCommand) => {
67744
68107
  const { profile } = actionCommand.optsWithGlobals();
67745
68108
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;