@go-to-k/cdkd 0.271.0 → 0.273.0

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.
@@ -11425,6 +11425,34 @@ function unescapeJsonPointerSegment(segment) {
11425
11425
  return segment.replace(/~1/g, "/").replace(/~0/g, "~");
11426
11426
  }
11427
11427
 
11428
+ //#endregion
11429
+ //#region src/provisioning/cc-protection-properties.ts
11430
+ const CC_PROTECTION_PROPERTIES = {
11431
+ "AWS::DSQL::Cluster": {
11432
+ property: "DeletionProtectionEnabled",
11433
+ offValue: false
11434
+ },
11435
+ "AWS::NeptuneGraph::Graph": {
11436
+ property: "DeletionProtection",
11437
+ offValue: false
11438
+ },
11439
+ "AWS::SMSVOICE::ProtectConfiguration": {
11440
+ property: "DeletionProtectionEnabled",
11441
+ offValue: false
11442
+ },
11443
+ "AWS::VerifiedPermissions::PolicyStore": {
11444
+ property: "DeletionProtection",
11445
+ offValue: { Mode: "DISABLED" }
11446
+ }
11447
+ };
11448
+ /**
11449
+ * Returns the protection entry for a CC-routed resource type, or undefined
11450
+ * when the type has no registered protection property.
11451
+ */
11452
+ function ccProtectionProperty(resourceType) {
11453
+ return CC_PROTECTION_PROPERTIES[resourceType];
11454
+ }
11455
+
11428
11456
  //#endregion
11429
11457
  //#region src/provisioning/unsupported-types.generated.ts
11430
11458
  /**
@@ -11958,12 +11986,16 @@ var CloudControlProvider = class {
11958
11986
  this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
11959
11987
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
11960
11988
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
11961
- const { ASGProvider } = await import("./asg-provider-CpHXw10b.js").then((n) => n.n);
11989
+ const { ASGProvider } = await import("./asg-provider-kIy8tYTG.js").then((n) => n.n);
11962
11990
  await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
11963
11991
  return;
11964
11992
  }
11965
11993
  const isProtectedEc2Instance = context?.removeProtection === true && resourceType === "AWS::EC2::Instance";
11966
11994
  if (isProtectedEc2Instance) await disableInstanceApiTermination(getAwsClients().ec2, physicalId, this.logger);
11995
+ if (context?.removeProtection === true) {
11996
+ const protectionEntry = ccProtectionProperty(resourceType);
11997
+ if (protectionEntry) await this.disableCcProtection(logicalId, physicalId, resourceType, protectionEntry);
11998
+ }
11967
11999
  const maxAttempts = isProtectedEc2Instance ? 5 : 1;
11968
12000
  for (let attempt = 1;; attempt++) try {
11969
12001
  const deleteResponse = await this.cloudControlClient.send(new DeleteResourceCommand({
@@ -11992,6 +12024,40 @@ var CloudControlProvider = class {
11992
12024
  }
11993
12025
  }
11994
12026
  /**
12027
+ * Set a registry-declared deletion-protection property to its "off" value
12028
+ * in-place via a CC UpdateResource patch (issues #1312 / #1314).
12029
+ * Best-effort: failures are logged at warn and swallowed — the subsequent
12030
+ * DeleteResource surfaces the real error if the protection is still on.
12031
+ * The `add` patch op is used (RFC 6902: replaces when the path exists,
12032
+ * adds when absent), so the flip is idempotent regardless of whether the
12033
+ * live model carries the property.
12034
+ */
12035
+ async disableCcProtection(logicalId, physicalId, resourceType, entry) {
12036
+ const protectionProperty = entry.property;
12037
+ this.logger.debug(`Disabling ${protectionProperty} on ${logicalId} (${resourceType}) before delete (--remove-protection)`);
12038
+ try {
12039
+ const patch = [{
12040
+ op: "add",
12041
+ path: `/${protectionProperty}`,
12042
+ value: entry.offValue
12043
+ }];
12044
+ const response = await this.cloudControlClient.send(new UpdateResourceCommand({
12045
+ TypeName: resourceType,
12046
+ Identifier: physicalId,
12047
+ PatchDocument: JSON.stringify(patch)
12048
+ }));
12049
+ if (!response.ProgressEvent?.RequestToken) {
12050
+ this.logger.warn(`Could not disable ${protectionProperty} on ${logicalId}: no request token received; proceeding with delete`);
12051
+ return;
12052
+ }
12053
+ await this.waitForOperation(response.ProgressEvent.RequestToken, logicalId, "UPDATE", resourceType);
12054
+ this.logger.debug(`Disabled ${protectionProperty} on ${logicalId}`);
12055
+ } catch (error) {
12056
+ const message = error instanceof Error ? error.message : String(error);
12057
+ this.logger.warn(`Could not disable ${protectionProperty} on ${logicalId} (${resourceType}): ${message}; proceeding with delete`);
12058
+ }
12059
+ }
12060
+ /**
11995
12061
  * Get current state of a resource
11996
12062
  */
11997
12063
  async getResourceState(resourceType, physicalId) {
@@ -17689,7 +17755,7 @@ const FLUSH_INTERVAL_MS = 2e3;
17689
17755
  const FLUSH_EVENT_THRESHOLD = 50;
17690
17756
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
17691
17757
  function getCdkdVersion() {
17692
- return "0.271.0";
17758
+ return "0.273.0";
17693
17759
  }
17694
17760
  /**
17695
17761
  * Generate a time-sortable unique run id, e.g.
@@ -19735,4 +19801,4 @@ var DeployEngine = class {
19735
19801
 
19736
19802
  //#endregion
19737
19803
  export { WorkGraph as $, LockError as $t, slowCcOperationTimeoutMs as A, warnDeprecatedNoPrefixCliFlag as At, applyRoleArnIfSet as B, resolveBucketRegion as Bt, yellow as C, resolveAutoAssetStorage as Ct, ProviderRegistry as D, resolveStateBucketWithDefaultAndSource as Dt, clearOnUpdateRemoval as E, resolveStateBucketWithDefault as Et, refStateLookupFromResource as F, uploadCfnTemplate as Ft, DagBuilder as G, AssetError as Gt, describeTypeWithThrottleRetry as H, getAwsClients as Ht, WAFv2WebACLProvider as I, expectedOwnerParam as It, S3StateBackend as J, DependencyError as Jt, TemplateParser as K, CdkdError as Kt, normalizeAwsTagsToCfn as L, AssemblyReader as Lt, isTerminationProtectionPropagationError as M, CFN_TEMPLATE_URL_LIMIT as Mt, IntrinsicFunctionResolver as N, MIGRATE_TMP_PREFIX as Nt, findActionableSilentDrops as O, resolveUseCdkBootstrapAssets as Ot, cfnRefValueFromPhysicalId as P, findLargeInlineResources as Pt, stringifyValue as Q, LocalStartServiceError as Qt, resolveExplicitPhysicalId as R, processStackMessages as Rt, red as S, resolveApp as St, collectInlinePolicyNamesManagedBySiblings as T, resolveSkipPrefix as Tt, withRetry as U, resetAwsClients as Ut, DiffCalculator as V, AwsClients as Vt, isRetryableTransientError as W, setAwsClients as Wt, shouldRetainResource as X, LocalInvokeBuildError as Xt, rebuildClientForBucketRegion as Y, DeployCancelledError as Yt, AssetPublisher as Z, LocalMigrateError as Zt, formatResourceLine as _, getDockerImageBySourceHash as _t, DeploymentEventsStore as a, ResourceUpdateNotSupportedError as an, BOOTSTRAP_MARKER_PREFIX as at, gray as b, getDefaultStateBucketName as bt, replayFailedOperations as c, StateError as cn, parseBootstrapMarker as ct, IMPLICIT_DELETE_DEPENDENCIES as d, isCdkdError as dn, buildDockerImage as dt, MissingCdkCliError as en, buildAssetRedirectMap as et, computeImplicitDeleteEdges as f, normalizeAwsError as fn, formatDockerLoginError as ft, renderStatefulReason as g, AssetManifestLoader as gt, isStatefulRecreateTargetSync as h, runDockerStreaming as ht, DeploymentEventsReader as i, ResourceTimeoutError as in, AssetModeResolver as it, disableInstanceApiTermination as j, CFN_TEMPLATE_BODY_LIMIT as jt, CloudControlProvider as k, stateBucketExistenceConfirmed as kt, replayRollback as l, SynthesisError as ln, validateAssetBucketName as lt, MULTI_REGION_RECREATE_BLOCKED_TYPES as m, __exportAll as mn, runDockerForeground as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, PartialFailureError as nn, loadPublishableAssetManifest as nt, planFailedOps as o, StackHasActiveImportsError as on, ensureAssetStorage as ot, extractDeploymentEventError as p, withErrorHandling as pn, getDockerCmd as pt, LockManager as q, ConfigError as qt, DeployEngine as r, ProvisioningError as rn, rewriteTemplateAssetReferences as rt, planRollback as s, StackTerminationProtectionError as sn, getBootstrapMarkerKey as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, NestedStackChildDirectDestroyError as tn, createAssetRedirectResolver as tt, withResourceDeadline as u, formatError as un, validateContainerRepoName as ut, bold as v, Synthesizer as vt, IAMRoleProvider as w, resolveCaptureObservedState as wt, green as x, getLegacyStateBucketName as xt, cyan as y, synthesisStatusMessage as yt, assertRegionMatch as z, clearBucketRegionCache as zt };
19738
- //# sourceMappingURL=deploy-engine-DlTH1ou6.js.map
19804
+ //# sourceMappingURL=deploy-engine-DrZSOAoG.js.map