@go-to-k/cdkd 0.278.51 → 0.278.53

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-C1otn94r.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-CeEJqaaT.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-B2jsUFUl.js";
4
+ import { t as ASGProvider } from "./asg-provider-Camwh-s6.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";
@@ -33254,6 +33254,18 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
33254
33254
 
33255
33255
  //#endregion
33256
33256
  //#region src/provisioning/providers/appsync-provider.ts
33257
+ const MUTABLE_GRAPHQL_API_CONFIG_PROPERTIES = [
33258
+ "UserPoolConfig",
33259
+ "OpenIDConnectConfig",
33260
+ "LambdaAuthorizerConfig",
33261
+ "AdditionalAuthenticationProviders",
33262
+ "EnhancedMetricsConfig",
33263
+ "IntrospectionConfig",
33264
+ "QueryDepthLimit",
33265
+ "ResolverCountLimit",
33266
+ "OwnerContact",
33267
+ "MergedApiExecutionRoleArn"
33268
+ ];
33257
33269
  /**
33258
33270
  * SDK Provider for AWS AppSync resources
33259
33271
  *
@@ -33291,7 +33303,20 @@ var AppSyncProvider = class {
33291
33303
  "AuthenticationType",
33292
33304
  "XrayEnabled",
33293
33305
  "LogConfig",
33294
- "Tags"
33306
+ "Tags",
33307
+ "AdditionalAuthenticationProviders",
33308
+ "ApiType",
33309
+ "EnhancedMetricsConfig",
33310
+ "EnvironmentVariables",
33311
+ "IntrospectionConfig",
33312
+ "LambdaAuthorizerConfig",
33313
+ "MergedApiExecutionRoleArn",
33314
+ "OpenIDConnectConfig",
33315
+ "OwnerContact",
33316
+ "QueryDepthLimit",
33317
+ "ResolverCountLimit",
33318
+ "UserPoolConfig",
33319
+ "Visibility"
33295
33320
  ])],
33296
33321
  ["AWS::AppSync::GraphQLSchema", /* @__PURE__ */ new Set([
33297
33322
  "ApiId",
@@ -33331,9 +33356,9 @@ var AppSyncProvider = class {
33331
33356
  if (!this.client) this.client = new AppSyncClient(this.providerRegion ? { region: this.providerRegion } : {});
33332
33357
  return this.client;
33333
33358
  }
33334
- async create(logicalId, resourceType, properties) {
33359
+ async create(logicalId, resourceType, properties, context) {
33335
33360
  switch (resourceType) {
33336
- case "AWS::AppSync::GraphQLApi": return this.createGraphQLApi(logicalId, resourceType, properties);
33361
+ case "AWS::AppSync::GraphQLApi": return this.createGraphQLApi(logicalId, resourceType, properties, context);
33337
33362
  case "AWS::AppSync::GraphQLSchema": return this.createGraphQLSchema(logicalId, resourceType, properties);
33338
33363
  case "AWS::AppSync::DataSource": return this.createDataSource(logicalId, resourceType, properties);
33339
33364
  case "AWS::AppSync::Resolver": return this.createResolver(logicalId, resourceType, properties);
@@ -33389,6 +33414,7 @@ var AppSyncProvider = class {
33389
33414
  }
33390
33415
  async updateGraphQLApi(logicalId, physicalId, resourceType, properties, previousProperties) {
33391
33416
  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");
33417
+ 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
33418
  const newAuthType = properties["AuthenticationType"];
33393
33419
  const oldAuthType = previousProperties["AuthenticationType"];
33394
33420
  const newXray = properties["XrayEnabled"];
@@ -33398,7 +33424,8 @@ var AppSyncProvider = class {
33398
33424
  const hasXrayDiff = ("XrayEnabled" in properties || "XrayEnabled" in previousProperties) && newXray !== oldXray;
33399
33425
  const hasAuthDiff = ("AuthenticationType" in properties || "AuthenticationType" in previousProperties) && newAuthType !== oldAuthType;
33400
33426
  const hasLogDiff = ("LogConfig" in properties || "LogConfig" in previousProperties) && !this.deepEqual(newLog, oldLog);
33401
- if (hasAuthDiff || hasXrayDiff || hasLogDiff) {
33427
+ const hasConfigDiff = MUTABLE_GRAPHQL_API_CONFIG_PROPERTIES.some((key) => (key in properties || key in previousProperties) && !this.deepEqual(properties[key], previousProperties[key]));
33428
+ if (hasAuthDiff || hasXrayDiff || hasLogDiff || hasConfigDiff) {
33402
33429
  const input = {
33403
33430
  apiId: physicalId,
33404
33431
  name: properties["Name"] ?? previousProperties["Name"],
@@ -33418,17 +33445,26 @@ var AppSyncProvider = class {
33418
33445
  };
33419
33446
  else this.logger.warn(`AppSync GraphqlApi ${logicalId}: cannot clear LogConfig — previous state has no CloudWatchLogsRoleArn to reuse for the disable call`);
33420
33447
  }
33448
+ this.applyGraphQLApiConfig(input, properties, {
33449
+ forUpdate: true,
33450
+ previousProperties,
33451
+ logicalId,
33452
+ shapeGuard: {
33453
+ logicalId,
33454
+ onUnusable: (message) => this.logger.warn(`${message} (leaving the live value untouched)`)
33455
+ }
33456
+ });
33421
33457
  try {
33422
33458
  await this.getClient().send(new UpdateGraphqlApiCommand(input));
33423
33459
  } catch (error) {
33424
33460
  throw this.wrapUpdateError(error, resourceType, logicalId, physicalId, "GraphqlApi");
33425
33461
  }
33426
33462
  }
33463
+ await this.applyEnvironmentVariables(physicalId, resourceType, logicalId, properties, previousProperties);
33427
33464
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
33428
33465
  return {
33429
33466
  physicalId,
33430
- wasReplaced: false,
33431
- attributes: {}
33467
+ wasReplaced: false
33432
33468
  };
33433
33469
  }
33434
33470
  async updateGraphQLSchema(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33436,8 +33472,7 @@ var AppSyncProvider = class {
33436
33472
  const oldDef = previousProperties["Definition"];
33437
33473
  if (newDef === void 0 || newDef === oldDef) return {
33438
33474
  physicalId,
33439
- wasReplaced: false,
33440
- attributes: {}
33475
+ wasReplaced: false
33441
33476
  };
33442
33477
  const apiId = properties["ApiId"] ?? physicalId;
33443
33478
  try {
@@ -33450,8 +33485,7 @@ var AppSyncProvider = class {
33450
33485
  }
33451
33486
  return {
33452
33487
  physicalId,
33453
- wasReplaced: false,
33454
- attributes: {}
33488
+ wasReplaced: false
33455
33489
  };
33456
33490
  }
33457
33491
  async updateDataSource(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33479,8 +33513,7 @@ var AppSyncProvider = class {
33479
33513
  const oldHttp = previousProperties["HttpConfig"];
33480
33514
  if (!(newDesc !== oldDesc || newRole !== oldRole || !this.deepEqual(newDDB, oldDDB) || !this.deepEqual(newLambda, oldLambda) || !this.deepEqual(newHttp, oldHttp))) return {
33481
33515
  physicalId,
33482
- wasReplaced: false,
33483
- attributes: {}
33516
+ wasReplaced: false
33484
33517
  };
33485
33518
  const input = {
33486
33519
  apiId,
@@ -33503,8 +33536,7 @@ var AppSyncProvider = class {
33503
33536
  }
33504
33537
  return {
33505
33538
  physicalId,
33506
- wasReplaced: false,
33507
- attributes: {}
33539
+ wasReplaced: false
33508
33540
  };
33509
33541
  }
33510
33542
  async updateResolver(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33530,8 +33562,7 @@ var AppSyncProvider = class {
33530
33562
  "Code"
33531
33563
  ].some((key) => !this.deepEqual(properties[key], previousProperties[key]))) return {
33532
33564
  physicalId,
33533
- wasReplaced: false,
33534
- attributes: {}
33565
+ wasReplaced: false
33535
33566
  };
33536
33567
  const input = {
33537
33568
  apiId,
@@ -33559,8 +33590,7 @@ var AppSyncProvider = class {
33559
33590
  }
33560
33591
  return {
33561
33592
  physicalId,
33562
- wasReplaced: false,
33563
- attributes: {}
33593
+ wasReplaced: false
33564
33594
  };
33565
33595
  }
33566
33596
  async updateApiKey(logicalId, physicalId, resourceType, properties, previousProperties) {
@@ -33573,8 +33603,7 @@ var AppSyncProvider = class {
33573
33603
  const oldExp = previousProperties["Expires"];
33574
33604
  if (newDesc === oldDesc && newExp === oldExp) return {
33575
33605
  physicalId,
33576
- wasReplaced: false,
33577
- attributes: {}
33606
+ wasReplaced: false
33578
33607
  };
33579
33608
  const input = {
33580
33609
  apiId,
@@ -33589,8 +33618,7 @@ var AppSyncProvider = class {
33589
33618
  }
33590
33619
  return {
33591
33620
  physicalId,
33592
- wasReplaced: false,
33593
- attributes: {}
33621
+ wasReplaced: false
33594
33622
  };
33595
33623
  }
33596
33624
  /**
@@ -33677,11 +33705,212 @@ var AppSyncProvider = class {
33677
33705
  if (resourceType === "AWS::AppSync::GraphQLSchema") return ["DefinitionS3Location"];
33678
33706
  return [];
33679
33707
  }
33680
- async createGraphQLApi(logicalId, resourceType, properties) {
33708
+ /**
33709
+ * Read a nested config container.
33710
+ *
33711
+ * A present-but-NOT-an-object value (an unresolved intrinsic, a mis-nested
33712
+ * L1, a string where the template meant a block) must never fall through as
33713
+ * "absent" — that reintroduces the very silent-drop class this batch closes
33714
+ * (see `src/provisioning/config-shape.ts`'s "Never infer a default from a
33715
+ * possibly-malformed value"). An ABSENT container keeps returning
33716
+ * `undefined`, which is a legitimate "not configured".
33717
+ */
33718
+ asObject(value, path, options) {
33719
+ if (value == null) return void 0;
33720
+ if (typeof value === "object" && !Array.isArray(value)) return value;
33721
+ const message = `AWS::AppSync::GraphQLApi ${path} must be an object, got ${Array.isArray(value) ? "array" : typeof value} — cdkd refuses to drop it silently`;
33722
+ if (options?.onUnusable) {
33723
+ options.onUnusable(message);
33724
+ return;
33725
+ }
33726
+ throw new ProvisioningError(message, "AWS::AppSync::GraphQLApi", options?.logicalId ?? "");
33727
+ }
33728
+ /**
33729
+ * NOTE: `awsRegion` / `defaultAction` are passed through VERBATIM, including
33730
+ * when the template omits them. cdkd deliberately does NOT substitute a
33731
+ * default: `DefaultAction` decides whether an unauthenticated request is
33732
+ * ALLOWed or DENYed, so inventing one would be a security decision made on
33733
+ * the user's behalf, and what CloudFormation itself defaults here has not
33734
+ * been A/B-verified. An omitted required member reaches AWS as a LOUD
33735
+ * validation error naming the field — not a silent drop.
33736
+ */
33737
+ toSdkUserPoolConfig(value, path = "UserPoolConfig", options) {
33738
+ const cfn = this.asObject(value, path, options);
33739
+ if (!cfn) return void 0;
33740
+ return {
33741
+ userPoolId: cfn["UserPoolId"],
33742
+ awsRegion: cfn["AwsRegion"],
33743
+ defaultAction: cfn["DefaultAction"],
33744
+ ...cfn["AppIdClientRegex"] !== void 0 ? { appIdClientRegex: cfn["AppIdClientRegex"] } : {}
33745
+ };
33746
+ }
33747
+ /**
33748
+ * The `UserPoolConfig` nested under an ADDITIONAL auth provider is a
33749
+ * DIFFERENT shape from the top-level one — AWS models it as
33750
+ * `CognitoUserPoolConfig`, which has no `defaultAction` member.
33751
+ */
33752
+ toSdkCognitoUserPoolConfig(value, path = "UserPoolConfig", options) {
33753
+ const cfn = this.asObject(value, path, options);
33754
+ if (!cfn) return void 0;
33755
+ return {
33756
+ userPoolId: cfn["UserPoolId"],
33757
+ awsRegion: cfn["AwsRegion"],
33758
+ ...cfn["AppIdClientRegex"] !== void 0 ? { appIdClientRegex: cfn["AppIdClientRegex"] } : {}
33759
+ };
33760
+ }
33761
+ toSdkOpenIDConnectConfig(value, path = "OpenIDConnectConfig", options) {
33762
+ const cfn = this.asObject(value, path, options);
33763
+ if (!cfn) return void 0;
33764
+ return {
33765
+ issuer: cfn["Issuer"],
33766
+ ...cfn["ClientId"] !== void 0 ? { clientId: cfn["ClientId"] } : {},
33767
+ ...cfn["IatTTL"] !== void 0 ? { iatTTL: cfn["IatTTL"] } : {},
33768
+ ...cfn["AuthTTL"] !== void 0 ? { authTTL: cfn["AuthTTL"] } : {}
33769
+ };
33770
+ }
33771
+ toSdkLambdaAuthorizerConfig(value, path = "LambdaAuthorizerConfig", options) {
33772
+ const cfn = this.asObject(value, path, options);
33773
+ if (!cfn) return void 0;
33774
+ return {
33775
+ authorizerUri: cfn["AuthorizerUri"],
33776
+ ...cfn["AuthorizerResultTtlInSeconds"] !== void 0 ? { authorizerResultTtlInSeconds: cfn["AuthorizerResultTtlInSeconds"] } : {},
33777
+ ...cfn["IdentityValidationExpression"] !== void 0 ? { identityValidationExpression: cfn["IdentityValidationExpression"] } : {}
33778
+ };
33779
+ }
33780
+ toSdkAdditionalAuthProviders(value, options) {
33781
+ if (value == null) return void 0;
33782
+ let entries;
33783
+ try {
33784
+ entries = requireConfigArray(value, "AWS::AppSync::GraphQLApi AdditionalAuthenticationProviders");
33785
+ } catch (error) {
33786
+ const message = error instanceof Error ? error.message : String(error);
33787
+ if (options?.onUnusable) {
33788
+ options.onUnusable(message);
33789
+ return;
33790
+ }
33791
+ throw new ProvisioningError(message, "AWS::AppSync::GraphQLApi", options?.logicalId ?? "", void 0, error instanceof Error ? error : void 0);
33792
+ }
33793
+ return entries.map((entry, index) => {
33794
+ const at = `AdditionalAuthenticationProviders[${index}]`;
33795
+ const cfn = this.asObject(entry, at, options) ?? {};
33796
+ const provider = {};
33797
+ if (cfn["AuthenticationType"] !== void 0) provider.authenticationType = cfn["AuthenticationType"];
33798
+ const oidc = this.toSdkOpenIDConnectConfig(cfn["OpenIDConnectConfig"], `${at}.OpenIDConnectConfig`, options);
33799
+ if (oidc) provider.openIDConnectConfig = oidc;
33800
+ const pool = this.toSdkCognitoUserPoolConfig(cfn["UserPoolConfig"], `${at}.UserPoolConfig`);
33801
+ if (pool) provider.userPoolConfig = pool;
33802
+ const lambda = this.toSdkLambdaAuthorizerConfig(cfn["LambdaAuthorizerConfig"], `${at}.LambdaAuthorizerConfig`, options);
33803
+ if (lambda) provider.lambdaAuthorizerConfig = lambda;
33804
+ return provider;
33805
+ });
33806
+ }
33807
+ toSdkEnhancedMetricsConfig(value, options) {
33808
+ const cfn = this.asObject(value, "EnhancedMetricsConfig", options);
33809
+ if (!cfn) return void 0;
33810
+ return {
33811
+ resolverLevelMetricsBehavior: cfn["ResolverLevelMetricsBehavior"],
33812
+ dataSourceLevelMetricsBehavior: cfn["DataSourceLevelMetricsBehavior"],
33813
+ operationLevelMetricsConfig: cfn["OperationLevelMetricsConfig"]
33814
+ };
33815
+ }
33816
+ /**
33817
+ * Fill the config members shared by `CreateGraphqlApi` and
33818
+ * `UpdateGraphqlApi` from the CFn property bag.
33819
+ *
33820
+ * `ApiType` / `Visibility` are deliberately NOT here: the SDK's update
33821
+ * input has no member for either (they are create-only on AWS), so
33822
+ * `updateGraphQLApi` refuses the change and the replacement rule in
33823
+ * `src/analyzer/replacement-rules.ts` routes it through CREATE+DELETE.
33824
+ *
33825
+ * `forUpdate` turns on the removal sentinels: on UPDATE a property the
33826
+ * user DELETED from the template must be actively reset, because
33827
+ * AppSync treats an omitted member as "no change" (the same semantic
33828
+ * `LogConfig`'s clearing branch documents below). Only the members AWS
33829
+ * gives a sentinel for can be reset that way — `MergedApiExecutionRoleArn`
33830
+ * and the three auth-config blocks have none, so their removal is
33831
+ * reported to the user instead of silently no-op'ing.
33832
+ */
33833
+ applyGraphQLApiConfig(input, properties, options) {
33834
+ const forUpdate = options?.forUpdate === true;
33835
+ const previous = options?.previousProperties ?? {};
33836
+ const guard = options?.shapeGuard ?? (options?.logicalId !== void 0 ? { logicalId: options.logicalId } : {});
33837
+ const removed = (key) => forUpdate && properties[key] === void 0 && previous[key] !== void 0;
33838
+ const userPool = this.toSdkUserPoolConfig(properties["UserPoolConfig"], "UserPoolConfig", guard);
33839
+ if (userPool) input.userPoolConfig = userPool;
33840
+ const oidc = this.toSdkOpenIDConnectConfig(properties["OpenIDConnectConfig"], "OpenIDConnectConfig", guard);
33841
+ if (oidc) input.openIDConnectConfig = oidc;
33842
+ const lambdaAuth = this.toSdkLambdaAuthorizerConfig(properties["LambdaAuthorizerConfig"], "LambdaAuthorizerConfig", guard);
33843
+ if (lambdaAuth) input.lambdaAuthorizerConfig = lambdaAuth;
33844
+ const additional = this.toSdkAdditionalAuthProviders(properties["AdditionalAuthenticationProviders"], guard);
33845
+ if (additional) input.additionalAuthenticationProviders = additional;
33846
+ else if (removed("AdditionalAuthenticationProviders")) input.additionalAuthenticationProviders = [];
33847
+ const metrics = this.toSdkEnhancedMetricsConfig(properties["EnhancedMetricsConfig"], guard);
33848
+ if (metrics) input.enhancedMetricsConfig = metrics;
33849
+ if (properties["IntrospectionConfig"] !== void 0) input.introspectionConfig = properties["IntrospectionConfig"];
33850
+ else if (removed("IntrospectionConfig")) input.introspectionConfig = "ENABLED";
33851
+ if (properties["QueryDepthLimit"] !== void 0) input.queryDepthLimit = properties["QueryDepthLimit"];
33852
+ else if (removed("QueryDepthLimit")) input.queryDepthLimit = 0;
33853
+ if (properties["ResolverCountLimit"] !== void 0) input.resolverCountLimit = properties["ResolverCountLimit"];
33854
+ else if (removed("ResolverCountLimit")) input.resolverCountLimit = 0;
33855
+ if (properties["OwnerContact"] !== void 0) input.ownerContact = properties["OwnerContact"];
33856
+ else if (removed("OwnerContact")) input.ownerContact = "";
33857
+ if (properties["MergedApiExecutionRoleArn"] !== void 0) input.mergedApiExecutionRoleArn = properties["MergedApiExecutionRoleArn"];
33858
+ if (forUpdate) {
33859
+ for (const key of [
33860
+ "MergedApiExecutionRoleArn",
33861
+ "UserPoolConfig",
33862
+ "OpenIDConnectConfig",
33863
+ "LambdaAuthorizerConfig",
33864
+ "EnhancedMetricsConfig"
33865
+ ]) 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.`);
33866
+ }
33867
+ }
33868
+ /**
33869
+ * `EnvironmentVariables` lives on its OWN API pair
33870
+ * (`PutGraphqlApiEnvironmentVariables` / `Get...`), not on
33871
+ * Create/UpdateGraphqlApi. The PUT is whole-map replace, so a removed
33872
+ * key is cleared by re-putting the remaining map (and `{}` clears all).
33873
+ */
33874
+ async applyEnvironmentVariables(apiId, resourceType, logicalId, properties, previousProperties, replayingState = false) {
33875
+ const isUpdate = previousProperties !== void 0;
33876
+ let desired;
33877
+ try {
33878
+ desired = this.asObject(properties["EnvironmentVariables"], "EnvironmentVariables", { logicalId });
33879
+ } catch (error) {
33880
+ if (!isUpdate && !replayingState) throw error;
33881
+ this.logger.warn(`AppSync GraphqlApi ${logicalId}: ${error instanceof Error ? error.message : String(error)} — leaving the live environment variables untouched`);
33882
+ return;
33883
+ }
33884
+ let previous;
33885
+ if (previousProperties) {
33886
+ const raw = previousProperties["EnvironmentVariables"];
33887
+ previous = raw != null && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
33888
+ }
33889
+ if (desired === void 0 && previous === void 0) return;
33890
+ if (isUpdate && this.deepEqual(desired, previous)) return;
33891
+ const environmentVariables = {};
33892
+ for (const [key, value] of Object.entries(desired ?? {})) if (typeof value === "string") environmentVariables[key] = value;
33893
+ else if (typeof value === "number" && Number.isFinite(value) || typeof value === "boolean") environmentVariables[key] = String(value);
33894
+ 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);
33895
+ try {
33896
+ await this.getClient().send(new PutGraphqlApiEnvironmentVariablesCommand({
33897
+ apiId,
33898
+ environmentVariables
33899
+ }));
33900
+ } catch (error) {
33901
+ throw this.wrapUpdateError(error, resourceType, logicalId, apiId, isUpdate ? "GraphqlApi (env vars)" : "GraphqlApi (env vars, post-create)");
33902
+ }
33903
+ }
33904
+ async createGraphQLApi(logicalId, resourceType, properties, context) {
33681
33905
  this.logger.debug(`Creating GraphQL API ${logicalId}`);
33682
33906
  const name = properties["Name"];
33683
33907
  if (!name) throw new ProvisioningError(`Name is required for GraphQLApi ${logicalId}`, resourceType, logicalId);
33684
33908
  const authenticationType = properties["AuthenticationType"];
33909
+ let createdApiId;
33910
+ const shapeGuard = {
33911
+ logicalId,
33912
+ ...context?.replayingState === true ? { onUnusable: (message) => this.logger.warn(`${message} (state replay — proceeding without it)`) } : {}
33913
+ };
33685
33914
  try {
33686
33915
  const input = {
33687
33916
  name,
@@ -33702,10 +33931,18 @@ var AppSyncProvider = class {
33702
33931
  for (const tag of tags) tagMap[tag.Key] = tag.Value;
33703
33932
  input.tags = tagMap;
33704
33933
  }
33934
+ this.applyGraphQLApiConfig(input, properties, {
33935
+ logicalId,
33936
+ shapeGuard
33937
+ });
33938
+ if (properties["ApiType"] !== void 0) input.apiType = properties["ApiType"];
33939
+ if (properties["Visibility"] !== void 0) input.visibility = properties["Visibility"];
33705
33940
  const response = await this.getClient().send(new CreateGraphqlApiCommand(input));
33941
+ createdApiId = response.graphqlApi?.apiId;
33706
33942
  const apiId = response.graphqlApi.apiId;
33707
33943
  const arn = response.graphqlApi.arn;
33708
33944
  const graphQLUrl = response.graphqlApi.uris?.["GRAPHQL"] ?? "";
33945
+ await this.applyEnvironmentVariables(apiId, resourceType, logicalId, properties, void 0, context?.replayingState === true);
33709
33946
  this.logger.debug(`Successfully created GraphQL API ${logicalId}: ${apiId}`);
33710
33947
  return {
33711
33948
  physicalId: apiId,
@@ -33716,6 +33953,12 @@ var AppSyncProvider = class {
33716
33953
  }
33717
33954
  };
33718
33955
  } catch (error) {
33956
+ if (createdApiId) try {
33957
+ await this.getClient().send(new DeleteGraphqlApiCommand({ apiId: createdApiId }));
33958
+ this.logger.debug(`Rolled back partially-created GraphQL API ${createdApiId}`);
33959
+ } catch (rollbackError) {
33960
+ this.logger.warn(`Failed to roll back partially-created GraphQL API ${createdApiId}: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
33961
+ }
33719
33962
  const cause = error instanceof Error ? error : void 0;
33720
33963
  throw new ProvisioningError(`Failed to create GraphQL API ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
33721
33964
  }
@@ -34039,8 +34282,62 @@ var AppSyncProvider = class {
34039
34282
  result["LogConfig"] = log;
34040
34283
  }
34041
34284
  result["Tags"] = normalizeAwsTagsToCfn(api.tags);
34285
+ if (api.userPoolConfig) result["UserPoolConfig"] = this.userPoolConfigToCfn(api.userPoolConfig);
34286
+ if (api.openIDConnectConfig) result["OpenIDConnectConfig"] = this.openIDConnectConfigToCfn(api.openIDConnectConfig);
34287
+ if (api.lambdaAuthorizerConfig) result["LambdaAuthorizerConfig"] = this.lambdaAuthorizerConfigToCfn(api.lambdaAuthorizerConfig);
34288
+ if (api.additionalAuthenticationProviders) result["AdditionalAuthenticationProviders"] = api.additionalAuthenticationProviders.map((provider) => {
34289
+ const entry = {};
34290
+ if (provider.authenticationType !== void 0) entry["AuthenticationType"] = provider.authenticationType;
34291
+ if (provider.openIDConnectConfig) entry["OpenIDConnectConfig"] = this.openIDConnectConfigToCfn(provider.openIDConnectConfig);
34292
+ if (provider.userPoolConfig) entry["UserPoolConfig"] = this.userPoolConfigToCfn(provider.userPoolConfig);
34293
+ if (provider.lambdaAuthorizerConfig) entry["LambdaAuthorizerConfig"] = this.lambdaAuthorizerConfigToCfn(provider.lambdaAuthorizerConfig);
34294
+ return entry;
34295
+ });
34296
+ if (api.enhancedMetricsConfig) {
34297
+ const metrics = {};
34298
+ if (api.enhancedMetricsConfig.resolverLevelMetricsBehavior !== void 0) metrics["ResolverLevelMetricsBehavior"] = api.enhancedMetricsConfig.resolverLevelMetricsBehavior;
34299
+ if (api.enhancedMetricsConfig.dataSourceLevelMetricsBehavior !== void 0) metrics["DataSourceLevelMetricsBehavior"] = api.enhancedMetricsConfig.dataSourceLevelMetricsBehavior;
34300
+ if (api.enhancedMetricsConfig.operationLevelMetricsConfig !== void 0) metrics["OperationLevelMetricsConfig"] = api.enhancedMetricsConfig.operationLevelMetricsConfig;
34301
+ result["EnhancedMetricsConfig"] = metrics;
34302
+ }
34303
+ if (api.apiType !== void 0) result["ApiType"] = api.apiType;
34304
+ if (api.visibility !== void 0) result["Visibility"] = api.visibility;
34305
+ if (api.introspectionConfig !== void 0) result["IntrospectionConfig"] = api.introspectionConfig;
34306
+ if (api.queryDepthLimit !== void 0) result["QueryDepthLimit"] = api.queryDepthLimit;
34307
+ if (api.resolverCountLimit !== void 0) result["ResolverCountLimit"] = api.resolverCountLimit;
34308
+ if (api.ownerContact !== void 0) result["OwnerContact"] = api.ownerContact;
34309
+ if (api.mergedApiExecutionRoleArn !== void 0) result["MergedApiExecutionRoleArn"] = api.mergedApiExecutionRoleArn;
34310
+ try {
34311
+ const envResp = await this.getClient().send(new GetGraphqlApiEnvironmentVariablesCommand({ apiId: physicalId }));
34312
+ if (envResp.environmentVariables !== void 0) result["EnvironmentVariables"] = envResp.environmentVariables;
34313
+ } catch (err) {
34314
+ 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)}`);
34315
+ }
34042
34316
  return result;
34043
34317
  }
34318
+ userPoolConfigToCfn(config) {
34319
+ const out = {};
34320
+ if (config.userPoolId !== void 0) out["UserPoolId"] = config.userPoolId;
34321
+ if (config.awsRegion !== void 0) out["AwsRegion"] = config.awsRegion;
34322
+ if ("defaultAction" in config && config.defaultAction !== void 0) out["DefaultAction"] = config.defaultAction;
34323
+ if (config.appIdClientRegex !== void 0) out["AppIdClientRegex"] = config.appIdClientRegex;
34324
+ return out;
34325
+ }
34326
+ openIDConnectConfigToCfn(config) {
34327
+ const out = {};
34328
+ if (config.issuer !== void 0) out["Issuer"] = config.issuer;
34329
+ if (config.clientId !== void 0) out["ClientId"] = config.clientId;
34330
+ if (config.iatTTL !== void 0) out["IatTTL"] = config.iatTTL;
34331
+ if (config.authTTL !== void 0) out["AuthTTL"] = config.authTTL;
34332
+ return out;
34333
+ }
34334
+ lambdaAuthorizerConfigToCfn(config) {
34335
+ const out = {};
34336
+ if (config.authorizerUri !== void 0) out["AuthorizerUri"] = config.authorizerUri;
34337
+ if (config.authorizerResultTtlInSeconds !== void 0) out["AuthorizerResultTtlInSeconds"] = config.authorizerResultTtlInSeconds;
34338
+ if (config.identityValidationExpression !== void 0) out["IdentityValidationExpression"] = config.identityValidationExpression;
34339
+ return out;
34340
+ }
34044
34341
  async readDataSource(physicalId) {
34045
34342
  const [apiId, name] = physicalId.split("|");
34046
34343
  if (!apiId || !name) return void 0;
@@ -42758,6 +43055,25 @@ function mapHttpEndpointDescriptionToCfn(desc) {
42758
43055
  //#endregion
42759
43056
  //#region src/provisioning/providers/cloudtrail-provider.ts
42760
43057
  /**
43058
+ * The selector set a trail carries when its template declares NO
43059
+ * `EventSelectors`, and therefore the RESET payload for a removal.
43060
+ *
43061
+ * Live CFn A/B (issue #1549, us-east-1, 2026-08-11): removing `EventSelectors`
43062
+ * from a deployed trail's template resets the live selectors to exactly this
43063
+ * shape — AWS echoes it back as `{ReadWriteType: 'All', IncludeManagementEvents:
43064
+ * true, DataResources: [], ExcludeManagementEventSources: []}`, the two empty
43065
+ * lists being response-side defaults that do NOT need sending.
43066
+ *
43067
+ * It is a VALUE, not an empty array, because `PutEventSelectors` rejects `[]`
43068
+ * with `InvalidEventSelectorsException: Specify a valid number of selectors
43069
+ * (1 to 5) for your trail` — the divergence from the `InsightSelectors` sibling,
43070
+ * where AWS documents `[]` as the removal shape.
43071
+ */
43072
+ const DEFAULT_EVENT_SELECTORS = Object.freeze([Object.freeze({
43073
+ ReadWriteType: "All",
43074
+ IncludeManagementEvents: true
43075
+ })]);
43076
+ /**
42761
43077
  * SDK Provider for AWS CloudTrail resources
42762
43078
  *
42763
43079
  * Supports:
@@ -42886,15 +43202,29 @@ var CloudTrailProvider = class {
42886
43202
  SnsTopicName: snsTopicName,
42887
43203
  IsOrganizationTrail: isOrganizationTrail
42888
43204
  }));
42889
- const newEventSelectors = properties["EventSelectors"];
43205
+ const rawEventSelectors = properties["EventSelectors"];
43206
+ let eventSelectorsUnusable = false;
43207
+ let newEventSelectors;
43208
+ if (rawEventSelectors != null) try {
43209
+ newEventSelectors = requireConfigArray(rawEventSelectors, "AWS::CloudTrail::Trail EventSelectors");
43210
+ } catch (error) {
43211
+ eventSelectorsUnusable = true;
43212
+ this.logger.warn(`${error instanceof Error ? error.message : String(error)} The trail's existing event selectors are left untouched for this update rather than reset to the AWS default.`);
43213
+ }
42890
43214
  const oldEventSelectors = previousProperties["EventSelectors"];
42891
- if (JSON.stringify(newEventSelectors) !== JSON.stringify(oldEventSelectors)) {
42892
- if (newEventSelectors && newEventSelectors.length > 0) {
42893
- this.logger.debug(`Updating event selectors for CloudTrail Trail ${logicalId}`);
43215
+ if (!eventSelectorsUnusable && JSON.stringify(newEventSelectors) !== JSON.stringify(oldEventSelectors)) {
43216
+ const isRemoval = newEventSelectors === void 0 || newEventSelectors.length === 0;
43217
+ const eventSelectorsToSend = newEventSelectors === void 0 || newEventSelectors.length === 0 ? DEFAULT_EVENT_SELECTORS : newEventSelectors;
43218
+ this.logger.debug(isRemoval ? `Resetting event selectors to the AWS default for CloudTrail Trail ${logicalId}` : `Updating event selectors for CloudTrail Trail ${logicalId}`);
43219
+ try {
42894
43220
  await this.getClient().send(new PutEventSelectorsCommand({
42895
43221
  TrailName: physicalId,
42896
- EventSelectors: newEventSelectors
43222
+ EventSelectors: [...eventSelectorsToSend]
42897
43223
  }));
43224
+ } catch (error) {
43225
+ const message = error instanceof Error ? error.message : String(error);
43226
+ if (!isRemoval || !/advanced[\s-]*event[\s-]*selector/i.test(message)) throw error;
43227
+ this.logger.warn(`CloudTrail Trail ${logicalId}: skipping the EventSelectors reset — the trail is using AdvancedEventSelectors, which AWS manages through a separate API, so there are no basic event selectors to clear (${message})`);
42898
43228
  }
42899
43229
  }
42900
43230
  const newInsightSelectors = properties["InsightSelectors"];
@@ -42906,7 +43236,8 @@ var CloudTrailProvider = class {
42906
43236
  InsightSelectors: newInsightSelectors ?? []
42907
43237
  }));
42908
43238
  }
42909
- if (isLogging !== previousProperties["IsLogging"]) if (isLogging === false) {
43239
+ const oldIsLogging = previousProperties["IsLogging"];
43240
+ if (isLogging !== void 0 && isLogging !== oldIsLogging) if (isLogging === false) {
42910
43241
  this.logger.debug(`Stopping logging for CloudTrail Trail ${logicalId}`);
42911
43242
  await this.getClient().send(new StopLoggingCommand({ Name: physicalId }));
42912
43243
  } else {
@@ -67705,7 +68036,7 @@ function createMigrateCommand() {
67705
68036
  */
67706
68037
  function buildProgram() {
67707
68038
  const program = new Command();
67708
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.51");
68039
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.53");
67709
68040
  program.hook("preAction", (_thisCommand, actionCommand) => {
67710
68041
  const { profile } = actionCommand.optsWithGlobals();
67711
68042
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;