@reddoorla/maintenance 0.66.0 → 0.67.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.
Files changed (84) hide show
  1. package/dist/airtable-33SY2UBZ.js +9 -0
  2. package/dist/{announce-YPXVHNNP.js → announce-74ZIAV26.js} +4 -4
  3. package/dist/{bump-deps-INDDTDSG.js → bump-deps-HYBYNPMY.js} +2 -2
  4. package/dist/{chunk-LISJ3K3R.js → chunk-7MJJEEII.js} +2 -2
  5. package/dist/{chunk-4P6UQG5L.js → chunk-CL5DYUWQ.js} +4 -1
  6. package/dist/chunk-CL5DYUWQ.js.map +1 -0
  7. package/dist/{chunk-XKKTK6WA.js → chunk-HIN3P4ZN.js} +23 -2
  8. package/dist/chunk-HIN3P4ZN.js.map +1 -0
  9. package/dist/{chunk-CH6K2VMM.js → chunk-JDGIO54P.js} +2 -2
  10. package/dist/{chunk-JD3X3QMP.js → chunk-KN5OC5YH.js} +3 -3
  11. package/dist/{chunk-XKSKHHSX.js → chunk-OAMJINM5.js} +3 -3
  12. package/dist/{chunk-G2YRXV26.js → chunk-OTBA7DON.js} +2 -2
  13. package/dist/{chunk-PTPTVVY7.js → chunk-PH3AGF4Z.js} +2 -2
  14. package/dist/{chunk-YBYWNUT3.js → chunk-T34EUM5B.js} +2 -2
  15. package/dist/{chunk-G35B5U6F.js → chunk-ULL4AD3Y.js} +2 -2
  16. package/dist/{chunk-NMGGP5WN.js → chunk-Y4O44LZB.js} +2 -2
  17. package/dist/{chunk-CWSQZ27M.js → chunk-YKOOAWVL.js} +3 -3
  18. package/dist/cli/bin.js +15 -15
  19. package/dist/cli/commands/audit.js +8 -8
  20. package/dist/client-NVVQK3HH.js +11 -0
  21. package/dist/{convert-to-pnpm-4GD4667L.js → convert-to-pnpm-5MPZWFHM.js} +2 -2
  22. package/dist/{db-YBLQR2YY.js → db-3QW2XEXA.js} +3 -3
  23. package/dist/{digest-SIZUXT67.js → digest-MECMZPFE.js} +3 -3
  24. package/dist/forms/index.d.ts +13 -0
  25. package/dist/forms/index.js +28 -2
  26. package/dist/forms/index.js.map +1 -1
  27. package/dist/{github-signals-3O64PFWP.js → github-signals-VWBMQNLH.js} +7 -7
  28. package/dist/index.d.ts +12 -1
  29. package/dist/index.js +27 -15
  30. package/dist/index.js.map +1 -1
  31. package/dist/{init-KMWXJZEX.js → init-X3BCJAUG.js} +2 -2
  32. package/dist/{launch-5KRCKFYM.js → launch-NQCL5K5H.js} +5 -5
  33. package/dist/{lighthouse-airtable-5JICCZND.js → lighthouse-airtable-QUNOSDT5.js} +3 -3
  34. package/dist/migrate-35DNNF3H.js +7 -0
  35. package/dist/{onboard-RCBXS5B3.js → onboard-7JOBZY35.js} +2 -2
  36. package/dist/{orchestrate-O4KR6JME.js → orchestrate-JQX72RJE.js} +6 -6
  37. package/dist/{renovate-dispatch-ABRSIT77.js → renovate-dispatch-PWXFZNHN.js} +2 -2
  38. package/dist/{report-LSGTMXQJ.js → report-QUKNKUUE.js} +5 -5
  39. package/dist/{self-updating-CPMY3HFY.js → self-updating-OKJKU2FE.js} +2 -2
  40. package/dist/{selftest-7Y5K4PYL.js → selftest-6JVYR24F.js} +8 -8
  41. package/dist/{svelte-codemods-GJRTBLJE.js → svelte-codemods-GG6EEES5.js} +2 -2
  42. package/dist/{sync-configs-NYJNSIRN.js → sync-configs-UFHZZPL7.js} +2 -2
  43. package/dist/{upgrade-LVYRDKDL.js → upgrade-S25N3473.js} +2 -2
  44. package/dist/{websites-5ETIXB7F.js → websites-U3UZS5VG.js} +2 -2
  45. package/dist/{write-audits-to-airtable-GHR337N7.js → write-audits-to-airtable-GAJUCSTY.js} +4 -4
  46. package/package.json +1 -1
  47. package/dist/airtable-M4AQHRNV.js +0 -9
  48. package/dist/chunk-4P6UQG5L.js.map +0 -1
  49. package/dist/chunk-XKKTK6WA.js.map +0 -1
  50. package/dist/client-C2GOZD2D.js +0 -11
  51. package/dist/migrate-BFOG2OCP.js +0 -7
  52. /package/dist/{airtable-M4AQHRNV.js.map → airtable-33SY2UBZ.js.map} +0 -0
  53. /package/dist/{announce-YPXVHNNP.js.map → announce-74ZIAV26.js.map} +0 -0
  54. /package/dist/{bump-deps-INDDTDSG.js.map → bump-deps-HYBYNPMY.js.map} +0 -0
  55. /package/dist/{chunk-LISJ3K3R.js.map → chunk-7MJJEEII.js.map} +0 -0
  56. /package/dist/{chunk-CH6K2VMM.js.map → chunk-JDGIO54P.js.map} +0 -0
  57. /package/dist/{chunk-JD3X3QMP.js.map → chunk-KN5OC5YH.js.map} +0 -0
  58. /package/dist/{chunk-XKSKHHSX.js.map → chunk-OAMJINM5.js.map} +0 -0
  59. /package/dist/{chunk-G2YRXV26.js.map → chunk-OTBA7DON.js.map} +0 -0
  60. /package/dist/{chunk-PTPTVVY7.js.map → chunk-PH3AGF4Z.js.map} +0 -0
  61. /package/dist/{chunk-YBYWNUT3.js.map → chunk-T34EUM5B.js.map} +0 -0
  62. /package/dist/{chunk-G35B5U6F.js.map → chunk-ULL4AD3Y.js.map} +0 -0
  63. /package/dist/{chunk-NMGGP5WN.js.map → chunk-Y4O44LZB.js.map} +0 -0
  64. /package/dist/{chunk-CWSQZ27M.js.map → chunk-YKOOAWVL.js.map} +0 -0
  65. /package/dist/{client-C2GOZD2D.js.map → client-NVVQK3HH.js.map} +0 -0
  66. /package/dist/{convert-to-pnpm-4GD4667L.js.map → convert-to-pnpm-5MPZWFHM.js.map} +0 -0
  67. /package/dist/{db-YBLQR2YY.js.map → db-3QW2XEXA.js.map} +0 -0
  68. /package/dist/{digest-SIZUXT67.js.map → digest-MECMZPFE.js.map} +0 -0
  69. /package/dist/{github-signals-3O64PFWP.js.map → github-signals-VWBMQNLH.js.map} +0 -0
  70. /package/dist/{init-KMWXJZEX.js.map → init-X3BCJAUG.js.map} +0 -0
  71. /package/dist/{launch-5KRCKFYM.js.map → launch-NQCL5K5H.js.map} +0 -0
  72. /package/dist/{lighthouse-airtable-5JICCZND.js.map → lighthouse-airtable-QUNOSDT5.js.map} +0 -0
  73. /package/dist/{migrate-BFOG2OCP.js.map → migrate-35DNNF3H.js.map} +0 -0
  74. /package/dist/{onboard-RCBXS5B3.js.map → onboard-7JOBZY35.js.map} +0 -0
  75. /package/dist/{orchestrate-O4KR6JME.js.map → orchestrate-JQX72RJE.js.map} +0 -0
  76. /package/dist/{renovate-dispatch-ABRSIT77.js.map → renovate-dispatch-PWXFZNHN.js.map} +0 -0
  77. /package/dist/{report-LSGTMXQJ.js.map → report-QUKNKUUE.js.map} +0 -0
  78. /package/dist/{self-updating-CPMY3HFY.js.map → self-updating-OKJKU2FE.js.map} +0 -0
  79. /package/dist/{selftest-7Y5K4PYL.js.map → selftest-6JVYR24F.js.map} +0 -0
  80. /package/dist/{svelte-codemods-GJRTBLJE.js.map → svelte-codemods-GG6EEES5.js.map} +0 -0
  81. /package/dist/{sync-configs-NYJNSIRN.js.map → sync-configs-UFHZZPL7.js.map} +0 -0
  82. /package/dist/{upgrade-LVYRDKDL.js.map → upgrade-S25N3473.js.map} +0 -0
  83. /package/dist/{websites-5ETIXB7F.js.map → websites-U3UZS5VG.js.map} +0 -0
  84. /package/dist/{write-audits-to-airtable-GHR337N7.js.map → write-audits-to-airtable-GAJUCSTY.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-4NAOR44V.js";
6
6
  import {
7
7
  resolveSites
8
- } from "./chunk-LISJ3K3R.js";
8
+ } from "./chunk-7MJJEEII.js";
9
9
  import {
10
10
  init
11
11
  } from "./chunk-LCKKIJ22.js";
@@ -101,4 +101,4 @@ async function runInitCommand(site, opts) {
101
101
  export {
102
102
  runInitCommand
103
103
  };
104
- //# sourceMappingURL=init-KMWXJZEX.js.map
104
+ //# sourceMappingURL=init-X3BCJAUG.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  writeAuditsToAirtable
3
- } from "./chunk-JD3X3QMP.js";
3
+ } from "./chunk-KN5OC5YH.js";
4
4
  import {
5
5
  hasRealScores,
6
6
  lighthouseScoresFromResult
7
- } from "./chunk-YBYWNUT3.js";
7
+ } from "./chunk-T34EUM5B.js";
8
8
  import {
9
9
  selfUpdating
10
10
  } from "./chunk-IRRZG66U.js";
11
11
  import "./chunk-5L3FPQIJ.js";
12
12
  import {
13
13
  resolveSites
14
- } from "./chunk-LISJ3K3R.js";
14
+ } from "./chunk-7MJJEEII.js";
15
15
  import {
16
16
  queueDraft
17
17
  } from "./chunk-6LIWDIXU.js";
@@ -42,7 +42,7 @@ import "./chunk-U5SZ4FOP.js";
42
42
  import {
43
43
  listWebsites,
44
44
  siteSlug
45
- } from "./chunk-4P6UQG5L.js";
45
+ } from "./chunk-CL5DYUWQ.js";
46
46
  import {
47
47
  openBase,
48
48
  readAirtableConfig
@@ -212,4 +212,4 @@ async function runLaunchCommand(site, opts) {
212
212
  export {
213
213
  runLaunchCommand
214
214
  };
215
- //# sourceMappingURL=launch-5KRCKFYM.js.map
215
+ //# sourceMappingURL=launch-NQCL5K5H.js.map
@@ -2,11 +2,11 @@ import {
2
2
  hasRealScores,
3
3
  lighthouseScoresFromResult,
4
4
  resolveSlugFromCwd
5
- } from "./chunk-YBYWNUT3.js";
6
- import "./chunk-4P6UQG5L.js";
5
+ } from "./chunk-T34EUM5B.js";
6
+ import "./chunk-CL5DYUWQ.js";
7
7
  export {
8
8
  hasRealScores,
9
9
  lighthouseScoresFromResult,
10
10
  resolveSlugFromCwd
11
11
  };
12
- //# sourceMappingURL=lighthouse-airtable-5JICCZND.js.map
12
+ //# sourceMappingURL=lighthouse-airtable-QUNOSDT5.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ runMigrations
3
+ } from "./chunk-HIN3P4ZN.js";
4
+ export {
5
+ runMigrations
6
+ };
7
+ //# sourceMappingURL=migrate-35DNNF3H.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-4NAOR44V.js";
9
9
  import {
10
10
  resolveSites
11
- } from "./chunk-LISJ3K3R.js";
11
+ } from "./chunk-7MJJEEII.js";
12
12
  import {
13
13
  onboard
14
14
  } from "./chunk-ZYBOT5PM.js";
@@ -70,4 +70,4 @@ async function runOnboardCommand(site, opts) {
70
70
  export {
71
71
  runOnboardCommand
72
72
  };
73
- //# sourceMappingURL=onboard-RCBXS5B3.js.map
73
+ //# sourceMappingURL=onboard-7JOBZY35.js.map
@@ -4,16 +4,16 @@ import {
4
4
  parseAddresses,
5
5
  sendApprovedReports,
6
6
  withGlobalCc
7
- } from "./chunk-CWSQZ27M.js";
7
+ } from "./chunk-YKOOAWVL.js";
8
8
  import "./chunk-OGGRFBL4.js";
9
9
  import "./chunk-GECESMVS.js";
10
10
  import "./chunk-SYTPVYIK.js";
11
11
  import "./chunk-OCS7SZUZ.js";
12
- import "./chunk-G2YRXV26.js";
13
- import "./chunk-PTPTVVY7.js";
14
- import "./chunk-XKKTK6WA.js";
12
+ import "./chunk-OTBA7DON.js";
13
+ import "./chunk-PH3AGF4Z.js";
14
+ import "./chunk-HIN3P4ZN.js";
15
15
  import "./chunk-U5SZ4FOP.js";
16
- import "./chunk-4P6UQG5L.js";
16
+ import "./chunk-CL5DYUWQ.js";
17
17
  import "./chunk-HN6I2XWI.js";
18
18
  import "./chunk-WEKL2HYJ.js";
19
19
  import "./chunk-6VAL7XJT.js";
@@ -24,4 +24,4 @@ export {
24
24
  sendApprovedReports,
25
25
  withGlobalCc
26
26
  };
27
- //# sourceMappingURL=orchestrate-O4KR6JME.js.map
27
+ //# sourceMappingURL=orchestrate-JQX72RJE.js.map
@@ -9,7 +9,7 @@ import {
9
9
  isDashboardVisible,
10
10
  listWebsites,
11
11
  updateAutoFixAttempts
12
- } from "./chunk-4P6UQG5L.js";
12
+ } from "./chunk-CL5DYUWQ.js";
13
13
  import {
14
14
  openBase,
15
15
  readAirtableConfig
@@ -136,4 +136,4 @@ No active repo-backed sites with critical/high vulnerabilities \u2014 nothing to
136
136
  export {
137
137
  runRenovateDispatchCommand
138
138
  };
139
- //# sourceMappingURL=renovate-dispatch-ABRSIT77.js.map
139
+ //# sourceMappingURL=renovate-dispatch-PWXFZNHN.js.map
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  draftReportForSite,
8
8
  readGaConfig
9
- } from "./chunk-G35B5U6F.js";
9
+ } from "./chunk-ULL4AD3Y.js";
10
10
  import {
11
11
  reportTier
12
12
  } from "./chunk-6LIWDIXU.js";
@@ -20,7 +20,7 @@ import {
20
20
  listWebsites,
21
21
  siteSlug,
22
22
  updateNextDueDates
23
- } from "./chunk-4P6UQG5L.js";
23
+ } from "./chunk-CL5DYUWQ.js";
24
24
  import {
25
25
  openBase,
26
26
  readAirtableConfig
@@ -70,11 +70,11 @@ function dashboardBaseUrl() {
70
70
  }
71
71
  async function runReportCommand(slug, opts) {
72
72
  if (opts.digest) {
73
- const { runDigest } = await import("./digest-SIZUXT67.js");
73
+ const { runDigest } = await import("./digest-MECMZPFE.js");
74
74
  return runDigest({ baseUrl: dashboardBaseUrl() });
75
75
  }
76
76
  if (opts.sendReady) {
77
- const { sendApprovedReports } = await import("./orchestrate-O4KR6JME.js");
77
+ const { sendApprovedReports } = await import("./orchestrate-JQX72RJE.js");
78
78
  return sendApprovedReports();
79
79
  }
80
80
  if (opts.due) {
@@ -253,4 +253,4 @@ export {
253
253
  parseSingleSiteReportType,
254
254
  runReportCommand
255
255
  };
256
- //# sourceMappingURL=report-LSGTMXQJ.js.map
256
+ //# sourceMappingURL=report-QUKNKUUE.js.map
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-4NAOR44V.js";
12
12
  import {
13
13
  resolveSites
14
- } from "./chunk-LISJ3K3R.js";
14
+ } from "./chunk-7MJJEEII.js";
15
15
  import "./chunk-CASCWQQX.js";
16
16
  import "./chunk-GASBX52O.js";
17
17
  import "./chunk-YEGHUODU.js";
@@ -61,4 +61,4 @@ async function runSelfUpdatingCommand(site, opts) {
61
61
  export {
62
62
  runSelfUpdatingCommand
63
63
  };
64
- //# sourceMappingURL=self-updating-CPMY3HFY.js.map
64
+ //# sourceMappingURL=self-updating-OKJKU2FE.js.map
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  buildReportDataForSite,
3
3
  scoresFromRow
4
- } from "./chunk-XKSKHHSX.js";
5
- import "./chunk-G35B5U6F.js";
4
+ } from "./chunk-OAMJINM5.js";
5
+ import "./chunk-ULL4AD3Y.js";
6
6
  import "./chunk-6LIWDIXU.js";
7
7
  import {
8
8
  isProbablyEmail,
9
9
  parseAddresses,
10
10
  prepareHeaderImage,
11
11
  renderReportEmail
12
- } from "./chunk-CWSQZ27M.js";
12
+ } from "./chunk-YKOOAWVL.js";
13
13
  import "./chunk-OGGRFBL4.js";
14
14
  import "./chunk-GECESMVS.js";
15
15
  import {
16
16
  fetchAttachmentBytes
17
17
  } from "./chunk-SYTPVYIK.js";
18
18
  import "./chunk-OCS7SZUZ.js";
19
- import "./chunk-G2YRXV26.js";
20
- import "./chunk-PTPTVVY7.js";
21
- import "./chunk-XKKTK6WA.js";
19
+ import "./chunk-OTBA7DON.js";
20
+ import "./chunk-PH3AGF4Z.js";
21
+ import "./chunk-HIN3P4ZN.js";
22
22
  import "./chunk-U5SZ4FOP.js";
23
23
  import {
24
24
  listWebsites,
25
25
  siteSlug
26
- } from "./chunk-4P6UQG5L.js";
26
+ } from "./chunk-CL5DYUWQ.js";
27
27
  import {
28
28
  openBase,
29
29
  readAirtableConfig
@@ -158,4 +158,4 @@ async function runSelftestCommand(kind, site, opts) {
158
158
  export {
159
159
  runSelftestCommand
160
160
  };
161
- //# sourceMappingURL=selftest-7Y5K4PYL.js.map
161
+ //# sourceMappingURL=selftest-6JVYR24F.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-4NAOR44V.js";
9
9
  import {
10
10
  resolveSites
11
- } from "./chunk-LISJ3K3R.js";
11
+ } from "./chunk-7MJJEEII.js";
12
12
  import {
13
13
  svelteCodemods
14
14
  } from "./chunk-BTEBRTW4.js";
@@ -50,4 +50,4 @@ async function runSvelteCodemodsCommand(site, opts) {
50
50
  export {
51
51
  runSvelteCodemodsCommand
52
52
  };
53
- //# sourceMappingURL=svelte-codemods-GJRTBLJE.js.map
53
+ //# sourceMappingURL=svelte-codemods-GG6EEES5.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-4NAOR44V.js";
9
9
  import {
10
10
  resolveSites
11
- } from "./chunk-LISJ3K3R.js";
11
+ } from "./chunk-7MJJEEII.js";
12
12
  import {
13
13
  ALL_CONFIG_NAMES,
14
14
  CANONICAL_GITIGNORE_ENTRIES,
@@ -112,4 +112,4 @@ async function runSyncConfigsCommand(site, opts) {
112
112
  export {
113
113
  runSyncConfigsCommand
114
114
  };
115
- //# sourceMappingURL=sync-configs-NYJNSIRN.js.map
115
+ //# sourceMappingURL=sync-configs-UFHZZPL7.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-4NAOR44V.js";
9
9
  import {
10
10
  resolveSites
11
- } from "./chunk-LISJ3K3R.js";
11
+ } from "./chunk-7MJJEEII.js";
12
12
  import {
13
13
  upgradeSvelte4to5
14
14
  } from "./chunk-ZO7WNY57.js";
@@ -59,4 +59,4 @@ async function runUpgradeCommand(upgradeName, site, opts = {}) {
59
59
  export {
60
60
  runUpgradeCommand
61
61
  };
62
- //# sourceMappingURL=upgrade-LVYRDKDL.js.map
62
+ //# sourceMappingURL=upgrade-S25N3473.js.map
@@ -21,7 +21,7 @@ import {
21
21
  updateScores,
22
22
  updateSecurityCounts,
23
23
  updateSiteField
24
- } from "./chunk-4P6UQG5L.js";
24
+ } from "./chunk-CL5DYUWQ.js";
25
25
  export {
26
26
  ACTIVE_STATUSES,
27
27
  SEVERITY_RANK,
@@ -46,4 +46,4 @@ export {
46
46
  updateSecurityCounts,
47
47
  updateSiteField
48
48
  };
49
- //# sourceMappingURL=websites-5ETIXB7F.js.map
49
+ //# sourceMappingURL=websites-U3UZS5VG.js.map
@@ -2,13 +2,13 @@ import {
2
2
  formatFleetWriteSummary,
3
3
  writeAuditsToAirtable,
4
4
  writeFleetAuditsToAirtable
5
- } from "./chunk-JD3X3QMP.js";
6
- import "./chunk-YBYWNUT3.js";
5
+ } from "./chunk-KN5OC5YH.js";
6
+ import "./chunk-T34EUM5B.js";
7
7
  import "./chunk-5L3FPQIJ.js";
8
- import "./chunk-4P6UQG5L.js";
8
+ import "./chunk-CL5DYUWQ.js";
9
9
  export {
10
10
  formatFleetWriteSummary,
11
11
  writeAuditsToAirtable,
12
12
  writeFleetAuditsToAirtable
13
13
  };
14
- //# sourceMappingURL=write-audits-to-airtable-GHR337N7.js.map
14
+ //# sourceMappingURL=write-audits-to-airtable-GAJUCSTY.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddoorla/maintenance",
3
- "version": "0.66.0",
3
+ "version": "0.67.0",
4
4
  "description": "Canonical maintenance configs, audits, and recipes for the reddoor stack.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,9 +0,0 @@
1
- import {
2
- fromAirtableBase
3
- } from "./chunk-NMGGP5WN.js";
4
- import "./chunk-U5SZ4FOP.js";
5
- import "./chunk-4P6UQG5L.js";
6
- export {
7
- fromAirtableBase
8
- };
9
- //# sourceMappingURL=airtable-M4AQHRNV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/reports/airtable/websites.ts"],"sourcesContent":["import type { FieldSet } from \"airtable\";\nimport type { AirtableBase } from \"./client.js\";\nimport type { LighthouseScores, LighthouseScoreWriteback } from \"../types.js\";\n\nexport const WEBSITES_TABLE = \"Websites\";\n\nexport type Frequency = \"None\" | \"Monthly\" | \"Quarterly\" | \"Yearly\";\n\nexport type Status =\n | \"in development\"\n | \"launch period\"\n | \"maintenance\"\n | \"hosting\"\n | \"probably not our problem\"\n | \"deprecated\";\n\n/**\n * Per-site notification routing. When present on a `maintenance` site, the form\n * notification is addressed by the value of a submission field (`field`, read from\n * `extraFields`) — e.g. route a contact form's `interest` to a different recipient\n * per option, always CC-ing a shared address. Absent (`null`) → the site keeps the\n * default single-POC behavior. Recipients live HERE (server-side Airtable config),\n * never supplied by the submitting site, so the ingest can't be turned into an open\n * relay.\n */\nexport type NotifyRouting = {\n /** The `extraFields` key whose value selects a route, e.g. \"interest\". */\n field: string;\n /** Field-value → recipient address(es). */\n routes: Record<string, string | string[]>;\n /** Recipient(s) when the value matches no route. */\n default?: string | string[];\n /** Address(es) CC'd on every routed (maintenance) send. */\n cc?: string[];\n};\n\nexport type WebsiteRow = {\n id: string;\n name: string;\n url: string;\n status: Status | null;\n pointOfContact: string | null;\n maintenanceFreq: Frequency;\n testingFreq: Frequency;\n /** Last manually-recorded maintenance day (used as fallback when no Reports row exists). */\n maintenanceDay: string | null;\n testingDay: string | null;\n ga4PropertyId: string | null;\n /** Operator-supplied query for the Google search-presence check (e.g. the business name).\n * Null = no query set → the check is skipped for this site. */\n searchQuery: string | null;\n /** Explicit Search Console property for this site (`sc-domain:...` or `https://.../`).\n * Null = auto-resolve from the SA's visible properties by host. */\n searchConsoleProperty: string | null;\n /** ISO timestamp of the last draft run where THIS site's GA/Search enrichment\n * ERRORED (vs a legitimate \"not configured\" skip). Set by drafting on a soft-fail,\n * cleared (null) on a clean enrichment, so the per-site analytics-failure signal\n * self-heals. Null when the operator-added `Analytics soft-fail at` column is absent. */\n analyticsSoftFailAt: string | null;\n /** GitHub repo identity as `owner/repo`. Null = no git wiring → self-update ops skip\n * (or, for local runs, fall back to the checkout's origin remote). */\n gitRepo: string | null;\n reportRecipientsTo: string | null;\n reportRecipientsCc: string | null;\n acceptedWatchConditions: string[];\n /** First attachment in the Header image field (Airtable's signed URL — fetch before expiry). */\n headerImage: { url: string; filename: string; type: string } | null;\n /** Lighthouse \"current state\" snapshot, kept fresh by `audit lighthouse --write-airtable`. */\n pScore: number | null;\n rScore: number | null;\n bpScore: number | null;\n seoScore: number | null;\n /** ISO timestamp set by `audit lighthouse --write-airtable` when scores were last refreshed. */\n lastLighthouseAuditAt: string | null;\n /** Last-known counts from non-lighthouse audits, written by\n * `audit --write-airtable`. `null` = never audited (or this audit\n * type was skipped on the last run). 0 = audited, clean. */\n a11yViolations: number | null;\n /** Declared-range drift vs the Reddoor baseline (what package.json asks for). */\n depsDrifted: number | null;\n depsMajorBehind: number | null;\n /** Real installed-version drift: deps behind the registry's latest, from the\n * committed lockfile (`pnpm outdated`). Null = not determined this run. */\n depsOutdated: number | null;\n /** Of {@link depsOutdated}, how many are a *major* version behind the\n * registry's latest — the \"majors available on npm\" signal, distinct from the\n * baseline-drift {@link depsMajorBehind}. Null = not determined this run. */\n depsMajorOutdated: number | null;\n securityVulnsCritical: number | null;\n securityVulnsHigh: number | null;\n securityVulnsModerate: number | null;\n securityVulnsLow: number | null;\n /** Count of consecutive nightly Renovate auto-fix dispatches for the CURRENT\n * critical/high vuln episode that have NOT yet cleared it. Owned by\n * `renovate-dispatch`: +1 per real dispatch, reset to 0 when vulns clear.\n * Null = field absent / never dispatched → reads as 0. At/above\n * AUTO_FIX_EXHAUSTED_CYCLES the vuln renders as \"auto-fix failed\". */\n securityAutoFixAttempts: number | null;\n /** ISO timestamp the security audit last ran — gates freshness of the Security Updates auto-tick\n * (clean counts only auto-tick when recent). */\n lastSecurityAuditAt: string | null;\n /** The known advisories behind the counts (severity-sorted, capped), so the dashboard can show\n * WHICH packages are vulnerable, not just the totals. null = never audited / unparseable;\n * empty array = audited clean. Written alongside the counts by the security audit. */\n securityAdvisories: SecurityAdvisory[] | null;\n /** Domain/DNS/SSL probe (the `domain` audit). `certDaysRemaining` is days until the TLS cert\n * expires (null = unresolved or no usable cert); `domainCheckedAt` is when it last ran. */\n certDaysRemaining: number | null;\n domainCheckedAt: string | null;\n /** Netlify site id — the IDENTITY the `netlify-deploy` audit needs to query the\n * Netlify API. Read-only input (operator-set in Airtable); null = not on Netlify\n * (or not wired) → that audit skips. Never derived from the URL. */\n netlifyId: string | null;\n /** Latest PRODUCTION deploy health (the `netlify-deploy` audit). `deployStatus` is\n * Netlify's deploy state lower-cased (`ready`/`error`/`building`/…), null = none / not\n * checked; `lastDeployAt` is when it deployed; `deployLogUrl` links to the deploy/log. */\n deployStatus: string | null;\n lastDeployAt: string | null;\n deployLogUrl: string | null;\n /** Deployed-URL browser probe (the `browser` audit): cross-engine render OK, mobile render OK,\n * internal-links OK + broken count, and when it last ran (one timestamp gates all three). */\n crossbrowserOk: boolean | null;\n mobileOk: boolean | null;\n linksOk: boolean | null;\n brokenLinks: number | null;\n browserCheckedAt: string | null;\n /** Per-site copy overrides (M6a). Blank → null → the DEFAULT_COPY value. */\n copyIntro: string | null;\n copyContact: string | null;\n copyFooter: string | null;\n /** Go-live timestamp, stamped when a Launch report sends (M6b). Null = not yet launched. */\n launchedAt: string | null;\n /** Optional per-site webhook (e.g. Zapier Catch Hook). When set, the ingest\n * POSTs newsletter-formType submissions here (best-effort). Blank → null. */\n newsletterWebhook: string | null;\n /** Per-site Mailchimp (newsletter). Both must be set for the direct add;\n * blank → skipped. The API key is `key-dc` format; dc is derived from it. */\n mailchimpApiKey: string | null;\n mailchimpAudienceId: string | null;\n /** GitHub-signals sweep (slice 2a), written nightly by `github-signals --fleet`. */\n renovateFailingCis: number | null;\n defaultBranchCi: string | null; // \"passing\" | \"failing\" | \"pending\" | \"none\"\n lastCommitAt: string | null;\n githubSignalsAt: string | null;\n notifyRouting: NotifyRouting | null;\n};\n\nexport function siteSlug(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n}\n\n/** Blank-trim-to-null: a non-string or whitespace-only value becomes null,\n * otherwise the trimmed string. */\nfunction trimToNull(raw: unknown): string | null {\n if (typeof raw !== \"string\") return null;\n const trimmed = raw.trim();\n return trimmed.length > 0 ? trimmed : null;\n}\n\n/**\n * Parse the Websites `Notify Routing` JSON into a NotifyRouting, defensively: a\n * non-string, blank, malformed-JSON, or wrong-shape value yields null (the site\n * then keeps default single-POC routing) — never throws. Mirrors the pipeline's\n * \"a bad Airtable string degrades quietly\" rule.\n */\nexport function parseNotifyRouting(raw: unknown): NotifyRouting | null {\n if (typeof raw !== \"string\") return null;\n const trimmed = raw.trim();\n if (!trimmed) return null;\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return null;\n }\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) return null;\n const o = parsed as Record<string, unknown>;\n if (typeof o.field !== \"string\" || !o.field.trim()) return null;\n if (!o.routes || typeof o.routes !== \"object\" || Array.isArray(o.routes)) return null;\n const routing: NotifyRouting = {\n field: o.field,\n routes: o.routes as Record<string, string | string[]>,\n };\n if (o.default !== undefined) routing.default = o.default as string | string[];\n if (Array.isArray(o.cc)) routing.cc = o.cc.filter((x): x is string => typeof x === \"string\");\n return routing;\n}\n\n/**\n * Active sites: actively-maintained or pre-launch. Single source of truth for\n * \"is this a live site\" — the operator cockpit shows these, and the fleet\n * audit/report path runs against these. A `null` status (not-yet-active) is\n * deliberately excluded.\n */\nexport const ACTIVE_STATUSES: ReadonlySet<Status> = new Set<Status>([\n \"maintenance\",\n \"launch period\",\n]);\n\nexport function isDashboardVisible(site: WebsiteRow): boolean {\n return site.status !== null && ACTIVE_STATUSES.has(site.status);\n}\n\nconst FREQUENCIES: readonly Frequency[] = [\"None\", \"Monthly\", \"Quarterly\", \"Yearly\"];\n\n/** Coerce an Airtable single-select value to a known Frequency. An unrecognized value — a\n * renamed / typo'd / whitespace option — falls back to \"None\" (its section is simply omitted)\n * rather than flowing a bogus string downstream, which the announcement would otherwise render\n * as \"We do this undefined.\" into a client email. */\nfunction toFrequency(raw: unknown): Frequency {\n return typeof raw === \"string\" && (FREQUENCIES as readonly string[]).includes(raw)\n ? (raw as Frequency)\n : \"None\";\n}\n\n// NOTE: every `f[\"...\"]` key below is a load-bearing magic string that must match\n// the live Airtable \"Websites\" column name EXACTLY — including the legacy\n// misspelling `\"maintenence freq\"`, the mixed-case `\"GA4 property ID\"`, and the\n// lowercase `\"url\"` / `\"point of contact\"`. A column rename in Airtable silently\n// returns undefined here (→ null), which degrades quietly (GA skipped, recipients\n// empty) with no error. If you rename a column, change it here too.\nexport function mapRow(rec: { id: string; fields: Record<string, unknown> }): WebsiteRow {\n const f = rec.fields;\n const attachments =\n (f[\"Header image\"] as Array<{ url: string; filename: string; type: string }> | undefined) ?? [];\n const header = attachments[0] ?? null;\n return {\n id: rec.id,\n name: String(f[\"Name\"] ?? \"\"),\n url: String(f[\"url\"] ?? \"\"),\n status: (f[\"Status\"] as Status | undefined) ?? null,\n pointOfContact: (f[\"point of contact\"] as string | undefined) ?? null,\n maintenanceFreq: toFrequency(f[\"maintenence freq\"]),\n testingFreq: toFrequency(f[\"testing freq\"]),\n maintenanceDay: (f[\"maintenance day\"] as string | undefined) ?? null,\n testingDay: (f[\"testing day\"] as string | undefined) ?? null,\n ga4PropertyId: (f[\"GA4 property ID\"] as string | undefined) ?? null,\n searchQuery: (f[\"Search query\"] as string | undefined) ?? null,\n searchConsoleProperty: (f[\"Search Console property\"] as string | undefined) ?? null,\n analyticsSoftFailAt: (f[\"Analytics soft-fail at\"] as string | undefined) ?? null,\n gitRepo: (f[\"Git repo\"] as string | undefined) ?? null,\n reportRecipientsTo: (f[\"Report recipients (To)\"] as string | undefined) ?? null,\n reportRecipientsCc: (f[\"Report recipients (CC)\"] as string | undefined) ?? null,\n acceptedWatchConditions: Array.isArray(f[\"Accepted Watch Conditions\"])\n ? (f[\"Accepted Watch Conditions\"] as string[])\n : [],\n headerImage: header,\n pScore: (f[\"pScore\"] as number | undefined) ?? null,\n rScore: (f[\"rScore\"] as number | undefined) ?? null,\n bpScore: (f[\"bpScore\"] as number | undefined) ?? null,\n seoScore: (f[\"seoScore\"] as number | undefined) ?? null,\n lastLighthouseAuditAt: (f[\"Last lighthouse audit at\"] as string | undefined) ?? null,\n a11yViolations: (f[\"A11y Violations\"] as number | undefined) ?? null,\n depsDrifted: (f[\"Deps Drifted\"] as number | undefined) ?? null,\n depsMajorBehind: (f[\"Deps Major Behind\"] as number | undefined) ?? null,\n depsOutdated: (f[\"Deps Outdated\"] as number | undefined) ?? null,\n depsMajorOutdated: (f[\"Deps Major Outdated\"] as number | undefined) ?? null,\n securityVulnsCritical: (f[\"Security Vulns Critical\"] as number | undefined) ?? null,\n securityVulnsHigh: (f[\"Security Vulns High\"] as number | undefined) ?? null,\n securityVulnsModerate: (f[\"Security Vulns Moderate\"] as number | undefined) ?? null,\n securityVulnsLow: (f[\"Security Vulns Low\"] as number | undefined) ?? null,\n securityAutoFixAttempts: (f[\"Security Auto-Fix Attempts\"] as number | undefined) ?? null,\n lastSecurityAuditAt: (f[\"Last security audit at\"] as string | undefined) ?? null,\n securityAdvisories: parseSecurityAdvisories(f[\"Security advisories\"]),\n certDaysRemaining: (f[\"Cert days remaining\"] as number | undefined) ?? null,\n domainCheckedAt: (f[\"Domain checked at\"] as string | undefined) ?? null,\n netlifyId: trimToNull(f[\"Netlify ID\"]),\n deployStatus: (f[\"Deploy status\"] as string | undefined) ?? null,\n lastDeployAt: (f[\"Last deploy at\"] as string | undefined) ?? null,\n deployLogUrl: (f[\"Deploy log URL\"] as string | undefined) ?? null,\n crossbrowserOk:\n typeof f[\"Crossbrowser OK\"] === \"boolean\" ? (f[\"Crossbrowser OK\"] as boolean) : null,\n mobileOk: typeof f[\"Mobile OK\"] === \"boolean\" ? (f[\"Mobile OK\"] as boolean) : null,\n linksOk: typeof f[\"Links OK\"] === \"boolean\" ? (f[\"Links OK\"] as boolean) : null,\n brokenLinks: typeof f[\"Broken links\"] === \"number\" ? (f[\"Broken links\"] as number) : null,\n browserCheckedAt: (f[\"Browser checked at\"] as string | undefined) ?? null,\n copyIntro: trimToNull(f[\"Copy — Intro\"]),\n copyContact: trimToNull(f[\"Copy — Contact\"]),\n copyFooter: trimToNull(f[\"Copy — Footer\"]),\n launchedAt: (f[\"Launched at\"] as string | undefined) ?? null,\n newsletterWebhook: trimToNull(f[\"Newsletter Webhook\"]),\n notifyRouting: parseNotifyRouting(f[\"Notify Routing\"]),\n mailchimpApiKey: trimToNull(f[\"Mailchimp API Key\"]),\n mailchimpAudienceId: trimToNull(f[\"Mailchimp Audience ID\"]),\n renovateFailingCis: (f[\"Renovate Failing CIs\"] as number | undefined) ?? null,\n defaultBranchCi: (f[\"Default Branch CI\"] as string | undefined) ?? null,\n lastCommitAt: (f[\"Last Commit At\"] as string | undefined) ?? null,\n githubSignalsAt: (f[\"GitHub Signals At\"] as string | undefined) ?? null,\n };\n}\n\nexport async function listWebsites(base: AirtableBase): Promise<WebsiteRow[]> {\n const out: WebsiteRow[] = [];\n await base(WEBSITES_TABLE)\n .select({ pageSize: 100 })\n .eachPage((records, fetchNextPage) => {\n for (const rec of records) out.push(mapRow({ id: rec.id, fields: rec.fields }));\n fetchNextPage();\n });\n return out;\n}\n\nexport async function getWebsiteBySlug(\n base: AirtableBase,\n slug: string,\n): Promise<WebsiteRow | null> {\n // Slugs are siteSlug() output: [a-z0-9] segments joined by single hyphens.\n // Reject anything else — it can't match a real row, and it keeps URL-supplied\n // input out of the filter formula below (formula-injection guard).\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug)) return null;\n\n // Narrow the fetch to the slug-matching row server-side instead of paging the\n // whole table per request (MEDIUM-H). The formula replicates siteSlug() on\n // {Name} — lowercase → non-alnum runs to \"-\" → strip leading/trailing \"-\" —\n // verified against the live base. maxRecords caps it (slug collisions keep the\n // prior first-match-wins behavior).\n const formula = `REGEX_REPLACE(REGEX_REPLACE(LOWER({Name}),\"[^a-z0-9]+\",\"-\"),\"^-|-$\",\"\")=${JSON.stringify(\n slug,\n )}`;\n const rows: WebsiteRow[] = [];\n await base(WEBSITES_TABLE)\n .select({ filterByFormula: formula, maxRecords: 1 })\n .eachPage((records, fetchNextPage) => {\n for (const rec of records) rows.push(mapRow({ id: rec.id, fields: rec.fields }));\n fetchNextPage();\n });\n // Confirm the match in JS too: keeps the function correct if the formula and\n // siteSlug() ever drift, and under test fakes that don't evaluate the formula.\n return rows.find((w) => siteSlug(w.name) === slug) ?? null;\n}\n\n// ── audit-field builders ─────────────────────────────────────────────────────\n// One source of truth for the column-name → value mappings of each audit type.\n// The per-audit `updateXxxCounts` writers delegate to these (for their other\n// callers), and `updateAuditFields` merges whichever are present into ONE write —\n// so the field-name magic strings live in exactly one place.\n\nexport type A11yCounts = { violations: number };\nexport type DepsCounts = {\n drifted: number;\n majorBehind: number;\n outdated: number | null;\n majorOutdated: number | null;\n};\nexport type SecurityCounts = { critical: number; high: number; moderate: number; low: number };\nexport type Severity = \"low\" | \"moderate\" | \"high\" | \"critical\";\n/** One known vulnerability behind the security counts, as persisted/rendered. */\nexport type SecurityAdvisory = {\n module: string;\n severity: Severity;\n title: string;\n cves: string[];\n url: string | null;\n /** GitHub Dependabot dependency scope (\"runtime\" | \"development\"), when known. Lets the\n * dashboard flag build-time-only (\"development\") vulns. Omitted for advisories from the\n * lockfile `pnpm audit` fallback, which carries no per-package graph scope. */\n scope?: \"runtime\" | \"development\";\n};\nexport type DomainResult = { certDaysRemaining: number | null; checkedAt: string };\nexport type NetlifyDeployResult = {\n /** Netlify deploy state lower-cased (`ready`/`error`/`building`/…), null = none. */\n state: string | null;\n /** When the latest production deploy was published/created (ISO), null = unknown. */\n deployedAt: string | null;\n /** Link to the deploy / its build log, null = unknown. */\n logUrl: string | null;\n /** When the audit last ran. */\n checkedAt: string;\n};\nexport type BrowserAuditFields = {\n desktopOk: boolean;\n mobileOk: boolean;\n linksOk: boolean;\n brokenLinks: number;\n checkedAt: string;\n};\n\nfunction scoreFields(scores: LighthouseScoreWriteback): FieldSet {\n // A null score CLEARS the cell (→ dashboard \"—\"), distinguishing a metric that\n // errored this run (e.g. NO_LCP → null performance) from a real low score. This\n // intentionally overwrites a prior value: a run that couldn't measure the metric\n // shouldn't keep showing a stale number. Writing null to clear mirrors\n // updateAnalyticsHealth; the `as FieldSet` cast is needed because airtable's\n // FieldSet type omits null.\n const fields: Record<string, number | string | null> = {\n pScore: scores.performance,\n rScore: scores.accessibility,\n bpScore: scores.bestPractices,\n seoScore: scores.seo,\n \"Last lighthouse audit at\": new Date().toISOString(),\n };\n return fields as FieldSet;\n}\n\nfunction a11yFields(counts: A11yCounts): FieldSet {\n return { \"A11y Violations\": counts.violations };\n}\n\nfunction depsFields(counts: DepsCounts): FieldSet {\n const fields: FieldSet = {\n \"Deps Drifted\": counts.drifted,\n \"Deps Major Behind\": counts.majorBehind,\n };\n // Only write the outdated count when it was determined — a null (no/stale\n // lockfile this run) must not clobber a previously-good value.\n if (counts.outdated !== null) {\n fields[\"Deps Outdated\"] = counts.outdated;\n }\n // Same null-guard for the registry-major breakdown (same source signal).\n if (counts.majorOutdated !== null) {\n fields[\"Deps Major Outdated\"] = counts.majorOutdated;\n }\n return fields;\n}\n\n/** Critical first → low last; the persist cap and the dashboard list both lean on this. */\nexport const SEVERITY_RANK: Record<Severity, number> = {\n critical: 0,\n high: 1,\n moderate: 2,\n low: 3,\n};\n/** Cap persisted advisories so the JSON field can't blow up on a badly-neglected site. */\nconst MAX_PERSISTED_ADVISORIES = 25;\n\n/** Coerce one untrusted value into a SecurityAdvisory, or null if it isn't shaped like one.\n * Shared by the read path (`parseSecurityAdvisories`) and the write path so both validate\n * identically. A missing module or unrecognized severity drops the entry entirely. */\nexport function normalizeSecurityAdvisory(raw: unknown): SecurityAdvisory | null {\n if (!raw || typeof raw !== \"object\") return null;\n const e = raw as Record<string, unknown>;\n const module = typeof e[\"module\"] === \"string\" ? (e[\"module\"] as string) : null;\n const severity = e[\"severity\"];\n if (module === null) return null;\n if (\n severity !== \"low\" &&\n severity !== \"moderate\" &&\n severity !== \"high\" &&\n severity !== \"critical\"\n )\n return null;\n const cves = Array.isArray(e[\"cves\"])\n ? (e[\"cves\"] as unknown[]).filter((c): c is string => typeof c === \"string\")\n : [];\n const scope =\n e[\"scope\"] === \"runtime\" || e[\"scope\"] === \"development\"\n ? (e[\"scope\"] as \"runtime\" | \"development\")\n : undefined;\n return {\n module,\n severity,\n title: typeof e[\"title\"] === \"string\" ? (e[\"title\"] as string) : \"\",\n cves,\n url: typeof e[\"url\"] === \"string\" ? (e[\"url\"] as string) : null,\n ...(scope ? { scope } : {}),\n };\n}\n\n/** Parse the `Security advisories` JSON cell. null when absent/blank/unparseable/not-an-array\n * (treated as \"never audited\"); a valid array (possibly empty = audited clean) otherwise. */\nexport function parseSecurityAdvisories(raw: unknown): SecurityAdvisory[] | null {\n if (typeof raw !== \"string\" || raw.trim() === \"\") return null;\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n if (!Array.isArray(parsed)) return null;\n return parsed.map(normalizeSecurityAdvisory).filter((a): a is SecurityAdvisory => a !== null);\n}\n\nfunction securityAdvisoryFields(advisories: SecurityAdvisory[]): FieldSet {\n const capped = [...advisories]\n .sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity])\n .slice(0, MAX_PERSISTED_ADVISORIES);\n // Always write — an empty array (\"[]\") clears a stale list when a once-vulnerable site goes clean.\n return { \"Security advisories\": JSON.stringify(capped) };\n}\n\nfunction securityFields(counts: SecurityCounts): FieldSet {\n return {\n \"Security Vulns Critical\": counts.critical,\n \"Security Vulns High\": counts.high,\n \"Security Vulns Moderate\": counts.moderate,\n \"Security Vulns Low\": counts.low,\n // Stamp freshness alongside the counts so the Security Updates auto-tick can require a recent\n // audit (a clean count from months ago must not silently keep ticking the box).\n \"Last security audit at\": new Date().toISOString(),\n };\n}\n\nfunction domainFields(result: DomainResult): FieldSet {\n const fields: FieldSet = { \"Domain checked at\": result.checkedAt };\n // Write the cert days UNCONDITIONALLY: a null (unresolved / no usable cert) must CLEAR any\n // previously-good value. Leaving a stale number in place — next to a freshly-stamped \"Domain\n // checked at\" — false-passes the Domain/DNS/SSL auto-tick (domainEvidence reads the stale\n // non-null value as a current pass) for a site that's actually down. null clears the cell in\n // Airtable; FieldSet's type doesn't model null, hence the cast through a widened record.\n (fields as Record<string, number | null>)[\"Cert days remaining\"] = result.certDaysRemaining;\n return fields;\n}\n\nfunction netlifyDeployFields(result: NetlifyDeployResult): FieldSet {\n // Write all three deploy fields UNCONDITIONALLY (null clears the cell): a null state /\n // deployedAt / logUrl this run means \"couldn't read it\" and must not leave a STALE value\n // sitting next to a fresh \"Deploy checked at\" — the dashboard would otherwise render a green\n // \"ready\" badge for a site whose latest deploy actually errored. FieldSet's type doesn't model\n // null, hence the cast through a widened record (same approach as domainFields).\n const fields: Record<string, string | null> = {\n \"Deploy status\": result.state,\n \"Last deploy at\": result.deployedAt,\n \"Deploy log URL\": result.logUrl,\n \"Deploy checked at\": result.checkedAt,\n };\n return fields as FieldSet;\n}\n\nfunction browserFields(r: BrowserAuditFields): FieldSet {\n return {\n \"Crossbrowser OK\": r.desktopOk,\n \"Mobile OK\": r.mobileOk,\n \"Links OK\": r.linksOk,\n \"Broken links\": r.brokenLinks,\n \"Browser checked at\": r.checkedAt,\n };\n}\n\n/**\n * Write the four Lighthouse scores + a refreshed-at timestamp onto a Websites row.\n * Called by `audit lighthouse --write-airtable` after a successful audit run, so\n * the operator never has to paste numbers manually before drafting a report.\n */\nexport async function updateScores(\n base: AirtableBase,\n recordId: string,\n scores: LighthouseScores,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: scoreFields(scores) }]);\n}\n\n/**\n * Record (or clear) the per-site GA/Search enrichment health on the `Analytics\n * soft-fail at` column. `at` is an ISO timestamp when the site's last draft had a\n * GA/Search soft-failure, or `null` to clear it after a clean enrichment. The\n * caller (drafting) swallows errors: this column is operator-added, so until it\n * exists Airtable throws UNKNOWN_FIELD_NAME — which must not break a draft.\n */\nexport async function updateAnalyticsHealth(\n base: AirtableBase,\n recordId: string,\n at: string | null,\n): Promise<void> {\n const fields: Record<string, string | null> = { \"Analytics soft-fail at\": at };\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: fields as FieldSet }]);\n}\n\n/** Persist a11y violation count. */\nexport async function updateA11yCounts(\n base: AirtableBase,\n recordId: string,\n counts: A11yCounts,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: a11yFields(counts) }]);\n}\n\n/** Persist deps drift counts (declared-range drift + real outdated installs). */\nexport async function updateDepsCounts(\n base: AirtableBase,\n recordId: string,\n counts: DepsCounts,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: depsFields(counts) }]);\n}\n\n/** Persist security vulnerability counts by severity. */\nexport async function updateSecurityCounts(\n base: AirtableBase,\n recordId: string,\n counts: SecurityCounts,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: securityFields(counts) }]);\n}\n\n/** Persist a site's auto-fix attempt counter. Its own one-field writer so the\n * nightly Renovate dispatch can update it without touching the audit's counts. */\nexport async function updateAutoFixAttempts(\n base: AirtableBase,\n recordId: string,\n attempts: number,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([\n { id: recordId, fields: { \"Security Auto-Fix Attempts\": attempts } },\n ]);\n}\n\n/**\n * Persist the code-computed next-due dates (date-only `YYYY-MM-DD`, or `null` to\n * clear) for the maintenance + testing schedules. Owned by the nightly `--due` sweep\n * so the \"next\" dates shown in Airtable come from the SAME logic as the scheduler\n * (`nextDueDate`) — no Airtable-side formula or automation. Best-effort at the call\n * site: the `Next … at` columns are operator-added, so until they exist Airtable\n * throws UNKNOWN_FIELD_NAME, which must not break the nightly draft run.\n */\nexport async function updateNextDueDates(\n base: AirtableBase,\n recordId: string,\n dates: { maintenanceAt: string | null; testingAt: string | null },\n): Promise<void> {\n const fields: Record<string, string | null> = {\n \"Next maintenance at\": dates.maintenanceAt,\n \"Next testing at\": dates.testingAt,\n };\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: fields as FieldSet }]);\n}\n\n/** Generic single-field writer for the dashboard site-details editor. The caller\n * (setSiteDetail) restricts `column` to the EDITABLE_SITE_FIELDS allowlist, so this\n * never writes an arbitrary column from request input. */\nexport async function updateSiteField(\n base: AirtableBase,\n recordId: string,\n column: string,\n value: string,\n): Promise<void> {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: { [column]: value } }]);\n}\n\n/**\n * Persist all of a single audit run's results to one Websites row in ONE atomic\n * `update()` — instead of up to four sequential updates on the same id (which left\n * a row half-written on a mid-sequence failure and quadrupled the request volume).\n * Pass only the audit slices that produced real values; each present slice is merged\n * via the SAME field mappings the per-audit writers use. Omit a slice (or pass\n * undefined) to leave those columns untouched. Returns the merged FieldSet so the\n * caller can enumerate what was written.\n */\nexport async function updateAuditFields(\n base: AirtableBase,\n recordId: string,\n audits: {\n scores?: LighthouseScoreWriteback;\n a11y?: A11yCounts;\n deps?: DepsCounts;\n security?: SecurityCounts;\n securityAdvisories?: SecurityAdvisory[];\n domain?: DomainResult;\n browser?: BrowserAuditFields;\n netlifyDeploy?: NetlifyDeployResult;\n },\n): Promise<FieldSet> {\n const fields: FieldSet = {};\n if (audits.scores) Object.assign(fields, scoreFields(audits.scores));\n if (audits.a11y) Object.assign(fields, a11yFields(audits.a11y));\n if (audits.deps) Object.assign(fields, depsFields(audits.deps));\n if (audits.security) Object.assign(fields, securityFields(audits.security));\n // Separate slice (not folded into `security`) so the advisory list and the counts can be\n // written independently, but in practice the security audit supplies both together.\n if (audits.securityAdvisories)\n Object.assign(fields, securityAdvisoryFields(audits.securityAdvisories));\n if (audits.domain) Object.assign(fields, domainFields(audits.domain));\n if (audits.browser) Object.assign(fields, browserFields(audits.browser));\n if (audits.netlifyDeploy) Object.assign(fields, netlifyDeployFields(audits.netlifyDeploy));\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n return fields;\n}\n\n/** Persist the GitHub-signals sweep onto a Websites row (slice 2a). A null\n * `lastCommitAt` is OMITTED so a not-determined-this-run value never clobbers a\n * previously-good timestamp (mirrors updateDepsCounts' outdated handling). */\nexport async function updateGitHubSignals(\n base: AirtableBase,\n recordId: string,\n signals: {\n renovateFailingCis: number;\n ciState: string;\n lastCommitAt: string | null;\n sweptAt: string;\n },\n): Promise<void> {\n const fields: FieldSet = {\n \"Renovate Failing CIs\": signals.renovateFailingCis,\n \"Default Branch CI\": signals.ciState,\n \"GitHub Signals At\": signals.sweptAt,\n };\n if (signals.lastCommitAt !== null) {\n fields[\"Last Commit At\"] = signals.lastCommitAt;\n }\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n}\n\n/** Mark a site launched: flip Status → maintenance + stamp Launched at (M6b).\n * The first code that writes Status. Called after a Launch report sends. */\nexport async function updateLaunched(\n base: AirtableBase,\n recordId: string,\n at: string,\n): Promise<void> {\n const fields: FieldSet = { Status: \"maintenance\", \"Launched at\": at };\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n}\n"],"mappings":";AAIO,IAAM,iBAAiB;AA+IvB,SAAS,SAAS,MAAsB;AAC7C,SAAO,KACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,UAAU,EAAE;AACzB;AAIA,SAAS,WAAW,KAA6B;AAC/C,MAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,QAAM,UAAU,IAAI,KAAK;AACzB,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAQO,SAAS,mBAAmB,KAAoC;AACrE,MAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI;AACJ,MAAI;AACF,aAAS,KAAK,MAAM,OAAO;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,EAAG,QAAO;AAC3E,QAAM,IAAI;AACV,MAAI,OAAO,EAAE,UAAU,YAAY,CAAC,EAAE,MAAM,KAAK,EAAG,QAAO;AAC3D,MAAI,CAAC,EAAE,UAAU,OAAO,EAAE,WAAW,YAAY,MAAM,QAAQ,EAAE,MAAM,EAAG,QAAO;AACjF,QAAM,UAAyB;AAAA,IAC7B,OAAO,EAAE;AAAA,IACT,QAAQ,EAAE;AAAA,EACZ;AACA,MAAI,EAAE,YAAY,OAAW,SAAQ,UAAU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AAQ;AAAA,IAChC,qBAAqB,QAAQ;AAAA,IAC7B,qBAAqB,QAAQ;AAAA,EAC/B;AACA,MAAI,QAAQ,iBAAiB,MAAM;AACjC,WAAO,gBAAgB,IAAI,QAAQ;AAAA,EACrC;AACA,QAAM,KAAK,cAAc,EAAE,OAAO,CAAC,EAAE,IAAI,UAAU,OAAO,CAAC,CAAC;AAC9D;AAIA,eAAsB,eACpB,MACA,UACA,IACe;AACf,QAAM,SAAmB,EAAE,QAAQ,eAAe,eAAe,GAAG;AACpE,QAAM,KAAK,cAAc,EAAE,OAAO,CAAC,EAAE,IAAI,UAAU,OAAO,CAAC,CAAC;AAC9D;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/db/migrations.ts","../src/db/migrate.ts"],"sourcesContent":["/** Ordered, append-only list of standard-SQL migration scripts. Each runs once,\n * tracked by `id` in the `_migrations` table (see migrate.ts). Statements use\n * IF NOT EXISTS so even a partial re-apply is safe. Never edit a shipped script —\n * add a new one. Every statement in a script MUST be independently idempotent:\n * `migrate.ts` runs each script via `executeMultiple`, which is NOT transactional,\n * so a mid-script failure can leave earlier statements applied and the id unrecorded\n * — a re-run then re-executes the whole script. Standard SQLite SQL only (no\n * Turso-specific syntax) so the host stays a connection-string swap. */\nexport type Migration = { id: string; sql: string };\n\nexport const MIGRATIONS: Migration[] = [\n {\n id: \"0001_init\",\n sql: `\n CREATE TABLE IF NOT EXISTS submissions (\n id TEXT PRIMARY KEY,\n submission_id INTEGER,\n site_id TEXT NOT NULL,\n form_type TEXT NOT NULL,\n name TEXT NOT NULL,\n email TEXT NOT NULL,\n phone TEXT,\n message TEXT,\n extra_fields TEXT,\n source_url TEXT,\n utm TEXT,\n submitted_at TEXT,\n status TEXT NOT NULL DEFAULT 'new',\n notify_status TEXT NOT NULL DEFAULT 'skipped',\n resend_message_id TEXT\n );\n CREATE INDEX IF NOT EXISTS idx_submissions_site_submitted\n ON submissions (site_id, submitted_at DESC);\n CREATE INDEX IF NOT EXISTS idx_submissions_status\n ON submissions (status);\n CREATE TABLE IF NOT EXISTS spam_screenouts (\n site_id TEXT NOT NULL,\n date TEXT NOT NULL,\n honeypot INTEGER NOT NULL DEFAULT 0,\n too_fast INTEGER NOT NULL DEFAULT 0,\n marked_spam INTEGER NOT NULL DEFAULT 0,\n PRIMARY KEY (site_id, date)\n );\n `,\n },\n {\n id: \"0002_fleet_events\",\n sql: `\n CREATE TABLE IF NOT EXISTS fleet_events (\n id TEXT PRIMARY KEY,\n ts TEXT NOT NULL,\n type TEXT NOT NULL,\n site_id TEXT,\n site_name TEXT,\n summary TEXT NOT NULL,\n data TEXT,\n created_at TEXT NOT NULL\n );\n CREATE INDEX IF NOT EXISTS idx_fleet_events_ts ON fleet_events (ts);\n `,\n },\n];\n","import type { Client } from \"@libsql/client\";\nimport { MIGRATIONS } from \"./migrations.js\";\n\n/** Apply every not-yet-applied migration in order against a raw libSQL client,\n * tracking applied ids in `_migrations`. Idempotent: ids already present are\n * skipped, and the DDL uses IF NOT EXISTS. Returns the ids applied this run.\n * Runs on every openDb() — cheap (one indexed SELECT) and the gate every fresh\n * Turso database needs before its first write. */\nexport async function runMigrations(client: Client): Promise<string[]> {\n await client.execute(\n \"CREATE TABLE IF NOT EXISTS _migrations (id TEXT PRIMARY KEY, applied_at TEXT NOT NULL)\",\n );\n const existing = await client.execute(\"SELECT id FROM _migrations\");\n const applied = new Set(existing.rows.map((r) => String(r.id)));\n const ran: string[] = [];\n for (const m of MIGRATIONS) {\n if (applied.has(m.id)) continue;\n await client.executeMultiple(m.sql);\n await client.execute({\n sql: \"INSERT INTO _migrations (id, applied_at) VALUES (?, ?)\",\n args: [m.id, new Date().toISOString()],\n });\n ran.push(m.id);\n }\n return ran;\n}\n"],"mappings":";AAUO,IAAM,aAA0B;AAAA,EACrC;AAAA,IACE,IAAI;AAAA,IACJ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+BP;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaP;AACF;;;ACrDA,eAAsB,cAAc,QAAmC;AACrE,QAAM,OAAO;AAAA,IACX;AAAA,EACF;AACA,QAAM,WAAW,MAAM,OAAO,QAAQ,4BAA4B;AAClE,QAAM,UAAU,IAAI,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,OAAO,EAAE,EAAE,CAAC,CAAC;AAC9D,QAAM,MAAgB,CAAC;AACvB,aAAW,KAAK,YAAY;AAC1B,QAAI,QAAQ,IAAI,EAAE,EAAE,EAAG;AACvB,UAAM,OAAO,gBAAgB,EAAE,GAAG;AAClC,UAAM,OAAO,QAAQ;AAAA,MACnB,KAAK;AAAA,MACL,MAAM,CAAC,EAAE,KAAI,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,IACvC,CAAC;AACD,QAAI,KAAK,EAAE,EAAE;AAAA,EACf;AACA,SAAO;AACT;","names":[]}
@@ -1,11 +0,0 @@
1
- import {
2
- openDb,
3
- readDbConfig
4
- } from "./chunk-PTPTVVY7.js";
5
- import "./chunk-XKKTK6WA.js";
6
- import "./chunk-6VAL7XJT.js";
7
- export {
8
- openDb,
9
- readDbConfig
10
- };
11
- //# sourceMappingURL=client-C2GOZD2D.js.map
@@ -1,7 +0,0 @@
1
- import {
2
- runMigrations
3
- } from "./chunk-XKKTK6WA.js";
4
- export {
5
- runMigrations
6
- };
7
- //# sourceMappingURL=migrate-BFOG2OCP.js.map
File without changes