@go-to-k/cdkd 0.227.0 → 0.228.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.
@@ -1,7 +1,7 @@
1
1
  import { B as generateResourceNameWithFallback, E as SynthesisError, F as getLiveRenderer, H as withStackName, M as getLogger, R as applyDefaultNameForFallback, T as StateError, a as assertRegionMatch, b as ProvisioningError, c as AssetError, d as DependencyError, g as MacroExpansionError, h as LockError, i as resolveExplicitPhysicalId, k as normalizeAwsError, n as matchesCdkPath, o as disableInstanceApiTermination, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, x as ResourceTimeoutError } from "./import-helpers-wLipXr5g.js";
2
2
  import { r as getAwsClients } from "./aws-clients-pjPwZz1r.js";
3
3
  import { randomUUID } from "node:crypto";
4
- import { DeleteObjectCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, NoSuchKey, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
4
+ import { DeleteObjectCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, NoSuchKey, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
5
5
  import { CloudControlClient, CreateResourceCommand, DeleteResourceCommand, GetResourceCommand, GetResourceRequestStatusCommand, ListResourcesCommand, UpdateResourceCommand } from "@aws-sdk/client-cloudcontrol";
6
6
  import { AttachRolePolicyCommand, CreateRoleCommand, DeleteRoleCommand, DeleteRolePermissionsBoundaryCommand, DeleteRolePolicyCommand, DetachRolePolicyCommand, GetRoleCommand, GetRolePolicyCommand, IAMClient, ListAttachedRolePoliciesCommand, ListInstanceProfilesForRoleCommand, ListRolePoliciesCommand, ListRoleTagsCommand, ListRolesCommand, NoSuchEntityException, PutRolePermissionsBoundaryCommand, PutRolePolicyCommand, RemoveRoleFromInstanceProfileCommand, TagRoleCommand, UntagRoleCommand, UpdateAssumeRolePolicyCommand, UpdateRoleCommand } from "@aws-sdk/client-iam";
7
7
  import { PublishCommand, SNSClient } from "@aws-sdk/client-sns";
@@ -3641,6 +3641,37 @@ var S3StateBackend = class {
3641
3641
  return keys;
3642
3642
  }
3643
3643
  /**
3644
+ * Raw sidecar-object batch delete under the state bucket. Used by the
3645
+ * deployment-events pruner (issue #885) to drop superseded `{runId}.jsonl`
3646
+ * streams + their index. Chunked to the 1,000-key `DeleteObjects` ceiling.
3647
+ * S3 `DeleteObjects` is idempotent — deleting a key that does not exist is
3648
+ * not an error — so callers do not need to pre-filter for existence.
3649
+ *
3650
+ * `DeleteObjects` reports per-key failures (e.g. partial `AccessDenied`,
3651
+ * `SlowDown`) in `response.Errors` rather than throwing — with `Quiet:
3652
+ * true` only those error entries come back. We aggregate them across
3653
+ * chunks and throw, so the explicit `cdkd events prune` purge does NOT
3654
+ * report success while leaving orphaned streams behind (the writer's
3655
+ * best-effort auto-prune swallows the throw via its write-chain catch).
3656
+ */
3657
+ async deleteRawObjects(keys) {
3658
+ if (keys.length === 0) return;
3659
+ await this.ensureClientForBucket();
3660
+ const failures = [];
3661
+ for (let i = 0; i < keys.length; i += 1e3) {
3662
+ const chunk = keys.slice(i, i + 1e3);
3663
+ const response = await this.s3Client.send(new DeleteObjectsCommand({
3664
+ Bucket: this.config.bucket,
3665
+ Delete: {
3666
+ Objects: chunk.map((Key) => ({ Key })),
3667
+ Quiet: true
3668
+ }
3669
+ }));
3670
+ for (const err of response.Errors ?? []) failures.push(`${err.Key ?? "<unknown>"} (${err.Code ?? "Error"}: ${err.Message ?? ""})`);
3671
+ }
3672
+ if (failures.length > 0) throw new StateError(`Failed to delete ${failures.length} object(s) from bucket '${this.config.bucket}': ${failures.join("; ")}`);
3673
+ }
3674
+ /**
3644
3675
  * HeadObject probe — returns true on 200, false on NotFound. Other errors
3645
3676
  * propagate so we don't accidentally swallow IAM denials.
3646
3677
  */
@@ -4771,6 +4802,35 @@ var DagBuilder = class {
4771
4802
  * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html
4772
4803
  */
4773
4804
  /**
4805
+ * Conditional-replacement predicate for `AWS::DynamoDB::Table.AttributeDefinitions`.
4806
+ *
4807
+ * Returns true only when an attribute present in BOTH the old and new definition
4808
+ * lists changed its `AttributeType` (e.g. `S` -> `N`). Adding a brand-new attribute
4809
+ * (to back a new GSI) or removing one (when a GSI is dropped) returns false — those
4810
+ * are in-place `UpdateTable` operations, matching CloudFormation's "No interruption"
4811
+ * update behavior for this property.
4812
+ */
4813
+ function attributeTypeChangedForSharedAttribute(oldValue, newValue) {
4814
+ const toTypeMap = (value) => {
4815
+ const map = /* @__PURE__ */ new Map();
4816
+ if (Array.isArray(value)) {
4817
+ for (const def of value) if (def && typeof def === "object") {
4818
+ const name = def["AttributeName"];
4819
+ const type = def["AttributeType"];
4820
+ if (typeof name === "string" && typeof type === "string") map.set(name, type);
4821
+ }
4822
+ }
4823
+ return map;
4824
+ };
4825
+ const oldTypes = toTypeMap(oldValue);
4826
+ const newTypes = toTypeMap(newValue);
4827
+ for (const [name, oldType] of oldTypes) {
4828
+ const newType = newTypes.get(name);
4829
+ if (newType !== void 0 && newType !== oldType) return true;
4830
+ }
4831
+ return false;
4832
+ }
4833
+ /**
4774
4834
  * Replacement rules registry
4775
4835
  *
4776
4836
  * Maps resource types to their replacement rules
@@ -4843,11 +4903,7 @@ var ReplacementRulesRegistry = class {
4843
4903
  ])
4844
4904
  });
4845
4905
  this.rules.set("AWS::DynamoDB::Table", {
4846
- replacementProperties: new Set([
4847
- "TableName",
4848
- "KeySchema",
4849
- "AttributeDefinitions"
4850
- ]),
4906
+ replacementProperties: new Set(["TableName", "KeySchema"]),
4851
4907
  updateableProperties: new Set([
4852
4908
  "BillingMode",
4853
4909
  "ProvisionedThroughput",
@@ -4858,7 +4914,8 @@ var ReplacementRulesRegistry = class {
4858
4914
  "Tags",
4859
4915
  "TimeToLiveSpecification",
4860
4916
  "PointInTimeRecoverySpecification"
4861
- ])
4917
+ ]),
4918
+ conditionalReplacements: new Map([["AttributeDefinitions", attributeTypeChangedForSharedAttribute]])
4862
4919
  });
4863
4920
  this.rules.set("AWS::SQS::Queue", {
4864
4921
  replacementProperties: new Set([
@@ -13385,4 +13442,4 @@ var DeployEngine = class {
13385
13442
 
13386
13443
  //#endregion
13387
13444
  export { findLargeInlineResources as $, shouldRetainResource as A, getDockerImageBySourceHash as B, applyRoleArnIfSet as C, LockManager as D, TemplateParser as E, formatDockerLoginError as F, resolveCaptureObservedState as G, getDefaultStateBucketName as H, getDockerCmd as I, resolveStateBucketWithDefaultAndSource as J, resolveSkipPrefix as K, runDockerForeground as L, stringifyValue as M, WorkGraph as N, S3StateBackend as O, buildDockerImage as P, MIGRATE_TMP_PREFIX as Q, runDockerStreaming as R, IntrinsicFunctionResolver as S, DagBuilder as T, getLegacyStateBucketName as U, Synthesizer as V, resolveApp as W, CFN_TEMPLATE_BODY_LIMIT as X, warnDeprecatedNoPrefixCliFlag as Y, CFN_TEMPLATE_URL_LIMIT as Z, IAMRoleProvider as _, withRetry as a, findActionableSilentDrops as b, computeImplicitDeleteEdges as c, bold as d, uploadCfnTemplate as et, cyan as f, yellow as g, red as h, withResourceDeadline as i, AssetPublisher as j, rebuildClientForBucketRegion as k, extractDeploymentEventError as l, green as m, DEFAULT_RESOURCE_WARN_AFTER_MS as n, clearBucketRegionCache as nt, isRetryableTransientError as o, gray as p, resolveStateBucketWithDefault as q, DeployEngine as r, resolveBucketRegion as rt, IMPLICIT_DELETE_DEPENDENCIES as s, DEFAULT_RESOURCE_TIMEOUT_MS as t, AssemblyReader as tt, formatResourceLine as u, collectInlinePolicyNamesManagedBySiblings as v, DiffCalculator as w, CloudControlProvider as x, ProviderRegistry as y, AssetManifestLoader as z };
13388
- //# sourceMappingURL=deploy-engine-CBzCsd24.js.map
13445
+ //# sourceMappingURL=deploy-engine-BRZdKXDs.js.map