@theholocron/cli 5.0.0-alpha.469 → 5.0.0-alpha.470

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.mjs CHANGED
@@ -7898,75 +7898,82 @@ function problemsOf(input, state) {
7898
7898
  }
7899
7899
  return problems;
7900
7900
  }
7901
+ /** The rows of one page: its own row, then what it holds beyond the config. Read-only. */
7902
+ async function rowsFor(monitoring, page) {
7903
+ const id = `monitoring-status-page:${page.name}`;
7904
+ if (!monitoring.inspectStatusPage) return [{
7905
+ id,
7906
+ title: title(page.name),
7907
+ status: "skip",
7908
+ detail: "provider does not implement inspectStatusPage",
7909
+ problems: []
7910
+ }];
7911
+ try {
7912
+ const state = await monitoring.inspectStatusPage(page);
7913
+ if (!state.exists) return [{
7914
+ id,
7915
+ title: title(page.name),
7916
+ status: "fail",
7917
+ detail: "does not exist; run `holocron setup`",
7918
+ problems: []
7919
+ }];
7920
+ const problems = problemsOf(page, state);
7921
+ const rows = [problems.length > 0 ? {
7922
+ id,
7923
+ title: title(page.name),
7924
+ status: "fail",
7925
+ detail: `${problems.length} problem(s)`,
7926
+ problems
7927
+ } : {
7928
+ id,
7929
+ title: title(page.name),
7930
+ status: "ok",
7931
+ detail: `${state.public ? "public" : "private"}, ${page.components.length} component(s)${state.domainVerified ? ", domain verified" : ""}`,
7932
+ problems: []
7933
+ }];
7934
+ const extras = [...state.extraComponents.map((n) => `component ${n}`), ...state.extraRules.map((n) => `rule ${n}`)];
7935
+ if (extras.length > 0) rows.push({
7936
+ id: `${id}:extra`,
7937
+ title: `status page ${page.name} has more than the config`,
7938
+ status: "skip",
7939
+ detail: extras.join(", "),
7940
+ problems: []
7941
+ });
7942
+ return rows;
7943
+ } catch (err) {
7944
+ const noToken = missingTokenReason(err);
7945
+ return [noToken !== void 0 ? {
7946
+ id,
7947
+ title: title(page.name),
7948
+ status: "skip",
7949
+ detail: noToken,
7950
+ problems: []
7951
+ } : {
7952
+ id,
7953
+ title: title(page.name),
7954
+ status: "fail",
7955
+ detail: errorMessage(err),
7956
+ problems: []
7957
+ }];
7958
+ }
7959
+ }
7901
7960
  /**
7902
7961
  * One row per declared status page: it exists, its privacy is what is declared, its components and rules are as
7903
- * declared and its custom domain is verified. What the page holds beyond the config is a skipped `info` row.
7904
- * Read-only. A provider with no `inspectStatusPage`, or no token, is a skip with the reason.
7962
+ * declared and its custom domain is verified. What the page holds beyond the config is a skipped `info` row, and a page
7963
+ * declared with `automation: false` gets a skipped row saying its rules are not managed, whatever else the inspection
7964
+ * found. Read-only. A provider with no `inspectStatusPage`, or no token, is a skip with the reason.
7905
7965
  */
7906
7966
  async function statusPageRows(monitoring) {
7907
7967
  const rows = [];
7908
7968
  for (const page of monitoring.statusPages ?? []) {
7909
- const id = `monitoring-status-page:${page.name}`;
7910
- if (!monitoring.inspectStatusPage) {
7911
- rows.push({
7912
- id,
7913
- title: title(page.name),
7914
- status: "skip",
7915
- detail: "provider does not implement inspectStatusPage",
7916
- problems: []
7917
- });
7918
- continue;
7919
- }
7920
- try {
7921
- const state = await monitoring.inspectStatusPage(page);
7922
- if (!state.exists) {
7923
- rows.push({
7924
- id,
7925
- title: title(page.name),
7926
- status: "fail",
7927
- detail: "does not exist; run `holocron setup`",
7928
- problems: []
7929
- });
7930
- continue;
7931
- }
7932
- const problems = problemsOf(page, state);
7933
- rows.push(problems.length > 0 ? {
7934
- id,
7935
- title: title(page.name),
7936
- status: "fail",
7937
- detail: `${problems.length} problem(s)`,
7938
- problems
7939
- } : {
7940
- id,
7941
- title: title(page.name),
7942
- status: "ok",
7943
- detail: `${state.public ? "public" : "private"}, ${page.components.length} component(s)${state.domainVerified ? ", domain verified" : ""}`,
7944
- problems: []
7945
- });
7946
- const extras = [...state.extraComponents.map((n) => `component ${n}`), ...state.extraRules.map((n) => `rule ${n}`)];
7947
- if (extras.length > 0) rows.push({
7948
- id: `${id}:extra`,
7949
- title: `status page ${page.name} has more than the config`,
7950
- status: "skip",
7951
- detail: extras.join(", "),
7952
- problems: []
7953
- });
7954
- } catch (err) {
7955
- const noToken = missingTokenReason(err);
7956
- rows.push(noToken !== void 0 ? {
7957
- id,
7958
- title: title(page.name),
7959
- status: "skip",
7960
- detail: noToken,
7961
- problems: []
7962
- } : {
7963
- id,
7964
- title: title(page.name),
7965
- status: "fail",
7966
- detail: errorMessage(err),
7967
- problems: []
7968
- });
7969
- }
7969
+ rows.push(...await rowsFor(monitoring, page));
7970
+ if (page.automation === false) rows.push({
7971
+ id: `monitoring-status-page:${page.name}:automation`,
7972
+ title: `status page ${page.name} automation`,
7973
+ status: "skip",
7974
+ detail: "off: rules are neither read nor made, so a failing check does not move a component and incidents are opened by hand (a rule that already exists is left as it is)",
7975
+ problems: []
7976
+ });
7970
7977
  }
7971
7978
  return rows;
7972
7979
  }