@go-to-k/cdkd 0.221.4 → 0.221.6

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
@@ -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.4";
1556
+ return "0.221.6";
1557
1557
  }
1558
1558
  /**
1559
1559
  * Generate a time-sortable unique run id, e.g.
@@ -6101,6 +6101,43 @@ function serializeRedriveAllowPolicy(value) {
6101
6101
  return JSON.stringify(value);
6102
6102
  }
6103
6103
  /**
6104
+ * Reset value for a CDK-managed SQS attribute that was set on a previous
6105
+ * deploy but is ABSENT from the desired properties on an in-place UPDATE
6106
+ * (e.g. its `Fn::If` branch resolved to `AWS::NoValue`, so the resolved
6107
+ * desired properties no longer carry the key).
6108
+ *
6109
+ * cdkd's diff layer correctly classifies a property present in current
6110
+ * state but absent from the desired template as a change, but the provider
6111
+ * `update()` loop only acts on keys PRESENT in the new properties — so
6112
+ * without an explicit reset the stale value lingers on AWS (the
6113
+ * `conditions-update-2` integ exercises exactly this for `RedrivePolicy`).
6114
+ *
6115
+ * CloudFormation resets a removed property to the attribute's default. We
6116
+ * mirror that here:
6117
+ * - The JSON policy attributes (`RedrivePolicy` / `RedriveAllowPolicy`)
6118
+ * are cleared with the empty string the SQS API documents for removal.
6119
+ * - `KmsMasterKeyId` is cleared with the empty string (removes a custom
6120
+ * CMK; SQS falls back to its own default encryption behavior).
6121
+ * - Numeric attributes reset to their documented `SetQueueAttributes`
6122
+ * defaults (see the SQS API reference).
6123
+ *
6124
+ * Attributes NOT in this map (immutable / FIFO-discriminated ones such as
6125
+ * `FifoQueue` / `DeduplicationScope` / `FifoThroughputLimit`) are never
6126
+ * reset on removal — flipping them would either be rejected by AWS or
6127
+ * require a replacement, which the diff layer handles separately.
6128
+ */
6129
+ const SQS_ATTRIBUTE_REMOVAL_RESET = {
6130
+ RedrivePolicy: "",
6131
+ RedriveAllowPolicy: "",
6132
+ KmsMasterKeyId: "",
6133
+ VisibilityTimeout: "30",
6134
+ MaximumMessageSize: "262144",
6135
+ MessageRetentionPeriod: "345600",
6136
+ DelaySeconds: "0",
6137
+ ReceiveMessageWaitTimeSeconds: "0",
6138
+ KmsDataKeyReusePeriodSeconds: "300"
6139
+ };
6140
+ /**
6104
6141
  * CDK property name to SQS attribute name mapping
6105
6142
  */
6106
6143
  const CDK_TO_SQS_ATTRIBUTES = {
@@ -6207,7 +6244,7 @@ var SQSQueueProvider = class {
6207
6244
  if (cdkKey === "RedrivePolicy" && typeof value === "object") attributes[sqsKey] = serializeRedrivePolicy(value);
6208
6245
  else if (cdkKey === "RedriveAllowPolicy") attributes[sqsKey] = serializeRedriveAllowPolicy(value);
6209
6246
  else attributes[sqsKey] = stringifyValue(value);
6210
- }
6247
+ } else if (previousProperties[cdkKey] !== void 0 && cdkKey in SQS_ATTRIBUTE_REMOVAL_RESET) attributes[sqsKey] = SQS_ATTRIBUTE_REMOVAL_RESET[cdkKey];
6211
6248
  }
6212
6249
  if (Object.keys(attributes).length > 0) {
6213
6250
  await this.sqsClient.send(new SetQueueAttributesCommand({
@@ -36843,17 +36880,55 @@ async function loadStateOrEmpty(stackName, region, stateBackend) {
36843
36880
  * Pure with respect to AWS state mutation — only reads state (the resolver
36844
36881
  * may read producer state for `Fn::ImportValue` / `Fn::GetStackOutput`).
36845
36882
  */
36846
- async function computeStackDiff(currentState, template, region, stackName, stateBackend, diffCalculator) {
36883
+ async function computeStackDiff(currentState, template, region, stackName, stateBackend, diffCalculator, parameters) {
36847
36884
  const intrinsicResolver = new IntrinsicFunctionResolver(region);
36848
36885
  const resolveFn = (value) => intrinsicResolver.resolve(value, {
36849
36886
  template,
36850
36887
  resources: currentState.resources,
36851
36888
  stateBackend,
36852
- stackName
36889
+ stackName,
36890
+ ...parameters && { parameters }
36853
36891
  });
36854
36892
  return diffCalculator.calculateDiff(currentState, template, resolveFn);
36855
36893
  }
36856
36894
  /**
36895
+ * Resolve a nested-stack child's input `Parameters` (declared on the parent's
36896
+ * `AWS::CloudFormation::Stack` row under `Properties.Parameters`) to scalar
36897
+ * values against the PARENT's deployed state + already-resolved parameters.
36898
+ *
36899
+ * This is the diff-time analogue of `NestedStackProvider.extractParameters`:
36900
+ * the deploy engine resolves these same `Parameters` against the parent's
36901
+ * resolver context and forwards the scalar map to the child engine as
36902
+ * `DeployEngineOptions.parameters`, so a `Ref` to a child input parameter
36903
+ * resolves at deploy time. The recursive diff must do the same or it reports
36904
+ * spurious changes on every freshly-deployed nested child whose property
36905
+ * derives from a passed-down parameter.
36906
+ *
36907
+ * Each value is resolved independently and best-effort: a value that cannot
36908
+ * be resolved (e.g. a `Ref` to a resource not yet in state) is dropped from
36909
+ * the map rather than forwarded as a raw intrinsic — leaving it out means the
36910
+ * child's `Ref` to that parameter falls through to the existing
36911
+ * intrinsic-vs-resolved comparison path (no behavior change for the
36912
+ * unresolvable case), while resolvable parameters (the freshly-deployed tree)
36913
+ * get exact scalar values.
36914
+ */
36915
+ async function resolveChildStackParameters(parentStackRow, parentTemplate, parentState, region, parentStackName, stateBackend, parentParameters) {
36916
+ const rawParams = parentStackRow.Properties?.["Parameters"];
36917
+ if (!rawParams || typeof rawParams !== "object" || Array.isArray(rawParams)) return {};
36918
+ const resolver = new IntrinsicFunctionResolver(region);
36919
+ const resolved = {};
36920
+ for (const [name, value] of Object.entries(rawParams)) try {
36921
+ resolved[name] = await resolver.resolve(value, {
36922
+ template: parentTemplate,
36923
+ resources: parentState.resources,
36924
+ stateBackend,
36925
+ stackName: parentStackName,
36926
+ ...parentParameters && { parameters: parentParameters }
36927
+ });
36928
+ } catch {}
36929
+ return resolved;
36930
+ }
36931
+ /**
36857
36932
  * Build the diff tree for one stack and (when `recursive`) every nested
36858
36933
  * `AWS::CloudFormation::Stack` descendant.
36859
36934
  *
@@ -36874,13 +36949,13 @@ async function computeStackDiff(currentState, template, region, stackName, state
36874
36949
  * fail at deploy time.
36875
36950
  */
36876
36951
  async function buildDiffTree(args) {
36877
- const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator } = args;
36952
+ const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parameters } = args;
36878
36953
  const state = await loadStateOrEmpty(stackName, region, stateBackend);
36879
36954
  const node = {
36880
36955
  stackName,
36881
36956
  displayName,
36882
36957
  region,
36883
- changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator),
36958
+ changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator, parameters),
36884
36959
  ccApiRoutes: collectCcApiRoutes(template, state),
36885
36960
  children: []
36886
36961
  };
@@ -36894,6 +36969,7 @@ async function buildDiffTree(args) {
36894
36969
  const childStackName = `${stackName}~${logicalId}`;
36895
36970
  const childTemplate = readNestedTemplate(childTemplatePath);
36896
36971
  const grandchildTemplates = indexNestedChildTemplates(childTemplate, childTemplatePath);
36972
+ const childParameters = await resolveChildStackParameters(resource, template, state, region, stackName, stateBackend, parameters);
36897
36973
  node.children.push(await buildDiffTree({
36898
36974
  stackName: childStackName,
36899
36975
  displayName: childStackName,
@@ -36902,7 +36978,8 @@ async function buildDiffTree(args) {
36902
36978
  nestedTemplates: grandchildTemplates,
36903
36979
  recursive: true,
36904
36980
  stateBackend,
36905
- diffCalculator
36981
+ diffCalculator,
36982
+ parameters: childParameters
36906
36983
  }));
36907
36984
  }
36908
36985
  for (const [logicalId, resource] of Object.entries(state.resources)) {
@@ -53802,7 +53879,7 @@ function reorderArgs(argv) {
53802
53879
  async function main() {
53803
53880
  installPipeCloseHandler();
53804
53881
  const program = new Command();
53805
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.4");
53882
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.6");
53806
53883
  program.addCommand(createBootstrapCommand());
53807
53884
  program.addCommand(createSynthCommand());
53808
53885
  program.addCommand(createListCommand());