cdk-real-drift 0.12.78 → 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
@@ -7518,6 +7518,7 @@ async function enumerateRestApiChildren(ctx) {
7518
7518
  const declaredValidatorIds = [];
7519
7519
  const declaredResponseTypes = [];
7520
7520
  let gatewayResponseTypeUnresolved = false;
7521
+ let deploymentStageUnresolved = false;
7521
7522
  const declaredStageNames = [];
7522
7523
  for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
7523
7524
  else if (r.resourceType === "AWS::ApiGateway::Model" && parentRefMatches(r.declared.RestApiId, apiId)) {
@@ -7530,6 +7531,9 @@ async function enumerateRestApiChildren(ctx) {
7530
7531
  } else if (r.resourceType === "AWS::ApiGateway::Stage" && parentRefMatches(r.declared.RestApiId, apiId)) {
7531
7532
  const name = typeof r.declared.StageName === "string" ? r.declared.StageName : r.physicalId;
7532
7533
  if (name) declaredStageNames.push(name);
7534
+ } else if (r.resourceType === "AWS::ApiGateway::Deployment" && parentRefMatches(r.declared.RestApiId, apiId)) {
7535
+ if (r.declared.StageName === UNRESOLVED || hasUnresolved(r.declared.StageName)) deploymentStageUnresolved = true;
7536
+ else if (typeof r.declared.StageName === "string") declaredStageNames.push(r.declared.StageName);
7533
7537
  }
7534
7538
  const specChildren = bodyDefined ? deriveSpecRestApiPaths(parent.declared.Body) : null;
7535
7539
  const client = new APIGatewayClient({
@@ -7610,7 +7614,8 @@ async function enumerateRestApiChildren(ctx) {
7610
7614
  liveStages: (await getAllStages(client, apiId)).filter((s) => typeof s.stageName === "string").map((s) => ({
7611
7615
  name: s.stageName,
7612
7616
  label: s.stageName
7613
- }))
7617
+ })),
7618
+ unresolvedDeploymentStage: deploymentStageUnresolved
7614
7619
  });
7615
7620
  return [
7616
7621
  ...resourceAndMethodAdded,
@@ -7623,6 +7628,7 @@ async function enumerateRestApiChildren(ctx) {
7623
7628
  }
7624
7629
  function diffApiGatewayStages(input) {
7625
7630
  const { apiId, declaredStageNames, liveStages } = input;
7631
+ if (input.unresolvedDeploymentStage) return [];
7626
7632
  const declared = new Set(declaredStageNames);
7627
7633
  const added = [];
7628
7634
  for (const s of liveStages) {
@@ -7923,6 +7929,7 @@ async function pageV2Authorizers(client, apiId) {
7923
7929
  }
7924
7930
  function diffApiGatewayV2Stages(input) {
7925
7931
  const { apiId, declaredStageNames, liveStages, quickCreate } = input;
7932
+ if (input.unresolvedDeploymentStage) return [];
7926
7933
  const declared = new Set(declaredStageNames);
7927
7934
  const added = [];
7928
7935
  for (const s of liveStages) {
@@ -7966,6 +7973,7 @@ async function enumerateHttpApiChildren(ctx) {
7966
7973
  const declaredIntegrationIds = [];
7967
7974
  const declaredAuthorizerIds = [];
7968
7975
  const declaredStageNames = [];
7976
+ let deploymentStageUnresolved = false;
7969
7977
  for (const r of desired.resources) {
7970
7978
  if (!parentRefMatches(r.declared.ApiId, apiId)) continue;
7971
7979
  if (r.resourceType === "AWS::ApiGatewayV2::Route" && r.physicalId) declaredRouteIds.push(r.physicalId);
@@ -7974,6 +7982,9 @@ async function enumerateHttpApiChildren(ctx) {
7974
7982
  else if (r.resourceType === "AWS::ApiGatewayV2::Stage") {
7975
7983
  const name = r.physicalId ?? r.declared.StageName;
7976
7984
  if (name) declaredStageNames.push(name);
7985
+ } else if (r.resourceType === "AWS::ApiGatewayV2::Deployment") {
7986
+ if (r.declared.StageName === UNRESOLVED || hasUnresolved(r.declared.StageName)) deploymentStageUnresolved = true;
7987
+ else if (typeof r.declared.StageName === "string") declaredStageNames.push(r.declared.StageName);
7977
7988
  }
7978
7989
  }
7979
7990
  const client = new ApiGatewayV2Client({
@@ -8019,7 +8030,8 @@ async function enumerateHttpApiChildren(ctx) {
8019
8030
  apiId,
8020
8031
  declaredStageNames,
8021
8032
  liveStages,
8022
- quickCreate
8033
+ quickCreate,
8034
+ unresolvedDeploymentStage: deploymentStageUnresolved
8023
8035
  });
8024
8036
  return added.concat(authorizerAdded, stageAdded);
8025
8037
  }
@@ -14901,13 +14913,22 @@ const assertOpsConsumed = (resourceType, ops, handled) => {
14901
14913
  const dropped = [...new Set(ops.map((o) => opTopSeg(o.path)).filter((s) => !isHandled(s)))];
14902
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`);
14903
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
+ }
14904
14923
  async function desiredModel(type, ctx, ops) {
14905
14924
  const reader = SDK_OVERRIDES[type];
14906
14925
  const current = (reader && await reader(ctx)) ?? {};
14907
- return applyOps(current.PolicyDocument === void 0 ? current : {
14926
+ const aligned = current.PolicyDocument === void 0 ? current : {
14908
14927
  ...current,
14909
14928
  PolicyDocument: canonicalizeForCompare(current.PolicyDocument)
14910
- }, ops);
14929
+ };
14930
+ assertIndexedPriorsFresh(type, aligned, ops);
14931
+ return applyOps(aligned, ops);
14911
14932
  }
14912
14933
  const policyJson = (m) => m.PolicyDocument === void 0 ? void 0 : JSON.stringify(m.PolicyDocument);
14913
14934
  const writeS3BucketPolicy = async (ctx, ops) => {
@@ -15267,7 +15288,9 @@ const writeWafv2WebAcl = async (ctx, ops) => {
15267
15288
  Scope: scope
15268
15289
  }));
15269
15290
  if (!cur.WebACL || !cur.LockToken) throw new Error("could not read current WebACL for revert");
15270
- 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);
15271
15294
  const desc = m.Description;
15272
15295
  await c.send(new UpdateWebACLCommand({
15273
15296
  Name: name,