cdk-real-drift 0.12.79 → 0.12.80

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
@@ -14913,13 +14913,22 @@ const assertOpsConsumed = (resourceType, ops, handled) => {
14913
14913
  const dropped = [...new Set(ops.map((o) => opTopSeg(o.path)).filter((s) => !isHandled(s)))];
14914
14914
  if (dropped.length > 0) throw new Error(`${resourceType} revert cannot apply ${dropped.join(", ")}: this SDK writer supports only a subset of properties and does not handle ${dropped.length > 1 ? "these" : "this one"}; update ${dropped.length > 1 ? "them" : "it"} manually`);
14915
14915
  };
14916
+ function assertIndexedPriorsFresh(resourceType, freshModel, ops) {
14917
+ for (const { path, prior } of ops) {
14918
+ if (!hasArrayIndexSegment(path) || prior === void 0) continue;
14919
+ const fresh = rawValueAtPointer(freshModel, path);
14920
+ if (fresh === POINTER_ABSENT || !deepEqual(fresh, prior)) throw new Error(`${resourceType} revert aborted: the live value at ${path} changed since check (an element was added, removed, or reordered) — re-run check and revert again`);
14921
+ }
14922
+ }
14916
14923
  async function desiredModel(type, ctx, ops) {
14917
14924
  const reader = SDK_OVERRIDES[type];
14918
14925
  const current = (reader && await reader(ctx)) ?? {};
14919
- return applyOps(current.PolicyDocument === void 0 ? current : {
14926
+ const aligned = current.PolicyDocument === void 0 ? current : {
14920
14927
  ...current,
14921
14928
  PolicyDocument: canonicalizeForCompare(current.PolicyDocument)
14922
- }, ops);
14929
+ };
14930
+ assertIndexedPriorsFresh(type, aligned, ops);
14931
+ return applyOps(aligned, ops);
14923
14932
  }
14924
14933
  const policyJson = (m) => m.PolicyDocument === void 0 ? void 0 : JSON.stringify(m.PolicyDocument);
14925
14934
  const writeS3BucketPolicy = async (ctx, ops) => {
@@ -15279,7 +15288,9 @@ const writeWafv2WebAcl = async (ctx, ops) => {
15279
15288
  Scope: scope
15280
15289
  }));
15281
15290
  if (!cur.WebACL || !cur.LockToken) throw new Error("could not read current WebACL for revert");
15282
- const m = applyOps(canonicalizeForCompare(cur.WebACL), ops);
15291
+ const canonWebAcl = canonicalizeForCompare(cur.WebACL);
15292
+ assertIndexedPriorsFresh("AWS::WAFv2::WebACL", canonWebAcl, ops);
15293
+ const m = applyOps(canonWebAcl, ops);
15283
15294
  const desc = m.Description;
15284
15295
  await c.send(new UpdateWebACLCommand({
15285
15296
  Name: name,