@go-to-k/cdkd 0.221.16 → 0.222.1

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
2
  import { A as withErrorHandling, B as generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-DsPQH0fw.js";
4
+ import { $ as AssemblyReader, A as shouldRetainResource, B as getDefaultStateBucketName, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as formatDockerLoginError, G as resolveStateBucketWithDefault, H as resolveApp, I as getDockerCmd, J as CFN_TEMPLATE_BODY_LIMIT, K as resolveStateBucketWithDefaultAndSource, L as runDockerForeground, M as stringifyValue, N as WorkGraph, O as S3StateBackend, P as buildDockerImage, Q as uploadCfnTemplate, R as runDockerStreaming, S as IntrinsicFunctionResolver, T as DagBuilder, U as resolveCaptureObservedState, V as getLegacyStateBucketName, W as resolveSkipPrefix, X as MIGRATE_TMP_PREFIX, Y as CFN_TEMPLATE_URL_LIMIT, Z as findLargeInlineResources, _ as IAMRoleProvider, a as withRetry, b as findActionableSilentDrops, c as computeImplicitDeleteEdges, d as bold, f as cyan, g as yellow, h as red, i as withResourceDeadline, j as AssetPublisher, k as rebuildClientForBucketRegion, l as extractDeploymentEventError, m as green, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as gray, q as warnDeprecatedNoPrefixCliFlag, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as resolveBucketRegion, u as formatResourceLine, v as collectInlinePolicyNamesManagedBySiblings, w as DiffCalculator, x as CloudControlProvider, y as ProviderRegistry, z as Synthesizer } from "./deploy-engine-CmN65bEv.js";
5
5
  import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
@@ -53,7 +53,7 @@ import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCom
53
53
  import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
54
54
  import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$13, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
55
55
  import { parse, print } from "graphql";
56
- import { CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetDatabasesCommand, GetJobCommand, GetSecurityConfigurationCommand, GetSecurityConfigurationsCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, ListWorkflowsCommand, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
56
+ import { CrawlerRunningException, CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetDatabasesCommand, GetJobCommand, GetSecurityConfigurationCommand, GetSecurityConfigurationsCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, ListWorkflowsCommand, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
57
57
  import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListStreamsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$8, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$14, UpdateShardCountCommand } from "@aws-sdk/client-kinesis";
58
58
  import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand, CreateMountTargetCommand, DeleteAccessPointCommand, DeleteFileSystemCommand, DeleteMountTargetCommand, DescribeAccessPointsCommand, DescribeBackupPolicyCommand, DescribeFileSystemPolicyCommand, DescribeFileSystemsCommand, DescribeLifecycleConfigurationCommand, DescribeMountTargetSecurityGroupsCommand, DescribeMountTargetsCommand, EFSClient, FileSystemNotFound, ModifyMountTargetSecurityGroupsCommand, MountTargetNotFound, PutBackupPolicyCommand, PutFileSystemPolicyCommand, PutLifecycleConfigurationCommand, UpdateFileSystemCommand, UpdateFileSystemProtectionCommand } from "@aws-sdk/client-efs";
59
59
  import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListDeliveryStreamsCommand, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$9, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
@@ -1553,7 +1553,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1553
1553
  const FLUSH_EVENT_THRESHOLD = 50;
1554
1554
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1555
1555
  function getCdkdVersion() {
1556
- return "0.221.16";
1556
+ return "0.222.1";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -28173,12 +28173,13 @@ var GlueWorkflowProvider = class {
28173
28173
  const name = properties["Name"];
28174
28174
  if (!name) throw new ProvisioningError(`Name is required for Glue Workflow ${logicalId}`, resourceType, logicalId);
28175
28175
  try {
28176
- const tags = workflowTagsForCreate(properties["Tags"]);
28176
+ const tagsMap = cfnTagsToMap(properties["Tags"]);
28177
+ const tags = tagsMap && Object.keys(tagsMap).length > 0 ? tagsMap : void 0;
28177
28178
  await this.getClient().send(new CreateWorkflowCommand({
28178
28179
  Name: name,
28179
28180
  ...properties["Description"] !== void 0 && { Description: properties["Description"] },
28180
28181
  ...properties["DefaultRunProperties"] !== void 0 && { DefaultRunProperties: properties["DefaultRunProperties"] },
28181
- ...properties["MaxConcurrentRuns"] !== void 0 && { MaxConcurrentRuns: properties["MaxConcurrentRuns"] },
28182
+ ...properties["MaxConcurrentRuns"] !== void 0 && { MaxConcurrentRuns: coerceNumber(properties["MaxConcurrentRuns"]) },
28182
28183
  ...tags && { Tags: tags }
28183
28184
  }));
28184
28185
  this.logger.debug(`Successfully created Glue Workflow ${logicalId}: ${name}`);
@@ -28198,7 +28199,7 @@ var GlueWorkflowProvider = class {
28198
28199
  Name: physicalId,
28199
28200
  ...properties["Description"] !== void 0 && { Description: properties["Description"] },
28200
28201
  ...properties["DefaultRunProperties"] !== void 0 && { DefaultRunProperties: properties["DefaultRunProperties"] },
28201
- ...properties["MaxConcurrentRuns"] !== void 0 && { MaxConcurrentRuns: properties["MaxConcurrentRuns"] }
28202
+ ...properties["MaxConcurrentRuns"] !== void 0 && { MaxConcurrentRuns: coerceNumber(properties["MaxConcurrentRuns"]) }
28202
28203
  }));
28203
28204
  this.logger.debug(`Successfully updated Glue Workflow ${logicalId}`);
28204
28205
  return {
@@ -28432,22 +28433,17 @@ var GlueSecurityConfigurationProvider = class {
28432
28433
  return null;
28433
28434
  }
28434
28435
  };
28435
- /**
28436
- * Normalize the CFn `Tags` shape (`Array<{Key,Value}>`) into the SDK's
28437
- * `TagsMap` (`Record<string,string>`) for `CreateWorkflow`. Returns
28438
- * `undefined` when no tags — the caller drops the key.
28439
- */
28440
- function workflowTagsForCreate(tags) {
28441
- if (!Array.isArray(tags) || tags.length === 0) return void 0;
28442
- const out = {};
28443
- for (const t of tags) {
28444
- const obj = t;
28445
- const k = typeof obj["Key"] === "string" ? obj["Key"] : void 0;
28446
- const v = typeof obj["Value"] === "string" ? obj["Value"] : "";
28447
- if (!k) continue;
28448
- out[k] = v;
28449
- }
28450
- return Object.keys(out).length > 0 ? out : void 0;
28436
+ /** Max GetCrawler polls while waiting for a stopped crawler to settle. */
28437
+ const CRAWLER_STOP_MAX_ATTEMPTS = 30;
28438
+ /** Delay between GetCrawler polls while waiting for a crawler to stop. */
28439
+ const CRAWLER_STOP_POLL_INTERVAL_MS = 2e3;
28440
+ /** Max GetTrigger polls while waiting for a trigger to reach DEACTIVATED. */
28441
+ const TRIGGER_DEACTIVATE_MAX_ATTEMPTS = 30;
28442
+ /** Delay between GetTrigger polls while waiting for a trigger to deactivate. */
28443
+ const TRIGGER_DEACTIVATE_POLL_INTERVAL_MS = 1e3;
28444
+ /** Promise-based sleep used by the crawler / trigger state-machine waiters. */
28445
+ function sleep$1(ms) {
28446
+ return new Promise((resolve) => setTimeout(resolve, ms));
28451
28447
  }
28452
28448
  /**
28453
28449
  * Build the SDK `EncryptionConfiguration` from the CFn-shape input
@@ -28768,24 +28764,51 @@ function buildJobCommonFields(p) {
28768
28764
  "LogUri",
28769
28765
  "DefaultArguments",
28770
28766
  "NonOverridableArguments",
28771
- "MaxRetries",
28772
- "AllocatedCapacity",
28773
- "Timeout",
28774
- "MaxCapacity",
28775
28767
  "WorkerType",
28776
- "NumberOfWorkers",
28777
28768
  "SecurityConfiguration",
28778
28769
  "GlueVersion",
28779
28770
  "ExecutionClass",
28780
28771
  "MaintenanceWindow"
28781
28772
  ]) if (p[k] !== void 0) r[k] = p[k];
28782
- if (p["ExecutionProperty"] !== void 0) r.ExecutionProperty = p["ExecutionProperty"];
28773
+ for (const k of [
28774
+ "MaxRetries",
28775
+ "AllocatedCapacity",
28776
+ "Timeout",
28777
+ "MaxCapacity",
28778
+ "NumberOfWorkers"
28779
+ ]) {
28780
+ const v = p[k];
28781
+ if (v !== void 0) r[k] = coerceNumber(v);
28782
+ }
28783
+ if (p["ExecutionProperty"] !== void 0) {
28784
+ const ep = { ...p["ExecutionProperty"] };
28785
+ if (ep["MaxConcurrentRuns"] !== void 0) ep["MaxConcurrentRuns"] = coerceNumber(ep["MaxConcurrentRuns"]);
28786
+ r.ExecutionProperty = ep;
28787
+ }
28783
28788
  if (p["Connections"] !== void 0) r.Connections = { Connections: p["Connections"]["Connections"] ?? [] };
28784
- if (p["NotificationProperty"] !== void 0) r.NotificationProperty = p["NotificationProperty"];
28789
+ if (p["NotificationProperty"] !== void 0) {
28790
+ const np = { ...p["NotificationProperty"] };
28791
+ if (np["NotifyDelayAfter"] !== void 0) np["NotifyDelayAfter"] = coerceNumber(np["NotifyDelayAfter"]);
28792
+ r.NotificationProperty = np;
28793
+ }
28785
28794
  if (p["SourceControlDetails"] !== void 0) r.SourceControlDetails = p["SourceControlDetails"];
28786
28795
  return r;
28787
28796
  }
28788
28797
  /**
28798
+ * Coerce a CFn-delivered numeric property (often a string like `"10"`) to a
28799
+ * JS number at the SDK wire boundary. Non-finite / unparseable inputs are
28800
+ * returned unchanged so AWS surfaces a clear validation error rather than
28801
+ * silently sending `NaN`.
28802
+ */
28803
+ function coerceNumber(value) {
28804
+ if (typeof value === "number") return value;
28805
+ if (typeof value === "string" && value.trim() !== "") {
28806
+ const n = Number(value);
28807
+ if (Number.isFinite(n)) return n;
28808
+ }
28809
+ return value;
28810
+ }
28811
+ /**
28789
28812
  * Convert CFn `Tags: [{Key,Value}]` (or a tag map) to AWS Glue's
28790
28813
  * `Record<string,string>` shape used by Create commands and TagResource. Returns
28791
28814
  * `undefined` when the input is undefined so callers can elide the key.
@@ -28894,12 +28917,21 @@ var GlueCrawlerProvider = class {
28894
28917
  async update(logicalId, physicalId, resourceType, properties, previousProperties) {
28895
28918
  this.logger.debug(`Updating Glue Crawler ${logicalId}: ${physicalId}`);
28896
28919
  try {
28897
- await this.getClient().send(new UpdateCrawlerCommand({
28920
+ const updateInput = {
28898
28921
  Name: physicalId,
28899
28922
  ...properties["Role"] !== void 0 && { Role: properties["Role"] },
28900
28923
  ...properties["Targets"] !== void 0 && { Targets: properties["Targets"] },
28901
28924
  ...buildCrawlerCommonFields(properties)
28902
- }));
28925
+ };
28926
+ try {
28927
+ await this.getClient().send(new UpdateCrawlerCommand(updateInput));
28928
+ } catch (err) {
28929
+ if (err instanceof CrawlerRunningException) {
28930
+ this.logger.debug(`Glue Crawler ${physicalId} is running; stopping before update and retrying`);
28931
+ await this.stopCrawlerAndWait(physicalId);
28932
+ await this.getClient().send(new UpdateCrawlerCommand(updateInput));
28933
+ } else throw err;
28934
+ }
28903
28935
  const oldTags = cfnTagsToMap(previousProperties["Tags"]) ?? {};
28904
28936
  const newTags = cfnTagsToMap(properties["Tags"]) ?? {};
28905
28937
  await this.applyTagDiff(physicalId, oldTags, newTags);
@@ -28922,10 +28954,39 @@ var GlueCrawlerProvider = class {
28922
28954
  this.logger.debug(`Glue Crawler ${physicalId} does not exist, skipping deletion`);
28923
28955
  return;
28924
28956
  }
28957
+ if (error instanceof CrawlerRunningException) {
28958
+ this.logger.debug(`Glue Crawler ${physicalId} is running; stopping before delete and retrying`);
28959
+ await this.stopCrawlerAndWait(physicalId);
28960
+ await this.getClient().send(new DeleteCrawlerCommand({ Name: physicalId }));
28961
+ return;
28962
+ }
28925
28963
  const cause = error instanceof Error ? error : void 0;
28926
28964
  throw new ProvisioningError(`Failed to delete Glue Crawler ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
28927
28965
  }
28928
28966
  }
28967
+ /**
28968
+ * Stop a running crawler and poll until it leaves the RUNNING / STOPPING
28969
+ * state (or until {@link CRAWLER_STOP_MAX_ATTEMPTS} is exhausted). Tolerates a
28970
+ * CrawlerStoppingException / "not running" race (the crawler may have just
28971
+ * finished on its own) so callers can unconditionally retry their delete /
28972
+ * update afterwards.
28973
+ */
28974
+ async stopCrawlerAndWait(physicalId) {
28975
+ try {
28976
+ await this.getClient().send(new StopCrawlerCommand({ Name: physicalId }));
28977
+ } catch (err) {
28978
+ this.logger.debug(`StopCrawler for ${physicalId} returned ${err instanceof Error ? err.name : String(err)}; continuing to wait`);
28979
+ }
28980
+ for (let attempt = 0; attempt < CRAWLER_STOP_MAX_ATTEMPTS; attempt++) {
28981
+ try {
28982
+ const state = (await this.getClient().send(new GetCrawlerCommand({ Name: physicalId }))).Crawler?.State;
28983
+ if (state !== "RUNNING" && state !== "STOPPING") return;
28984
+ } catch (err) {
28985
+ if (err instanceof EntityNotFoundException) return;
28986
+ }
28987
+ await sleep$1(CRAWLER_STOP_POLL_INTERVAL_MS);
28988
+ }
28989
+ }
28929
28990
  async getAttribute(physicalId, _resourceType, attributeName) {
28930
28991
  if (attributeName === "Id" || attributeName === "Ref" || attributeName === "Name") return physicalId;
28931
28992
  }
@@ -29248,6 +29309,7 @@ var GlueTriggerProvider = class {
29248
29309
  if ((await this.getClient().send(new GetTriggerCommand({ Name: physicalId }))).Trigger?.State === "ACTIVATED") {
29249
29310
  restart = true;
29250
29311
  await this.getClient().send(new StopTriggerCommand({ Name: physicalId }));
29312
+ await this.waitForTriggerDeactivated(physicalId);
29251
29313
  }
29252
29314
  } catch (err) {
29253
29315
  if (!(err instanceof EntityNotFoundException)) this.logger.debug(`GetTrigger pre-check failed for ${physicalId}; continuing anyway: ${err instanceof Error ? err.message : String(err)}`);
@@ -29259,11 +29321,22 @@ var GlueTriggerProvider = class {
29259
29321
  ...properties["Predicate"] !== void 0 && { Predicate: properties["Predicate"] },
29260
29322
  ...properties["EventBatchingCondition"] !== void 0 && { EventBatchingCondition: properties["EventBatchingCondition"] }
29261
29323
  };
29262
- await this.getClient().send(new UpdateTriggerCommand({
29263
- Name: physicalId,
29264
- TriggerUpdate: update
29265
- }));
29266
- if (restart) await this.getClient().send(new StartTriggerCommand({ Name: physicalId }));
29324
+ let updateError;
29325
+ try {
29326
+ await this.getClient().send(new UpdateTriggerCommand({
29327
+ Name: physicalId,
29328
+ TriggerUpdate: update
29329
+ }));
29330
+ } catch (err) {
29331
+ updateError = err;
29332
+ }
29333
+ if (restart) try {
29334
+ await this.getClient().send(new StartTriggerCommand({ Name: physicalId }));
29335
+ } catch (restartError) {
29336
+ if (updateError === void 0) throw restartError;
29337
+ this.logger.warn(`Failed to re-activate Glue Trigger ${physicalId} after a failed update: ${restartError.message}`);
29338
+ }
29339
+ if (updateError !== void 0) throw updateError;
29267
29340
  const oldTags = cfnTagsToMap(previousProperties["Tags"]) ?? {};
29268
29341
  const newTags = cfnTagsToMap(properties["Tags"]) ?? {};
29269
29342
  await this.applyTagDiff(physicalId, oldTags, newTags);
@@ -29276,9 +29349,34 @@ var GlueTriggerProvider = class {
29276
29349
  throw new ProvisioningError(`Failed to update Glue Trigger ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
29277
29350
  }
29278
29351
  }
29352
+ /**
29353
+ * Poll GetTrigger until the trigger leaves the ACTIVATED / ACTIVATING state
29354
+ * (StopTrigger is async). Returns once DEACTIVATED (or any non-active state)
29355
+ * is observed, the trigger is gone, or the attempt budget is exhausted —
29356
+ * callers then proceed with UpdateTrigger / DeleteTrigger.
29357
+ */
29358
+ async waitForTriggerDeactivated(physicalId) {
29359
+ for (let attempt = 0; attempt < TRIGGER_DEACTIVATE_MAX_ATTEMPTS; attempt++) {
29360
+ try {
29361
+ const state = (await this.getClient().send(new GetTriggerCommand({ Name: physicalId }))).Trigger?.State;
29362
+ if (state !== "ACTIVATED" && state !== "ACTIVATING") return;
29363
+ } catch (err) {
29364
+ if (err instanceof EntityNotFoundException) return;
29365
+ }
29366
+ await sleep$1(TRIGGER_DEACTIVATE_POLL_INTERVAL_MS);
29367
+ }
29368
+ }
29279
29369
  async delete(logicalId, physicalId, resourceType, _properties, context) {
29280
29370
  this.logger.debug(`Deleting Glue Trigger ${logicalId}: ${physicalId}`);
29281
29371
  try {
29372
+ try {
29373
+ if ((await this.getClient().send(new GetTriggerCommand({ Name: physicalId }))).Trigger?.State === "ACTIVATED") {
29374
+ await this.getClient().send(new StopTriggerCommand({ Name: physicalId }));
29375
+ await this.waitForTriggerDeactivated(physicalId);
29376
+ }
29377
+ } catch (err) {
29378
+ if (!(err instanceof EntityNotFoundException)) this.logger.debug(`GetTrigger pre-delete check failed for ${physicalId}; continuing: ${err instanceof Error ? err.message : String(err)}`);
29379
+ }
29282
29380
  await this.getClient().send(new DeleteTriggerCommand({ Name: physicalId }));
29283
29381
  } catch (error) {
29284
29382
  if (error instanceof EntityNotFoundException) {
@@ -54100,7 +54198,7 @@ function reorderArgs(argv) {
54100
54198
  async function main() {
54101
54199
  installPipeCloseHandler();
54102
54200
  const program = new Command();
54103
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.16");
54201
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.222.1");
54104
54202
  program.addCommand(createBootstrapCommand());
54105
54203
  program.addCommand(createSynthCommand());
54106
54204
  program.addCommand(createListCommand());