@reddoorla/maintenance 0.96.0 → 0.97.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/README.md +5 -6
- package/dist/{announce-45HVP4J4.js → announce-5ZD2SBGD.js} +39 -31
- package/dist/announce-5ZD2SBGD.js.map +1 -0
- package/dist/attachments-JFGFQRXQ.js +10 -0
- package/dist/{blux-RUFMNOUJ.js → blux-NXQLMS4W.js} +5 -5
- package/dist/{bump-deps-EL3TKMIL.js → bump-deps-775VLDYB.js} +6 -6
- package/dist/{chunk-IMYL67JV.js → chunk-3RLDX3Q2.js} +5 -5
- package/dist/{chunk-CA6ADGOC.js → chunk-6PGXKN6F.js} +2 -2
- package/dist/{chunk-Y5BVR4HW.js → chunk-6THEZQLA.js} +3 -3
- package/dist/chunk-ASLDCWBF.js +41 -0
- package/dist/chunk-ASLDCWBF.js.map +1 -0
- package/dist/{chunk-DVJNYPFR.js → chunk-AYDQQBNG.js} +2 -2
- package/dist/{chunk-GEUC5VGM.js → chunk-BINFZQ2T.js} +49 -4
- package/dist/chunk-BINFZQ2T.js.map +1 -0
- package/dist/{chunk-72FJZ6LO.js → chunk-DRNZVORX.js} +26 -22
- package/dist/chunk-DRNZVORX.js.map +1 -0
- package/dist/{chunk-SHGIDTYF.js → chunk-DYTYPKFN.js} +2 -2
- package/dist/{chunk-NVLREB5R.js → chunk-EN6CTBUN.js} +7 -7
- package/dist/{chunk-ZH5LOQET.js → chunk-FHFXJ3EM.js} +7 -5
- package/dist/chunk-FHFXJ3EM.js.map +1 -0
- package/dist/{chunk-H445EH33.js → chunk-FP6HOW6J.js} +10 -7
- package/dist/chunk-FP6HOW6J.js.map +1 -0
- package/dist/{chunk-RRE74VWI.js → chunk-HSMN35LU.js} +2 -2
- package/dist/chunk-ICSRWW5Q.js +148 -0
- package/dist/chunk-ICSRWW5Q.js.map +1 -0
- package/dist/{chunk-XG2A6GIG.js → chunk-IDBPII6G.js} +4 -4
- package/dist/{chunk-XG2A6GIG.js.map → chunk-IDBPII6G.js.map} +1 -1
- package/dist/{chunk-T76MA2FH.js → chunk-IOTOOTII.js} +12 -1
- package/dist/{chunk-T76MA2FH.js.map → chunk-IOTOOTII.js.map} +1 -1
- package/dist/{chunk-ECDJDHKT.js → chunk-JHJNNJLG.js} +2 -2
- package/dist/{chunk-XY7YV2YQ.js → chunk-L3S3QZXL.js} +2 -2
- package/dist/{chunk-XED2DNAI.js → chunk-LAG6IP7Y.js} +7 -7
- package/dist/{chunk-P4A6D6HO.js → chunk-LDHRIQUW.js} +32 -18
- package/dist/chunk-LDHRIQUW.js.map +1 -0
- package/dist/{chunk-UIITN37J.js → chunk-LF2TJN4X.js} +2 -2
- package/dist/chunk-LF2TJN4X.js.map +1 -0
- package/dist/{chunk-SQ4FSNYL.js → chunk-LUF52EIY.js} +2 -2
- package/dist/{chunk-MZZDMBDT.js → chunk-LZMAG73U.js} +19 -19
- package/dist/chunk-LZMAG73U.js.map +1 -0
- package/dist/{chunk-6INOBNRO.js → chunk-MMSMZC7S.js} +2 -2
- package/dist/{chunk-CGQZFQAY.js → chunk-MVKNU4QD.js} +2 -3
- package/dist/chunk-MVKNU4QD.js.map +1 -0
- package/dist/{chunk-62YWOFVN.js → chunk-PARKXDXI.js} +3 -3
- package/dist/{chunk-62YWOFVN.js.map → chunk-PARKXDXI.js.map} +1 -1
- package/dist/{chunk-44SDGPGQ.js → chunk-PZZ6HM5T.js} +3 -3
- package/dist/chunk-RQJFGK3A.js +51 -0
- package/dist/chunk-RQJFGK3A.js.map +1 -0
- package/dist/{chunk-KN52PM63.js → chunk-TC4GANMX.js} +47 -149
- package/dist/chunk-TC4GANMX.js.map +1 -0
- package/dist/{chunk-F3JWOPTG.js → chunk-TEMQPSCM.js} +45 -105
- package/dist/chunk-TEMQPSCM.js.map +1 -0
- package/dist/{chunk-4UTJ4G6P.js → chunk-TJLKWQOX.js} +2 -2
- package/dist/{chunk-VEIIUCYL.js → chunk-TV76A6GN.js} +2 -2
- package/dist/{chunk-D3CTOCUR.js → chunk-TVZ6QCOE.js} +3 -3
- package/dist/{chunk-3EA43S3R.js → chunk-U2ZI6G7H.js} +12 -12
- package/dist/chunk-UPE6D4AT.js +69 -0
- package/dist/chunk-UPE6D4AT.js.map +1 -0
- package/dist/{chunk-OTEVKRAH.js → chunk-VMGHQUTV.js} +7 -16
- package/dist/chunk-VMGHQUTV.js.map +1 -0
- package/dist/chunk-VQMAAQ5M.js +53 -0
- package/dist/chunk-VQMAAQ5M.js.map +1 -0
- package/dist/{chunk-EASYCD6F.js → chunk-WMF5S2MB.js} +1 -1
- package/dist/{chunk-EASYCD6F.js.map → chunk-WMF5S2MB.js.map} +1 -1
- package/dist/{chunk-37B4LVB3.js → chunk-X56LAKPR.js} +3 -3
- package/dist/chunk-X56LAKPR.js.map +1 -0
- package/dist/{chunk-IY6256GK.js → chunk-YJBSB4LP.js} +6 -1
- package/dist/chunk-YJBSB4LP.js.map +1 -0
- package/dist/{chunk-EQQ4H6L3.js → chunk-YXWBM26P.js} +2 -2
- package/dist/cli/bin.js +92 -50
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/audit.d.ts +33 -3
- package/dist/cli/commands/audit.js +25 -22
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/client-DGTO65WB.js +11 -0
- package/dist/{convert-to-pnpm-4DON7IFS.js → convert-to-pnpm-KLWA53N5.js} +6 -6
- package/dist/{db-5K4CDEGJ.js → db-II5WAK4D.js} +13 -13
- package/dist/{digest-5AJGWS33.js → digest-CWKK2DMR.js} +28 -27
- package/dist/digest-CWKK2DMR.js.map +1 -0
- package/dist/{digest-collectors-MC5NWEUA.js → digest-collectors-CYTN2EUX.js} +15 -12
- package/dist/ensure-site-2QZHFVQ3.js +70 -0
- package/dist/ensure-site-2QZHFVQ3.js.map +1 -0
- package/dist/ensure-site-JEKV2ODE.js +105 -0
- package/dist/ensure-site-JEKV2ODE.js.map +1 -0
- package/dist/{ensure-site-XESZHZEB.js → ensure-site-OO4UPWNQ.js} +19 -42
- package/dist/ensure-site-OO4UPWNQ.js.map +1 -0
- package/dist/fleet-events-CkOZpMVC.d.ts +435 -0
- package/dist/{fleet-state-GJWGKTLD.js → fleet-state-RJROYXKO.js} +17 -7
- package/dist/{forms-notify-target-4NPLX2UG.js → forms-notify-target-X6UEOI2M.js} +17 -13
- package/dist/forms-notify-target-X6UEOI2M.js.map +1 -0
- package/dist/{github-signals-DMU74SAX.js → github-signals-QIRTHHET.js} +20 -15
- package/dist/github-signals-QIRTHHET.js.map +1 -0
- package/dist/{header-image-BRTOLHJF.js → header-image-H7ZJAV26.js} +13 -17
- package/dist/header-image-H7ZJAV26.js.map +1 -0
- package/dist/{health-endpoint-UCLMSSCN.js → health-endpoint-BJ6BKRHF.js} +7 -7
- package/dist/{health-mirror-ONRT4DQ5.js → health-mirror-KU3G7V2Y.js} +10 -10
- package/dist/{import-airtable-IIK2QUUF.js → import-airtable-UBF5GYAL.js} +3 -3
- package/dist/index.d.ts +102 -494
- package/dist/index.js +60 -49
- package/dist/index.js.map +1 -1
- package/dist/{init-3LMZTCVD.js → init-GOWDA5QS.js} +15 -15
- package/dist/{launch-XTDMC6LD.js → launch-7N3X2MXB.js} +36 -34
- package/dist/launch-7N3X2MXB.js.map +1 -0
- package/dist/lighthouse-airtable-M45OPVRV.js +14 -0
- package/dist/{chunk-IHHAYXKY.js → match-harness-GBCDSVPS.js} +70 -4
- package/dist/match-harness-GBCDSVPS.js.map +1 -0
- package/dist/migrate-XZ7U5DFC.js +7 -0
- package/dist/notify-K3WVH3DM.js +1 -1
- package/dist/{onboard-CZYBWVWH.js → onboard-JQQIMQW7.js} +6 -6
- package/dist/{orchestrate-TGDFGY52.js → orchestrate-L2A5BZFY.js} +13 -10
- package/dist/parity-2JGVUCZD.js +14 -0
- package/dist/{preflight-POZZI3GN.js → preflight-O7Q6FWHU.js} +35 -11
- package/dist/preflight-O7Q6FWHU.js.map +1 -0
- package/dist/{prismic-ci-AHY5ULJR.js → prismic-ci-NAPWOXXD.js} +11 -11
- package/dist/prismic-ci-NAPWOXXD.js.map +1 -0
- package/dist/{prismic-models-URYGODNY.js → prismic-models-LL6ORTQ2.js} +19 -16
- package/dist/prismic-models-LL6ORTQ2.js.map +1 -0
- package/dist/{prospect-audit-AJEE3Z4L.js → prospect-audit-FMPGQIRQ.js} +2 -2
- package/dist/{protection-audit-3J3UEOVT.js → protection-audit-YXJKFU6O.js} +3 -3
- package/dist/{protection-audit-3J3UEOVT.js.map → protection-audit-YXJKFU6O.js.map} +1 -1
- package/dist/recipes/sync-configs.js +3 -3
- package/dist/{render-from-row-65DC6ZP3.js → render-from-row-75JTED2Z.js} +6 -4
- package/dist/{renovate-dispatch-ONJMBUHJ.js → renovate-dispatch-2IHAZDVA.js} +13 -8
- package/dist/{renovate-dispatch-ONJMBUHJ.js.map → renovate-dispatch-2IHAZDVA.js.map} +1 -1
- package/dist/{report-RC5LGPU3.js → report-IAHXN5CW.js} +102 -58
- package/dist/report-IAHXN5CW.js.map +1 -0
- package/dist/{report-mirror-KKZZ6RMZ.js → report-mirror-4QM57LMS.js} +28 -10
- package/dist/report-mirror-4QM57LMS.js.map +1 -0
- package/dist/roster-GDNSIRAK.js +19 -0
- package/dist/roster-GDNSIRAK.js.map +1 -0
- package/dist/{self-updating-RKKIYNV4.js → self-updating-ZUWPGYUP.js} +7 -7
- package/dist/{selftest-AFLR7YV7.js → selftest-G4W3LIBQ.js} +21 -17
- package/dist/{selftest-AFLR7YV7.js.map → selftest-G4W3LIBQ.js.map} +1 -1
- package/dist/site-create-ZU3ACBTO.js +45 -0
- package/dist/site-create-ZU3ACBTO.js.map +1 -0
- package/dist/{site-mirror-H2FYMN55.js → site-mirror-WR7ACXOV.js} +10 -10
- package/dist/site-mirror-WR7ACXOV.js.map +1 -0
- package/dist/{smoke-suite-BWHR3XX5.js → smoke-suite-WAUPI6EJ.js} +7 -7
- package/dist/{submissions-II5J35QM.js → submissions-2SHCFOKD.js} +11 -6
- package/dist/submissions-2SHCFOKD.js.map +1 -0
- package/dist/{svelte-codemods-QWGIRNN6.js → svelte-codemods-VOLOKKFI.js} +6 -6
- package/dist/{sync-NKPDCMYW.js → sync-F4USL4K5.js} +6 -6
- package/dist/{sync-configs-HGLQV55H.js → sync-configs-OXSWKVZ2.js} +6 -6
- package/dist/turso-KQKBBQCK.js +24 -0
- package/dist/turso-KQKBBQCK.js.map +1 -0
- package/dist/{upgrade-WZ44IARG.js → upgrade-EVAL3JTO.js} +6 -6
- package/dist/util/git.d.ts +1 -1
- package/dist/util/git.js +1 -1
- package/dist/{websites-6DHIHJ2D.js → websites-Y6FN2XFD.js} +26 -21
- package/dist/{write-audits-to-airtable-BIK6LNVC.js → write-audits-to-airtable-TI3JMWSY.js} +6 -4
- package/package.json +1 -1
- package/dist/airtable-SJV4ZSMS.js +0 -9
- package/dist/announce-45HVP4J4.js.map +0 -1
- package/dist/attachments-NLZIJ5NU.js +0 -9
- package/dist/chunk-37B4LVB3.js.map +0 -1
- package/dist/chunk-72FJZ6LO.js.map +0 -1
- package/dist/chunk-74QRWE6G.js +0 -53
- package/dist/chunk-74QRWE6G.js.map +0 -1
- package/dist/chunk-CGQZFQAY.js.map +0 -1
- package/dist/chunk-F3JWOPTG.js.map +0 -1
- package/dist/chunk-GEUC5VGM.js.map +0 -1
- package/dist/chunk-H445EH33.js.map +0 -1
- package/dist/chunk-IHHAYXKY.js.map +0 -1
- package/dist/chunk-IY6256GK.js.map +0 -1
- package/dist/chunk-KN52PM63.js.map +0 -1
- package/dist/chunk-MZZDMBDT.js.map +0 -1
- package/dist/chunk-OTEVKRAH.js.map +0 -1
- package/dist/chunk-P4A6D6HO.js.map +0 -1
- package/dist/chunk-UIITN37J.js.map +0 -1
- package/dist/chunk-YFAXOD7Z.js +0 -42
- package/dist/chunk-YFAXOD7Z.js.map +0 -1
- package/dist/chunk-ZH5LOQET.js.map +0 -1
- package/dist/client-L7NAUG6J.js +0 -11
- package/dist/digest-5AJGWS33.js.map +0 -1
- package/dist/ensure-site-XESZHZEB.js.map +0 -1
- package/dist/fleet-events-cF2Om88w.d.ts +0 -24
- package/dist/forms-notify-target-4NPLX2UG.js.map +0 -1
- package/dist/github-signals-DMU74SAX.js.map +0 -1
- package/dist/header-image-BRTOLHJF.js.map +0 -1
- package/dist/launch-XTDMC6LD.js.map +0 -1
- package/dist/lighthouse-airtable-3NOFB42B.js +0 -12
- package/dist/match-harness-OW45CB5H.js +0 -77
- package/dist/match-harness-OW45CB5H.js.map +0 -1
- package/dist/migrate-NE3DUMTM.js +0 -7
- package/dist/parity-AEKYSLN6.js +0 -14
- package/dist/preflight-POZZI3GN.js.map +0 -1
- package/dist/prismic-ci-AHY5ULJR.js.map +0 -1
- package/dist/prismic-models-URYGODNY.js.map +0 -1
- package/dist/report-RC5LGPU3.js.map +0 -1
- package/dist/report-mirror-KKZZ6RMZ.js.map +0 -1
- package/dist/site-mirror-H2FYMN55.js.map +0 -1
- package/dist/submissions-II5J35QM.js.map +0 -1
- package/dist/write-audits-to-airtable-BIK6LNVC.js.map +0 -1
- /package/dist/{airtable-SJV4ZSMS.js.map → attachments-JFGFQRXQ.js.map} +0 -0
- /package/dist/{blux-RUFMNOUJ.js.map → blux-NXQLMS4W.js.map} +0 -0
- /package/dist/{bump-deps-EL3TKMIL.js.map → bump-deps-775VLDYB.js.map} +0 -0
- /package/dist/{chunk-IMYL67JV.js.map → chunk-3RLDX3Q2.js.map} +0 -0
- /package/dist/{chunk-CA6ADGOC.js.map → chunk-6PGXKN6F.js.map} +0 -0
- /package/dist/{chunk-Y5BVR4HW.js.map → chunk-6THEZQLA.js.map} +0 -0
- /package/dist/{chunk-DVJNYPFR.js.map → chunk-AYDQQBNG.js.map} +0 -0
- /package/dist/{chunk-SHGIDTYF.js.map → chunk-DYTYPKFN.js.map} +0 -0
- /package/dist/{chunk-NVLREB5R.js.map → chunk-EN6CTBUN.js.map} +0 -0
- /package/dist/{chunk-RRE74VWI.js.map → chunk-HSMN35LU.js.map} +0 -0
- /package/dist/{chunk-ECDJDHKT.js.map → chunk-JHJNNJLG.js.map} +0 -0
- /package/dist/{chunk-XY7YV2YQ.js.map → chunk-L3S3QZXL.js.map} +0 -0
- /package/dist/{chunk-XED2DNAI.js.map → chunk-LAG6IP7Y.js.map} +0 -0
- /package/dist/{chunk-SQ4FSNYL.js.map → chunk-LUF52EIY.js.map} +0 -0
- /package/dist/{chunk-6INOBNRO.js.map → chunk-MMSMZC7S.js.map} +0 -0
- /package/dist/{chunk-44SDGPGQ.js.map → chunk-PZZ6HM5T.js.map} +0 -0
- /package/dist/{chunk-4UTJ4G6P.js.map → chunk-TJLKWQOX.js.map} +0 -0
- /package/dist/{chunk-VEIIUCYL.js.map → chunk-TV76A6GN.js.map} +0 -0
- /package/dist/{chunk-D3CTOCUR.js.map → chunk-TVZ6QCOE.js.map} +0 -0
- /package/dist/{chunk-3EA43S3R.js.map → chunk-U2ZI6G7H.js.map} +0 -0
- /package/dist/{chunk-EQQ4H6L3.js.map → chunk-YXWBM26P.js.map} +0 -0
- /package/dist/{attachments-NLZIJ5NU.js.map → client-DGTO65WB.js.map} +0 -0
- /package/dist/{convert-to-pnpm-4DON7IFS.js.map → convert-to-pnpm-KLWA53N5.js.map} +0 -0
- /package/dist/{db-5K4CDEGJ.js.map → db-II5WAK4D.js.map} +0 -0
- /package/dist/{client-L7NAUG6J.js.map → digest-collectors-CYTN2EUX.js.map} +0 -0
- /package/dist/{digest-collectors-MC5NWEUA.js.map → fleet-state-RJROYXKO.js.map} +0 -0
- /package/dist/{health-endpoint-UCLMSSCN.js.map → health-endpoint-BJ6BKRHF.js.map} +0 -0
- /package/dist/{health-mirror-ONRT4DQ5.js.map → health-mirror-KU3G7V2Y.js.map} +0 -0
- /package/dist/{fleet-state-GJWGKTLD.js.map → import-airtable-UBF5GYAL.js.map} +0 -0
- /package/dist/{init-3LMZTCVD.js.map → init-GOWDA5QS.js.map} +0 -0
- /package/dist/{import-airtable-IIK2QUUF.js.map → lighthouse-airtable-M45OPVRV.js.map} +0 -0
- /package/dist/{lighthouse-airtable-3NOFB42B.js.map → migrate-XZ7U5DFC.js.map} +0 -0
- /package/dist/{onboard-CZYBWVWH.js.map → onboard-JQQIMQW7.js.map} +0 -0
- /package/dist/{migrate-NE3DUMTM.js.map → orchestrate-L2A5BZFY.js.map} +0 -0
- /package/dist/{orchestrate-TGDFGY52.js.map → parity-2JGVUCZD.js.map} +0 -0
- /package/dist/{prospect-audit-AJEE3Z4L.js.map → prospect-audit-FMPGQIRQ.js.map} +0 -0
- /package/dist/{parity-AEKYSLN6.js.map → render-from-row-75JTED2Z.js.map} +0 -0
- /package/dist/{self-updating-RKKIYNV4.js.map → self-updating-ZUWPGYUP.js.map} +0 -0
- /package/dist/{smoke-suite-BWHR3XX5.js.map → smoke-suite-WAUPI6EJ.js.map} +0 -0
- /package/dist/{svelte-codemods-QWGIRNN6.js.map → svelte-codemods-VOLOKKFI.js.map} +0 -0
- /package/dist/{sync-NKPDCMYW.js.map → sync-F4USL4K5.js.map} +0 -0
- /package/dist/{sync-configs-HGLQV55H.js.map → sync-configs-OXSWKVZ2.js.map} +0 -0
- /package/dist/{upgrade-WZ44IARG.js.map → upgrade-EVAL3JTO.js.map} +0 -0
- /package/dist/{render-from-row-65DC6ZP3.js.map → websites-Y6FN2XFD.js.map} +0 -0
- /package/dist/{websites-6DHIHJ2D.js.map → write-audits-to-airtable-TI3JMWSY.js.map} +0 -0
|
@@ -1,87 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SEVERITY_RANK,
|
|
3
|
+
canonicalizeStatus,
|
|
4
|
+
parseNotifyRouting,
|
|
5
|
+
parseSecurityAdvisories,
|
|
6
|
+
siteSlug,
|
|
7
|
+
toFrequency,
|
|
8
|
+
toPrismicModelsVerdict,
|
|
9
|
+
toVerdict,
|
|
10
|
+
trimToNull
|
|
11
|
+
} from "./chunk-ICSRWW5Q.js";
|
|
12
|
+
import {
|
|
13
|
+
skipsAirtableShadow
|
|
14
|
+
} from "./chunk-RQJFGK3A.js";
|
|
15
|
+
|
|
1
16
|
// src/reports/airtable/site-status.ts
|
|
2
|
-
var CANONICAL_STATUSES = [
|
|
3
|
-
"building",
|
|
4
|
-
"launching",
|
|
5
|
-
"maintained",
|
|
6
|
-
"hosted-only",
|
|
7
|
-
"external",
|
|
8
|
-
"archived"
|
|
9
|
-
];
|
|
10
|
-
var CANONICAL_SET = new Set(CANONICAL_STATUSES);
|
|
11
|
-
function canonicalizeStatus(raw) {
|
|
12
|
-
if (typeof raw !== "string") return null;
|
|
13
|
-
return raw;
|
|
14
|
-
}
|
|
15
17
|
function toAirtableStatus(s) {
|
|
16
18
|
return s;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
// src/reports/airtable/websites.ts
|
|
20
22
|
var WEBSITES_TABLE = "Websites";
|
|
21
|
-
function siteSlug(name) {
|
|
22
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
23
|
-
}
|
|
24
|
-
function trimToNull(raw) {
|
|
25
|
-
if (typeof raw !== "string") return null;
|
|
26
|
-
const trimmed = raw.trim();
|
|
27
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
28
|
-
}
|
|
29
|
-
function parseNotifyRouting(raw) {
|
|
30
|
-
if (typeof raw !== "string") return null;
|
|
31
|
-
const trimmed = raw.trim();
|
|
32
|
-
if (!trimmed) return null;
|
|
33
|
-
let parsed;
|
|
34
|
-
try {
|
|
35
|
-
parsed = JSON.parse(trimmed);
|
|
36
|
-
} catch {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
40
|
-
const o = parsed;
|
|
41
|
-
if (typeof o.field !== "string" || !o.field.trim()) return null;
|
|
42
|
-
if (!o.routes || typeof o.routes !== "object" || Array.isArray(o.routes)) return null;
|
|
43
|
-
const routing = {
|
|
44
|
-
field: o.field,
|
|
45
|
-
routes: o.routes
|
|
46
|
-
};
|
|
47
|
-
if (o.default !== void 0) routing.default = o.default;
|
|
48
|
-
if (Array.isArray(o.cc)) routing.cc = o.cc.filter((x) => typeof x === "string");
|
|
49
|
-
return routing;
|
|
50
|
-
}
|
|
51
|
-
var ACTIVE_STATUSES = /* @__PURE__ */ new Set(["maintained", "launching"]);
|
|
52
|
-
function isDashboardVisible(site) {
|
|
53
|
-
return site.status !== null && ACTIVE_STATUSES.has(site.status);
|
|
54
|
-
}
|
|
55
|
-
var PRE_LAUNCH_STATUSES = /* @__PURE__ */ new Set(["building", "launching"]);
|
|
56
|
-
function isPreLaunch(status) {
|
|
57
|
-
return status !== null && PRE_LAUNCH_STATUSES.has(status);
|
|
58
|
-
}
|
|
59
|
-
var KNOWN_STATUSES = new Set(CANONICAL_STATUSES);
|
|
60
|
-
var ARCHIVED_STATUSES = /* @__PURE__ */ new Set(["archived"]);
|
|
61
|
-
function isArchivedStatus(status) {
|
|
62
|
-
return status !== null && ARCHIVED_STATUSES.has(status);
|
|
63
|
-
}
|
|
64
|
-
function isUnrecognizedStatus(status) {
|
|
65
|
-
return status !== null && !KNOWN_STATUSES.has(status);
|
|
66
|
-
}
|
|
67
|
-
var FREQUENCIES = ["None", "Monthly", "Quarterly", "Yearly"];
|
|
68
|
-
function toFrequency(raw, context) {
|
|
69
|
-
if (typeof raw !== "string") return "None";
|
|
70
|
-
const trimmed = raw.trim();
|
|
71
|
-
if (FREQUENCIES.includes(trimmed)) return trimmed;
|
|
72
|
-
if (trimmed !== "") {
|
|
73
|
-
console.warn(
|
|
74
|
-
`\u26A0 ${context}: unrecognized frequency '${raw}' \u2014 treating as None (not scheduling); fix the Airtable value`
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return "None";
|
|
78
|
-
}
|
|
79
|
-
function toVerdict(raw) {
|
|
80
|
-
return raw === "pass" || raw === "fail" ? raw : null;
|
|
81
|
-
}
|
|
82
|
-
function toPrismicModelsVerdict(raw) {
|
|
83
|
-
return raw === "pass" || raw === "fail" || raw === "unknown" ? raw : null;
|
|
84
|
-
}
|
|
85
23
|
function mapRow(rec) {
|
|
86
24
|
const f = rec.fields;
|
|
87
25
|
const name = String(f["Name"] ?? "");
|
|
@@ -224,51 +162,7 @@ function depsFields(counts) {
|
|
|
224
162
|
}
|
|
225
163
|
return fields;
|
|
226
164
|
}
|
|
227
|
-
var SEVERITY_RANK = {
|
|
228
|
-
critical: 0,
|
|
229
|
-
high: 1,
|
|
230
|
-
moderate: 2,
|
|
231
|
-
low: 3
|
|
232
|
-
};
|
|
233
165
|
var MAX_PERSISTED_ADVISORIES = 25;
|
|
234
|
-
function normalizeSecurityAdvisory(raw) {
|
|
235
|
-
if (!raw || typeof raw !== "object") return null;
|
|
236
|
-
const e = raw;
|
|
237
|
-
const module = typeof e["module"] === "string" ? e["module"] : null;
|
|
238
|
-
const severity = e["severity"];
|
|
239
|
-
if (module === null) return null;
|
|
240
|
-
if (severity !== "low" && severity !== "moderate" && severity !== "high" && severity !== "critical")
|
|
241
|
-
return null;
|
|
242
|
-
const cves = Array.isArray(e["cves"]) ? e["cves"].filter((c) => typeof c === "string") : [];
|
|
243
|
-
const scope = e["scope"] === "runtime" || e["scope"] === "development" ? e["scope"] : void 0;
|
|
244
|
-
const relationship = e["relationship"] === "direct" || e["relationship"] === "transitive" ? e["relationship"] : void 0;
|
|
245
|
-
return {
|
|
246
|
-
module,
|
|
247
|
-
severity,
|
|
248
|
-
title: typeof e["title"] === "string" ? e["title"] : "",
|
|
249
|
-
cves,
|
|
250
|
-
url: typeof e["url"] === "string" ? e["url"] : null,
|
|
251
|
-
...scope ? { scope } : {},
|
|
252
|
-
...relationship ? { relationship } : {}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function allActionableVulnsTransitive(advisories) {
|
|
256
|
-
if (!advisories) return false;
|
|
257
|
-
const actionable = advisories.filter((a) => a.severity === "critical" || a.severity === "high");
|
|
258
|
-
if (actionable.length === 0) return false;
|
|
259
|
-
return actionable.every((a) => a.relationship === "transitive");
|
|
260
|
-
}
|
|
261
|
-
function parseSecurityAdvisories(raw) {
|
|
262
|
-
if (typeof raw !== "string" || raw.trim() === "") return null;
|
|
263
|
-
let parsed;
|
|
264
|
-
try {
|
|
265
|
-
parsed = JSON.parse(raw);
|
|
266
|
-
} catch {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
if (!Array.isArray(parsed)) return null;
|
|
270
|
-
return parsed.map(normalizeSecurityAdvisory).filter((a) => a !== null);
|
|
271
|
-
}
|
|
272
166
|
function securityAdvisoryFields(advisories) {
|
|
273
167
|
const capped = [...advisories].sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity]).slice(0, MAX_PERSISTED_ADVISORIES);
|
|
274
168
|
return { "Security advisories": JSON.stringify(capped) };
|
|
@@ -342,6 +236,7 @@ function formE2eFields(r) {
|
|
|
342
236
|
return fields;
|
|
343
237
|
}
|
|
344
238
|
async function updateScores(base, recordId, scores) {
|
|
239
|
+
if (skipsAirtableShadow("updateScores", recordId)) return;
|
|
345
240
|
await base(WEBSITES_TABLE).update([{ id: recordId, fields: scoreFields(scores) }]);
|
|
346
241
|
}
|
|
347
242
|
function analyticsHealthFields(at) {
|
|
@@ -350,21 +245,28 @@ function analyticsHealthFields(at) {
|
|
|
350
245
|
}
|
|
351
246
|
async function updateAnalyticsHealth(base, recordId, at) {
|
|
352
247
|
const fields = analyticsHealthFields(at);
|
|
353
|
-
|
|
248
|
+
if (!skipsAirtableShadow("updateAnalyticsHealth", recordId)) {
|
|
249
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
250
|
+
}
|
|
354
251
|
return fields;
|
|
355
252
|
}
|
|
356
253
|
async function updateA11yCounts(base, recordId, counts) {
|
|
254
|
+
if (skipsAirtableShadow("updateA11yCounts", recordId)) return;
|
|
357
255
|
await base(WEBSITES_TABLE).update([{ id: recordId, fields: a11yFields(counts) }]);
|
|
358
256
|
}
|
|
359
257
|
async function updateDepsCounts(base, recordId, counts) {
|
|
258
|
+
if (skipsAirtableShadow("updateDepsCounts", recordId)) return;
|
|
360
259
|
await base(WEBSITES_TABLE).update([{ id: recordId, fields: depsFields(counts) }]);
|
|
361
260
|
}
|
|
362
261
|
async function updateSecurityCounts(base, recordId, counts) {
|
|
262
|
+
if (skipsAirtableShadow("updateSecurityCounts", recordId)) return;
|
|
363
263
|
await base(WEBSITES_TABLE).update([{ id: recordId, fields: securityFields(counts) }]);
|
|
364
264
|
}
|
|
365
265
|
async function updateAutoFixAttempts(base, recordId, attempts) {
|
|
366
266
|
const fields = { "Security Auto-Fix Attempts": attempts };
|
|
367
|
-
|
|
267
|
+
if (!skipsAirtableShadow("updateAutoFixAttempts", recordId)) {
|
|
268
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
269
|
+
}
|
|
368
270
|
return fields;
|
|
369
271
|
}
|
|
370
272
|
async function updateNextDueDates(base, recordId, dates) {
|
|
@@ -372,12 +274,19 @@ async function updateNextDueDates(base, recordId, dates) {
|
|
|
372
274
|
"Next maintenance at": dates.maintenanceAt,
|
|
373
275
|
"Next testing at": dates.testingAt
|
|
374
276
|
};
|
|
375
|
-
|
|
277
|
+
if (!skipsAirtableShadow("updateNextDueDates", recordId)) {
|
|
278
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
279
|
+
}
|
|
376
280
|
return fields;
|
|
377
281
|
}
|
|
378
282
|
async function updateSiteField(base, recordId, column, value) {
|
|
283
|
+
if (skipsAirtableShadow("updateSiteField", recordId)) return;
|
|
379
284
|
await base(WEBSITES_TABLE).update([{ id: recordId, fields: { [column]: value } }]);
|
|
380
285
|
}
|
|
286
|
+
async function updateSiteFields(base, recordId, fields) {
|
|
287
|
+
if (skipsAirtableShadow("updateSiteFields", recordId)) return;
|
|
288
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
289
|
+
}
|
|
381
290
|
async function updateAuditFields(base, recordId, audits) {
|
|
382
291
|
const fields = {};
|
|
383
292
|
if (audits.scores) Object.assign(fields, scoreFields(audits.scores));
|
|
@@ -392,7 +301,9 @@ async function updateAuditFields(base, recordId, audits) {
|
|
|
392
301
|
if (audits.functionHealth) Object.assign(fields, functionHealthFields(audits.functionHealth));
|
|
393
302
|
if (audits.smoke) Object.assign(fields, smokeFields(audits.smoke));
|
|
394
303
|
if (audits.formE2e) Object.assign(fields, formE2eFields(audits.formE2e));
|
|
395
|
-
|
|
304
|
+
if (!skipsAirtableShadow("updateAuditFields", recordId)) {
|
|
305
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
306
|
+
}
|
|
396
307
|
return fields;
|
|
397
308
|
}
|
|
398
309
|
async function updateGitHubSignals(base, recordId, signals) {
|
|
@@ -404,7 +315,9 @@ async function updateGitHubSignals(base, recordId, signals) {
|
|
|
404
315
|
if (signals.lastCommitAt !== null) {
|
|
405
316
|
fields["Last Commit At"] = signals.lastCommitAt;
|
|
406
317
|
}
|
|
407
|
-
|
|
318
|
+
if (!skipsAirtableShadow("updateGitHubSignals", recordId)) {
|
|
319
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
320
|
+
}
|
|
408
321
|
return fields;
|
|
409
322
|
}
|
|
410
323
|
var MAX_PRISMIC_DETAIL_CHARS = 5e4;
|
|
@@ -423,41 +336,25 @@ async function updatePrismicModels(base, recordId, models) {
|
|
|
423
336
|
"Prismic Models Checked At": models.checkedAt,
|
|
424
337
|
"Prismic Models Drift": models.detail === null ? null : truncatePrismicDetail(models.detail)
|
|
425
338
|
};
|
|
426
|
-
|
|
339
|
+
if (!skipsAirtableShadow("updatePrismicModels", recordId)) {
|
|
340
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
341
|
+
}
|
|
427
342
|
return fields;
|
|
428
343
|
}
|
|
429
344
|
async function updateLaunched(base, recordId, at) {
|
|
430
345
|
const fields = { Status: toAirtableStatus("maintained"), "Launched at": at };
|
|
431
|
-
|
|
346
|
+
if (!skipsAirtableShadow("updateLaunched", recordId)) {
|
|
347
|
+
await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);
|
|
348
|
+
}
|
|
432
349
|
return fields;
|
|
433
350
|
}
|
|
434
351
|
|
|
435
352
|
export {
|
|
436
|
-
CANONICAL_STATUSES,
|
|
437
|
-
canonicalizeStatus,
|
|
438
353
|
toAirtableStatus,
|
|
439
354
|
WEBSITES_TABLE,
|
|
440
|
-
siteSlug,
|
|
441
|
-
trimToNull,
|
|
442
|
-
parseNotifyRouting,
|
|
443
|
-
ACTIVE_STATUSES,
|
|
444
|
-
isDashboardVisible,
|
|
445
|
-
PRE_LAUNCH_STATUSES,
|
|
446
|
-
isPreLaunch,
|
|
447
|
-
KNOWN_STATUSES,
|
|
448
|
-
ARCHIVED_STATUSES,
|
|
449
|
-
isArchivedStatus,
|
|
450
|
-
isUnrecognizedStatus,
|
|
451
|
-
toFrequency,
|
|
452
|
-
toVerdict,
|
|
453
|
-
toPrismicModelsVerdict,
|
|
454
355
|
mapRow,
|
|
455
356
|
listWebsites,
|
|
456
357
|
getWebsiteBySlug,
|
|
457
|
-
SEVERITY_RANK,
|
|
458
|
-
normalizeSecurityAdvisory,
|
|
459
|
-
allActionableVulnsTransitive,
|
|
460
|
-
parseSecurityAdvisories,
|
|
461
358
|
updateScores,
|
|
462
359
|
analyticsHealthFields,
|
|
463
360
|
updateAnalyticsHealth,
|
|
@@ -467,9 +364,10 @@ export {
|
|
|
467
364
|
updateAutoFixAttempts,
|
|
468
365
|
updateNextDueDates,
|
|
469
366
|
updateSiteField,
|
|
367
|
+
updateSiteFields,
|
|
470
368
|
updateAuditFields,
|
|
471
369
|
updateGitHubSignals,
|
|
472
370
|
updatePrismicModels,
|
|
473
371
|
updateLaunched
|
|
474
372
|
};
|
|
475
|
-
//# sourceMappingURL=chunk-
|
|
373
|
+
//# sourceMappingURL=chunk-TC4GANMX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reports/airtable/site-status.ts","../src/reports/airtable/websites.ts"],"sourcesContent":["/**\n * The Airtable WRITE seam for the site-status vocabulary.\n *\n * The vocabulary itself — `Status`, `CANONICAL_STATUSES`, `canonicalizeStatus`,\n * `isCanonicalStatus` — moved to `src/fleet/site-status.ts` in #539 Phase 6 step 1\n * (#646): `canonicalizeStatus` runs on every Turso lead read, so it cannot live in\n * the directory Phase 6 deletes. It is re-exported here so existing Airtable-layer\n * imports keep resolving unchanged; only `toAirtableStatus`, which exists solely\n * to write an Airtable cell, stays behind and goes with the layer.\n */\nimport type { Status } from \"../../fleet/site-status.js\";\n\nexport {\n CANONICAL_STATUSES,\n canonicalizeStatus,\n isCanonicalStatus,\n type Status,\n} from \"../../fleet/site-status.js\";\n\n/**\n * The string to WRITE into the Airtable \"Status\" cell for a canonical status.\n * Every writer of a CODE-OWNED status routes through here.\n *\n * Since stage 3 this is the identity: Airtable's single-select carries exactly\n * the six canonical options, so the canonical name IS the option name. It is\n * kept as a named seam rather than inlined because it is the one place a future\n * divergence between the code's vocabulary and Airtable's would be expressed,\n * and because every writer already routes through it — inlining would scatter\n * that decision across `ensureSite`, `updateLaunched`, `forms-notify-target`\n * and the dashboard status save.\n *\n * The stage-1/2 hazard it used to carry is GONE: while a many-to-one map\n * existed, `toAirtableStatus(canonicalizeStatus(x))` was not the identity —\n * feeding it \"legacy\" yielded \"deprecated\", silently writing an option the\n * operator never asked for. Both functions are now the identity, so that trap\n * no longer exists. `forms-notify-target --restore` still writes operator text\n * verbatim (`restoreCell`) rather than routing through here, which remains the\n * right shape: operator free text is not a canonical status.\n */\nexport function toAirtableStatus(s: Status): string {\n return s;\n}\n","import type { FieldSet } from \"airtable\";\nimport type { AirtableBase } from \"./client.js\";\nimport type { LighthouseScores, LighthouseScoreWriteback } from \"../types.js\";\nimport { canonicalizeStatus, toAirtableStatus } from \"./site-status.js\";\nimport { skipsAirtableShadow } from \"../../fleet/site-id.js\";\nimport {\n siteSlug,\n trimToNull,\n parseNotifyRouting,\n toFrequency,\n toVerdict,\n toPrismicModelsVerdict,\n SEVERITY_RANK,\n parseSecurityAdvisories,\n type WebsiteRow,\n type PrismicModelsVerdict,\n type SecurityAdvisory,\n} from \"../../fleet/site-row.js\";\n\n// The site-row model and its pure coercers live in src/fleet/site-row.ts since\n// #539 Phase 6 step 1 (#646) — they run on Turso reads too. Re-exported so every\n// existing import from this module resolves unchanged.\nexport {\n siteSlug,\n trimToNull,\n parseNotifyRouting,\n ACTIVE_STATUSES,\n isDashboardVisible,\n PRE_LAUNCH_STATUSES,\n isPreLaunch,\n KNOWN_STATUSES,\n ARCHIVED_STATUSES,\n isArchivedStatus,\n isUnrecognizedStatus,\n toFrequency,\n toVerdict,\n toPrismicModelsVerdict,\n SEVERITY_RANK,\n normalizeSecurityAdvisory,\n allActionableVulnsTransitive,\n parseSecurityAdvisories,\n type Frequency,\n type Status,\n type NotifyRouting,\n type WebsiteRow,\n type PrismicModelsVerdict,\n type Severity,\n type SecurityAdvisory,\n} from \"../../fleet/site-row.js\";\n\nexport const WEBSITES_TABLE = \"Websites\";\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 name = String(f[\"Name\"] ?? \"\");\n const attachments =\n (f[\"Header image\"] as Array<{ url: string; filename: string; type: string }> | undefined) ?? [];\n // LAST, not first: Airtable's uploadAttachment APPENDS, so the newest file is the\n // tail. Reading [0] served the OLDEST forever whenever a field held more than one —\n // which is how a pre-clean-plate header reached a live announcement (#574/#577).\n // The prune keeps these fields at a single entry, so this is normally the same\n // element; preferring the tail means a field that stacks again still serves the\n // CURRENT header instead of silently reverting to the first one ever uploaded.\n const header = attachments.at(-1) ?? null;\n return {\n id: rec.id,\n name,\n url: String(f[\"url\"] ?? \"\"),\n status: canonicalizeStatus(f[\"Status\"]),\n statusRaw: (f[\"Status\"] as string | undefined) ?? null,\n pointOfContact: (f[\"point of contact\"] as string | undefined) ?? null,\n maintenanceFreq: toFrequency(f[\"maintenence freq\"], `${name} maintenance`),\n testingFreq: toFrequency(f[\"testing freq\"], `${name} testing`),\n maintenanceFreqRaw: (f[\"maintenence freq\"] as string | undefined) ?? null,\n testingFreqRaw: (f[\"testing freq\"] as string | undefined) ?? null,\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 // Tolerate BOTH the current Multiple-Select array shape AND a delimited long-text\n // string (comma/newline separated), so the field can migrate to a plain text column\n // with no code change here. Trim + drop empties either way. The array branch also\n // validates ELEMENT types: a collaborator/attachment-shaped field passes\n // Array.isArray with OBJECT elements, and an unchecked cast would make assignTier's\n // `.trim()` throw — one misconfigured row must not 500 the whole cockpit build.\n acceptedWatchConditions: Array.isArray(f[\"Accepted Watch Conditions\"])\n ? (f[\"Accepted Watch Conditions\"] as unknown[])\n .filter((x): x is string => typeof x === \"string\")\n .map((s) => s.trim())\n .filter(Boolean)\n : typeof f[\"Accepted Watch Conditions\"] === \"string\"\n ? (f[\"Accepted Watch Conditions\"] as string)\n .split(/[\\n,]/)\n .map((s) => s.trim())\n .filter(Boolean)\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 deployCheckedAt: (f[\"Deploy checked at\"] as string | undefined) ?? null,\n functionHealth: toVerdict(f[\"Function health\"]),\n cmsReachable: toVerdict(f[\"CMS Reachable\"]),\n turnstileWidget: toVerdict(f[\"Turnstile widget\"]),\n functionHealthCheckedAt: (f[\"Function health checked at\"] 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 reachableOk: toVerdict(f[\"Uptime Reachable\"]),\n titleMetaOk: toVerdict(f[\"Titles & Meta OK\"]),\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 notifyRoutingRaw: trimToNull(f[\"Notify Routing\"]),\n mailchimpApiKey: trimToNull(f[\"Mailchimp API Key\"]),\n mailchimpAudienceId: trimToNull(f[\"Mailchimp Audience ID\"]),\n // Boolean guard like crossbrowserOk, but defaults FALSE (not null) when absent: an\n // unset/unknown column must read as \"not required\" so the feature ships dark.\n requireTurnstile:\n typeof f[\"Require Turnstile\"] === \"boolean\" ? (f[\"Require Turnstile\"] as boolean) : false,\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 smokeOk: toVerdict(f[\"Smoke OK\"]),\n lastSmokeAt: (f[\"Last Smoke At\"] as string | undefined) ?? null,\n formE2eOk: toVerdict(f[\"Form E2E OK\"]),\n formE2eCheckedAt: (f[\"Form E2E checked at\"] as string | undefined) ?? null,\n prismicModels: toPrismicModelsVerdict(f[\"Prismic Models\"]),\n prismicModelsCheckedAt: (f[\"Prismic Models Checked At\"] as string | undefined) ?? null,\n prismicModelsDrift: (f[\"Prismic Models Drift\"] as string | undefined) ?? null,\n prismicAckUntil: (f[\"Prismic Ack Until\"] as string | undefined) ?? null,\n nextMaintenanceAt: (f[\"Next maintenance at\"] as string | undefined) ?? null,\n nextTestingAt: (f[\"Next testing 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 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 reachableOk: boolean;\n titleMetaOk: boolean;\n brokenLinks: number;\n checkedAt: string;\n};\nexport type FunctionHealthResult = {\n /** `pass` when `/health` answered `ok:true`, else `fail`. Never null — the audit only produces a\n * result when it ran (a self-skip carries no details, so this extractor isn't reached). */\n functionHealth: \"pass\" | \"fail\";\n /** From the same body's `prismic` sub-status (R2.2): `\"ok\"` → `\"pass\"`, `\"error\"` → `\"fail\"`.\n * Anything else (`\"skipped\"` — a placeholder repo with no live Prismic — or a raw `null`, e.g.\n * the synthetic \"deployed but erroring\" body) → `null`: the CMS probe never actually ran, so it\n * must NOT red CMS reachability for a site that simply hasn't wired Prismic yet. */\n cmsReachable: \"pass\" | \"fail\" | null;\n /** From the same body's `forms.turnstile` boolean: `true` → `\"pass\"`, `false` → `\"fail\"`.\n * A missing/null `forms` block (older site package, or the synthetic \"deployed but\n * erroring\" body) → `null` — the widget state is simply unknown, not a failure. */\n turnstileWidget: \"pass\" | \"fail\" | null;\n /** When the audit ran (freshness stamp for all three verdicts). */\n checkedAt: string;\n};\n\nexport type SmokeResult = { ok: \"pass\" | \"fail\"; checkedAt: string };\n\n/** `ok` null clears the single-select cell (n/a — no contact form); a fresh\n * `checkedAt` still stamps the row so Plan 4 reads null+fresh as n/a. */\nexport type FormE2eResult = {\n /** Absent = no FORM verdict this run; the column and its stamp are left alone. */\n ok?: \"pass\" | \"fail\" | null;\n checkedAt: string;\n /** The `Turnstile widget` verdict, owned by this audit since #689 — see\n * `formE2eFields`. Absent = no opinion this run (preserve); null = looked and\n * could not tell (clear). */\n turnstileWidget?: \"pass\" | \"fail\" | null;\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/** Cap persisted advisories so the JSON field can't blow up on a badly-neglected site. */\nconst MAX_PERSISTED_ADVISORIES = 25;\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 // NEW tri-state single-select verdicts (empty = never ran). The browser audit only produces a\n // BrowserAuditFields when it actually ran (hasBrowserResult guards on checkedAt), so each verdict\n // is always a concrete boolean here — serialize true→\"pass\", false→\"fail\". The existing boolean\n // columns above are deliberately NOT retrofitted (out of scope).\n \"Uptime Reachable\": r.reachableOk ? \"pass\" : \"fail\",\n \"Titles & Meta OK\": r.titleMetaOk ? \"pass\" : \"fail\",\n };\n}\n\nfunction functionHealthFields(r: FunctionHealthResult): FieldSet {\n // \"CMS Reachable\" is written UNCONDITIONALLY (null clears the cell): the audit only supplies a\n // result when it ran, but `cmsReachable` itself can legitimately be null this run (R2.2 — the CMS\n // probe never actually happened, e.g. a placeholder repo with no live Prismic). Clearing rather\n // than leaving a stale pass/fail sitting next to a freshly-stamped checked-at is what keeps a\n // placeholder site from showing a stale CMS verdict. FieldSet's type doesn't model null, hence the\n // cast through a widened record (same approach as domainFields/netlifyDeployFields).\n // \"Function health\" is never null — the audit only writes when it ran, so it's always a concrete\n // pass/fail. Written SEPARATELY from \"Deploy status\" so the Netlify build state keeps its own\n // meaning.\n const fields: Record<string, string | null> = {\n \"Function health\": r.functionHealth,\n \"CMS Reachable\": r.cmsReachable,\n // \"Turnstile widget\" is NOT written here any more. /health only knows whether\n // PUBLIC_TURNSTILE_SITE_KEY is a non-empty string — it never contacts\n // Cloudflare — so this audit cannot tell a working widget from one whose\n // hostname is not on the allowlist (#689). The column is owned by `form-e2e`,\n // which drives a real browser at the real widget and can. Writing it from\n // both would also be unreachable by the red alarm: this sweep runs at 08:00,\n // the digest reads at 09:23, form-e2e writes at 10:15 — a browser verdict\n // would be cleared by this null every morning before the alarm ever saw it.\n \"Function health checked at\": r.checkedAt,\n };\n return fields as FieldSet;\n}\n\nfunction smokeFields(r: SmokeResult): FieldSet {\n // The verdict is stored as the literal single-select option (\"pass\"/\"fail\"), so\n // no boolean→string coercion is needed. A skip never reaches here (it produces no\n // SmokeResult), so this column is only ever written with a concrete verdict.\n return { \"Smoke OK\": r.ok, \"Last Smoke At\": r.checkedAt };\n}\n\nfunction formE2eFields(r: FormE2eResult): FieldSet {\n // `ok` is already the single-select value (\"pass\"/\"fail\") or null. Writing null\n // CLEARS the cell (→ n/a, distinguished from \"never ran\" by the fresh checked-at\n // stamped alongside). FieldSet's type omits null, hence the widened-record cast\n // (same approach as domainFields / netlifyDeployFields).\n const fields: Record<string, string | null> = {};\n // The FORM verdict and its stamp move together, and only when this run produced\n // one. A run with no form verdict (the testMode-undeclared skip) writes neither,\n // which preserves both — refreshing the stamp while preserving a stale verdict\n // would present months-old evidence as fresh to auto-tick's `formsEvidence`.\n if (r.ok !== undefined) {\n fields[\"Form E2E OK\"] = r.ok;\n fields[\"Form E2E checked at\"] = r.checkedAt;\n }\n // The Turnstile verdict rides this audit because it is the only one that opens\n // a browser on the live form, where the site's REAL widget renders (the probe\n // never swaps the sitekey). Written only when this run had an opinion: the key\n // is ABSENT on a run that could not look, which preserves the prior verdict,\n // and an explicit null is the distinct \"looked, could not tell\" that clears it.\n if (r.turnstileWidget !== undefined) fields[\"Turnstile widget\"] = r.turnstileWidget;\n return fields as FieldSet;\n}\n\n// ————————————————————————— Websites writers (the Airtable shadow) —————————————————————————\n//\n// Every writer below addresses a Websites row by SITE id, and every one opens with\n// `skipsAirtableShadow` (#646 step 3). Sites created since the Turso-native\n// `ensure-site` carry `site_<ULID>` ids that Airtable has never held, so a write\n// for one is skipped on purpose — with an `AIRTABLE_SHADOW skipped=non-rec-id` line — instead of\n// 404ing. The FieldSet-returning writers still RETURN their payload when they\n// skip: callers feed it to the authoritative Turso write, which must not depend on\n// the shadow. tests/reports/airtable/shadow-skip-site-ids.test.ts fails for any\n// exported `update*` writer that is not covered.\n\n/**\n * Write the four Lighthouse scores + a refreshed-at timestamp onto a Websites row.\n * Called by `audit lighthouse --write-back` 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 if (skipsAirtableShadow(\"updateScores\", recordId)) return;\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: scoreFields(scores) }]);\n}\n\n/** The `Analytics soft-fail at` FieldSet, as a pure function of the stamp (#782).\n * Drafting mirrors THIS into Turso first — the authoritative store — and only\n * then shadows it to Airtable, so the two writes carry one payload and the\n * shadow's field gap cannot cost the real write. `at` is an ISO timestamp when\n * the site's last draft had a GA/Search soft-failure, `null` after a clean\n * enrichment (the signal self-heals). */\nexport function analyticsHealthFields(at: string | null): FieldSet {\n const fields: Record<string, string | null> = { \"Analytics soft-fail at\": at };\n return fields as FieldSet;\n}\n\n/**\n * Record (or clear) the per-site GA/Search enrichment health on the `Analytics\n * soft-fail at` column. The caller (drafting) swallows errors: this column is\n * operator-added and — checked against the base on 2026-09-15 — has never\n * existed there, so Airtable throws UNKNOWN_FIELD_NAME on every call. That is\n * why drafting writes Turso BEFORE this (#782): Turso is authoritative and the\n * Airtable layer is the shadow Phase 6 (#646) deletes.\n */\nexport async function updateAnalyticsHealth(\n base: AirtableBase,\n recordId: string,\n at: string | null,\n): Promise<FieldSet> {\n const fields = analyticsHealthFields(at);\n if (!skipsAirtableShadow(\"updateAnalyticsHealth\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n }\n // Same contract as updateNextDueDates/updateAuditFields: the #539 Turso mirror\n // consumes the returned FieldSet, so the two writes cannot diverge.\n return fields;\n}\n\n/** Persist a11y violation count. */\nexport async function updateA11yCounts(\n base: AirtableBase,\n recordId: string,\n counts: A11yCounts,\n): Promise<void> {\n if (skipsAirtableShadow(\"updateA11yCounts\", recordId)) return;\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 if (skipsAirtableShadow(\"updateDepsCounts\", recordId)) return;\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 if (skipsAirtableShadow(\"updateSecurityCounts\", recordId)) return;\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<FieldSet> {\n const fields: FieldSet = { \"Security Auto-Fix Attempts\": attempts };\n if (!skipsAirtableShadow(\"updateAutoFixAttempts\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n }\n // Returned for the #539 Turso mirror — see updateNextDueDates.\n return fields;\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<FieldSet> {\n const fields: Record<string, string | null> = {\n \"Next maintenance at\": dates.maintenanceAt,\n \"Next testing at\": dates.testingAt,\n };\n if (!skipsAirtableShadow(\"updateNextDueDates\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: fields as FieldSet }]);\n }\n // Same contract as updateAuditFields/updateGitHubSignals: the Phase 3 Turso\n // mirror consumes the returned FieldSet, so the two writes cannot diverge.\n return fields as FieldSet;\n}\n\n/** The cell shapes the site editor can write. Airtable rejects a string written\n * to a checkbox or a multi-select, so `Require Turnstile` (boolean) and\n * `Accepted Watch Conditions` (string[]) travel as themselves rather than being\n * stringified at the boundary and coerced back later. */\nexport type AirtableCellValue = string | boolean | string[];\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: AirtableCellValue,\n): Promise<void> {\n if (skipsAirtableShadow(\"updateSiteField\", recordId)) return;\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: { [column]: value } }]);\n}\n\n/** The multi-column shadow for `ensure-site`'s fill-blanks / `--name` path on a\n * pre-existing `rec` site (#646 step 3): ONE update, so a resumed bootstrap that\n * fills `url` and retitles `Name` cannot leave the shadow half-written. Turso is\n * the store that decides what to write; this only repeats it. */\nexport async function updateSiteFields(\n base: AirtableBase,\n recordId: string,\n fields: Record<string, string>,\n): Promise<void> {\n if (skipsAirtableShadow(\"updateSiteFields\", recordId)) return;\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: fields as FieldSet }]);\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 functionHealth?: FunctionHealthResult;\n smoke?: SmokeResult;\n formE2e?: FormE2eResult;\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 if (audits.functionHealth) Object.assign(fields, functionHealthFields(audits.functionHealth));\n if (audits.smoke) Object.assign(fields, smokeFields(audits.smoke));\n if (audits.formE2e) Object.assign(fields, formE2eFields(audits.formE2e));\n if (!skipsAirtableShadow(\"updateAuditFields\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n }\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).\n * Returns the FieldSet it wrote — the Phase 3 Turso mirror consumes the same\n * payload, so the two writes cannot diverge (updateAuditFields' contract). */\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<FieldSet> {\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 if (!skipsAirtableShadow(\"updateGitHubSignals\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n }\n return fields;\n}\n\n/** One site's Prismic model verdict, as the sweep hands it to the record.\n *\n * `verdict: null` is a REQUEST TO BLANK the cell, not \"leave it alone\" — see\n * {@link updatePrismicModels}. There is no way to express \"leave it alone\" here\n * on purpose. */\nexport type PrismicModelsWriteback = {\n verdict: PrismicModelsVerdict | null;\n checkedAt: string;\n /** The finding, the failure reason, or the skip reason — whichever this\n * verdict has. `null` clears the column. */\n detail: string | null;\n};\n\n/** Airtable's long-text cells hold ~100k characters and the sweep's report runs\n * long on a badly drifted site (an empty Prismic repository sorts every local\n * model into `toCreate`, with a line per field). Half the cell is the budget;\n * the rest is headroom for whatever renders it. */\nconst MAX_PRISMIC_DETAIL_CHARS = 50_000;\n\n/**\n * Shorten a detail that will not fit, and SAY SO — with the original length, so\n * nobody mistakes the remainder for the whole. Same reasoning as the PR comment's\n * truncation notice: a report that was shortened without saying it was shortened\n * is a report that looks complete and is not.\n *\n * The cut is by code unit, so it can land between the halves of an astral\n * character; a lone surrogate is not valid text and can make Airtable reject the\n * write, losing the entire finding to a cosmetic detail.\n */\nfunction truncatePrismicDetail(detail: string): string {\n if (detail.length <= MAX_PRISMIC_DETAIL_CHARS) return detail;\n const notice =\n `\\n…[truncated: this report is ${detail.length} characters and only the first` +\n ` ${MAX_PRISMIC_DETAIL_CHARS} are kept here. Run \\`reddoor-maint prismic-models\\` in the` +\n ` site — dry is the default — for the whole thing.]`;\n let head = detail.slice(0, MAX_PRISMIC_DETAIL_CHARS - notice.length);\n const last = head.charCodeAt(head.length - 1);\n if (last >= 0xd800 && last <= 0xdbff) head = head.slice(0, -1);\n return head + notice;\n}\n\n/**\n * Persist one site's Prismic model verdict.\n *\n * ALL THREE COLUMNS, ALWAYS, in one update — including when the verdict is\n * `unknown` or blank. That is the whole design: the alternative (\"only write a\n * verdict when we have one\") leaves the PREVIOUS verdict standing for a site\n * whose check has since started failing, and a stale `pass` is never aged out by\n * anything — the digest's freshness gate only examines failures. So the record\n * always says what the last run actually established, and `checkedAt` always\n * says when. See {@link WebsiteRow.prismicModels} for the four states.\n *\n * Best-effort AT THE CALL SITE: `Prismic Models*` are operator-added columns, so\n * until they exist Airtable throws UNKNOWN_FIELD_NAME. The nightly sweep must\n * survive that and collect it — same contract as `updateNextDueDates`.\n *\n * Takes a non-null `AirtableBase`, like every other writer here: whether to write\n * at all is the caller's decision, and this repo keeps \"do no writes\" separate\n * from \"do no IO\" one layer up.\n */\nexport async function updatePrismicModels(\n base: AirtableBase,\n recordId: string,\n models: PrismicModelsWriteback,\n): Promise<FieldSet> {\n const fields: Record<string, string | null> = {\n \"Prismic Models\": models.verdict,\n \"Prismic Models Checked At\": models.checkedAt,\n \"Prismic Models Drift\": models.detail === null ? null : truncatePrismicDetail(models.detail),\n };\n if (!skipsAirtableShadow(\"updatePrismicModels\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields: fields as FieldSet }]);\n }\n // Returned for the #539 Turso mirror — see updateNextDueDates.\n return fields as FieldSet;\n}\n\n/** Mark a site launched: flip Status → maintained + stamp Launched at (M6b).\n * The first code that writes Status. Called after a Launch report sends.\n * Routed through `toAirtableStatus`, so it still writes Airtable's \"maintenance\"\n * option until the stage-2 switch flips. */\nexport async function updateLaunched(\n base: AirtableBase,\n recordId: string,\n at: string,\n): Promise<FieldSet> {\n const fields: FieldSet = { Status: toAirtableStatus(\"maintained\"), \"Launched at\": at };\n if (!skipsAirtableShadow(\"updateLaunched\", recordId)) {\n await base(WEBSITES_TABLE).update([{ id: recordId, fields }]);\n }\n // Returned for the #539 Turso mirror. BOTH columns travel together on purpose:\n // mirroring them as two UPDATEs would open a window where Turso says a site is\n // maintained but never launched.\n return fields;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCO,SAAS,iBAAiB,GAAmB;AAClD,SAAO;AACT;;;ACSO,IAAM,iBAAiB;AAQvB,SAAS,OAAO,KAAkE;AACvF,QAAM,IAAI,IAAI;AACd,QA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UAAU,OAAO,CAAC,CAAC;AAAA,EAC9D;AAIA,SAAO;AACT;","names":[]}
|
|
@@ -1,19 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseAutoEvidence,
|
|
3
|
+
toReportType
|
|
4
|
+
} from "./chunk-ASLDCWBF.js";
|
|
1
5
|
import {
|
|
2
6
|
ALL_CHECKLIST_FIELDS
|
|
3
7
|
} from "./chunk-VAD43MOR.js";
|
|
8
|
+
import {
|
|
9
|
+
skipsAirtableShadow
|
|
10
|
+
} from "./chunk-RQJFGK3A.js";
|
|
4
11
|
|
|
5
|
-
// src/reports/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function toReportType(raw) {
|
|
9
|
-
if (raw && REPORT_TYPES.includes(raw)) return raw;
|
|
10
|
-
if (raw)
|
|
11
|
-
console.warn(`[reports] unknown Report type ${JSON.stringify(raw)} \u2014 treating as Maintenance`);
|
|
12
|
-
return "Maintenance";
|
|
12
|
+
// src/reports/draft-fields.ts
|
|
13
|
+
function ymd(d) {
|
|
14
|
+
return d.toISOString().slice(0, 10);
|
|
13
15
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
+
function draftFields(input) {
|
|
17
|
+
const fields = {
|
|
18
|
+
"Report ID": input.reportId,
|
|
19
|
+
Site: [input.siteId],
|
|
20
|
+
"Report type": input.reportType,
|
|
21
|
+
"Period start": ymd(input.periodStart),
|
|
22
|
+
"Period end": ymd(input.periodEnd),
|
|
23
|
+
"Completed on": ymd(input.completedOn),
|
|
24
|
+
"Lighthouse \u2014 Performance": input.lighthouse.performance,
|
|
25
|
+
"Lighthouse \u2014 Accessibility": input.lighthouse.accessibility,
|
|
26
|
+
"Lighthouse \u2014 Best Practices": input.lighthouse.bestPractices,
|
|
27
|
+
"Lighthouse \u2014 SEO": input.lighthouse.seo,
|
|
28
|
+
"Delivery status": "pending"
|
|
29
|
+
};
|
|
30
|
+
if (input.lastTestedDate) fields["Last tested date"] = ymd(input.lastTestedDate);
|
|
31
|
+
if (input.gaUsersCurrent !== void 0) fields["GA users (period)"] = input.gaUsersCurrent;
|
|
32
|
+
if (input.gaUsersPrevious !== void 0) fields["GA users (prev period)"] = input.gaUsersPrevious;
|
|
33
|
+
if (input.searchFoundPage1 !== void 0) fields["Search found page 1"] = input.searchFoundPage1;
|
|
34
|
+
if (input.searchPosition !== void 0) fields["Search position"] = input.searchPosition;
|
|
35
|
+
if (input.period !== void 0) fields["Period"] = input.period;
|
|
36
|
+
if (input.subjectOverride !== void 0) fields["Subject override"] = input.subjectOverride;
|
|
37
|
+
for (const field of input.checklistTicks ?? []) fields[field] = true;
|
|
38
|
+
if (input.autoEvidence && Object.keys(input.autoEvidence).length > 0) {
|
|
39
|
+
fields["Checklist auto-evidence"] = JSON.stringify(input.autoEvidence);
|
|
40
|
+
}
|
|
41
|
+
return fields;
|
|
16
42
|
}
|
|
43
|
+
|
|
44
|
+
// src/reports/airtable/reports.ts
|
|
45
|
+
var REPORTS_TABLE = "Reports";
|
|
17
46
|
function mapRow(rec) {
|
|
18
47
|
const f = rec.fields;
|
|
19
48
|
const linkSites = f["Site"] ?? [];
|
|
@@ -51,29 +80,6 @@ function mapRow(rec) {
|
|
|
51
80
|
overrideAt: f["Override at"] ?? null
|
|
52
81
|
};
|
|
53
82
|
}
|
|
54
|
-
function parseAutoEvidence(raw) {
|
|
55
|
-
if (typeof raw !== "string" || !raw.trim()) return null;
|
|
56
|
-
let parsed;
|
|
57
|
-
try {
|
|
58
|
-
parsed = JSON.parse(raw);
|
|
59
|
-
} catch {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
63
|
-
const out = {};
|
|
64
|
-
for (const [field, v] of Object.entries(parsed)) {
|
|
65
|
-
if (!v || typeof v !== "object") continue;
|
|
66
|
-
const o = v;
|
|
67
|
-
if (o.result !== "pass" && o.result !== "fail" && o.result !== "unknown" && o.result !== "n/a")
|
|
68
|
-
continue;
|
|
69
|
-
out[field] = {
|
|
70
|
-
result: o.result,
|
|
71
|
-
checkedAt: typeof o.checkedAt === "string" ? o.checkedAt : null,
|
|
72
|
-
note: typeof o.note === "string" ? o.note : ""
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return Object.keys(out).length > 0 ? out : null;
|
|
76
|
-
}
|
|
77
83
|
function lighthouseFromFields(f) {
|
|
78
84
|
const p = f["Lighthouse \u2014 Performance"];
|
|
79
85
|
const a = f["Lighthouse \u2014 Accessibility"];
|
|
@@ -83,48 +89,12 @@ function lighthouseFromFields(f) {
|
|
|
83
89
|
return null;
|
|
84
90
|
return { performance: p, accessibility: a, bestPractices: b, seo: s };
|
|
85
91
|
}
|
|
86
|
-
function ymd(d) {
|
|
87
|
-
return d.toISOString().slice(0, 10);
|
|
88
|
-
}
|
|
89
|
-
function escapeFormulaString(s) {
|
|
90
|
-
return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
91
|
-
}
|
|
92
|
-
async function createDraft(base, input, mirror) {
|
|
93
|
-
const fields = {
|
|
94
|
-
"Report ID": input.reportId,
|
|
95
|
-
Site: [input.siteId],
|
|
96
|
-
"Report type": input.reportType,
|
|
97
|
-
"Period start": ymd(input.periodStart),
|
|
98
|
-
"Period end": ymd(input.periodEnd),
|
|
99
|
-
"Completed on": ymd(input.completedOn),
|
|
100
|
-
"Lighthouse \u2014 Performance": input.lighthouse.performance,
|
|
101
|
-
"Lighthouse \u2014 Accessibility": input.lighthouse.accessibility,
|
|
102
|
-
"Lighthouse \u2014 Best Practices": input.lighthouse.bestPractices,
|
|
103
|
-
"Lighthouse \u2014 SEO": input.lighthouse.seo,
|
|
104
|
-
"Delivery status": "pending"
|
|
105
|
-
};
|
|
106
|
-
if (input.lastTestedDate) fields["Last tested date"] = ymd(input.lastTestedDate);
|
|
107
|
-
if (input.gaUsersCurrent !== void 0) fields["GA users (period)"] = input.gaUsersCurrent;
|
|
108
|
-
if (input.gaUsersPrevious !== void 0) fields["GA users (prev period)"] = input.gaUsersPrevious;
|
|
109
|
-
if (input.searchFoundPage1 !== void 0) fields["Search found page 1"] = input.searchFoundPage1;
|
|
110
|
-
if (input.searchPosition !== void 0) fields["Search position"] = input.searchPosition;
|
|
111
|
-
if (input.period !== void 0) fields["Period"] = input.period;
|
|
112
|
-
if (input.subjectOverride !== void 0) fields["Subject override"] = input.subjectOverride;
|
|
113
|
-
for (const field of input.checklistTicks ?? []) fields[field] = true;
|
|
114
|
-
if (input.autoEvidence && Object.keys(input.autoEvidence).length > 0) {
|
|
115
|
-
fields["Checklist auto-evidence"] = JSON.stringify(input.autoEvidence);
|
|
116
|
-
}
|
|
117
|
-
const created = await base(REPORTS_TABLE).create([{ fields }]);
|
|
118
|
-
const rec = created[0];
|
|
119
|
-
if (!rec) throw new Error("Airtable create returned no records");
|
|
120
|
-
const raw = { id: rec.id, fields: rec.fields };
|
|
121
|
-
if (mirror) await mirror(raw);
|
|
122
|
-
return mapRow(raw);
|
|
123
|
-
}
|
|
124
92
|
async function setDraftReady(base, recordId, ready) {
|
|
93
|
+
if (skipsAirtableShadow("setDraftReady", recordId)) return;
|
|
125
94
|
await base(REPORTS_TABLE).update([{ id: recordId, fields: { "Draft ready": ready } }]);
|
|
126
95
|
}
|
|
127
96
|
async function updateReportScores(base, recordId, scores, completedOn, enrichment) {
|
|
97
|
+
if (skipsAirtableShadow("updateReportScores", recordId)) return;
|
|
128
98
|
const fields = {
|
|
129
99
|
"Lighthouse \u2014 Performance": scores.performance,
|
|
130
100
|
"Lighthouse \u2014 Accessibility": scores.accessibility,
|
|
@@ -142,17 +112,6 @@ async function updateReportScores(base, recordId, scores, completedOn, enrichmen
|
|
|
142
112
|
fields["Search position"] = enrichment.searchPosition;
|
|
143
113
|
await base(REPORTS_TABLE).update([{ id: recordId, fields }]);
|
|
144
114
|
}
|
|
145
|
-
async function listSendableReports(base) {
|
|
146
|
-
const out = [];
|
|
147
|
-
await base(REPORTS_TABLE).select({
|
|
148
|
-
filterByFormula: "AND({Draft ready} = TRUE(), {Approved to send} = TRUE(), {Sent at} = BLANK())",
|
|
149
|
-
pageSize: 100
|
|
150
|
-
}).eachPage((records, fetchNextPage) => {
|
|
151
|
-
for (const rec of records) out.push(mapRow({ id: rec.id, fields: rec.fields }));
|
|
152
|
-
fetchNextPage();
|
|
153
|
-
});
|
|
154
|
-
return out;
|
|
155
|
-
}
|
|
156
115
|
async function listAllReports(base) {
|
|
157
116
|
const out = [];
|
|
158
117
|
await base(REPORTS_TABLE).select({ pageSize: 100 }).eachPage((records, fetchNextPage) => {
|
|
@@ -161,10 +120,8 @@ async function listAllReports(base) {
|
|
|
161
120
|
});
|
|
162
121
|
return out;
|
|
163
122
|
}
|
|
164
|
-
async function listReportsForSite(base, siteId) {
|
|
165
|
-
return (await listAllReports(base)).filter((r) => r.siteId === siteId);
|
|
166
|
-
}
|
|
167
123
|
async function stampSent(base, recordId, sentAt, messageId) {
|
|
124
|
+
if (skipsAirtableShadow("stampSent", recordId)) return;
|
|
168
125
|
const fields = { "Sent at": sentAt.toISOString() };
|
|
169
126
|
if (messageId !== null) fields["Resend message ID"] = messageId;
|
|
170
127
|
await base(REPORTS_TABLE).update([
|
|
@@ -174,29 +131,12 @@ async function stampSent(base, recordId, sentAt, messageId) {
|
|
|
174
131
|
}
|
|
175
132
|
]);
|
|
176
133
|
}
|
|
177
|
-
async function findReportByPeriod(base, siteId, reportType, period) {
|
|
178
|
-
const safeType = escapeFormulaString(reportType);
|
|
179
|
-
const safePeriod = escapeFormulaString(period);
|
|
180
|
-
const formula = `AND({Report type} = "${safeType}", {Period} = "${safePeriod}")`;
|
|
181
|
-
const rows = [];
|
|
182
|
-
await base(REPORTS_TABLE).select({ filterByFormula: formula, pageSize: 100 }).eachPage((records, fetchNextPage) => {
|
|
183
|
-
for (const rec of records) rows.push(mapRow({ id: rec.id, fields: rec.fields }));
|
|
184
|
-
fetchNextPage();
|
|
185
|
-
});
|
|
186
|
-
return rows.find((r) => r.siteId === siteId) ?? null;
|
|
187
|
-
}
|
|
188
134
|
|
|
189
135
|
export {
|
|
190
|
-
|
|
191
|
-
isPendingApproval,
|
|
192
|
-
parseAutoEvidence,
|
|
193
|
-
createDraft,
|
|
136
|
+
draftFields,
|
|
194
137
|
setDraftReady,
|
|
195
138
|
updateReportScores,
|
|
196
|
-
listSendableReports,
|
|
197
139
|
listAllReports,
|
|
198
|
-
|
|
199
|
-
stampSent,
|
|
200
|
-
findReportByPeriod
|
|
140
|
+
stampSent
|
|
201
141
|
};
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
142
|
+
//# sourceMappingURL=chunk-TEMQPSCM.js.map
|