aws-cdk 2.1140.0 → 2.1142.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.
package/lib/index.js CHANGED
@@ -1609,8 +1609,8 @@ var require_validator = __commonJS({
1609
1609
  if (ctx.schemas[switchSchema]) {
1610
1610
  return { subschema: ctx.schemas[switchSchema], switchSchema };
1611
1611
  }
1612
- let parsed = new URL(switchSchema, "thismessage::/");
1613
- let fragment = parsed.hash;
1612
+ let hashIndex = switchSchema.indexOf("#");
1613
+ let fragment = hashIndex === -1 || hashIndex === switchSchema.length - 1 ? "" : switchSchema.substr(hashIndex);
1614
1614
  var document2 = fragment && fragment.length && switchSchema.substr(0, switchSchema.length - fragment.length);
1615
1615
  if (!document2 || !ctx.schemas[document2]) {
1616
1616
  throw new SchemaError("no such schema <" + switchSchema + ">", schema);
@@ -3695,7 +3695,7 @@ var require_semver2 = __commonJS({
3695
3695
  // ../@aws-cdk/cloud-assembly-schema/cli-version.json
3696
3696
  var require_cli_version = __commonJS({
3697
3697
  "../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
3698
- module2.exports = { version: "2.1140.0" };
3698
+ module2.exports = { version: "2.1142.0" };
3699
3699
  }
3700
3700
  });
3701
3701
 
@@ -35566,7 +35566,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
35566
35566
  // ../../node_modules/@smithy/node-http-handler/dist-cjs/index.js
35567
35567
  var require_dist_cjs5 = __commonJS({
35568
35568
  "../../node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2) {
35569
- var { hasOwn: hasOwn2 } = (init_serde(), __toCommonJS(serde_exports));
35569
+ var { hasOwn: hasOwn3 } = (init_serde(), __toCommonJS(serde_exports));
35570
35570
  var { streamCollector: streamCollector8 } = (init_serde(), __toCommonJS(serde_exports));
35571
35571
  exports2.streamCollector = streamCollector8;
35572
35572
  var { buildQueryString: buildQueryString2, HttpResponse: HttpResponse2 } = (init_protocols(), __toCommonJS(protocols_exports));
@@ -35595,7 +35595,7 @@ var require_dist_cjs5 = __commonJS({
35595
35595
  var getTransformedHeaders = /* @__PURE__ */ __name((headers) => {
35596
35596
  const transformedHeaders = {};
35597
35597
  for (const name in headers) {
35598
- if (!hasOwn2(headers, name))
35598
+ if (!hasOwn3(headers, name))
35599
35599
  continue;
35600
35600
  const headerValues = headers[name];
35601
35601
  transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
@@ -35787,7 +35787,7 @@ var require_dist_cjs5 = __commonJS({
35787
35787
  }
35788
35788
  if (sockets && requests) {
35789
35789
  for (const origin in sockets) {
35790
- if (!hasOwn2(sockets, origin))
35790
+ if (!hasOwn3(sockets, origin))
35791
35791
  continue;
35792
35792
  const socketsInUse = sockets[origin]?.length ?? 0;
35793
35793
  const requestsEnqueued = requests[origin]?.length ?? 0;
@@ -36644,7 +36644,7 @@ var init_package = __esm({
36644
36644
  "../../node_modules/@aws-sdk/nested-clients/package.json"() {
36645
36645
  package_default = {
36646
36646
  name: "@aws-sdk/nested-clients",
36647
- version: "3.997.44",
36647
+ version: "3.997.45",
36648
36648
  description: "Nested clients for AWS SDK packages.",
36649
36649
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
36650
36650
  license: "Apache-2.0",
@@ -36744,7 +36744,7 @@ var init_package = __esm({
36744
36744
  "test:watch": "yarn g:vitest watch"
36745
36745
  },
36746
36746
  dependencies: {
36747
- "@aws-sdk/core": "^3.977.9",
36747
+ "@aws-sdk/core": "^3.978.0",
36748
36748
  "@aws-sdk/signature-v4-multi-region": "^3.996.46",
36749
36749
  "@aws-sdk/types": "^3.974.5",
36750
36750
  "@smithy/core": "^3.33.3",
@@ -46811,6 +46811,7 @@ var require_dist_cjs15 = __commonJS({
46811
46811
  if (!passiveLock) {
46812
46812
  passiveLock = chain3(options).then((c6) => {
46813
46813
  credentials = c6;
46814
+ }).catch(() => {
46814
46815
  }).finally(() => {
46815
46816
  passiveLock = void 0;
46816
46817
  });
@@ -53491,11 +53492,22 @@ var init_format_url = __esm({
53491
53492
  }
53492
53493
  });
53493
53494
 
53495
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js
53496
+ function hasOwn2(container, key) {
53497
+ return Object.prototype.hasOwnProperty.call(container, key);
53498
+ }
53499
+ var init_hasOwn2 = __esm({
53500
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js"() {
53501
+ __name(hasOwn2, "hasOwn");
53502
+ }
53503
+ });
53504
+
53494
53505
  // ../../node_modules/@aws-sdk/core/dist-es/submodules/util/index.js
53495
53506
  var util_exports = {};
53496
53507
  __export(util_exports, {
53497
53508
  build: () => build,
53498
53509
  formatUrl: () => formatUrl,
53510
+ hasOwn: () => hasOwn2,
53499
53511
  parse: () => parse2,
53500
53512
  validate: () => validate
53501
53513
  });
@@ -53503,6 +53515,7 @@ var init_util3 = __esm({
53503
53515
  "../../node_modules/@aws-sdk/core/dist-es/submodules/util/index.js"() {
53504
53516
  init_arn();
53505
53517
  init_format_url();
53518
+ init_hasOwn2();
53506
53519
  }
53507
53520
  });
53508
53521
 
@@ -83391,6 +83404,11 @@ var init_messages = __esm({
83391
83404
  description: "Stack Monitoring error",
83392
83405
  interface: "ErrorPayload"
83393
83406
  }),
83407
+ CDK_TOOLKIT_W5500: warn({
83408
+ code: "CDK_TOOLKIT_W5500",
83409
+ description: "Stack events could not be read; the reported event log may be incomplete",
83410
+ interface: "ErrorPayload"
83411
+ }),
83394
83412
  // 6: Rollback (6xxx)
83395
83413
  CDK_TOOLKIT_I6000: info({
83396
83414
  code: "CDK_TOOLKIT_I6000",
@@ -92912,31 +92930,6 @@ var init_template_body_parameter = __esm({
92912
92930
  }
92913
92931
  });
92914
92932
 
92915
- // ../@aws-cdk/toolkit-lib/lib/api/aws-auth/util.ts
92916
- function isAccessDeniedError(e6) {
92917
- const name = e6?.name ?? e6?.Code ?? "";
92918
- return name === "AccessDenied" || name === "AccessDeniedException";
92919
- }
92920
- function readIfPossible(filename) {
92921
- try {
92922
- if (!fs16.pathExistsSync(filename)) {
92923
- return void 0;
92924
- }
92925
- return fs16.readFileSync(filename, { encoding: "utf-8" });
92926
- } catch (e6) {
92927
- return void 0;
92928
- }
92929
- }
92930
- var fs16;
92931
- var init_util5 = __esm({
92932
- "../@aws-cdk/toolkit-lib/lib/api/aws-auth/util.ts"() {
92933
- "use strict";
92934
- fs16 = __toESM(require_lib4());
92935
- __name(isAccessDeniedError, "isAccessDeniedError");
92936
- __name(readIfPossible, "readIfPossible");
92937
- }
92938
- });
92939
-
92940
92933
  // ../@aws-cdk/toolkit-lib/lib/api/stack-events/hook-result-details.ts
92941
92934
  function formatHookResultDetails(result2) {
92942
92935
  const annotations = ("Annotations" in result2 ? result2.Annotations : void 0) ?? [];
@@ -92971,21 +92964,9 @@ async function fetchHookResultDetails(cfn, hookInvocationId, options) {
92971
92964
  return formatHookResultDetails(result2);
92972
92965
  } catch (e6) {
92973
92966
  const errorMessage = e6 instanceof Error ? e6.message : String(e6);
92974
- const isPermissionsError = isAccessDeniedError(e6) || typeof errorMessage === "string" && errorMessage.toLowerCase().includes("not authorized to perform: cloudformation:gethookresult");
92975
- if (isPermissionsError && options.envResources) {
92976
- let currentVersion = void 0;
92977
- try {
92978
- currentVersion = (await options.envResources.lookupToolkit()).version;
92979
- } catch {
92980
- }
92981
- await options.ioHelper.defaults.warn(
92982
- `Failed to fetch result details for Hook invocation ${hookInvocationId}: ${errorMessage}. Make sure you have permissions to call the GetHookResult API, or re-bootstrap your environment by running 'cdk bootstrap' to update the Bootstrap CDK Toolkit stack. Bootstrap toolkit stack version 31 or later is needed; current version: ${currentVersion ?? "unknown"}.`
92983
- );
92984
- } else {
92985
- await options.ioHelper.defaults.warn(
92986
- util4.format("Failed to fetch Hook details for invocation %s: %s", hookInvocationId, errorMessage)
92987
- );
92988
- }
92967
+ await options.ioHelper.defaults.warn(
92968
+ util4.format("Could not fetch extra detail for Hook invocation %s (%s). Run again with -v to see the full error.", hookInvocationId, errorMessage)
92969
+ );
92989
92970
  return void 0;
92990
92971
  }
92991
92972
  }
@@ -92998,7 +92979,6 @@ var init_hook_result_details = __esm({
92998
92979
  "../@aws-cdk/toolkit-lib/lib/api/stack-events/hook-result-details.ts"() {
92999
92980
  "use strict";
93000
92981
  util4 = __toESM(require("node:util"));
93001
- init_util5();
93002
92982
  __name(formatHookResultDetails, "formatHookResultDetails");
93003
92983
  __name(isFailedHookStatus, "isFailedHookStatus");
93004
92984
  __name(fetchHookResultDetails, "fetchHookResultDetails");
@@ -93590,7 +93570,6 @@ var init_stack_activity_monitor = __esm({
93590
93570
  stackDisplayName;
93591
93571
  stack;
93592
93572
  cfn;
93593
- envResources;
93594
93573
  isStackUpdate;
93595
93574
  constructor({
93596
93575
  cfn,
@@ -93600,14 +93579,12 @@ var init_stack_activity_monitor = __esm({
93600
93579
  resourcesTotal,
93601
93580
  changeSetCreationTime,
93602
93581
  pollingInterval = 2e3,
93603
- envResources,
93604
93582
  isStackUpdate = false
93605
93583
  }) {
93606
93584
  this.ioHelper = ioHelper;
93607
93585
  this.stack = stack;
93608
93586
  this.stackDisplayName = stackNameFromArn(stackArn);
93609
93587
  this.cfn = cfn;
93610
- this.envResources = envResources;
93611
93588
  this.isStackUpdate = isStackUpdate;
93612
93589
  this.progressMonitor = new StackProgressMonitor(resourcesTotal);
93613
93590
  this.pollingInterval = pollingInterval;
@@ -93675,7 +93652,6 @@ var init_stack_activity_monitor = __esm({
93675
93652
  try {
93676
93653
  this.readPromise = this.readNewEvents(this.monitorId);
93677
93654
  await this.readPromise;
93678
- this.readPromise = void 0;
93679
93655
  if (!this.monitorId) {
93680
93656
  return;
93681
93657
  }
@@ -93684,6 +93660,8 @@ var init_stack_activity_monitor = __esm({
93684
93660
  util6.format("Error occurred while monitoring stack: %s", e6),
93685
93661
  { error: e6 }
93686
93662
  ));
93663
+ } finally {
93664
+ this.readPromise = void 0;
93687
93665
  }
93688
93666
  this.scheduleNextTick();
93689
93667
  }
@@ -93705,8 +93683,7 @@ var init_stack_activity_monitor = __esm({
93705
93683
  this.progressMonitor.process(resourceEvent);
93706
93684
  if (resourceEvent.event.HookInvocationId) {
93707
93685
  const details = await fetchHookResultDetails(this.cfn, resourceEvent.event.HookInvocationId, {
93708
- ioHelper: this.ioHelper,
93709
- envResources: this.envResources
93686
+ ioHelper: this.ioHelper
93710
93687
  });
93711
93688
  if (details) {
93712
93689
  resourceEvent.event.HookStatusReason = details;
@@ -93728,10 +93705,20 @@ var init_stack_activity_monitor = __esm({
93728
93705
  * reached the last page.
93729
93706
  */
93730
93707
  async finalPollToEnd(monitorId) {
93731
- if (this.readPromise) {
93708
+ try {
93732
93709
  await this.readPromise;
93710
+ } catch {
93711
+ }
93712
+ try {
93713
+ await this.readNewEvents(monitorId);
93714
+ } catch (e6) {
93715
+ const errorName = e6 instanceof Error ? e6.name : String(e6);
93716
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_W5500.msg(
93717
+ util6.format("Could not read the final stack events, the event log may be incomplete (%s). Run again with -v to see the full error.", errorName),
93718
+ { error: e6 }
93719
+ ));
93720
+ await this.ioHelper.defaults.debug(util6.format("Error occurred during final stack event poll: %s", e6));
93733
93721
  }
93734
- await this.readNewEvents(monitorId);
93735
93722
  }
93736
93723
  /**
93737
93724
  * Formats a stack activity into a basic string
@@ -94055,7 +94042,7 @@ async function getNestedStackTemplates(rootStackArtifact, nestedTemplateAssetPat
94055
94042
  const nestedStackArn = await getNestedStackArn(nestedStackLogicalId, listStackResources);
94056
94043
  const deployedStackName = nestedStackArn?.slice(nestedStackArn.indexOf("/") + 1, nestedStackArn.lastIndexOf("/"));
94057
94044
  return {
94058
- generatedTemplate: JSON.parse(fs17.readFileSync(nestedTemplatePath, "utf-8")),
94045
+ generatedTemplate: JSON.parse(fs16.readFileSync(nestedTemplatePath, "utf-8")),
94059
94046
  deployedTemplate: deployedStackName ? await loadCurrentStackTemplate(deployedStackName, sdk) : {},
94060
94047
  deployedStackName
94061
94048
  };
@@ -94074,12 +94061,12 @@ async function getNestedStackArn(nestedStackLogicalId, listStackResources) {
94074
94061
  function isCdkManagedNestedStack(stackResource) {
94075
94062
  return stackResource.Type === "AWS::CloudFormation::Stack" && stackResource.Metadata && stackResource.Metadata["aws:asset:path"];
94076
94063
  }
94077
- var path16, fs17;
94064
+ var path16, fs16;
94078
94065
  var init_nested_stack_helpers = __esm({
94079
94066
  "../@aws-cdk/toolkit-lib/lib/api/cloudformation/nested-stack-helpers.ts"() {
94080
94067
  "use strict";
94081
94068
  path16 = __toESM(require("path"));
94082
- fs17 = __toESM(require_lib4());
94069
+ fs16 = __toESM(require_lib4());
94083
94070
  init_evaluate_cloudformation_template();
94084
94071
  init_stack_helpers();
94085
94072
  init_util4();
@@ -94344,6 +94331,31 @@ var init_stack_template = __esm({
94344
94331
  }
94345
94332
  });
94346
94333
 
94334
+ // ../@aws-cdk/toolkit-lib/lib/api/aws-auth/util.ts
94335
+ function isAccessDeniedError(e6) {
94336
+ const name = e6?.name ?? e6?.Code ?? "";
94337
+ return name === "AccessDenied" || name === "AccessDeniedException";
94338
+ }
94339
+ function readIfPossible(filename) {
94340
+ try {
94341
+ if (!fs17.pathExistsSync(filename)) {
94342
+ return void 0;
94343
+ }
94344
+ return fs17.readFileSync(filename, { encoding: "utf-8" });
94345
+ } catch (e6) {
94346
+ return void 0;
94347
+ }
94348
+ }
94349
+ var fs17;
94350
+ var init_util5 = __esm({
94351
+ "../@aws-cdk/toolkit-lib/lib/api/aws-auth/util.ts"() {
94352
+ "use strict";
94353
+ fs17 = __toESM(require_lib4());
94354
+ __name(isAccessDeniedError, "isAccessDeniedError");
94355
+ __name(readIfPossible, "readIfPossible");
94356
+ }
94357
+ });
94358
+
94347
94359
  // ../@aws-cdk/toolkit-lib/lib/api/diagnosing/cloudtrail-investigation.ts
94348
94360
  async function investigateStackViaCloudTrail(sdk, errors, ioHelper) {
94349
94361
  const debug2 = /* @__PURE__ */ __name((msg) => ioHelper.defaults.debug(msg), "debug");
@@ -95625,29 +95637,31 @@ var init_stack_diagnoser = __esm({
95625
95637
  if (ev.type === "could-not-check") {
95626
95638
  await this.props.ioHelper.defaults.warn(ev.message);
95627
95639
  }
95628
- const hookErrors = await this._changeSetHookErrors(changeSet);
95640
+ let hookErrors = [];
95641
+ let warnings = [];
95642
+ try {
95643
+ hookErrors = await this._changeSetHookErrors(changeSet);
95644
+ } catch (e6) {
95645
+ const errorMessage = e6 instanceof Error ? e6.message : String(e6);
95646
+ warnings = [`Could not fetch extra hook failure detail for change set ${changeSet.ChangeSetName} (${errorMessage}). Run again with -v to see the full error.`];
95647
+ }
95629
95648
  if (hookErrors.length > 0) {
95630
95649
  return Diagnosis.problem(detectedBy, await this.enhanceErrors(hookErrors));
95631
95650
  }
95632
- return this._nonSpecificChangeSetError(changeSet, detectedBy);
95651
+ return this._nonSpecificChangeSetError(changeSet, detectedBy, warnings);
95633
95652
  }
95634
95653
  /**
95635
95654
  * Find the hooks that failed this change set, and return their failure details as resource errors.
95636
95655
  *
95637
95656
  * Failures of hooks with failure mode WARN don't fail a change set, so those are excluded.
95638
- * Returns an empty array if hook results can't be listed (e.g. for lack of permissions).
95657
+ * Throws if hook results can't be listed (e.g. lack of permissions, or the API being
95658
+ * unavailable).
95639
95659
  */
95640
95660
  async _changeSetHookErrors(changeSet) {
95641
- let hookResults;
95642
- try {
95643
- hookResults = (await this.cfn.listHookResults({
95644
- TargetType: "CHANGE_SET",
95645
- TargetId: changeSet.ChangeSetId
95646
- })).HookResults ?? [];
95647
- } catch (e6) {
95648
- await this.props.ioHelper.defaults.debug(`Could not list hook results for change set ${changeSet.ChangeSetName}: ${e6.message}`);
95649
- return [];
95650
- }
95661
+ const hookResults = (await this.cfn.listHookResults({
95662
+ TargetType: "CHANGE_SET",
95663
+ TargetId: changeSet.ChangeSetId
95664
+ })).HookResults ?? [];
95651
95665
  const failedHooks = hookResults.filter((r6) => isFailedHookStatus(r6.Status) && r6.FailureMode === "FAIL");
95652
95666
  const errors = [];
95653
95667
  for (const hook of failedHooks) {
@@ -95674,8 +95688,7 @@ var init_stack_diagnoser = __esm({
95674
95688
  async _hookResultDetails(hook) {
95675
95689
  if (hook.HookResultId) {
95676
95690
  const details = await fetchHookResultDetails(this.cfn, hook.HookResultId, {
95677
- ioHelper: this.props.ioHelper,
95678
- envResources: this.props.envResources
95691
+ ioHelper: this.props.ioHelper
95679
95692
  });
95680
95693
  if (details) {
95681
95694
  return details;
@@ -95693,7 +95706,11 @@ var init_stack_diagnoser = __esm({
95693
95706
  this.investigateResourceBestEffort(err),
95694
95707
  this.hookFailureContext(err)
95695
95708
  ]);
95696
- const allContext = [...hookContext, ...additionalContext];
95709
+ const allContext = [
95710
+ ...hookContext,
95711
+ ...additionalContext,
95712
+ ...err.warnings?.length ? [{ source: "Warnings", messages: err.warnings }] : []
95713
+ ];
95697
95714
  return {
95698
95715
  ...err,
95699
95716
  sourceTrace,
@@ -95719,8 +95736,7 @@ var init_stack_diagnoser = __esm({
95719
95736
  const ret = [];
95720
95737
  for (const hook of err.hookFailures ?? []) {
95721
95738
  let details = hook.hookInvocationId ? await fetchHookResultDetails(this.cfn, hook.hookInvocationId, {
95722
- ioHelper: this.props.ioHelper,
95723
- envResources: this.props.envResources
95739
+ ioHelper: this.props.ioHelper
95724
95740
  }) : void 0;
95725
95741
  details = details ?? (hook.hookStatusReason ? normalizeHookMessage(hook.hookStatusReason) : void 0);
95726
95742
  if (details) {
@@ -95750,8 +95766,12 @@ var init_stack_diagnoser = __esm({
95750
95766
  * Build a generic stack error from the given change set information
95751
95767
  *
95752
95768
  * We can't point to a specific resource.
95769
+ *
95770
+ * @param warnings - Warnings to attach to the error (e.g. a note that hook detail couldn't
95771
+ * be fetched). Rendered after the main failure message, instead of appearing to precede or
95772
+ * replace it.
95753
95773
  */
95754
- async _nonSpecificChangeSetError(changeSet, detectedBy) {
95774
+ async _nonSpecificChangeSetError(changeSet, detectedBy, warnings = []) {
95755
95775
  return Diagnosis.problem(detectedBy, [
95756
95776
  await this.enhanceError({
95757
95777
  // It's about a stack
@@ -95760,7 +95780,8 @@ var init_stack_diagnoser = __esm({
95760
95780
  parentStackLogicalIds: this.parentStackLogicalIds,
95761
95781
  stackArn: changeSet.StackId ?? "",
95762
95782
  physicalId: changeSet.StackId,
95763
- resourceType: "AWS::CloudFormation::Stack"
95783
+ resourceType: "AWS::CloudFormation::Stack",
95784
+ warnings
95764
95785
  })
95765
95786
  ]);
95766
95787
  }
@@ -99562,6 +99583,28 @@ function contextProperties(context) {
99562
99583
  }
99563
99584
  return parsed && typeof parsed === "object" ? parsed.Properties : void 0;
99564
99585
  }
99586
+ function propertyIsResolvedAtDeployTime(difference2) {
99587
+ return containsDeployTimeValue(difference2.oldValue) || containsDeployTimeValue(difference2.newValue);
99588
+ }
99589
+ function containsDeployTimeValue(value2) {
99590
+ if (typeof value2 === "string") {
99591
+ return value2.includes("{{resolve:");
99592
+ }
99593
+ if (Array.isArray(value2)) {
99594
+ return value2.some(containsDeployTimeValue);
99595
+ }
99596
+ if (typeof value2 === "object" && value2 !== null) {
99597
+ for (const [key, nested] of Object.entries(value2)) {
99598
+ if (key === "Ref" || key.startsWith("Fn::")) {
99599
+ return true;
99600
+ }
99601
+ if (containsDeployTimeValue(nested)) {
99602
+ return true;
99603
+ }
99604
+ }
99605
+ }
99606
+ return false;
99607
+ }
99565
99608
  var TemplateAndChangeSetDiffMerger;
99566
99609
  var init_template_and_changeset_diff_merger = __esm({
99567
99610
  "../@aws-cdk/cloudformation-diff/lib/diff/template-and-changeset-diff-merger.ts"() {
@@ -99632,6 +99675,9 @@ var init_template_and_changeset_diff_merger = __esm({
99632
99675
  change.forEachDifference((type, name, value2) => {
99633
99676
  if (type === "Property") {
99634
99677
  if (!this.changeSetResources[logicalId]) {
99678
+ if (!propertyIsResolvedAtDeployTime(value2)) {
99679
+ return;
99680
+ }
99635
99681
  value2.changeImpact = "NO_CHANGE" /* NO_CHANGE */;
99636
99682
  value2.isDifferent = false;
99637
99683
  return;
@@ -99648,6 +99694,9 @@ var init_template_and_changeset_diff_merger = __esm({
99648
99694
  value2.changeImpact = "MAY_REPLACE" /* MAY_REPLACE */;
99649
99695
  break;
99650
99696
  case void 0:
99697
+ if (!propertyIsResolvedAtDeployTime(value2)) {
99698
+ break;
99699
+ }
99651
99700
  value2.changeImpact = "NO_CHANGE" /* NO_CHANGE */;
99652
99701
  value2.isDifferent = false;
99653
99702
  break;
@@ -99898,6 +99947,8 @@ var init_template_and_changeset_diff_merger = __esm({
99898
99947
  __name(tryJsonParse, "tryJsonParse");
99899
99948
  __name(changeImpactForReplacementMode, "changeImpactForReplacementMode");
99900
99949
  __name(contextProperties, "contextProperties");
99950
+ __name(propertyIsResolvedAtDeployTime, "propertyIsResolvedAtDeployTime");
99951
+ __name(containsDeployTimeValue, "containsDeployTimeValue");
99901
99952
  }
99902
99953
  });
99903
99954
 
@@ -106994,11 +107045,11 @@ function _diffStrings(oldStr, newStr, context) {
106994
107045
  }
106995
107046
  __name(_findIndent, "_findIndent");
106996
107047
  }
106997
- var import_util24, import_chalk7, PATH_METADATA_KEY3, structuredPatch, ADDITION2, CONTEXT, UPDATE2, REMOVAL2, IMPORT, Formatter;
107048
+ var import_util23, import_chalk7, PATH_METADATA_KEY3, structuredPatch, ADDITION2, CONTEXT, UPDATE2, REMOVAL2, IMPORT, Formatter;
106998
107049
  var init_format = __esm({
106999
107050
  "../@aws-cdk/cloudformation-diff/lib/format.ts"() {
107000
107051
  "use strict";
107001
- import_util24 = require("util");
107052
+ import_util23 = require("util");
107002
107053
  import_chalk7 = __toESM(require_source());
107003
107054
  init_util6();
107004
107055
  init_diff_template();
@@ -107030,10 +107081,10 @@ var init_format = __esm({
107030
107081
  __name(this, "Formatter");
107031
107082
  }
107032
107083
  print(fmt, ...args) {
107033
- this.stream.write(import_chalk7.default.reset((0, import_util24.format)(fmt, ...args)) + "\n");
107084
+ this.stream.write(import_chalk7.default.reset((0, import_util23.format)(fmt, ...args)) + "\n");
107034
107085
  }
107035
107086
  warning(fmt, ...args) {
107036
- this.stream.write(import_chalk7.default.yellow((0, import_util24.format)(fmt, ...args)) + "\n");
107087
+ this.stream.write(import_chalk7.default.yellow((0, import_util23.format)(fmt, ...args)) + "\n");
107037
107088
  }
107038
107089
  formatSection(title, entryType, collection, formatter = this.formatDifference.bind(this)) {
107039
107090
  if (collection.differenceCount === 0) {
@@ -108809,6 +108860,8 @@ async function isHotswappableCloudControlChange(logicalId, change, evaluateCfnTe
108809
108860
  patchOps.push({ op: "remove", path: `/${propName}` });
108810
108861
  } else if (diff.isAddition) {
108811
108862
  patchOps.push({ op: "add", path: `/${propName}`, value: newValue });
108863
+ } else if (propName === "Tags" && newValue && typeof newValue === "object") {
108864
+ patchOps.push(...await buildTagPatchOps(cloudControl, resourceType, identifier, newValue));
108812
108865
  } else {
108813
108866
  patchOps.push({ op: "replace", path: `/${propName}`, value: newValue });
108814
108867
  }
@@ -108829,6 +108882,103 @@ async function isHotswappableCloudControlChange(logicalId, change, evaluateCfnTe
108829
108882
  });
108830
108883
  return ret;
108831
108884
  }
108885
+ function isReservedTagKey(key) {
108886
+ return typeof key === "string" && key.toLowerCase().startsWith("aws:");
108887
+ }
108888
+ function escapeJsonPointerToken(key) {
108889
+ return key.replace(/~/g, "~0").replace(/\//g, "~1");
108890
+ }
108891
+ async function buildTagPatchOps(cloudControl, resourceType, identifier, desiredTags) {
108892
+ const readTags = await currentResourceTags(cloudControl, resourceType, identifier);
108893
+ const desiredIsList = Array.isArray(desiredTags);
108894
+ const currentTags = readTags ?? (desiredIsList ? [] : {});
108895
+ if (desiredIsList && Array.isArray(currentTags)) {
108896
+ return buildListTagPatchOps(currentTags, desiredTags);
108897
+ }
108898
+ if (!desiredIsList && !Array.isArray(currentTags) && typeof currentTags === "object") {
108899
+ return buildMapTagPatchOps(currentTags, desiredTags);
108900
+ }
108901
+ throw new ToolkitError(
108902
+ "HotswapTagReadFailed",
108903
+ `could not interpret the current tags of ${identifier} (${resourceType}): the resource reports Tags as ${describeTagsShape(currentTags)} but the template declares ${describeTagsShape(desiredTags)}`
108904
+ );
108905
+ }
108906
+ function describeTagsShape(tags) {
108907
+ if (Array.isArray(tags)) {
108908
+ return "a list";
108909
+ }
108910
+ if (tags === null) {
108911
+ return "null";
108912
+ }
108913
+ if (typeof tags === "object") {
108914
+ return "a map";
108915
+ }
108916
+ return typeof tags;
108917
+ }
108918
+ function buildMapTagPatchOps(currentTags, desiredTags) {
108919
+ const ops = [];
108920
+ for (const [key, value2] of Object.entries(desiredTags)) {
108921
+ const path54 = `/Tags/${escapeJsonPointerToken(key)}`;
108922
+ if (!Object.hasOwn(currentTags, key)) {
108923
+ ops.push({ op: "add", path: path54, value: value2 });
108924
+ } else if (JSON.stringify(currentTags[key]) !== JSON.stringify(value2)) {
108925
+ ops.push({ op: "replace", path: path54, value: value2 });
108926
+ }
108927
+ }
108928
+ for (const key of Object.keys(currentTags)) {
108929
+ if (!Object.hasOwn(desiredTags, key) && !isReservedTagKey(key)) {
108930
+ ops.push({ op: "remove", path: `/Tags/${escapeJsonPointerToken(key)}` });
108931
+ }
108932
+ }
108933
+ return ops;
108934
+ }
108935
+ function buildListTagPatchOps(currentTags, desiredTags) {
108936
+ const isTag = /* @__PURE__ */ __name((tag) => tag && typeof tag === "object" && typeof tag.Key === "string", "isTag");
108937
+ const indexByKey = /* @__PURE__ */ new Map();
108938
+ currentTags.forEach((tag, i6) => {
108939
+ if (isTag(tag) && !indexByKey.has(tag.Key)) {
108940
+ indexByKey.set(tag.Key, i6);
108941
+ }
108942
+ });
108943
+ const replacements = [];
108944
+ const additions = [];
108945
+ for (const tag of desiredTags) {
108946
+ if (!isTag(tag)) {
108947
+ continue;
108948
+ }
108949
+ const index = indexByKey.get(tag.Key);
108950
+ if (index === void 0) {
108951
+ additions.push({ op: "add", path: "/Tags/-", value: tag });
108952
+ } else if (JSON.stringify(currentTags[index]) !== JSON.stringify(tag)) {
108953
+ replacements.push({ op: "replace", path: `/Tags/${index}`, value: tag });
108954
+ }
108955
+ }
108956
+ const desiredKeys = new Set(desiredTags.filter(isTag).map((tag) => tag.Key));
108957
+ const removals = currentTags.map((tag, i6) => ({ tag, i: i6 })).filter(({ tag }) => isTag(tag) && !desiredKeys.has(tag.Key) && !isReservedTagKey(tag.Key)).sort((a6, b6) => b6.i - a6.i).map(({ i: i6 }) => ({ op: "remove", path: `/Tags/${i6}` }));
108958
+ return [...replacements, ...removals, ...additions];
108959
+ }
108960
+ async function currentResourceTags(cloudControl, resourceType, identifier) {
108961
+ const unreadable = /* @__PURE__ */ __name((cause) => ToolkitError.withCause(
108962
+ "HotswapTagReadFailed",
108963
+ `could not read the current tags of ${identifier} (${resourceType}), which are needed to update tags without removing the reserved aws: tags that AWS manages - ensure the deployment role is allowed to call cloudcontrolapi:GetResource for this resource type`,
108964
+ cause
108965
+ ), "unreadable");
108966
+ let current;
108967
+ try {
108968
+ current = await cloudControl.getResource({ TypeName: resourceType, Identifier: identifier });
108969
+ } catch (e6) {
108970
+ throw unreadable(e6);
108971
+ }
108972
+ const properties = current.ResourceDescription?.Properties;
108973
+ if (!properties) {
108974
+ throw unreadable(new Error("GetResource returned no resource properties"));
108975
+ }
108976
+ try {
108977
+ return JSON.parse(properties).Tags;
108978
+ } catch (e6) {
108979
+ throw unreadable(e6);
108980
+ }
108981
+ }
108832
108982
  async function resolveCloudControlIdentifier(logicalId, resourceType, evaluateCfnTemplate) {
108833
108983
  const cfnPhysicalId = await evaluateCfnTemplate.findPhysicalNameFor(logicalId);
108834
108984
  if (!cfnPhysicalId) {
@@ -108844,6 +108994,13 @@ var init_cloud_control_resource = __esm({
108844
108994
  init_toolkit_error();
108845
108995
  init_cloudformation2();
108846
108996
  __name(isHotswappableCloudControlChange, "isHotswappableCloudControlChange");
108997
+ __name(isReservedTagKey, "isReservedTagKey");
108998
+ __name(escapeJsonPointerToken, "escapeJsonPointerToken");
108999
+ __name(buildTagPatchOps, "buildTagPatchOps");
109000
+ __name(describeTagsShape, "describeTagsShape");
109001
+ __name(buildMapTagPatchOps, "buildMapTagPatchOps");
109002
+ __name(buildListTagPatchOps, "buildListTagPatchOps");
109003
+ __name(currentResourceTags, "currentResourceTags");
108847
109004
  __name(resolveCloudControlIdentifier, "resolveCloudControlIdentifier");
108848
109005
  }
108849
109006
  });
@@ -109291,7 +109448,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
109291
109448
  sdk.appendCustomUserAgent(customUserAgent);
109292
109449
  const resourceText = /* @__PURE__ */ __name((r6) => r6.description ?? `${r6.resourceType} '${r6.physicalName ?? r6.logicalId}'`, "resourceText");
109293
109450
  await ioSpan.notify(IO.CDK_TOOLKIT_I5402.msg(
109294
- hotswapOperation.change.resources.map((r6) => (0, import_util30.format)(` ${ICON} %s`, import_chalk10.default.bold(resourceText(r6)))).join("\n"),
109451
+ hotswapOperation.change.resources.map((r6) => (0, import_util29.format)(` ${ICON} %s`, import_chalk10.default.bold(resourceText(r6)))).join("\n"),
109295
109452
  hotswapOperation.change
109296
109453
  ));
109297
109454
  try {
@@ -109306,7 +109463,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
109306
109463
  throw e6;
109307
109464
  }
109308
109465
  await ioSpan.notify(IO.CDK_TOOLKIT_I5403.msg(
109309
- hotswapOperation.change.resources.map((r6) => (0, import_util30.format)(` ${ICON} %s %s`, import_chalk10.default.bold(resourceText(r6)), import_chalk10.default.green("hotswapped!"))).join("\n"),
109466
+ hotswapOperation.change.resources.map((r6) => (0, import_util29.format)(` ${ICON} %s %s`, import_chalk10.default.bold(resourceText(r6)), import_chalk10.default.green("hotswapped!"))).join("\n"),
109310
109467
  hotswapOperation.change
109311
109468
  ));
109312
109469
  sdk.removeCustomUserAgent(customUserAgent);
@@ -109335,9 +109492,9 @@ async function logRejectedChanges(ioSpan, rejectedChanges, hotswapMode) {
109335
109492
  }
109336
109493
  const messages = [""];
109337
109494
  if (hotswapMode === "hotswap-only") {
109338
- messages.push((0, import_util30.format)("%s %s", import_chalk10.default.red("\u26A0\uFE0F"), import_chalk10.default.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
109495
+ messages.push((0, import_util29.format)("%s %s", import_chalk10.default.red("\u26A0\uFE0F"), import_chalk10.default.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
109339
109496
  } else {
109340
- messages.push((0, import_util30.format)("%s %s", import_chalk10.default.red("\u26A0\uFE0F"), import_chalk10.default.red("The following non-hotswappable changes were found:")));
109497
+ messages.push((0, import_util29.format)("%s %s", import_chalk10.default.red("\u26A0\uFE0F"), import_chalk10.default.red("The following non-hotswappable changes were found:")));
109341
109498
  }
109342
109499
  for (const { change } of rejectedChanges) {
109343
109500
  messages.push(" " + nonHotswappableChangeMessage(change));
@@ -109350,7 +109507,7 @@ function nonHotswappableChangeMessage(change) {
109350
109507
  const reason = change.description ?? change.reason;
109351
109508
  switch (subject.type) {
109352
109509
  case "Output":
109353
- return (0, import_util30.format)(
109510
+ return (0, import_util29.format)(
109354
109511
  "output: %s, reason: %s",
109355
109512
  import_chalk10.default.bold(subject.logicalId),
109356
109513
  import_chalk10.default.red(reason)
@@ -109361,7 +109518,7 @@ function nonHotswappableChangeMessage(change) {
109361
109518
  }
109362
109519
  function nonHotswappableResourceMessage(subject, reason) {
109363
109520
  if (subject.rejectedProperties?.length) {
109364
- return (0, import_util30.format)(
109521
+ return (0, import_util29.format)(
109365
109522
  "resource: %s, type: %s, rejected changes: %s, reason: %s",
109366
109523
  import_chalk10.default.bold(subject.logicalId),
109367
109524
  import_chalk10.default.bold(subject.resourceType),
@@ -109369,18 +109526,18 @@ function nonHotswappableResourceMessage(subject, reason) {
109369
109526
  import_chalk10.default.red(reason)
109370
109527
  );
109371
109528
  }
109372
- return (0, import_util30.format)(
109529
+ return (0, import_util29.format)(
109373
109530
  "resource: %s, type: %s, reason: %s",
109374
109531
  import_chalk10.default.bold(subject.logicalId),
109375
109532
  import_chalk10.default.bold(subject.resourceType),
109376
109533
  import_chalk10.default.red(reason)
109377
109534
  );
109378
109535
  }
109379
- var import_util30, cfn_diff, import_chalk10, pLimit2, RESOURCE_DETECTORS;
109536
+ var import_util29, cfn_diff, import_chalk10, pLimit2, RESOURCE_DETECTORS;
109380
109537
  var init_hotswap_deployments = __esm({
109381
109538
  "../@aws-cdk/toolkit-lib/lib/api/hotswap/hotswap-deployments.ts"() {
109382
109539
  "use strict";
109383
- import_util30 = require("util");
109540
+ import_util29 = require("util");
109384
109541
  cfn_diff = __toESM(require_lib9());
109385
109542
  import_chalk10 = __toESM(require_source());
109386
109543
  init_payloads();
@@ -110751,11 +110908,11 @@ var init_notices2 = __esm({
110751
110908
  });
110752
110909
 
110753
110910
  // ../@aws-cdk/toolkit-lib/lib/api/toolkit-info.ts
110754
- var import_util36, import_chalk12, DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo, ExistingToolkitInfo, BootstrapStackNotFoundInfo;
110911
+ var import_util35, import_chalk12, DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo, ExistingToolkitInfo, BootstrapStackNotFoundInfo;
110755
110912
  var init_toolkit_info = __esm({
110756
110913
  "../@aws-cdk/toolkit-lib/lib/api/toolkit-info.ts"() {
110757
110914
  "use strict";
110758
- import_util36 = require("util");
110915
+ import_util35 = require("util");
110759
110916
  import_chalk12 = __toESM(require_source());
110760
110917
  init_bootstrap_props();
110761
110918
  init_toolkit_error();
@@ -110775,7 +110932,7 @@ var init_toolkit_info = __esm({
110775
110932
  const stack = await stabilizeStack(cfn, ioHelper, stackName);
110776
110933
  if (!stack) {
110777
110934
  await ioHelper.defaults.debug(
110778
- (0, import_util36.format)(
110935
+ (0, import_util35.format)(
110779
110936
  "The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
110780
110937
  environment.name,
110781
110938
  stackName,
@@ -110786,7 +110943,7 @@ var init_toolkit_info = __esm({
110786
110943
  }
110787
110944
  if (stack.stackStatus.isCreationFailure) {
110788
110945
  await ioHelper.defaults.debug(
110789
- (0, import_util36.format)(
110946
+ (0, import_util35.format)(
110790
110947
  "The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
110791
110948
  environment.name,
110792
110949
  stackName,
@@ -284523,7 +284680,10 @@ function makeSdkLoggerSafeByBindingThis(logger2) {
284523
284680
  };
284524
284681
  }
284525
284682
  function cappedExponentialBackoff(baseMs, capMs) {
284526
- return (attempt) => Math.min(baseMs * 2 ** attempt, capMs);
284683
+ return (attempt) => {
284684
+ const delay = Math.min(baseMs * 2 ** attempt, capMs);
284685
+ return Math.floor(delay / 2 + Math.random() * (delay / 2));
284686
+ };
284527
284687
  }
284528
284688
  var import_client_appsync, import_client_bedrock_agentcore_control, import_client_cloudcontrol, import_client_cloudformation6, import_client_cloudtrail, import_client_cloudwatch_logs, import_client_codebuild, import_client_ec2, import_client_ecr2, import_client_ecs, import_client_elastic_load_balancing_v2, import_client_iam, import_client_kms, import_client_lambda, import_client_route_53, import_client_s33, import_client_secrets_manager2, import_client_sfn, import_client_ssm, import_client_sts2, import_lib_storage2, import_middleware_endpoint2, import_util_retry, SDK, CURRENT_ACCOUNT_KEY;
284529
284689
  var init_sdk2 = __esm({
@@ -285552,7 +285712,7 @@ async function v3ProviderFromPlugin(producer) {
285552
285712
  } else if (isV2Credentials(initial)) {
285553
285713
  return v3ProviderFromV2Credentials(initial);
285554
285714
  } else {
285555
- throw new AuthenticationError("InvalidPluginCredentials", `Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util46.inspect)(initial)}`);
285715
+ throw new AuthenticationError("InvalidPluginCredentials", `Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util45.inspect)(initial)}`);
285556
285716
  }
285557
285717
  }
285558
285718
  function v3ProviderFromV2Credentials(x) {
@@ -285571,7 +285731,7 @@ function refreshFromPluginProvider(current, producer) {
285571
285731
  if (credentialsAboutToExpire(current)) {
285572
285732
  const newCreds = await producer();
285573
285733
  if (!isV3Credentials(newCreds)) {
285574
- throw new AuthenticationError("PluginCredentialTypeMismatch", `Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util46.inspect)(newCreds)}`);
285734
+ throw new AuthenticationError("PluginCredentialTypeMismatch", `Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util45.inspect)(newCreds)}`);
285575
285735
  }
285576
285736
  current = newCreds;
285577
285737
  }
@@ -285587,11 +285747,11 @@ function isV2Credentials(x) {
285587
285747
  function isV3Credentials(x) {
285588
285748
  return !!(x && typeof x === "object" && x.accessKeyId && !isV2Credentials(x));
285589
285749
  }
285590
- var import_util46, CredentialPlugins;
285750
+ var import_util45, CredentialPlugins;
285591
285751
  var init_credential_plugins = __esm({
285592
285752
  "../@aws-cdk/toolkit-lib/lib/api/aws-auth/credential-plugins.ts"() {
285593
285753
  "use strict";
285594
- import_util46 = require("util");
285754
+ import_util45 = require("util");
285595
285755
  init_provider_caching();
285596
285756
  init_toolkit_error();
285597
285757
  init_util4();
@@ -285990,7 +286150,7 @@ function formatSdkLoggerContent(content) {
285990
286150
  return apiFmt;
285991
286151
  }
285992
286152
  }
285993
- return content.map((x) => typeof x === "string" ? x : (0, import_util49.inspect)(x)).join("");
286153
+ return content.map((x) => typeof x === "string" ? x : (0, import_util48.inspect)(x)).join("");
285994
286154
  }
285995
286155
  function formatApiCall(content) {
285996
286156
  if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
@@ -286016,11 +286176,11 @@ function isSdkApiCallSuccess(x) {
286016
286176
  function isSdkApiCallError(x) {
286017
286177
  return x && typeof x === "object" && x.commandName && x.error;
286018
286178
  }
286019
- var import_util49, IoHostSdkLogger;
286179
+ var import_util48, IoHostSdkLogger;
286020
286180
  var init_sdk_logger = __esm({
286021
286181
  "../@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk-logger.ts"() {
286022
286182
  "use strict";
286023
- import_util49 = require("util");
286183
+ import_util48 = require("util");
286024
286184
  init_util4();
286025
286185
  init_private();
286026
286186
  IoHostSdkLogger = class {
@@ -286032,7 +286192,7 @@ var init_sdk_logger = __esm({
286032
286192
  this.ioHelper = ioHelper;
286033
286193
  }
286034
286194
  notify(level, ...content) {
286035
- void this.ioHelper.notify(IO.CDK_SDK_I0100.msg((0, import_util49.format)("[SDK %s] %s", level, formatSdkLoggerContent(content)), {
286195
+ void this.ioHelper.notify(IO.CDK_SDK_I0100.msg((0, import_util48.format)("[SDK %s] %s", level, formatSdkLoggerContent(content)), {
286036
286196
  sdkLevel: level,
286037
286197
  content
286038
286198
  }));
@@ -290793,6 +290953,12 @@ function quoteShellPart(part) {
290793
290953
  return part;
290794
290954
  }
290795
290955
  if (isWindows2) {
290956
+ if (/%[^%]*%/.test(part)) {
290957
+ throw new ToolkitError(
290958
+ "UnsafeWindowsPath",
290959
+ `Cannot safely run a path containing a '%...%' substring through the Windows shell: '${part}'. Rename the file or directory to remove the percent signs.`
290960
+ );
290961
+ }
290796
290962
  return `"${part}"`;
290797
290963
  }
290798
290964
  return `"${part.replace(/([\\"$`])/g, "\\$1")}"`;
@@ -290804,6 +290970,7 @@ var init_environment3 = __esm({
290804
290970
  path29 = __toESM(require("path"));
290805
290971
  cxapi4 = __toESM(require_lib11());
290806
290972
  fs28 = __toESM(require_lib4());
290973
+ init_toolkit_error();
290807
290974
  __name(prepareDefaultEnvironment, "prepareDefaultEnvironment");
290808
290975
  __name(contextFromSettings, "contextFromSettings");
290809
290976
  __name(synthParametersFromSettings, "synthParametersFromSettings");
@@ -291109,12 +291276,12 @@ var init_readable_assembly = __esm({
291109
291276
  });
291110
291277
 
291111
291278
  // ../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/source-builder.ts
291112
- var path31, import_util54, cxapi6, fs31, CloudAssemblySourceBuilder;
291279
+ var path31, import_util53, cxapi6, fs31, CloudAssemblySourceBuilder;
291113
291280
  var init_source_builder = __esm({
291114
291281
  "../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/source-builder.ts"() {
291115
291282
  "use strict";
291116
291283
  path31 = __toESM(require("path"));
291117
- import_util54 = require("util");
291284
+ import_util53 = require("util");
291118
291285
  cxapi6 = __toESM(require_lib3());
291119
291286
  fs31 = __toESM(require_lib4());
291120
291287
  init_context_store();
@@ -291180,7 +291347,7 @@ var init_source_builder = __esm({
291180
291347
  ...await contextStore.read(),
291181
291348
  ...synthParams.context
291182
291349
  };
291183
- await services.ioHelper.defaults.debug((0, import_util54.format)("context:", fullContext));
291350
+ await services.ioHelper.defaults.debug((0, import_util53.format)("context:", fullContext));
291184
291351
  const env3 = noUndefined({
291185
291352
  // Versioning, outdir, default account and region
291186
291353
  ...await execution.defaultEnvVars(),
@@ -291319,7 +291486,7 @@ var init_source_builder = __esm({
291319
291486
  ...await contextStore.read(),
291320
291487
  ...synthParams.context
291321
291488
  };
291322
- await services.ioHelper.defaults.debug((0, import_util54.format)("context:", fullContext));
291489
+ await services.ioHelper.defaults.debug((0, import_util53.format)("context:", fullContext));
291323
291490
  const env3 = noUndefined({
291324
291491
  // Need to start with full env of `writeContextToEnv` will not be able to do the size
291325
291492
  // calculation correctly.
@@ -291520,6 +291687,21 @@ var init_stack_collection = __esm({
291520
291687
  });
291521
291688
 
291522
291689
  // ../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/private/stack-assembly.ts
291690
+ function matcherFor(patterns) {
291691
+ const positives = [];
291692
+ const negatives = [];
291693
+ for (const pattern of patterns) {
291694
+ const parsed = (0, import_picomatch.default)(pattern, void 0, true);
291695
+ (parsed.state.negated ? negatives : positives).push(parsed);
291696
+ }
291697
+ if (positives.length === 0 && negatives.length === 0) {
291698
+ return () => false;
291699
+ }
291700
+ return (hierarchicalId) => {
291701
+ const included = positives.length === 0 || positives.some((matches) => matches(hierarchicalId));
291702
+ return included && negatives.every((matches) => matches(hierarchicalId));
291703
+ };
291704
+ }
291523
291705
  function indexByHierarchicalId(stacks) {
291524
291706
  const result2 = /* @__PURE__ */ new Map();
291525
291707
  for (const stack of stacks) {
@@ -291584,7 +291766,6 @@ var init_stack_assembly = __esm({
291584
291766
  import_picomatch = __toESM(require_picomatch4());
291585
291767
  import_semver2 = __toESM(require_semver4());
291586
291768
  init_toolkit_error();
291587
- init_util4();
291588
291769
  init_private();
291589
291770
  init_stack_collection();
291590
291771
  init_stack_selector();
@@ -291708,7 +291889,7 @@ var init_stack_assembly = __esm({
291708
291889
  }
291709
291890
  return {
291710
291891
  stacks: matched,
291711
- suggestions: options.suggestPatternMatches ? this.suggestionsForPatterns(patterns, matched) : void 0
291892
+ suggestions: options.suggestPatternMatches ? this.suggestionsForPatterns(patterns) : void 0
291712
291893
  };
291713
291894
  }
291714
291895
  }
@@ -291718,13 +291899,16 @@ var init_stack_assembly = __esm({
291718
291899
  * at least one stack are omitted; the array is empty when there is no close
291719
291900
  * match. Pure computation, never throws, emits no output.
291720
291901
  */
291721
- suggestionsForPatterns(patterns, matched) {
291902
+ suggestionsForPatterns(patterns) {
291722
291903
  const suggestions = {};
291723
291904
  for (const pattern of patterns) {
291724
- if (matched.stackArtifacts.some((stack) => (0, import_picomatch.isMatch)(stack.hierarchicalId, pattern))) {
291905
+ const exact = (0, import_picomatch.default)(pattern, void 0, true);
291906
+ const loose = (0, import_picomatch.default)(pattern.toLowerCase());
291907
+ const refersTo = exact.state.negated ? (matches, id) => !matches(id) : (matches, id) => matches(id);
291908
+ if (this.allStacks.some((stack) => refersTo(exact, stack.hierarchicalId))) {
291725
291909
  continue;
291726
291910
  }
291727
- suggestions[pattern] = this.allStacks.filter((stack) => (0, import_picomatch.isMatch)(stack.hierarchicalId.toLowerCase(), pattern.toLowerCase())).map((stack) => stack.hierarchicalId);
291911
+ suggestions[pattern] = this.allStacks.filter((stack) => refersTo(loose, stack.hierarchicalId.toLowerCase())).map((stack) => stack.hierarchicalId);
291728
291912
  }
291729
291913
  return suggestions;
291730
291914
  }
@@ -291738,8 +291922,8 @@ var init_stack_assembly = __esm({
291738
291922
  return new StackCollection(this, selected);
291739
291923
  }
291740
291924
  async selectMatchingStacks(stacks, patterns, extend = "none" /* NONE */) {
291741
- const matchingPattern = /* @__PURE__ */ __name((pattern) => (stack) => (0, import_picomatch.isMatch)(stack.hierarchicalId, pattern), "matchingPattern");
291742
- const matchedStacks = flatten2(patterns.map((pattern) => stacks.filter(matchingPattern(pattern))));
291925
+ const selects = matcherFor(patterns);
291926
+ const matchedStacks = stacks.filter((stack) => selects(stack.hierarchicalId));
291743
291927
  return this.extendStacks(matchedStacks, stacks, extend);
291744
291928
  }
291745
291929
  async extendStacks(matched, all, extend = "none" /* NONE */) {
@@ -291760,6 +291944,7 @@ var init_stack_assembly = __esm({
291760
291944
  return new StackCollection(this, selectedList);
291761
291945
  }
291762
291946
  };
291947
+ __name(matcherFor, "matcherFor");
291763
291948
  __name(indexByHierarchicalId, "indexByHierarchicalId");
291764
291949
  __name(includeDownstreamStacks, "includeDownstreamStacks");
291765
291950
  __name(includeUpstreamStacks, "includeUpstreamStacks");
@@ -292628,11 +292813,11 @@ function removeNonImportResources(stack) {
292628
292813
  delete template.Outputs;
292629
292814
  return template;
292630
292815
  }
292631
- var import_util59, cfnDiff, import_chalk17, fs32, ResourceImporter;
292816
+ var import_util57, cfnDiff, import_chalk17, fs32, ResourceImporter;
292632
292817
  var init_importer = __esm({
292633
292818
  "../@aws-cdk/toolkit-lib/lib/api/resource-import/importer.ts"() {
292634
292819
  "use strict";
292635
- import_util59 = require("util");
292820
+ import_util57 = require("util");
292636
292821
  cfnDiff = __toESM(require_lib9());
292637
292822
  import_chalk17 = __toESM(require_source());
292638
292823
  fs32 = __toESM(require_lib4());
@@ -292696,12 +292881,12 @@ var init_importer = __esm({
292696
292881
  const descr = this.describeResource(resource.logicalId);
292697
292882
  const idProps = remaining[resource.logicalId];
292698
292883
  if (idProps) {
292699
- await this.ioHelper.defaults.info((0, import_util59.format)("%s: importing using %s", import_chalk17.default.blue(descr), import_chalk17.default.blue(fmtdict(idProps))));
292884
+ await this.ioHelper.defaults.info((0, import_util57.format)("%s: importing using %s", import_chalk17.default.blue(descr), import_chalk17.default.blue(fmtdict(idProps))));
292700
292885
  ret.importResources.push(resource);
292701
292886
  ret.resourceMap[resource.logicalId] = idProps;
292702
292887
  delete remaining[resource.logicalId];
292703
292888
  } else {
292704
- await this.ioHelper.defaults.info((0, import_util59.format)("%s: skipping", import_chalk17.default.blue(descr)));
292889
+ await this.ioHelper.defaults.info((0, import_util57.format)("%s: skipping", import_chalk17.default.blue(descr)));
292705
292890
  }
292706
292891
  }
292707
292892
  const unknown = Object.keys(remaining);
@@ -292745,9 +292930,9 @@ var init_importer = __esm({
292745
292930
  });
292746
292931
  assertIsSuccessfulDeployStackResult(result2);
292747
292932
  const message2 = result2.noOp ? "\u2705 %s (no changes)" : "\u2705 %s";
292748
- await this.ioHelper.defaults.info("\n" + import_chalk17.default.green((0, import_util59.format)(message2, this.stack.displayName)));
292933
+ await this.ioHelper.defaults.info("\n" + import_chalk17.default.green((0, import_util57.format)(message2, this.stack.displayName)));
292749
292934
  } catch (e6) {
292750
- await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util59.format)("\n \u274C %s failed: %s", import_chalk17.default.bold(this.stack.displayName), e6), { error: e6 }));
292935
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util57.format)("\n \u274C %s failed: %s", import_chalk17.default.bold(this.stack.displayName), e6), { error: e6 }));
292751
292936
  throw e6;
292752
292937
  }
292753
292938
  }
@@ -292877,7 +293062,7 @@ var init_importer = __esm({
292877
293062
  for (const idProp of idProps) {
292878
293063
  const defaultValue2 = resourceProps[idProp] ?? "";
292879
293064
  const response = await this.ioHelper.requestResponse(IO.CDK_TOOLKIT_I3110.req(
292880
- (0, import_util59.format)(promptPattern, import_chalk17.default.blue(idProp)),
293065
+ (0, import_util57.format)(promptPattern, import_chalk17.default.blue(idProp)),
292881
293066
  {
292882
293067
  resource: {
292883
293068
  name: resourceName,
@@ -298909,7 +299094,7 @@ function countAssemblyResults(span, assembly) {
298909
299094
  span.incCounter("assemblies", asmCount(assembly));
298910
299095
  span.incCounter("errorAnns", sum3(stacksRecursively.map((s2) => s2.messages.filter((m4) => m4.level === import_cloud_assembly_api14.SynthesisMessageLevel.ERROR).length)));
298911
299096
  span.incCounter("warnings", sum3(stacksRecursively.map((s2) => s2.messages.filter((m4) => m4.level === import_cloud_assembly_api14.SynthesisMessageLevel.WARNING).length)));
298912
- const annotationErrorCodes = stacksRecursively.flatMap((s2) => Object.values(s2.metadata).flatMap((ms) => ms.filter((m4) => m4.type === ANNOTATION_ERROR_CODE_TYPE)));
299097
+ const annotationErrorCodes = stacksRecursively.flatMap((s2) => Object.values(s2.metadata ?? {}).flatMap((ms) => ms.filter((m4) => m4.type === ANNOTATION_ERROR_CODE_TYPE)));
298913
299098
  for (const annotationErrorCode of annotationErrorCodes) {
298914
299099
  span.incCounter(`errorAnn:${annotationErrorCode.data}`);
298915
299100
  }
@@ -300035,33 +300220,7 @@ var init_toolkit = __esm({
300035
300220
  try {
300036
300221
  const ioHelper = asIoHelper(this.ioHost, "synth");
300037
300222
  const assembly = __using(_stack, new AsyncDisposableBox(await synthAndMeasure(ioHelper, cx, stacksOpt(options))), true);
300038
- const stacks = await assembly.value.selectStacks(stacksOpt(options));
300039
- const autoValidateStacks = options.validateStacks ? [assembly.value.selectStacksForValidation()] : [];
300040
- await throwIfValidationFailures(assembly.value, stacks.concat(...autoValidateStacks), this.assemblyFailureAt, ioHelper);
300041
- const message2 = `Successfully synthesized to ${import_chalk29.default.blue(path35.resolve(stacks.assembly.directory))}`;
300042
- const assemblyData = {
300043
- assemblyDirectory: stacks.assembly.directory,
300044
- stacksCount: stacks.stackCount,
300045
- stackIds: stacks.hierarchicalIds
300046
- };
300047
- if (stacks.stackCount === 1) {
300048
- const firstStack = stacks.firstStack;
300049
- const template = firstStack.template;
300050
- const obscuredTemplate = obscureTemplate(template);
300051
- await ioHelper.notify(IO.CDK_TOOLKIT_I1901.msg(message2, {
300052
- ...assemblyData,
300053
- stack: {
300054
- stackName: firstStack.stackName,
300055
- hierarchicalId: firstStack.hierarchicalId,
300056
- template,
300057
- stringifiedJson: serializeStructure(obscuredTemplate, true),
300058
- stringifiedYaml: serializeStructure(obscuredTemplate, false)
300059
- }
300060
- }));
300061
- } else {
300062
- await ioHelper.notify(IO.CDK_TOOLKIT_I1902.msg(import_chalk29.default.green(message2), assemblyData));
300063
- await ioHelper.defaults.info(`Supply a stack id (${stacks.stackArtifacts.map((s2) => import_chalk29.default.green(s2.hierarchicalId)).join(", ")}) to display its template.`);
300064
- }
300223
+ await this._synth(assembly.value, options);
300065
300224
  return new CachedCloudAssembly(assembly.take());
300066
300225
  } catch (_) {
300067
300226
  var _error = _, _hasError = true;
@@ -300070,6 +300229,40 @@ var init_toolkit = __esm({
300070
300229
  _promise && await _promise;
300071
300230
  }
300072
300231
  }
300232
+ /**
300233
+ * Helper to allow synth being called with an already-produced assembly,
300234
+ * e.g. as part of the watch action which reuses the startup assembly.
300235
+ */
300236
+ async _synth(assembly, options = {}) {
300237
+ const ioHelper = asIoHelper(this.ioHost, "synth");
300238
+ const stacks = await assembly.selectStacks(stacksOpt(options));
300239
+ const autoValidateStacks = options.validateStacks ? [assembly.selectStacksForValidation()] : [];
300240
+ await throwIfValidationFailures(assembly, stacks.concat(...autoValidateStacks), this.assemblyFailureAt, ioHelper);
300241
+ const message2 = `Successfully synthesized to ${import_chalk29.default.blue(path35.resolve(stacks.assembly.directory))}`;
300242
+ const assemblyData = {
300243
+ assemblyDirectory: stacks.assembly.directory,
300244
+ stacksCount: stacks.stackCount,
300245
+ stackIds: stacks.hierarchicalIds
300246
+ };
300247
+ if (stacks.stackCount === 1) {
300248
+ const firstStack = stacks.firstStack;
300249
+ const template = firstStack.template;
300250
+ const obscuredTemplate = obscureTemplate(template);
300251
+ await ioHelper.notify(IO.CDK_TOOLKIT_I1901.msg(message2, {
300252
+ ...assemblyData,
300253
+ stack: {
300254
+ stackName: firstStack.stackName,
300255
+ hierarchicalId: firstStack.hierarchicalId,
300256
+ template,
300257
+ stringifiedJson: serializeStructure(obscuredTemplate, true),
300258
+ stringifiedYaml: serializeStructure(obscuredTemplate, false)
300259
+ }
300260
+ }));
300261
+ } else {
300262
+ await ioHelper.notify(IO.CDK_TOOLKIT_I1902.msg(import_chalk29.default.green(message2), assemblyData));
300263
+ await ioHelper.defaults.info(`Supply a stack id (${stacks.stackArtifacts.map((s2) => import_chalk29.default.green(s2.hierarchicalId)).join(", ")}) to display its template.`);
300264
+ }
300265
+ }
300073
300266
  /**
300074
300267
  * Diff Action
300075
300268
  */
@@ -300766,6 +300959,40 @@ ${deployResult.stackArn}`));
300766
300959
  onDispose: /* @__PURE__ */ __name(async () => cloudWatchLogMonitor?.deactivate(), "onDispose")
300767
300960
  });
300768
300961
  }
300962
+ /**
300963
+ * Continuously observe project files and re-synthesize the selected stacks
300964
+ * automatically when changes are detected.
300965
+ *
300966
+ * Never deploys: each iteration re-synthesizes the app to the cloud assembly
300967
+ * output directory and runs the same checks as the `synth` action.
300968
+ *
300969
+ * This function returns immediately, starting a watcher in the background.
300970
+ */
300971
+ async watchSynth(cx, options = {}) {
300972
+ const ioHelper = asIoHelper(this.ioHost, "synth");
300973
+ return this._watch(cx, options, {
300974
+ command: "cdk synth",
300975
+ activity: "synthesis",
300976
+ // `_watch` runs this inside `invokeSafe`, which reports (and swallows)
300977
+ // failures so the loop survives synth errors while the user is mid-edit.
300978
+ invoke: /* @__PURE__ */ __name(async (initialAssembly) => {
300979
+ var _stack = [];
300980
+ try {
300981
+ if (initialAssembly) {
300982
+ await this._synth(initialAssembly, options);
300983
+ return;
300984
+ }
300985
+ const assembly = __using(_stack, await synthAndMeasure(ioHelper, cx, stacksOpt(options)), true);
300986
+ await this._synth(assembly, options);
300987
+ } catch (_) {
300988
+ var _error = _, _hasError = true;
300989
+ } finally {
300990
+ var _promise = __callDispose(_stack, _error, _hasError);
300991
+ _promise && await _promise;
300992
+ }
300993
+ }, "invoke")
300994
+ });
300995
+ }
300769
300996
  /**
300770
300997
  * Continuously observe project files and validate the selected stacks
300771
300998
  * automatically when changes are detected.
@@ -302743,6 +302970,10 @@ var require_cli_type_registry = __commonJS({
302743
302970
  alias: "q",
302744
302971
  desc: "Do not output CloudFormation Template to stdout",
302745
302972
  default: false
302973
+ },
302974
+ watch: {
302975
+ type: "boolean",
302976
+ desc: "Continuously observe the project files, and synthesize the given stack(s) automatically when changes are detected. Never deploys, and never prints templates to stdout (--quiet and --json have no effect)"
302746
302977
  }
302747
302978
  }
302748
302979
  },
@@ -309404,7 +309635,7 @@ async function execProgram(aws, ioHelper, config2) {
309404
309635
  ...config2.context.all,
309405
309636
  ...params.context
309406
309637
  };
309407
- await debugFn((0, import_util77.format)("context:", context));
309638
+ await debugFn((0, import_util75.format)("context:", context));
309408
309639
  if (params.env.CDK_DEBUG === "true") {
309409
309640
  await ioHelper.defaults.info("\u{1F50D} Synthesizing with debug information. This may take a bit longer.");
309410
309641
  }
@@ -309454,7 +309685,7 @@ async function execProgram(aws, ioHelper, config2) {
309454
309685
  const perfCountersFile = path44.join(outdir, "performance-counters.json");
309455
309686
  await fs47.promises.rm(perfCountersFile, { force: true });
309456
309687
  env3.CDK_PERF_COUNTERS_FILE = perfCountersFile;
309457
- await debugFn((0, import_util77.format)("env:", env3));
309688
+ await debugFn((0, import_util75.format)("env:", env3));
309458
309689
  const cleanupTemp = writeContextToEnv(env3, context, "add-process-env-later");
309459
309690
  try {
309460
309691
  await exec2(commandLine);
@@ -309507,12 +309738,12 @@ function createAssembly(appDir) {
309507
309738
  function noUndefined2(xs) {
309508
309739
  return Object.fromEntries(Object.entries(xs).filter(([_, v]) => v !== void 0));
309509
309740
  }
309510
- var path44, import_util77, import_cloud_assembly_api16, cxschema11, cxapi12, import_toolkit_lib15, fs47;
309741
+ var path44, import_util75, import_cloud_assembly_api16, cxschema11, cxapi12, import_toolkit_lib15, fs47;
309511
309742
  var init_exec2 = __esm({
309512
309743
  "lib/cxapp/exec.ts"() {
309513
309744
  "use strict";
309514
309745
  path44 = __toESM(require("path"));
309515
- import_util77 = require("util");
309746
+ import_util75 = require("util");
309516
309747
  import_cloud_assembly_api16 = __toESM(require_lib3());
309517
309748
  cxschema11 = __toESM(require_lib2());
309518
309749
  cxapi12 = __toESM(require_lib11());
@@ -311408,6 +311639,38 @@ Do you wish to deploy these changes?`;
311408
311639
  await displayFlagsMessage(this.ioHost.asIoHelper(), this.toolkit, this.props.cloudExecutable);
311409
311640
  return void 0;
311410
311641
  }
311642
+ /**
311643
+ * Continuously synthesize the project, re-synthesizing on every file change.
311644
+ * Never deploys, and never prints templates to stdout.
311645
+ *
311646
+ * The files to observe are configured with the "watch" key of `cdk.json`,
311647
+ * exactly like `cdk deploy --watch`.
311648
+ */
311649
+ async synthWatch(options) {
311650
+ const rootDir = path46.dirname(path46.resolve(PROJECT_CONFIG));
311651
+ const watchSettings = this.props.configuration.settings.get(["watch"]);
311652
+ if (!watchSettings) {
311653
+ throw new import_toolkit_lib17.ToolkitError(
311654
+ "WatchConfigMissing",
311655
+ `Cannot use '--watch' without specifying at least one directory to monitor. Make sure to add a "watch" key to your cdk.json`
311656
+ );
311657
+ }
311658
+ const include = this.patternsArrayForWatch(watchSettings.include, {
311659
+ defaultPattern: "**",
311660
+ returnDefaultIfEmpty: true
311661
+ });
311662
+ const exclude = this.patternsArrayForWatch(watchSettings.exclude, {
311663
+ defaultPattern: "",
311664
+ returnDefaultIfEmpty: false
311665
+ });
311666
+ const watcher = await this.toolkit.watchSynth(this.props.cloudExecutable.uncachedSource(), {
311667
+ ...options,
311668
+ watchDir: rootDir,
311669
+ include,
311670
+ exclude
311671
+ });
311672
+ return watcher.waitForEnd();
311673
+ }
311411
311674
  /**
311412
311675
  * Bootstrap the CDK Toolkit stack in the accounts used by the specified stack(s).
311413
311676
  *
@@ -317213,6 +317476,10 @@ function parseCommandLineArguments(args) {
317213
317476
  type: "boolean",
317214
317477
  alias: "q",
317215
317478
  desc: "Do not output CloudFormation Template to stdout"
317479
+ }).option("watch", {
317480
+ default: void 0,
317481
+ type: "boolean",
317482
+ desc: "Continuously observe the project files, and synthesize the given stack(s) automatically when changes are detected. Never deploys, and never prints templates to stdout (--quiet and --json have no effect)"
317216
317483
  })
317217
317484
  ).command(
317218
317485
  "bootstrap [ENVIRONMENTS..]",
@@ -339576,7 +339843,7 @@ var require_types2 = __commonJS({
339576
339843
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
339577
339844
  var Op = Object.prototype;
339578
339845
  var objToStr = Op.toString;
339579
- var hasOwn2 = Op.hasOwnProperty;
339846
+ var hasOwn3 = Op.hasOwnProperty;
339580
339847
  var BaseType = (
339581
339848
  /** @class */
339582
339849
  (function() {
@@ -339735,7 +340002,7 @@ var require_types2 = __commonJS({
339735
340002
  if (this.finalized !== true || that.finalized !== true) {
339736
340003
  throw new Error("");
339737
340004
  }
339738
- return hasOwn2.call(that.allSupertypes, this.typeName);
340005
+ return hasOwn3.call(that.allSupertypes, this.typeName);
339739
340006
  } else {
339740
340007
  throw new Error(that + " is not a Def");
339741
340008
  }
@@ -339867,10 +340134,10 @@ var require_types2 = __commonJS({
339867
340134
  // The Def object d returned from Type.def may be used to configure the
339868
340135
  // type d.type by calling methods such as d.bases, d.build, and d.field.
339869
340136
  def: /* @__PURE__ */ __name(function(typeName) {
339870
- return hasOwn2.call(defCache, typeName) ? defCache[typeName] : defCache[typeName] = new DefImpl(typeName);
340137
+ return hasOwn3.call(defCache, typeName) ? defCache[typeName] : defCache[typeName] = new DefImpl(typeName);
339871
340138
  }, "def"),
339872
340139
  hasDef: /* @__PURE__ */ __name(function(typeName) {
339873
- return hasOwn2.call(defCache, typeName);
340140
+ return hasOwn3.call(defCache, typeName);
339874
340141
  }, "hasDef")
339875
340142
  };
339876
340143
  var builtInCtorFns = [];
@@ -339914,7 +340181,7 @@ var require_types2 = __commonJS({
339914
340181
  function defFromValue(value2) {
339915
340182
  if (value2 && typeof value2 === "object") {
339916
340183
  var type = value2.type;
339917
- if (typeof type === "string" && hasOwn2.call(defCache, type)) {
340184
+ if (typeof type === "string" && hasOwn3.call(defCache, type)) {
339918
340185
  var d6 = defCache[type];
339919
340186
  if (d6.finalized) {
339920
340187
  return d6;
@@ -339975,10 +340242,10 @@ var require_types2 = __commonJS({
339975
340242
  });
339976
340243
  this.buildable = true;
339977
340244
  var addParam = /* @__PURE__ */ __name(function(built, param, arg, isArgAvailable) {
339978
- if (hasOwn2.call(built, param))
340245
+ if (hasOwn3.call(built, param))
339979
340246
  return;
339980
340247
  var all = _this.allFields;
339981
- if (!hasOwn2.call(all, param)) {
340248
+ if (!hasOwn3.call(all, param)) {
339982
340249
  throw new Error("" + param);
339983
340250
  }
339984
340251
  var field = all[param];
@@ -340030,7 +340297,7 @@ var require_types2 = __commonJS({
340030
340297
  }
340031
340298
  var built = Object.create(nodePrototype);
340032
340299
  Object.keys(_this.allFields).forEach(function(param) {
340033
- if (hasOwn2.call(obj, param)) {
340300
+ if (hasOwn3.call(obj, param)) {
340034
340301
  addParam(built, param, obj[param], true);
340035
340302
  } else {
340036
340303
  addParam(built, param, null, false);
@@ -340075,7 +340342,7 @@ var require_types2 = __commonJS({
340075
340342
  allSupertypes[this.typeName] = this;
340076
340343
  this.fieldNames.length = 0;
340077
340344
  for (var fieldName in allFields) {
340078
- if (hasOwn2.call(allFields, fieldName) && !allFields[fieldName].hidden) {
340345
+ if (hasOwn3.call(allFields, fieldName) && !allFields[fieldName].hidden) {
340079
340346
  this.fieldNames.push(fieldName);
340080
340347
  }
340081
340348
  }
@@ -340094,7 +340361,7 @@ var require_types2 = __commonJS({
340094
340361
  })(Def)
340095
340362
  );
340096
340363
  function getSupertypeNames(typeName) {
340097
- if (!hasOwn2.call(defCache, typeName)) {
340364
+ if (!hasOwn3.call(defCache, typeName)) {
340098
340365
  throw new Error("");
340099
340366
  }
340100
340367
  var d6 = defCache[typeName];
@@ -340116,7 +340383,7 @@ var require_types2 = __commonJS({
340116
340383
  }
340117
340384
  for (var j6 = 0; j6 < d6.supertypeList.length; ++j6) {
340118
340385
  var superTypeName = d6.supertypeList[j6];
340119
- if (hasOwn2.call(candidates, superTypeName)) {
340386
+ if (hasOwn3.call(candidates, superTypeName)) {
340120
340387
  table3[typeName] = superTypeName;
340121
340388
  break;
340122
340389
  }
@@ -340231,14 +340498,14 @@ var require_types2 = __commonJS({
340231
340498
  if (d6.finalized !== true) {
340232
340499
  throw new Error("");
340233
340500
  }
340234
- if (hasOwn2.call(lastSeen, typeName)) {
340501
+ if (hasOwn3.call(lastSeen, typeName)) {
340235
340502
  delete list2[lastSeen[typeName]];
340236
340503
  }
340237
340504
  lastSeen[typeName] = pos2;
340238
340505
  list2.push.apply(list2, d6.baseNames);
340239
340506
  }
340240
340507
  for (var to = 0, from = to, len = list2.length; from < len; ++from) {
340241
- if (hasOwn2.call(list2, from)) {
340508
+ if (hasOwn3.call(list2, from)) {
340242
340509
  list2[to++] = list2[from];
340243
340510
  }
340244
340511
  }
@@ -340288,7 +340555,7 @@ var require_path2 = __commonJS({
340288
340555
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
340289
340556
  var types_1 = tslib_1.__importDefault(require_types2());
340290
340557
  var Op = Object.prototype;
340291
- var hasOwn2 = Op.hasOwnProperty;
340558
+ var hasOwn3 = Op.hasOwnProperty;
340292
340559
  function pathPlugin(fork) {
340293
340560
  var types2 = fork.use(types_1.default);
340294
340561
  var isArray2 = types2.builtInTypes.array;
@@ -340319,7 +340586,7 @@ var require_path2 = __commonJS({
340319
340586
  var cache6 = getChildCache(path54);
340320
340587
  var actualChildValue = path54.getValueProperty(name);
340321
340588
  var childPath = cache6[name];
340322
- if (!hasOwn2.call(cache6, name) || // Ensure consistency between cache and reality.
340589
+ if (!hasOwn3.call(cache6, name) || // Ensure consistency between cache and reality.
340323
340590
  childPath.value !== actualChildValue) {
340324
340591
  childPath = cache6[name] = new path54.constructor(actualChildValue, path54, name);
340325
340592
  }
@@ -340346,13 +340613,13 @@ var require_path2 = __commonJS({
340346
340613
  var len = this.value.length;
340347
340614
  var i6 = 0;
340348
340615
  for (var i6 = 0; i6 < len; ++i6) {
340349
- if (hasOwn2.call(this.value, i6)) {
340616
+ if (hasOwn3.call(this.value, i6)) {
340350
340617
  childPaths[i6] = this.get(i6);
340351
340618
  }
340352
340619
  }
340353
340620
  context = context || this;
340354
340621
  for (i6 = 0; i6 < len; ++i6) {
340355
- if (hasOwn2.call(childPaths, i6)) {
340622
+ if (hasOwn3.call(childPaths, i6)) {
340356
340623
  callback.call(context, childPaths[i6]);
340357
340624
  }
340358
340625
  }
@@ -340401,7 +340668,7 @@ var require_path2 = __commonJS({
340401
340668
  var moves = /* @__PURE__ */ Object.create(null);
340402
340669
  var cache6 = getChildCache(path54);
340403
340670
  for (var i6 = start; i6 < end2; ++i6) {
340404
- if (hasOwn2.call(path54.value, i6)) {
340671
+ if (hasOwn3.call(path54.value, i6)) {
340405
340672
  var childPath = path54.get(i6);
340406
340673
  if (childPath.name !== i6) {
340407
340674
  throw new Error("");
@@ -340596,7 +340863,7 @@ var require_scope = __commonJS({
340596
340863
  Object.defineProperty(exports2, "__esModule", { value: true });
340597
340864
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
340598
340865
  var types_1 = tslib_1.__importDefault(require_types2());
340599
- var hasOwn2 = Object.prototype.hasOwnProperty;
340866
+ var hasOwn3 = Object.prototype.hasOwnProperty;
340600
340867
  function scopePlugin(fork) {
340601
340868
  var types2 = fork.use(types_1.default);
340602
340869
  var Type = types2.Type;
@@ -340648,11 +340915,11 @@ var require_scope = __commonJS({
340648
340915
  Sp.didScan = false;
340649
340916
  Sp.declares = function(name) {
340650
340917
  this.scan();
340651
- return hasOwn2.call(this.bindings, name);
340918
+ return hasOwn3.call(this.bindings, name);
340652
340919
  };
340653
340920
  Sp.declaresType = function(name) {
340654
340921
  this.scan();
340655
- return hasOwn2.call(this.types, name);
340922
+ return hasOwn3.call(this.types, name);
340656
340923
  };
340657
340924
  Sp.declareTemporary = function(prefix) {
340658
340925
  if (prefix) {
@@ -340771,7 +341038,7 @@ var require_scope = __commonJS({
340771
341038
  if (namedTypes.CatchClause.check(node) && // TODO Broaden this to accept any pattern.
340772
341039
  namedTypes.Identifier.check(node.param)) {
340773
341040
  var catchParamName = node.param.name;
340774
- var hadBinding = hasOwn2.call(bindings, catchParamName);
341041
+ var hadBinding = hasOwn3.call(bindings, catchParamName);
340775
341042
  recursiveScanScope(path54.get("body"), bindings, scopeTypes2);
340776
341043
  if (!hadBinding) {
340777
341044
  delete bindings[catchParamName];
@@ -340786,7 +341053,7 @@ var require_scope = __commonJS({
340786
341053
  var pattern = patternPath.value;
340787
341054
  namedTypes.Pattern.assert(pattern);
340788
341055
  if (namedTypes.Identifier.check(pattern)) {
340789
- if (hasOwn2.call(bindings, pattern.name)) {
341056
+ if (hasOwn3.call(bindings, pattern.name)) {
340790
341057
  bindings[pattern.name].push(patternPath);
340791
341058
  } else {
340792
341059
  bindings[pattern.name] = [patternPath];
@@ -340824,7 +341091,7 @@ var require_scope = __commonJS({
340824
341091
  var pattern = patternPath.value;
340825
341092
  namedTypes.Pattern.assert(pattern);
340826
341093
  if (namedTypes.Identifier.check(pattern)) {
340827
- if (hasOwn2.call(types3, pattern.name)) {
341094
+ if (hasOwn3.call(types3, pattern.name)) {
340828
341095
  types3[pattern.name].push(patternPath);
340829
341096
  } else {
340830
341097
  types3[pattern.name] = [patternPath];
@@ -341228,7 +341495,7 @@ var require_path_visitor = __commonJS({
341228
341495
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
341229
341496
  var types_1 = tslib_1.__importDefault(require_types2());
341230
341497
  var node_path_1 = tslib_1.__importDefault(require_node_path());
341231
- var hasOwn2 = Object.prototype.hasOwnProperty;
341498
+ var hasOwn3 = Object.prototype.hasOwnProperty;
341232
341499
  function pathVisitorPlugin(fork) {
341233
341500
  var types2 = fork.use(types_1.default);
341234
341501
  var NodePath = fork.use(node_path_1.default);
@@ -341242,7 +341509,7 @@ var require_path_visitor = __commonJS({
341242
341509
  }
341243
341510
  this._reusableContextStack = [];
341244
341511
  this._methodNameTable = computeMethodNameTable(this);
341245
- this._shouldVisitComments = hasOwn2.call(this._methodNameTable, "Block") || hasOwn2.call(this._methodNameTable, "Line");
341512
+ this._shouldVisitComments = hasOwn3.call(this._methodNameTable, "Block") || hasOwn3.call(this._methodNameTable, "Line");
341246
341513
  this.Context = makeContextConstructor(this);
341247
341514
  this._visiting = false;
341248
341515
  this._changeReported = false;
@@ -341291,7 +341558,7 @@ var require_path_visitor = __commonJS({
341291
341558
  }, "fromMethodsObject");
341292
341559
  function extend(target, source) {
341293
341560
  for (var property in source) {
341294
- if (hasOwn2.call(source, property)) {
341561
+ if (hasOwn3.call(source, property)) {
341295
341562
  target[property] = source[property];
341296
341563
  }
341297
341564
  }
@@ -341383,7 +341650,7 @@ var require_path_visitor = __commonJS({
341383
341650
  var childPaths = [];
341384
341651
  for (var i6 = 0; i6 < childCount; ++i6) {
341385
341652
  var childName = childNames[i6];
341386
- if (!hasOwn2.call(value2, childName)) {
341653
+ if (!hasOwn3.call(value2, childName)) {
341387
341654
  value2[childName] = types2.getFieldValue(value2, childName);
341388
341655
  }
341389
341656
  childPaths.push(path54.get(childName));
@@ -341535,7 +341802,7 @@ var require_equiv = __commonJS({
341535
341802
  var isObject3 = types2.builtInTypes.object;
341536
341803
  var isDate = types2.builtInTypes.Date;
341537
341804
  var isRegExp = types2.builtInTypes.RegExp;
341538
- var hasOwn2 = Object.prototype.hasOwnProperty;
341805
+ var hasOwn3 = Object.prototype.hasOwnProperty;
341539
341806
  function astNodesAreEquivalent(a6, b6, problemPath) {
341540
341807
  if (isArray2.check(problemPath)) {
341541
341808
  problemPath.length = 0;
@@ -341656,7 +341923,7 @@ var require_equiv = __commonJS({
341656
341923
  }
341657
341924
  for (i6 = 0; i6 < bNameCount; ++i6) {
341658
341925
  name = bNames[i6];
341659
- if (!hasOwn2.call(seenNames, name)) {
341926
+ if (!hasOwn3.call(seenNames, name)) {
341660
341927
  problemPath.push(name);
341661
341928
  return false;
341662
341929
  }
@@ -368389,7 +368656,8 @@ async function exec(args, synthesizer) {
368389
368656
  );
368390
368657
  if (guessAgent() && !argv.verbose && configuration.settings.get(["progress"]) === void 0) {
368391
368658
  ioHost.stackProgress = "errors-only" /* ERRORS_ONLY */;
368392
- await ioHost.defaults.info('AI agent detected, using --progress "errors-only" (set --progress or the "progress" key in cdk.json to change)');
368659
+ await ioHost.defaults.info("AI agent detected");
368660
+ await ioHost.defaults.debug('Using --progress "errors-only" (set --progress or the "progress" key in cdk.json to change)');
368393
368661
  }
368394
368662
  const proxyAgent = await new ProxyAgentProvider(ioHelper).create({
368395
368663
  proxyAddress: configuration.settings.get(["proxy"]),
@@ -368786,6 +369054,12 @@ async function exec(args, synthesizer) {
368786
369054
  case "synthesize":
368787
369055
  case "synth":
368788
369056
  ioHost.currentAction = "synth";
369057
+ if (args2.watch) {
369058
+ return cli2.synthWatch({
369059
+ stacks: specificStacksOrAllRecursively(args2.STACKS),
369060
+ validateStacks: args2.validation
369061
+ });
369062
+ }
368789
369063
  const quiet = configuration.settings.get(["quiet"]) ?? args2.quiet;
368790
369064
  return cli2.synth({
368791
369065
  stackNames: args2.STACKS,