@reddoorla/maintenance 0.86.0 → 0.88.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/airtable-QG5ICI3Y.js +9 -0
- package/dist/{announce-MXTUQ6C7.js → announce-GKD5YJNB.js} +49 -28
- package/dist/announce-GKD5YJNB.js.map +1 -0
- package/dist/attachments-NLZIJ5NU.js +9 -0
- package/dist/{blux-ZGDSHI3U.js → blux-DN4MI532.js} +5 -5
- package/dist/{bump-deps-EC74CPLS.js → bump-deps-KGH5UYSF.js} +4 -4
- package/dist/{chunk-N45M3FDK.js → chunk-6I6L3CMX.js} +4 -4
- package/dist/{chunk-KTH5ZODA.js → chunk-7BZUOZPU.js} +2 -2
- package/dist/{chunk-2EVEFOZY.js → chunk-7FFUBF4I.js} +6 -3
- package/dist/chunk-7FFUBF4I.js.map +1 -0
- package/dist/{chunk-LDWZSLSU.js → chunk-7NYN2P6I.js} +7 -4
- package/dist/{chunk-LDWZSLSU.js.map → chunk-7NYN2P6I.js.map} +1 -1
- package/dist/{chunk-X3B723J4.js → chunk-7TMWBXX7.js} +184 -25
- package/dist/chunk-7TMWBXX7.js.map +1 -0
- package/dist/{chunk-3VQWSE3F.js → chunk-7UAYMAKR.js} +4 -4
- package/dist/{chunk-W7Z3BGCI.js → chunk-A2UNJIKH.js} +15 -7
- package/dist/chunk-A2UNJIKH.js.map +1 -0
- package/dist/{chunk-F5KM4LEQ.js → chunk-ANJNTAMM.js} +4 -70
- package/dist/chunk-ANJNTAMM.js.map +1 -0
- package/dist/{chunk-2ZPT7GLV.js → chunk-B23FFWU4.js} +4 -4
- package/dist/chunk-B23FFWU4.js.map +1 -0
- package/dist/{chunk-DJZWYIPP.js → chunk-BGTYPVLT.js} +1 -1
- package/dist/chunk-BGTYPVLT.js.map +1 -0
- package/dist/chunk-BRYXFH77.js +70 -0
- package/dist/chunk-BRYXFH77.js.map +1 -0
- package/dist/{chunk-2NDRHXMR.js → chunk-DGZWFI2G.js} +18 -141
- package/dist/chunk-DGZWFI2G.js.map +1 -0
- package/dist/{chunk-ACBRLLFT.js → chunk-F3JWOPTG.js} +7 -3
- package/dist/chunk-F3JWOPTG.js.map +1 -0
- package/dist/chunk-GQDDWYU2.js +372 -0
- package/dist/chunk-GQDDWYU2.js.map +1 -0
- package/dist/{chunk-Z7AXYKQB.js → chunk-IY6256GK.js} +1 -1
- package/dist/{chunk-BYK66EWO.js → chunk-J3WEZGIN.js} +52 -46
- package/dist/chunk-J3WEZGIN.js.map +1 -0
- package/dist/{chunk-BNM5POSJ.js → chunk-JRHIFA5R.js} +2 -2
- package/dist/{chunk-ZKXSX4LO.js → chunk-K6SLF6GI.js} +6 -6
- package/dist/{chunk-CQR4LIM7.js → chunk-KJGKZLCT.js} +7 -3
- package/dist/{chunk-CQR4LIM7.js.map → chunk-KJGKZLCT.js.map} +1 -1
- package/dist/{chunk-PPE5KZJK.js → chunk-KMCZA7CH.js} +13 -3
- package/dist/chunk-KMCZA7CH.js.map +1 -0
- package/dist/{chunk-3SF7D4DY.js → chunk-MFHS7IQ2.js} +36 -1
- package/dist/{chunk-3SF7D4DY.js.map → chunk-MFHS7IQ2.js.map} +1 -1
- package/dist/{chunk-SNSTJLQW.js → chunk-NO74DXDP.js} +48 -2
- package/dist/chunk-NO74DXDP.js.map +1 -0
- package/dist/{chunk-C6B4RHXR.js → chunk-O3GT46R2.js} +8 -2
- package/dist/chunk-O3GT46R2.js.map +1 -0
- package/dist/{chunk-ITIOFN7A.js → chunk-P6AORG32.js} +29 -10
- package/dist/chunk-P6AORG32.js.map +1 -0
- package/dist/{chunk-SLUQ7R6I.js → chunk-PR343K7F.js} +5 -5
- package/dist/{chunk-P2FE5AI6.js → chunk-Q47DU255.js} +4 -4
- package/dist/{chunk-EVBCK2KC.js → chunk-RARREDQE.js} +2 -1
- package/dist/{chunk-EVBCK2KC.js.map → chunk-RARREDQE.js.map} +1 -1
- package/dist/chunk-RUPPWAD6.js +7 -0
- package/dist/chunk-RUPPWAD6.js.map +1 -0
- package/dist/{chunk-VSBFM7DS.js → chunk-SJOXWJ5Y.js} +3 -3
- package/dist/{chunk-TERE5SDF.js → chunk-ULHPALI5.js} +4 -4
- package/dist/{chunk-XUGSZP7Z.js → chunk-W45FZEGE.js} +2 -2
- package/dist/{chunk-JHGHLKFS.js → chunk-WS6NU475.js} +2 -2
- package/dist/chunk-XP5WM2LV.js +146 -0
- package/dist/chunk-XP5WM2LV.js.map +1 -0
- package/dist/{chunk-ILUNZHYV.js → chunk-YFAXOD7Z.js} +10 -6
- package/dist/chunk-YFAXOD7Z.js.map +1 -0
- package/dist/{chunk-6TWWY7ZU.js → chunk-Z3JXLULD.js} +2 -2
- package/dist/cli/bin.js +34 -29
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/audit.d.ts +4 -0
- package/dist/cli/commands/audit.js +25 -18
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/client-JYKPVCJX.js +11 -0
- package/dist/configs/playwright-a11y.js +1 -1
- package/dist/{convert-to-pnpm-6L6P74WR.js → convert-to-pnpm-NWB5FCQ2.js} +4 -4
- package/dist/{db-B35OGV3G.js → db-V6UIS433.js} +124 -29
- package/dist/db-V6UIS433.js.map +1 -0
- package/dist/{digest-BL6UJYKH.js → digest-2JEAEJK6.js} +60 -35
- package/dist/digest-2JEAEJK6.js.map +1 -0
- package/dist/digest-state-CRZRNGDI.js +25 -0
- package/dist/digest-state-CRZRNGDI.js.map +1 -0
- package/dist/digest-state-F37XUCS5.js +13 -0
- package/dist/{dump-P6EBSIOH.js → dump-EPL7AZFR.js} +38 -13
- package/dist/dump-EPL7AZFR.js.map +1 -0
- package/dist/{email-VTTTKKL5.js → email-SL7464YI.js} +16 -6
- package/dist/{email-VTTTKKL5.js.map → email-SL7464YI.js.map} +1 -1
- package/dist/{ensure-site-DFTB7MN3.js → ensure-site-FU6527OU.js} +19 -11
- package/dist/ensure-site-FU6527OU.js.map +1 -0
- package/dist/fleet-state-R5LU7IC3.js +41 -0
- package/dist/{forms-notify-target-75U6OU7L.js → forms-notify-target-SGDGXXK5.js} +10 -7
- package/dist/forms-notify-target-SGDGXXK5.js.map +1 -0
- package/dist/{github-signals-IJUPGCUX.js → github-signals-GWGCKEE2.js} +13 -12
- package/dist/{github-signals-IJUPGCUX.js.map → github-signals-GWGCKEE2.js.map} +1 -1
- package/dist/{header-image-AWLLQA4L.js → header-image-7A7XLVEU.js} +8 -8
- package/dist/{header-images-335L2AKB.js → header-images-SQBCE5OD.js} +21 -1
- package/dist/header-images-SQBCE5OD.js.map +1 -0
- package/dist/{health-endpoint-WJC2UMYS.js → health-endpoint-UVX6R5N5.js} +4 -4
- package/dist/health-mirror-GCDN7BJL.js +46 -0
- package/dist/health-mirror-GCDN7BJL.js.map +1 -0
- package/dist/{import-airtable-HE43FB4H.js → import-airtable-OHVY344G.js} +7 -5
- package/dist/index.d.ts +149 -0
- package/dist/index.js +245 -108
- package/dist/index.js.map +1 -1
- package/dist/{init-NJEOEO7I.js → init-FGTYNGUI.js} +11 -11
- package/dist/{launch-XNAX427U.js → launch-5H7LPEGP.js} +59 -29
- package/dist/launch-5H7LPEGP.js.map +1 -0
- package/dist/{lighthouse-airtable-LBVIYYP5.js → lighthouse-airtable-3GUWHETW.js} +3 -3
- package/dist/migrate-YITCXBLS.js +7 -0
- package/dist/{notify-C645PGD5.js → notify-4HP4GZ2H.js} +5 -5
- package/dist/{onboard-GK4PHPNI.js → onboard-BKCYBAVW.js} +4 -4
- package/dist/{orchestrate-77UO4BYJ.js → orchestrate-JNKCWU5K.js} +14 -13
- package/dist/parity-NBYZUBFU.js +14 -0
- package/dist/pdf-N5QLQ5ZQ.js +38 -0
- package/dist/pdf-N5QLQ5ZQ.js.map +1 -0
- package/dist/{pipeline-S6CVHDGB.js → pipeline-WYTXSLHX.js} +3 -3
- package/dist/{preflight-6WBNU2GZ.js → preflight-IMTYDDD4.js} +15 -14
- package/dist/{preflight-6WBNU2GZ.js.map → preflight-IMTYDDD4.js.map} +1 -1
- package/dist/{prismic-ci-3RHOZUUT.js → prismic-ci-MY2U6NN7.js} +7 -7
- package/dist/{prismic-models-QBGUT2Q3.js → prismic-models-NJN5JORF.js} +15 -10
- package/dist/prismic-models-NJN5JORF.js.map +1 -0
- package/dist/prospect/types.d.ts +281 -0
- package/dist/prospect/types.js +1 -0
- package/dist/{prospect-audit-IUNCJ2LV.js → prospect-audit-JMBRVXSG.js} +32 -13
- package/dist/prospect-audit-JMBRVXSG.js.map +1 -0
- package/dist/recipes/sync-configs.js +2 -2
- package/dist/render-VX72AESY.js +10 -0
- package/dist/render-VX72AESY.js.map +1 -0
- package/dist/render-from-row-DOYJDO2L.js +17 -0
- package/dist/render-from-row-DOYJDO2L.js.map +1 -0
- package/dist/{renovate-dispatch-QJY75ODR.js → renovate-dispatch-6GQWTRKX.js} +10 -10
- package/dist/{renovate-dispatch-QJY75ODR.js.map → renovate-dispatch-6GQWTRKX.js.map} +1 -1
- package/dist/{replay-C2LXMJZP.js → replay-4S6ENYCH.js} +3 -3
- package/dist/{report-4EVNDHOZ.js → report-TALY5P3L.js} +63 -21
- package/dist/report-TALY5P3L.js.map +1 -0
- package/dist/report-mirror-AAK3MXHY.js +55 -0
- package/dist/report-mirror-AAK3MXHY.js.map +1 -0
- package/dist/rerender-3FM6DNRH.js +32 -0
- package/dist/rerender-3FM6DNRH.js.map +1 -0
- package/dist/schema-75PJECAE.js +18 -0
- package/dist/schema-75PJECAE.js.map +1 -0
- package/dist/{self-updating-6DWI2Z56.js → self-updating-NTCCWJYZ.js} +4 -4
- package/dist/{selftest-RC36MTKP.js → selftest-NZTR4SM2.js} +26 -24
- package/dist/{selftest-RC36MTKP.js.map → selftest-NZTR4SM2.js.map} +1 -1
- package/dist/site-mirror-Q763PLGG.js +62 -0
- package/dist/site-mirror-Q763PLGG.js.map +1 -0
- package/dist/{smoke-suite-VYY2LXM2.js → smoke-suite-4JFZZYVW.js} +4 -4
- package/dist/{spam-classifier-XLBFCO7G.js → spam-classifier-T5H4VTP6.js} +4 -2
- package/dist/spam-classifier-T5H4VTP6.js.map +1 -0
- package/dist/{submissions-Q7DRFOCD.js → submissions-TEHPBSZJ.js} +5 -5
- package/dist/{svelte-codemods-25J2FO22.js → svelte-codemods-QAPDZC6F.js} +4 -4
- package/dist/{sync-34HNZZ56.js → sync-GBFV45WX.js} +6 -4
- package/dist/{sync-34HNZZ56.js.map → sync-GBFV45WX.js.map} +1 -1
- package/dist/{sync-configs-3SE6PSCO.js → sync-configs-34JIA6KZ.js} +6 -6
- package/dist/{upgrade-WBRQ62FX.js → upgrade-IR2OO3KP.js} +4 -4
- package/dist/{webflow-IRKOIT7S.js → webflow-624FEBFD.js} +4 -4
- package/dist/{webhook-VOGOW3W6.js → webhook-XM6EV4XT.js} +2 -2
- package/dist/{websites-SXWTP72S.js → websites-D6WYFAES.js} +2 -2
- package/dist/websites-D6WYFAES.js.map +1 -0
- package/dist/write-audits-to-airtable-OBHGR7DQ.js +17 -0
- package/dist/write-audits-to-airtable-OBHGR7DQ.js.map +1 -0
- package/package.json +5 -1
- package/dist/airtable-G7WBQQMI.js +0 -9
- package/dist/announce-MXTUQ6C7.js.map +0 -1
- package/dist/chunk-2EVEFOZY.js.map +0 -1
- package/dist/chunk-2NDRHXMR.js.map +0 -1
- package/dist/chunk-2ZPT7GLV.js.map +0 -1
- package/dist/chunk-ACBRLLFT.js.map +0 -1
- package/dist/chunk-BYK66EWO.js.map +0 -1
- package/dist/chunk-C6B4RHXR.js.map +0 -1
- package/dist/chunk-DJZWYIPP.js.map +0 -1
- package/dist/chunk-F5KM4LEQ.js.map +0 -1
- package/dist/chunk-ILUNZHYV.js.map +0 -1
- package/dist/chunk-ITIOFN7A.js.map +0 -1
- package/dist/chunk-PPE5KZJK.js.map +0 -1
- package/dist/chunk-SNSTJLQW.js.map +0 -1
- package/dist/chunk-W7Z3BGCI.js.map +0 -1
- package/dist/chunk-X3B723J4.js.map +0 -1
- package/dist/client-AUE3XUPO.js +0 -11
- package/dist/db-B35OGV3G.js.map +0 -1
- package/dist/digest-BL6UJYKH.js.map +0 -1
- package/dist/dump-P6EBSIOH.js.map +0 -1
- package/dist/ensure-site-DFTB7MN3.js.map +0 -1
- package/dist/forms-notify-target-75U6OU7L.js.map +0 -1
- package/dist/header-images-335L2AKB.js.map +0 -1
- package/dist/health-mirror-4B2L7T2Y.js +0 -75
- package/dist/health-mirror-4B2L7T2Y.js.map +0 -1
- package/dist/launch-XNAX427U.js.map +0 -1
- package/dist/migrate-GQH237A6.js +0 -7
- package/dist/parity-MWS24A3H.js +0 -12
- package/dist/prismic-models-QBGUT2Q3.js.map +0 -1
- package/dist/prospect-audit-IUNCJ2LV.js.map +0 -1
- package/dist/render-AQAVQDPZ.js +0 -10
- package/dist/report-4EVNDHOZ.js.map +0 -1
- package/dist/write-audits-to-airtable-MBEILLPU.js +0 -14
- /package/dist/{airtable-G7WBQQMI.js.map → airtable-QG5ICI3Y.js.map} +0 -0
- /package/dist/{client-AUE3XUPO.js.map → attachments-NLZIJ5NU.js.map} +0 -0
- /package/dist/{blux-ZGDSHI3U.js.map → blux-DN4MI532.js.map} +0 -0
- /package/dist/{bump-deps-EC74CPLS.js.map → bump-deps-KGH5UYSF.js.map} +0 -0
- /package/dist/{chunk-N45M3FDK.js.map → chunk-6I6L3CMX.js.map} +0 -0
- /package/dist/{chunk-KTH5ZODA.js.map → chunk-7BZUOZPU.js.map} +0 -0
- /package/dist/{chunk-3VQWSE3F.js.map → chunk-7UAYMAKR.js.map} +0 -0
- /package/dist/{chunk-Z7AXYKQB.js.map → chunk-IY6256GK.js.map} +0 -0
- /package/dist/{chunk-BNM5POSJ.js.map → chunk-JRHIFA5R.js.map} +0 -0
- /package/dist/{chunk-ZKXSX4LO.js.map → chunk-K6SLF6GI.js.map} +0 -0
- /package/dist/{chunk-SLUQ7R6I.js.map → chunk-PR343K7F.js.map} +0 -0
- /package/dist/{chunk-P2FE5AI6.js.map → chunk-Q47DU255.js.map} +0 -0
- /package/dist/{chunk-VSBFM7DS.js.map → chunk-SJOXWJ5Y.js.map} +0 -0
- /package/dist/{chunk-TERE5SDF.js.map → chunk-ULHPALI5.js.map} +0 -0
- /package/dist/{chunk-XUGSZP7Z.js.map → chunk-W45FZEGE.js.map} +0 -0
- /package/dist/{chunk-JHGHLKFS.js.map → chunk-WS6NU475.js.map} +0 -0
- /package/dist/{chunk-6TWWY7ZU.js.map → chunk-Z3JXLULD.js.map} +0 -0
- /package/dist/{import-airtable-HE43FB4H.js.map → client-JYKPVCJX.js.map} +0 -0
- /package/dist/{convert-to-pnpm-6L6P74WR.js.map → convert-to-pnpm-NWB5FCQ2.js.map} +0 -0
- /package/dist/{lighthouse-airtable-LBVIYYP5.js.map → digest-state-F37XUCS5.js.map} +0 -0
- /package/dist/{migrate-GQH237A6.js.map → fleet-state-R5LU7IC3.js.map} +0 -0
- /package/dist/{header-image-AWLLQA4L.js.map → header-image-7A7XLVEU.js.map} +0 -0
- /package/dist/{health-endpoint-WJC2UMYS.js.map → health-endpoint-UVX6R5N5.js.map} +0 -0
- /package/dist/{notify-C645PGD5.js.map → import-airtable-OHVY344G.js.map} +0 -0
- /package/dist/{init-NJEOEO7I.js.map → init-FGTYNGUI.js.map} +0 -0
- /package/dist/{orchestrate-77UO4BYJ.js.map → lighthouse-airtable-3GUWHETW.js.map} +0 -0
- /package/dist/{parity-MWS24A3H.js.map → migrate-YITCXBLS.js.map} +0 -0
- /package/dist/{pipeline-S6CVHDGB.js.map → notify-4HP4GZ2H.js.map} +0 -0
- /package/dist/{onboard-GK4PHPNI.js.map → onboard-BKCYBAVW.js.map} +0 -0
- /package/dist/{render-AQAVQDPZ.js.map → orchestrate-JNKCWU5K.js.map} +0 -0
- /package/dist/{spam-classifier-XLBFCO7G.js.map → parity-NBYZUBFU.js.map} +0 -0
- /package/dist/{websites-SXWTP72S.js.map → pipeline-WYTXSLHX.js.map} +0 -0
- /package/dist/{prismic-ci-3RHOZUUT.js.map → prismic-ci-MY2U6NN7.js.map} +0 -0
- /package/dist/{write-audits-to-airtable-MBEILLPU.js.map → prospect/types.js.map} +0 -0
- /package/dist/{replay-C2LXMJZP.js.map → replay-4S6ENYCH.js.map} +0 -0
- /package/dist/{self-updating-6DWI2Z56.js.map → self-updating-NTCCWJYZ.js.map} +0 -0
- /package/dist/{smoke-suite-VYY2LXM2.js.map → smoke-suite-4JFZZYVW.js.map} +0 -0
- /package/dist/{submissions-Q7DRFOCD.js.map → submissions-TEHPBSZJ.js.map} +0 -0
- /package/dist/{svelte-codemods-25J2FO22.js.map → svelte-codemods-QAPDZC6F.js.map} +0 -0
- /package/dist/{sync-configs-3SE6PSCO.js.map → sync-configs-34JIA6KZ.js.map} +0 -0
- /package/dist/{upgrade-WBRQ62FX.js.map → upgrade-IR2OO3KP.js.map} +0 -0
- /package/dist/{webflow-IRKOIT7S.js.map → webflow-624FEBFD.js.map} +0 -0
- /package/dist/{webhook-VOGOW3W6.js.map → webhook-XM6EV4XT.js.map} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
generateHeaderImage
|
|
3
|
-
} from "./chunk-5UINJNAJ.js";
|
|
4
1
|
import {
|
|
5
2
|
uploadAttachment
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IY6256GK.js";
|
|
7
4
|
import {
|
|
8
5
|
openBase,
|
|
9
6
|
readAirtableConfig
|
|
10
7
|
} from "./chunk-HN6I2XWI.js";
|
|
8
|
+
import {
|
|
9
|
+
generateHeaderImage
|
|
10
|
+
} from "./chunk-5UINJNAJ.js";
|
|
11
11
|
import {
|
|
12
12
|
ACTIVE_STATUSES,
|
|
13
13
|
listWebsites,
|
|
14
14
|
siteSlug
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7NYN2P6I.js";
|
|
16
16
|
import "./chunk-6VAL7XJT.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/commands/header-image.ts
|
|
@@ -102,8 +102,8 @@ async function runHeaderImageCommand(site, opts) {
|
|
|
102
102
|
}
|
|
103
103
|
let withStore = opts;
|
|
104
104
|
if (opts.writeAirtable && !opts.storeDb && process.env.TURSO_DATABASE_URL) {
|
|
105
|
-
const { openDb, readDbConfig } = await import("./client-
|
|
106
|
-
const { storeHeaderImage } = await import("./header-images-
|
|
105
|
+
const { openDb, readDbConfig } = await import("./client-JYKPVCJX.js");
|
|
106
|
+
const { storeHeaderImage } = await import("./header-images-SQBCE5OD.js");
|
|
107
107
|
const db = await openDb(readDbConfig());
|
|
108
108
|
withStore = { ...opts, storeDb: (id, img) => storeHeaderImage(db, id, img) };
|
|
109
109
|
}
|
|
@@ -115,4 +115,4 @@ export {
|
|
|
115
115
|
resolveTargets,
|
|
116
116
|
runHeaderImageCommand
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=header-image-
|
|
118
|
+
//# sourceMappingURL=header-image-7A7XLVEU.js.map
|
|
@@ -7,6 +7,25 @@ async function storeHeaderImage(db, siteId, image) {
|
|
|
7
7
|
header_image_generated_at: image.generatedAt
|
|
8
8
|
}).where("id", "=", siteId).execute();
|
|
9
9
|
}
|
|
10
|
+
async function loadHeaderImage(db, siteId) {
|
|
11
|
+
const row = await db.selectFrom("sites").select([
|
|
12
|
+
"header_image",
|
|
13
|
+
"header_image_filename",
|
|
14
|
+
"header_image_type",
|
|
15
|
+
"header_image_generated_at"
|
|
16
|
+
]).where("id", "=", siteId).executeTakeFirst();
|
|
17
|
+
if (!row) return null;
|
|
18
|
+
const raw = row.header_image;
|
|
19
|
+
if (raw === null || raw === void 0) return null;
|
|
20
|
+
const bytes = new Uint8Array(raw);
|
|
21
|
+
if (bytes.length === 0) return null;
|
|
22
|
+
return {
|
|
23
|
+
bytes,
|
|
24
|
+
filename: row.header_image_filename ?? "header-image",
|
|
25
|
+
contentType: row.header_image_type ?? "application/octet-stream",
|
|
26
|
+
generatedAt: row.header_image_generated_at ?? null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
10
29
|
function headerImageAttachment(rec) {
|
|
11
30
|
const atts = rec.fields["Header image"];
|
|
12
31
|
const a = atts?.at(-1);
|
|
@@ -63,6 +82,7 @@ export {
|
|
|
63
82
|
backfillHeaderImages,
|
|
64
83
|
formatBackfillResult,
|
|
65
84
|
headerImageAttachment,
|
|
85
|
+
loadHeaderImage,
|
|
66
86
|
storeHeaderImage
|
|
67
87
|
};
|
|
68
|
-
//# sourceMappingURL=header-images-
|
|
88
|
+
//# sourceMappingURL=header-images-SQBCE5OD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/db/header-images.ts"],"sourcesContent":["/** Header images move to Turso (#539, design D5 completed).\n *\n * Since Phase 1 the schema has reserved `sites.header_image*` as the image's\n * home — the importer deliberately never touches those columns — but nothing\n * wrote them, so the read layer's `headerImage` was null fleet-wide and both\n * cockpit preflight and approve-report stayed pinned to the Airtable reader.\n * Two writers and one reader close that:\n *\n * - `storeHeaderImage` — the shared write, used by the header-image CLI's\n * dual-write (Airtable upload + Turso store, until Phase 5 freezes Airtable)\n * and by the backfill.\n * - `loadHeaderImage` — the reader. Until it existed the bytes went in and could\n * not come out, so every consumer still fetched Airtable's signed URL.\n * - `backfillHeaderImages` — one-shot: copy every site's CURRENT Airtable\n * attachment into Turso. Idempotent — a site whose BLOB is already\n * populated is skipped, so re-runs never clobber a freshly generated image\n * with a stale Airtable copy. Emits its machine line on EVERY run.\n */\nimport type { Db } from \"./client.js\";\nimport type { RawRecord } from \"./import-airtable.js\";\n\nexport type StoredHeaderImage = {\n bytes: Uint8Array;\n filename: string;\n contentType: string;\n /** The generator's stamp; null for a backfilled copy (a backfill is not a\n * generation — the column keeps meaning \"when the generator made it\"). */\n generatedAt: string | null;\n};\n\nexport async function storeHeaderImage(\n db: Db,\n siteId: string,\n image: StoredHeaderImage,\n): Promise<void> {\n await db\n .updateTable(\"sites\")\n .set({\n header_image: image.bytes,\n header_image_filename: image.filename,\n header_image_type: image.contentType,\n header_image_generated_at: image.generatedAt,\n })\n .where(\"id\", \"=\", siteId)\n .execute();\n}\n\n/**\n * Read one site's stored header image back.\n *\n * A SEPARATE query from the site read, deliberately. `getSiteBySlug` excludes\n * the BLOB on purpose — it is 0.6–0.8 MB per site in production, so a selectAll\n * would haul megabytes into every dashboard GET and every form ingest — which\n * means reading the bytes has to be an explicit, per-site act rather than a\n * field that arrives for free.\n *\n * Null when the site has no image, when the id is unknown, and when the\n * metadata is present but the BLOB is not: handing a consumer an empty buffer\n * with a filename would render a report with a broken header instead of failing\n * loudly with \"no header image\".\n */\nexport async function loadHeaderImage(db: Db, siteId: string): Promise<StoredHeaderImage | null> {\n const row = await db\n .selectFrom(\"sites\")\n .select([\n \"header_image\",\n \"header_image_filename\",\n \"header_image_type\",\n \"header_image_generated_at\",\n ])\n .where(\"id\", \"=\", siteId)\n .executeTakeFirst();\n if (!row) return null;\n // Normalize BEFORE measuring. libSQL can hand the BLOB back as an ArrayBuffer\n // rather than a Uint8Array, and an ArrayBuffer has `byteLength`, not `length` —\n // so a naive `bytes.length === 0` compares `undefined` to 0, passes, and lets a\n // zero-length image through as if it were real. Mutation-testing the null check\n // is what exposed that; the guard did not do what its own name said.\n const raw = row.header_image;\n if (raw === null || raw === undefined) return null;\n // `raw` is a Uint8Array on some drivers and an ArrayBuffer on others; the\n // Uint8Array constructor accepts either, but the two do not share a TS type.\n const bytes = new Uint8Array(raw as unknown as ArrayBufferLike);\n if (bytes.length === 0) return null;\n\n return {\n bytes,\n filename: row.header_image_filename ?? \"header-image\",\n contentType: row.header_image_type ?? \"application/octet-stream\",\n generatedAt: row.header_image_generated_at ?? null,\n };\n}\n\ntype Attachment = { url: string; filename: string; type: string };\n\n/** NEWEST \"Header image\" attachment of a raw Websites record, or null.\n *\n * The tail, not the head: Airtable's uploadAttachment APPENDS, so a field that ever\n * held more than one file served its OLDEST image from `[0]` forever — see the note\n * in `reports/airtable/websites.ts` and #574/#577. Kept in step with that reader so\n * the Turso mirror and the send path can never disagree about which file is current. */\nexport function headerImageAttachment(rec: RawRecord): Attachment | null {\n const atts = rec.fields[\"Header image\"] as Array<Partial<Attachment>> | undefined;\n const a = atts?.at(-1);\n return a && typeof a.url === \"string\" && a.url.length > 0\n ? {\n url: a.url,\n filename: typeof a.filename === \"string\" ? a.filename : \"header-image\",\n type: typeof a.type === \"string\" ? a.type : \"application/octet-stream\",\n }\n : null;\n}\n\nexport type BackfillIo = {\n listWebsiteRecords: () => Promise<RawRecord[]>;\n /** Fetch attachment bytes; null on failure (named in the summary, not fatal). */\n fetchBytes: (url: string) => Promise<Uint8Array | null>;\n};\n\nexport type BackfillResult = {\n stored: number;\n /** Sites whose BLOB was already populated — never overwritten. */\n skipped: number;\n /** Sites with no Airtable attachment at all. */\n absent: number;\n /** Record ids whose attachment fetch failed — named, never silent. */\n failed: string[];\n};\n\nexport async function backfillHeaderImages(db: Db, io: BackfillIo): Promise<BackfillResult> {\n const records = await io.listWebsiteRecords();\n const populated = new Set(\n (await db.selectFrom(\"sites\").select(\"id\").where(\"header_image\", \"is not\", null).execute()).map(\n (r) => r.id,\n ),\n );\n const result: BackfillResult = { stored: 0, skipped: 0, absent: 0, failed: [] };\n for (const rec of records) {\n const att = headerImageAttachment(rec);\n if (!att) {\n result.absent++;\n continue;\n }\n if (populated.has(rec.id)) {\n result.skipped++;\n continue;\n }\n const bytes = await io.fetchBytes(att.url);\n if (bytes === null) {\n result.failed.push(rec.id);\n continue;\n }\n await storeHeaderImage(db, rec.id, {\n bytes,\n filename: att.filename,\n contentType: att.type,\n generatedAt: null,\n });\n result.stored++;\n }\n return result;\n}\n\n/** Human lines + the machine line, emitted on every run (count=0 included). */\nexport function formatBackfillResult(r: BackfillResult): string {\n const lines: string[] = [];\n if (r.failed.length > 0) {\n lines.push(`⚠ ${r.failed.length} attachment fetch(es) failed: ${r.failed.join(\", \")}`);\n }\n lines.push(\n `HEADER_IMAGE_BACKFILL stored=${r.stored} skipped=${r.skipped} absent=${r.absent} failed=${r.failed.length}`,\n );\n return lines.join(\"\\n\");\n}\n"],"mappings":";AA8BA,eAAsB,iBACpB,IACA,QACA,OACe;AACf,QAAM,GACH,YAAY,OAAO,EACnB,IAAI;AAAA,IACH,cAAc,MAAM;AAAA,IACpB,uBAAuB,MAAM;AAAA,IAC7B,mBAAmB,MAAM;AAAA,IACzB,2BAA2B,MAAM;AAAA,EACnC,CAAC,EACA,MAAM,MAAM,KAAK,MAAM,EACvB,QAAQ;AACb;AAgBA,eAAsB,gBAAgB,IAAQ,QAAmD;AAC/F,QAAM,MAAM,MAAM,GACf,WAAW,OAAO,EAClB,OAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACA,MAAM,MAAM,KAAK,MAAM,EACvB,iBAAiB;AACpB,MAAI,CAAC,IAAK,QAAO;AAMjB,QAAM,MAAM,IAAI;AAChB,MAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAG9C,QAAM,QAAQ,IAAI,WAAW,GAAiC;AAC9D,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,SAAO;AAAA,IACL;AAAA,IACA,UAAU,IAAI,yBAAyB;AAAA,IACvC,aAAa,IAAI,qBAAqB;AAAA,IACtC,aAAa,IAAI,6BAA6B;AAAA,EAChD;AACF;AAUO,SAAS,sBAAsB,KAAmC;AACvE,QAAM,OAAO,IAAI,OAAO,cAAc;AACtC,QAAM,IAAI,MAAM,GAAG,EAAE;AACrB,SAAO,KAAK,OAAO,EAAE,QAAQ,YAAY,EAAE,IAAI,SAAS,IACpD;AAAA,IACE,KAAK,EAAE;AAAA,IACP,UAAU,OAAO,EAAE,aAAa,WAAW,EAAE,WAAW;AAAA,IACxD,MAAM,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO;AAAA,EAC9C,IACA;AACN;AAkBA,eAAsB,qBAAqB,IAAQ,IAAyC;AAC1F,QAAM,UAAU,MAAM,GAAG,mBAAmB;AAC5C,QAAM,YAAY,IAAI;AAAA,KACnB,MAAM,GAAG,WAAW,OAAO,EAAE,OAAO,IAAI,EAAE,MAAM,gBAAgB,UAAU,IAAI,EAAE,QAAQ,GAAG;AAAA,MAC1F,CAAC,MAAM,EAAE;AAAA,IACX;AAAA,EACF;AACA,QAAM,SAAyB,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC,EAAE;AAC9E,aAAW,OAAO,SAAS;AACzB,UAAM,MAAM,sBAAsB,GAAG;AACrC,QAAI,CAAC,KAAK;AACR,aAAO;AACP;AAAA,IACF;AACA,QAAI,UAAU,IAAI,IAAI,EAAE,GAAG;AACzB,aAAO;AACP;AAAA,IACF;AACA,UAAM,QAAQ,MAAM,GAAG,WAAW,IAAI,GAAG;AACzC,QAAI,UAAU,MAAM;AAClB,aAAO,OAAO,KAAK,IAAI,EAAE;AACzB;AAAA,IACF;AACA,UAAM,iBAAiB,IAAI,IAAI,IAAI;AAAA,MACjC;AAAA,MACA,UAAU,IAAI;AAAA,MACd,aAAa,IAAI;AAAA,MACjB,aAAa;AAAA,IACf,CAAC;AACD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,SAAS,qBAAqB,GAA2B;AAC9D,QAAM,QAAkB,CAAC;AACzB,MAAI,EAAE,OAAO,SAAS,GAAG;AACvB,UAAM,KAAK,UAAK,EAAE,OAAO,MAAM,iCAAiC,EAAE,OAAO,KAAK,IAAI,CAAC,EAAE;AAAA,EACvF;AACA,QAAM;AAAA,IACJ,gCAAgC,EAAE,MAAM,YAAY,EAAE,OAAO,WAAW,EAAE,MAAM,WAAW,EAAE,OAAO,MAAM;AAAA,EAC5G;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":[]}
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
} from "./chunk-TVL5MVUF.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Q47DU255.js";
|
|
12
12
|
import {
|
|
13
13
|
healthEndpoint
|
|
14
14
|
} from "./chunk-BQRFQSGY.js";
|
|
15
15
|
import "./chunk-R53VL3RI.js";
|
|
16
16
|
import "./chunk-3G25KIWW.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-Z3JXLULD.js";
|
|
18
|
+
import "./chunk-RARREDQE.js";
|
|
19
19
|
import "./chunk-XTK5VIQB.js";
|
|
20
20
|
import "./chunk-LBYOLBW7.js";
|
|
21
21
|
import "./chunk-XXTZBPUY.js";
|
|
@@ -51,4 +51,4 @@ async function runHealthEndpointCommand(site, opts) {
|
|
|
51
51
|
export {
|
|
52
52
|
runHealthEndpointCommand
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=health-endpoint-
|
|
54
|
+
//# sourceMappingURL=health-endpoint-UVX6R5N5.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TURSO_IS_AUTHORITATIVE
|
|
3
|
+
} from "./chunk-RUPPWAD6.js";
|
|
4
|
+
import {
|
|
5
|
+
mirrorHealthFields,
|
|
6
|
+
mirrorScheduleFields
|
|
7
|
+
} from "./chunk-GQDDWYU2.js";
|
|
8
|
+
import "./chunk-P6AORG32.js";
|
|
9
|
+
import "./chunk-F3JWOPTG.js";
|
|
10
|
+
import "./chunk-VAD43MOR.js";
|
|
11
|
+
import "./chunk-7NYN2P6I.js";
|
|
12
|
+
import {
|
|
13
|
+
openDb,
|
|
14
|
+
readDbConfig
|
|
15
|
+
} from "./chunk-WS6NU475.js";
|
|
16
|
+
import "./chunk-MFHS7IQ2.js";
|
|
17
|
+
import "./chunk-6VAL7XJT.js";
|
|
18
|
+
|
|
19
|
+
// src/audits/health-mirror.ts
|
|
20
|
+
async function makeHealthMirrorBestEffort(open = () => openDb(readDbConfig()), strict = TURSO_IS_AUTHORITATIVE) {
|
|
21
|
+
let db;
|
|
22
|
+
try {
|
|
23
|
+
db = await open();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (strict) throw new Error(`health-mirror unavailable: ${String(e)}`, { cause: e });
|
|
26
|
+
console.error(`[health-mirror] mirroring disabled: no libSQL (${String(e)})`);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return (siteId, fields) => mirrorHealthFields(db, siteId, fields);
|
|
30
|
+
}
|
|
31
|
+
async function makeScheduleMirrorBestEffort(open = () => openDb(readDbConfig()), strict = TURSO_IS_AUTHORITATIVE) {
|
|
32
|
+
let db;
|
|
33
|
+
try {
|
|
34
|
+
db = await open();
|
|
35
|
+
} catch (e) {
|
|
36
|
+
if (strict) throw new Error(`schedule-mirror unavailable: ${String(e)}`, { cause: e });
|
|
37
|
+
console.error(`[schedule-mirror] mirroring disabled: no libSQL (${String(e)})`);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return (siteId, fields, computedAt) => mirrorScheduleFields(db, siteId, fields, computedAt);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
makeHealthMirrorBestEffort,
|
|
44
|
+
makeScheduleMirrorBestEffort
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=health-mirror-GCDN7BJL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audits/health-mirror.ts"],"sourcesContent":["import { openDb, readDbConfig, type Db } from \"../db/client.js\";\nimport { mirrorHealthFields, mirrorScheduleFields } from \"../db/fleet-state.js\";\nimport { TURSO_IS_AUTHORITATIVE } from \"../db/freeze.js\";\n\n/** One site's just-written Airtable FieldSet, mirrored into site_health.\n * Resolves true when a site_health row matched; false when the UPDATE touched\n * 0 rows (site created in Airtable after the last hourly import) — callers\n * count that as mirror_missed, never as mirrored. */\nexport type HealthMirror = (siteId: string, fields: Record<string, unknown>) => Promise<boolean>;\n\n/** The site_schedule twin, for the nightly next-due write-back. Same\n * matched-row contract as {@link HealthMirror}: false = 0-row UPDATE →\n * mirror_missed. */\nexport type ScheduleMirror = (\n siteId: string,\n fields: Record<string, unknown>,\n computedAt: string,\n) => Promise<boolean>;\n\n/** Build the Turso write-through for the nightly writers (#539 Phase 3\n * dual-write), or null when libSQL creds are absent — mirroring NOT attempted\n * is a different outcome than mirroring failed, and the caller's summary line\n * reports mirror counts only when a mirror existed. Same contract as\n * recordFleetEventsBestEffort: the mirror must never fail the sweep that\n * produced the data (per-site failures are the caller's to count; Airtable\n * stays authoritative and the hourly sync converges whatever the mirror\n * missed). `open` is injectable for tests. */\nexport async function makeHealthMirrorBestEffort(\n open: () => Promise<Db> = () => openDb(readDbConfig()),\n /** #612. `true` = Turso is the only store, so \"mirroring disabled\" is no\n * longer a survivable state: returning null would discard every write in the\n * sweep with nothing to converge it. Throws instead. Injected by tests so\n * both sides stay proven. */\n strict: boolean = TURSO_IS_AUTHORITATIVE,\n): Promise<HealthMirror | null> {\n let db: Db;\n try {\n db = await open();\n } catch (e) {\n if (strict) throw new Error(`health-mirror unavailable: ${String(e)}`, { cause: e });\n console.error(`[health-mirror] mirroring disabled: no libSQL (${String(e)})`);\n return null;\n }\n return (siteId, fields) => mirrorHealthFields(db, siteId, fields);\n}\n\n/** {@link makeHealthMirrorBestEffort}'s schedule twin — same null-without-creds\n * contract, for `writeNextDueDates`' site_schedule write-through. */\nexport async function makeScheduleMirrorBestEffort(\n open: () => Promise<Db> = () => openDb(readDbConfig()),\n /** #612 — same contract as {@link makeHealthMirrorBestEffort}'s. */\n strict: boolean = TURSO_IS_AUTHORITATIVE,\n): Promise<ScheduleMirror | null> {\n let db: Db;\n try {\n db = await open();\n } catch (e) {\n if (strict) throw new Error(`schedule-mirror unavailable: ${String(e)}`, { cause: e });\n console.error(`[schedule-mirror] mirroring disabled: no libSQL (${String(e)})`);\n return null;\n }\n return (siteId, fields, computedAt) => mirrorScheduleFields(db, siteId, fields, computedAt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,eAAsB,2BACpB,OAA0B,MAAM,OAAO,aAAa,CAAC,GAKrD,SAAkB,wBACY;AAC9B,MAAI;AACJ,MAAI;AACF,SAAK,MAAM,KAAK;AAAA,EAClB,SAAS,GAAG;AACV,QAAI,OAAQ,OAAM,IAAI,MAAM,8BAA8B,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;AACnF,YAAQ,MAAM,kDAAkD,OAAO,CAAC,CAAC,GAAG;AAC5E,WAAO;AAAA,EACT;AACA,SAAO,CAAC,QAAQ,WAAW,mBAAmB,IAAI,QAAQ,MAAM;AAClE;AAIA,eAAsB,6BACpB,OAA0B,MAAM,OAAO,aAAa,CAAC,GAErD,SAAkB,wBACc;AAChC,MAAI;AACJ,MAAI;AACF,SAAK,MAAM,KAAK;AAAA,EAClB,SAAS,GAAG;AACV,QAAI,OAAQ,OAAM,IAAI,MAAM,gCAAgC,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;AACrF,YAAQ,MAAM,oDAAoD,OAAO,CAAC,CAAC,GAAG;AAC9E,WAAO;AAAA,EACT;AACA,SAAO,CAAC,QAAQ,QAAQ,eAAe,qBAAqB,IAAI,QAAQ,QAAQ,UAAU;AAC5F;","names":[]}
|
|
@@ -12,10 +12,11 @@ import {
|
|
|
12
12
|
reapAllowance,
|
|
13
13
|
reapRefusal,
|
|
14
14
|
renderedHtmlUrl,
|
|
15
|
-
scheduleColumnFor
|
|
16
|
-
|
|
15
|
+
scheduleColumnFor,
|
|
16
|
+
siteValueFor
|
|
17
|
+
} from "./chunk-P6AORG32.js";
|
|
17
18
|
import "./chunk-VAD43MOR.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-7NYN2P6I.js";
|
|
19
20
|
export {
|
|
20
21
|
EXCLUDED_WEBSITE_FIELDS,
|
|
21
22
|
HEALTH_BOOLEAN,
|
|
@@ -30,6 +31,7 @@ export {
|
|
|
30
31
|
reapAllowance,
|
|
31
32
|
reapRefusal,
|
|
32
33
|
renderedHtmlUrl,
|
|
33
|
-
scheduleColumnFor
|
|
34
|
+
scheduleColumnFor,
|
|
35
|
+
siteValueFor
|
|
34
36
|
};
|
|
35
|
-
//# sourceMappingURL=import-airtable-
|
|
37
|
+
//# sourceMappingURL=import-airtable-OHVY344G.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -952,6 +952,135 @@ type ReportRow = {
|
|
|
952
952
|
overrideBy: string | null;
|
|
953
953
|
overrideAt: string | null;
|
|
954
954
|
};
|
|
955
|
+
/** Called with the record Airtable echoed back from the create, before it is
|
|
956
|
+
* mapped (#539 Phase 5). Structurally typed rather than importing the db
|
|
957
|
+
* layer's `RawRecord`, so this module stays the leaf it has always been. */
|
|
958
|
+
type CreatedDraftMirror = (rec: {
|
|
959
|
+
id: string;
|
|
960
|
+
fields: Record<string, unknown>;
|
|
961
|
+
}) => Promise<void>;
|
|
962
|
+
|
|
963
|
+
/** Report rows (migration 0007). PK = Airtable rec id. `checklist` is JSON
|
|
964
|
+
* keyed by the STABLE checklist key (src/reports/checklist.ts), not the
|
|
965
|
+
* Airtable column name; `rendered_html` is the downloaded attachment body. */
|
|
966
|
+
interface ReportsTable {
|
|
967
|
+
id: string;
|
|
968
|
+
site_id: string | null;
|
|
969
|
+
report_id: string | null;
|
|
970
|
+
report_type: string | null;
|
|
971
|
+
period: string | null;
|
|
972
|
+
period_start: string | null;
|
|
973
|
+
period_end: string | null;
|
|
974
|
+
completed_on: string | null;
|
|
975
|
+
lighthouse_performance: number | null;
|
|
976
|
+
lighthouse_accessibility: number | null;
|
|
977
|
+
lighthouse_best_practices: number | null;
|
|
978
|
+
lighthouse_seo: number | null;
|
|
979
|
+
ga_users_current: number | null;
|
|
980
|
+
ga_users_previous: number | null;
|
|
981
|
+
search_found_page1: number | null;
|
|
982
|
+
search_position: number | null;
|
|
983
|
+
last_tested_date: string | null;
|
|
984
|
+
commentary: string | null;
|
|
985
|
+
subject_override: string | null;
|
|
986
|
+
draft_ready: number;
|
|
987
|
+
approved_to_send: number;
|
|
988
|
+
approved_at: string | null;
|
|
989
|
+
approved_by: string | null;
|
|
990
|
+
send_override: number;
|
|
991
|
+
override_reason: string | null;
|
|
992
|
+
override_by: string | null;
|
|
993
|
+
override_at: string | null;
|
|
994
|
+
sent_at: string | null;
|
|
995
|
+
delivery_status: string | null;
|
|
996
|
+
resend_message_id: string | null;
|
|
997
|
+
checklist: string | null;
|
|
998
|
+
checklist_auto_evidence: string | null;
|
|
999
|
+
rendered_html: string | null;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/** Columns a report writer mirrors after its Airtable write (same pattern as
|
|
1003
|
+
* mirrorSiteField): the approve/override flow, the resend-webhook's delivery
|
|
1004
|
+
* status, and — since #539 Phase 5 — the drafting path's queue flag and a
|
|
1005
|
+
* re-run's refreshed scores.
|
|
1006
|
+
*
|
|
1007
|
+
* `rendered_html` stays deliberately OUT even though the drafting path now
|
|
1008
|
+
* writes it: bodies go through `storeRenderedHtml`, so a request handler
|
|
1009
|
+
* holding a patch cannot accidentally write megabytes of HTML. `sent_at` and
|
|
1010
|
+
* `resend_message_id` stay out because nothing but the send batch writes them
|
|
1011
|
+
* and the hourly sync converges those. */
|
|
1012
|
+
type ReportMirrorPatch = Partial<Pick<ReportsTable, "approved_to_send" | "approved_at" | "approved_by" | "send_override" | "override_reason" | "override_by" | "override_at" | "delivery_status" | "commentary" | "draft_ready" | "lighthouse_performance" | "lighthouse_accessibility" | "lighthouse_best_practices" | "lighthouse_seo" | "ga_users_current" | "ga_users_previous" | "search_found_page1" | "search_position" | "completed_on">>;
|
|
1013
|
+
|
|
1014
|
+
/** #539 Phase 5: the Turso write-through for the Reports write surface.
|
|
1015
|
+
*
|
|
1016
|
+
* Before this, the only report mirrors were UPDATEs on the request path
|
|
1017
|
+
* (approve, override, delivery status, commentary). Everything the DRAFTING
|
|
1018
|
+
* path writes — the row itself, the rendered body, the queue flag, a re-run's
|
|
1019
|
+
* refreshed scores — reached Turso only via the hourly sync. Two of those are
|
|
1020
|
+
* visible to the operator today: a fresh draft's row does not exist, and its
|
|
1021
|
+
* preview route answers "No rendered body stored" for up to an hour. At the
|
|
1022
|
+
* freeze they stop being windows.
|
|
1023
|
+
*
|
|
1024
|
+
* Deliberately UNLIKE `makeHealthMirrorBestEffort`, this never returns null.
|
|
1025
|
+
* #585 is the reason: Phase 3's next-due mirror silently no-opped in production
|
|
1026
|
+
* for weeks because the factory returned null without creds, and a dead
|
|
1027
|
+
* dual-write then looked exactly like a healthy one — the only tell was an
|
|
1028
|
+
* ABSENT log suffix nobody was watching for. Here creds-absent is a state the
|
|
1029
|
+
* mirror REPORTS, so every write emits one REPORT_MIRROR line and an absent
|
|
1030
|
+
* line means the wiring is gone, not that conditions were quiet.
|
|
1031
|
+
*/
|
|
1032
|
+
|
|
1033
|
+
/** The three shapes a report write takes. Injected as ONE object rather than
|
|
1034
|
+
* three parameters because they share a db handle and always travel together:
|
|
1035
|
+
* a caller holding `created` but not `body` produces exactly the half-mirrored
|
|
1036
|
+
* state (row present, preview 404) this module exists to prevent. */
|
|
1037
|
+
type ReportMirror = {
|
|
1038
|
+
/** A row Airtable just CREATED, as Airtable echoed it back. */
|
|
1039
|
+
created: CreatedDraftMirror;
|
|
1040
|
+
/** A freshly rendered body for an existing row. */
|
|
1041
|
+
body: (reportId: string, html: string) => Promise<void>;
|
|
1042
|
+
/** Columns just written to an existing row. */
|
|
1043
|
+
patch: (reportId: string, patch: ReportMirrorPatch) => Promise<void>;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
/** #539 Phase 5: the Turso write-through for the ONE-OFF Websites writers.
|
|
1047
|
+
*
|
|
1048
|
+
* Phase 3 mirrored the nightly sweep — the audit write-back, github-signals and
|
|
1049
|
+
* the next-due dates. It did not touch the writers that run on their own
|
|
1050
|
+
* schedule or on demand: the analytics soft-fail stamp, the Renovate
|
|
1051
|
+
* auto-fix counter, the prismic-models verdict, `updateLaunched`, the
|
|
1052
|
+
* forms notify target, and the SINGLE-SITE audit write-back (only the fleet
|
|
1053
|
+
* path ever passed a mirror). Each of those reached Turso solely via the hourly
|
|
1054
|
+
* sync, which stops existing at the freeze.
|
|
1055
|
+
*
|
|
1056
|
+
* It lives in `src/db` rather than a feature folder because its callers span
|
|
1057
|
+
* audits, recipes, CLI commands and the send path — no one feature owns it.
|
|
1058
|
+
*
|
|
1059
|
+
* Deliberately UNLIKE `makeHealthMirrorBestEffort`, this never returns null.
|
|
1060
|
+
* #585 is the reason: that factory returned null without creds and the
|
|
1061
|
+
* dual-write silently no-opped in production for weeks, because a dead mirror
|
|
1062
|
+
* and a healthy one produced identical output — the only tell was an ABSENT log
|
|
1063
|
+
* suffix nobody was watching for. Here creds-absent is a state the mirror
|
|
1064
|
+
* REPORTS, so a missing SITE_MIRROR line means the wiring is gone.
|
|
1065
|
+
*/
|
|
1066
|
+
|
|
1067
|
+
/** Two ops because the Websites row is split across two Turso tables. Callers
|
|
1068
|
+
* pass the EXACT FieldSet the Airtable writer returned, so the mirror can never
|
|
1069
|
+
* carry a different payload than the write it shadows. */
|
|
1070
|
+
type SiteMirror = {
|
|
1071
|
+
/** A row Airtable just CREATED, as Airtable echoed it back (`ensure-site`).
|
|
1072
|
+
* Every other op is an UPDATE, which does nothing for a row that does not
|
|
1073
|
+
* exist yet — so without this a bootstrapped site is invisible to Turso and
|
|
1074
|
+
* every mirror the rest of the bootstrap fires reports `mirrored=missed`. */
|
|
1075
|
+
created: (rec: {
|
|
1076
|
+
id: string;
|
|
1077
|
+
fields: Record<string, unknown>;
|
|
1078
|
+
}) => Promise<void>;
|
|
1079
|
+
/** Columns that live in `site_health`. */
|
|
1080
|
+
health: (siteId: string, fields: Record<string, unknown>) => Promise<void>;
|
|
1081
|
+
/** Columns that live in `sites`. */
|
|
1082
|
+
site: (siteId: string, fields: Record<string, unknown>) => Promise<void>;
|
|
1083
|
+
};
|
|
955
1084
|
|
|
956
1085
|
type ShootOptions = {
|
|
957
1086
|
url: string;
|
|
@@ -1028,6 +1157,22 @@ type DraftOptions = {
|
|
|
1028
1157
|
* entirely. Tests set `false` (or a stub) so a unit suite never launches a
|
|
1029
1158
|
* browser or resolves DNS. Production leaves it unset and gets the real thing. */
|
|
1030
1159
|
refreshHeader?: RefreshHeaderDeps | false;
|
|
1160
|
+
/** #539 Phase 5: Turso write-through for everything this function writes to
|
|
1161
|
+
* Airtable — the created row, the rendered body, and the queue flag — so a
|
|
1162
|
+
* fresh draft is fully readable in the Turso-backed console immediately
|
|
1163
|
+
* instead of after the next hourly sync.
|
|
1164
|
+
*
|
|
1165
|
+
* Deliberately NOT defaulted here. Defaulting would open a real libSQL handle
|
|
1166
|
+
* from inside `draftReportForSite`, which every unit test calls — and on a
|
|
1167
|
+
* machine with TURSO_* exported that means a test suite writing rows into
|
|
1168
|
+
* production. The wiring lives at the composition roots (cli/commands/report.ts,
|
|
1169
|
+
* recipes) where it is pinned by test, the same division `runFleetWriteBack`
|
|
1170
|
+
* uses for the health mirror. */
|
|
1171
|
+
reportMirror?: ReportMirror;
|
|
1172
|
+
/** #539 Phase 5: the Websites-row twin of `reportMirror`. Drafting stamps
|
|
1173
|
+
* `Analytics soft-fail at` on the SITE row, which is a different Turso table
|
|
1174
|
+
* and a different mirror. Injected for the same reason — see reportMirror. */
|
|
1175
|
+
siteMirror?: SiteMirror;
|
|
1031
1176
|
};
|
|
1032
1177
|
/** An enrichment fetch that *errored* (not one that was legitimately skipped
|
|
1033
1178
|
* because it isn't configured / the site lacks the inputs). Surfaced so a
|
|
@@ -1106,6 +1251,10 @@ type ResendClient = {
|
|
|
1106
1251
|
|
|
1107
1252
|
type OrchestrateOptions = {
|
|
1108
1253
|
resend?: ResendClient;
|
|
1254
|
+
/** #539 Phase 5: Turso write-through for the Websites row a Launch send
|
|
1255
|
+
* updates. Injected rather than defaulted — this function is called directly
|
|
1256
|
+
* by tests, and a default would open a real libSQL handle inside the suite. */
|
|
1257
|
+
siteMirror?: SiteMirror;
|
|
1109
1258
|
};
|
|
1110
1259
|
declare function sendApprovedReports(options?: OrchestrateOptions): Promise<{
|
|
1111
1260
|
output: string;
|