@haakco/hostingctl 1.0.372 → 1.0.374

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/main.js CHANGED
@@ -16567,9 +16567,9 @@ async function environmentComponentVersion(context, rest) {
16567
16567
  //#region src/commands/environment-configuration.ts
16568
16568
  var CONFIGURATION_USAGE = [
16569
16569
  "Usage: hostingctl environment configuration show <environment-uuid> --company <slug>",
16570
- " hostingctl environment configuration preview <environment-uuid> --company <slug> --file <yaml> [--apply] [--application-uuid <uuid>]",
16571
- " hostingctl environment configuration save <environment-uuid> --company <slug> --file <yaml> [--application-uuid <uuid>]",
16572
- " hostingctl environment configuration apply <environment-uuid> --company <slug> --file <yaml> [--application-uuid <uuid>]",
16570
+ " hostingctl environment configuration preview <environment-uuid> --company <slug> --file <yaml> [--apply] [--switch-mode] [--application-uuid <uuid>]",
16571
+ " hostingctl environment configuration save <environment-uuid> --company <slug> --file <yaml> [--switch-mode] [--application-uuid <uuid>]",
16572
+ " hostingctl environment configuration apply <environment-uuid> --company <slug> --file <yaml> [--switch-mode] [--application-uuid <uuid>]",
16573
16573
  "",
16574
16574
  " show The current configuration revision, its secrets and its known-good revision.",
16575
16575
  " preview Review a YAML document against the environment; writes nothing.",
@@ -16580,6 +16580,8 @@ var CONFIGURATION_USAGE = [
16580
16580
  "The document is the same YAML the panel and repository origin use. save and apply re-run the",
16581
16581
  "review to obtain the hash the API requires, so a document that changed since review is refused.",
16582
16582
  "--application-uuid explicitly adopts one existing workload for a single-application document.",
16583
+ "--switch-mode confirms moving an environment's configuration source between its repository file and the",
16584
+ "document submitted here; the API refuses that switch without it.",
16583
16585
  "Both need --confirm; --dry-run describes the change without sending it."
16584
16586
  ].join("\n");
16585
16587
  /** `environment configuration <show|preview|save|apply> <uuid>`: the YAML configuration lifecycle. */
@@ -16618,7 +16620,7 @@ async function restore(context, company, environmentUuid) {
16618
16620
  async function preview(context, company, environmentUuid) {
16619
16621
  const document = configurationDocument(context);
16620
16622
  const apply = context.flags.has("--apply");
16621
- return await reviewed(company, environmentUuid, document, (await configurationPage(company, environmentUuid)).desiredGeneration, apply, adoptedApplication(context));
16623
+ return await reviewed(company, environmentUuid, document, (await configurationPage(company, environmentUuid)).desiredGeneration, apply, adoptedApplication(context), switchingSourceMode(context));
16622
16624
  }
16623
16625
  /**
16624
16626
  * `save`/`apply`: re-run the review to obtain the hash and expiry the API requires, then submit.
@@ -16630,7 +16632,8 @@ async function preview(context, company, environmentUuid) {
16630
16632
  async function record$2(context, company, environmentUuid, apply) {
16631
16633
  const document = configurationDocument(context);
16632
16634
  const applicationUuid = adoptedApplication(context);
16633
- const review = await reviewed(company, environmentUuid, document, (await configurationPage(company, environmentUuid)).desiredGeneration, apply, applicationUuid);
16635
+ const switchMode = switchingSourceMode(context);
16636
+ const review = await reviewed(company, environmentUuid, document, (await configurationPage(company, environmentUuid)).desiredGeneration, apply, applicationUuid, switchingSourceMode(context));
16634
16637
  return await confirmableWrite(context, describeRecord(review, apply), async () => (await hostingConfigurationSave({
16635
16638
  path: {
16636
16639
  company,
@@ -16643,6 +16646,7 @@ async function record$2(context, company, environmentUuid, apply) {
16643
16646
  previewHash: review.previewHash,
16644
16647
  expiresAt: review.expiresAt,
16645
16648
  apply,
16649
+ ...switchMode ? { switchMode: true } : {},
16646
16650
  ...applicationUuid === null ? {} : { applicationUuid }
16647
16651
  }
16648
16652
  })).data);
@@ -16655,7 +16659,7 @@ async function configurationPage(company, environmentUuid) {
16655
16659
  } })).data;
16656
16660
  }
16657
16661
  /** One review call, with the caller's own document and the generation it was composed against. */
16658
- async function reviewed(company, environmentUuid, document, desiredGeneration, apply, applicationUuid) {
16662
+ async function reviewed(company, environmentUuid, document, desiredGeneration, apply, applicationUuid, switchMode) {
16659
16663
  return (await hostingConfigurationPreview({
16660
16664
  path: {
16661
16665
  company,
@@ -16666,10 +16670,15 @@ async function reviewed(company, environmentUuid, document, desiredGeneration, a
16666
16670
  origin: "yaml",
16667
16671
  desiredGeneration,
16668
16672
  apply,
16673
+ ...switchMode ? { switchMode: true } : {},
16669
16674
  ...applicationUuid === null ? {} : { applicationUuid }
16670
16675
  }
16671
16676
  })).data;
16672
16677
  }
16678
+ /** `--switch-mode`: the caller's explicit confirmation of a configuration-source change. */
16679
+ function switchingSourceMode(context) {
16680
+ return context.flags.has("--switch-mode");
16681
+ }
16673
16682
  /** The one workload a single-member document adopts, or no adoption. */
16674
16683
  function adoptedApplication(context) {
16675
16684
  if (!context.flags.has("--application-uuid")) return null;
@@ -18362,6 +18371,11 @@ var ENVIRONMENT_METADATA = {
18362
18371
  takesValue: false,
18363
18372
  description: "Apply the reviewed configuration instead of only drafting it."
18364
18373
  },
18374
+ {
18375
+ name: "--switch-mode",
18376
+ takesValue: false,
18377
+ description: "Confirm moving the environment's configuration source between its repository file and this document."
18378
+ },
18365
18379
  {
18366
18380
  name: "--engine",
18367
18381
  takesValue: true,