@reddoorla/maintenance 0.95.1 → 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.
Files changed (316) hide show
  1. package/README.md +41 -7
  2. package/dist/{announce-CLQYX5I4.js → announce-5ZD2SBGD.js} +39 -31
  3. package/dist/announce-5ZD2SBGD.js.map +1 -0
  4. package/dist/attachments-JFGFQRXQ.js +10 -0
  5. package/dist/{blux-4KNXUP2K.js → blux-NXQLMS4W.js} +1 -1
  6. package/dist/{bump-deps-C5G2EFBB.js → bump-deps-775VLDYB.js} +6 -6
  7. package/dist/{chunk-FUWFLAWQ.js → chunk-3RLDX3Q2.js} +5 -5
  8. package/dist/{chunk-XHHMM5HX.js → chunk-43SW3FGW.js} +63 -1
  9. package/dist/chunk-43SW3FGW.js.map +1 -0
  10. package/dist/{chunk-R53VL3RI.js → chunk-5CJVUPJU.js} +1 -1
  11. package/dist/{chunk-R53VL3RI.js.map → chunk-5CJVUPJU.js.map} +1 -1
  12. package/dist/{chunk-S7RYFUIK.js → chunk-6PGXKN6F.js} +2 -2
  13. package/dist/{chunk-HTABUCF4.js → chunk-6THEZQLA.js} +3 -3
  14. package/dist/chunk-A5QKNOXW.js +72 -0
  15. package/dist/chunk-A5QKNOXW.js.map +1 -0
  16. package/dist/chunk-ASLDCWBF.js +41 -0
  17. package/dist/chunk-ASLDCWBF.js.map +1 -0
  18. package/dist/{chunk-CWXTNPNZ.js → chunk-AYDQQBNG.js} +3 -3
  19. package/dist/chunk-AYDQQBNG.js.map +1 -0
  20. package/dist/{chunk-WVNDEYXL.js → chunk-BINFZQ2T.js} +57 -6
  21. package/dist/chunk-BINFZQ2T.js.map +1 -0
  22. package/dist/{chunk-2NQUCS7O.js → chunk-BIYQN7FH.js} +3 -1
  23. package/dist/{chunk-2NQUCS7O.js.map → chunk-BIYQN7FH.js.map} +1 -1
  24. package/dist/{chunk-YLYXW5PH.js → chunk-CXICCLNM.js} +34 -4
  25. package/dist/chunk-CXICCLNM.js.map +1 -0
  26. package/dist/{chunk-BYGPUUCT.js → chunk-DRNZVORX.js} +66 -30
  27. package/dist/chunk-DRNZVORX.js.map +1 -0
  28. package/dist/{chunk-LM2NHRCJ.js → chunk-DYTYPKFN.js} +4 -4
  29. package/dist/chunk-DYTYPKFN.js.map +1 -0
  30. package/dist/{chunk-DFKBTBO3.js → chunk-EN6CTBUN.js} +35 -6
  31. package/dist/chunk-EN6CTBUN.js.map +1 -0
  32. package/dist/{chunk-5EEMTJMT.js → chunk-FHFXJ3EM.js} +8 -6
  33. package/dist/chunk-FHFXJ3EM.js.map +1 -0
  34. package/dist/{chunk-Z2K4JPQ3.js → chunk-FP6HOW6J.js} +10 -7
  35. package/dist/chunk-FP6HOW6J.js.map +1 -0
  36. package/dist/{chunk-2LYOAB2E.js → chunk-HSMN35LU.js} +2 -2
  37. package/dist/chunk-ICSRWW5Q.js +148 -0
  38. package/dist/chunk-ICSRWW5Q.js.map +1 -0
  39. package/dist/{chunk-FSGICFXB.js → chunk-IDBPII6G.js} +17 -5
  40. package/dist/chunk-IDBPII6G.js.map +1 -0
  41. package/dist/{chunk-C3IQQKXL.js → chunk-IOTOOTII.js} +121 -1
  42. package/dist/{chunk-C3IQQKXL.js.map → chunk-IOTOOTII.js.map} +1 -1
  43. package/dist/{chunk-BCKEP5S6.js → chunk-JHJNNJLG.js} +2 -2
  44. package/dist/{chunk-TO7DJYLZ.js → chunk-L3S3QZXL.js} +178 -39
  45. package/dist/chunk-L3S3QZXL.js.map +1 -0
  46. package/dist/{chunk-WSJ7RO54.js → chunk-LAG6IP7Y.js} +23 -5
  47. package/dist/chunk-LAG6IP7Y.js.map +1 -0
  48. package/dist/{chunk-WJMPCVOR.js → chunk-LAJ3FF54.js} +12 -4
  49. package/dist/chunk-LAJ3FF54.js.map +1 -0
  50. package/dist/{chunk-2ZAZ7ETT.js → chunk-LDHRIQUW.js} +32 -18
  51. package/dist/chunk-LDHRIQUW.js.map +1 -0
  52. package/dist/{chunk-6R56OKJZ.js → chunk-LF2TJN4X.js} +2 -2
  53. package/dist/chunk-LF2TJN4X.js.map +1 -0
  54. package/dist/{chunk-ZQV7UQNE.js → chunk-LUF52EIY.js} +2 -2
  55. package/dist/{chunk-5UINJNAJ.js → chunk-LZMAG73U.js} +34 -21
  56. package/dist/chunk-LZMAG73U.js.map +1 -0
  57. package/dist/{chunk-VSGMCCGQ.js → chunk-MMSMZC7S.js} +2 -2
  58. package/dist/chunk-MVKNU4QD.js +37 -0
  59. package/dist/chunk-MVKNU4QD.js.map +1 -0
  60. package/dist/{chunk-XPJQXSC4.js → chunk-P7323YVW.js} +27 -5
  61. package/dist/chunk-P7323YVW.js.map +1 -0
  62. package/dist/{chunk-KJRVMMM3.js → chunk-PARKXDXI.js} +36 -5
  63. package/dist/chunk-PARKXDXI.js.map +1 -0
  64. package/dist/{chunk-4763KQ6O.js → chunk-PXRN2MER.js} +2 -2
  65. package/dist/{chunk-WMBLR5VA.js → chunk-PZZ6HM5T.js} +3 -3
  66. package/dist/{chunk-TR3HFH6J.js → chunk-QFSL2L2B.js} +67 -10
  67. package/dist/chunk-QFSL2L2B.js.map +1 -0
  68. package/dist/chunk-RQJFGK3A.js +51 -0
  69. package/dist/chunk-RQJFGK3A.js.map +1 -0
  70. package/dist/{chunk-3Z6X3BHU.js → chunk-TC4GANMX.js} +53 -150
  71. package/dist/chunk-TC4GANMX.js.map +1 -0
  72. package/dist/{chunk-F3JWOPTG.js → chunk-TEMQPSCM.js} +45 -105
  73. package/dist/chunk-TEMQPSCM.js.map +1 -0
  74. package/dist/chunk-TJLKWQOX.js +52 -0
  75. package/dist/chunk-TJLKWQOX.js.map +1 -0
  76. package/dist/{chunk-CJ2RMTT7.js → chunk-TV76A6GN.js} +2 -2
  77. package/dist/{chunk-KZRR4NFG.js → chunk-TVZ6QCOE.js} +3 -3
  78. package/dist/{chunk-BVEDKMNG.js → chunk-U2ZI6G7H.js} +29 -11
  79. package/dist/chunk-U2ZI6G7H.js.map +1 -0
  80. package/dist/chunk-UPE6D4AT.js +69 -0
  81. package/dist/chunk-UPE6D4AT.js.map +1 -0
  82. package/dist/{chunk-R5IMFAFR.js → chunk-VMGHQUTV.js} +7 -16
  83. package/dist/chunk-VMGHQUTV.js.map +1 -0
  84. package/dist/chunk-VQMAAQ5M.js +53 -0
  85. package/dist/chunk-VQMAAQ5M.js.map +1 -0
  86. package/dist/{chunk-AVEQUR44.js → chunk-WMF5S2MB.js} +60 -17
  87. package/dist/chunk-WMF5S2MB.js.map +1 -0
  88. package/dist/{chunk-SVAAONYB.js → chunk-WQLNUEZL.js} +12 -2
  89. package/dist/{chunk-SVAAONYB.js.map → chunk-WQLNUEZL.js.map} +1 -1
  90. package/dist/{chunk-XN37VTDB.js → chunk-X56LAKPR.js} +3 -3
  91. package/dist/chunk-X56LAKPR.js.map +1 -0
  92. package/dist/{chunk-ZCL7C5LH.js → chunk-Y6FCXRIC.js} +1661 -387
  93. package/dist/chunk-Y6FCXRIC.js.map +1 -0
  94. package/dist/{chunk-2SLED3NB.js → chunk-YDZ7XGPZ.js} +1 -1
  95. package/dist/{chunk-2SLED3NB.js.map → chunk-YDZ7XGPZ.js.map} +1 -1
  96. package/dist/{chunk-IY6256GK.js → chunk-YJBSB4LP.js} +6 -1
  97. package/dist/chunk-YJBSB4LP.js.map +1 -0
  98. package/dist/{chunk-BI2VI6EM.js → chunk-YXWBM26P.js} +2 -2
  99. package/dist/{chunk-QF6IQQFP.js → chunk-Z7FDJ35L.js} +18 -12
  100. package/dist/chunk-Z7FDJ35L.js.map +1 -0
  101. package/dist/cli/bin.js +111 -51
  102. package/dist/cli/bin.js.map +1 -1
  103. package/dist/cli/commands/audit.d.ts +33 -3
  104. package/dist/cli/commands/audit.js +28 -25
  105. package/dist/cli/commands/audit.js.map +1 -1
  106. package/dist/client-DGTO65WB.js +11 -0
  107. package/dist/configs/playwright-a11y.d.ts +11 -1
  108. package/dist/configs/playwright-a11y.js +3 -1
  109. package/dist/{convert-to-pnpm-YTFREUJK.js → convert-to-pnpm-KLWA53N5.js} +6 -6
  110. package/dist/{db-XKZYDCKM.js → db-II5WAK4D.js} +45 -20
  111. package/dist/db-II5WAK4D.js.map +1 -0
  112. package/dist/deadletter-G4M3HSVM.js +17 -0
  113. package/dist/{digest-7UBGUBRK.js → digest-CWKK2DMR.js} +56 -32
  114. package/dist/digest-CWKK2DMR.js.map +1 -0
  115. package/dist/{digest-collectors-DJFN5ZDK.js → digest-collectors-CYTN2EUX.js} +17 -12
  116. package/dist/{digest-state-3KHZF7GD.js → digest-state-ZDPKR7MW.js} +18 -2
  117. package/dist/digest-state-ZDPKR7MW.js.map +1 -0
  118. package/dist/ensure-site-2QZHFVQ3.js +70 -0
  119. package/dist/ensure-site-2QZHFVQ3.js.map +1 -0
  120. package/dist/ensure-site-JEKV2ODE.js +105 -0
  121. package/dist/ensure-site-JEKV2ODE.js.map +1 -0
  122. package/dist/{ensure-site-OAAE5YE2.js → ensure-site-OO4UPWNQ.js} +49 -44
  123. package/dist/ensure-site-OO4UPWNQ.js.map +1 -0
  124. package/dist/fleet-events-CkOZpMVC.d.ts +435 -0
  125. package/dist/{fleet-state-UEVZ3X3J.js → fleet-state-RJROYXKO.js} +19 -7
  126. package/dist/{forms-notify-target-UC6PF3AE.js → forms-notify-target-X6UEOI2M.js} +19 -15
  127. package/dist/forms-notify-target-X6UEOI2M.js.map +1 -0
  128. package/dist/{freeze-A6MUCZU4.js → freeze-GUQ43EAU.js} +2 -2
  129. package/dist/{github-signals-TX5FPYP6.js → github-signals-QIRTHHET.js} +22 -17
  130. package/dist/github-signals-QIRTHHET.js.map +1 -0
  131. package/dist/{header-image-PSPT7CUM.js → header-image-H7ZJAV26.js} +15 -18
  132. package/dist/header-image-H7ZJAV26.js.map +1 -0
  133. package/dist/{health-endpoint-KVCJYWET.js → health-endpoint-BJ6BKRHF.js} +8 -7
  134. package/dist/{health-endpoint-KVCJYWET.js.map → health-endpoint-BJ6BKRHF.js.map} +1 -1
  135. package/dist/{health-mirror-XJAKA3EY.js → health-mirror-KU3G7V2Y.js} +10 -10
  136. package/dist/{import-airtable-TAKSN4NV.js → import-airtable-UBF5GYAL.js} +3 -3
  137. package/dist/index.d.ts +158 -419
  138. package/dist/index.js +91 -46
  139. package/dist/index.js.map +1 -1
  140. package/dist/{init-FFE4FCO2.js → init-GOWDA5QS.js} +19 -18
  141. package/dist/{init-FFE4FCO2.js.map → init-GOWDA5QS.js.map} +1 -1
  142. package/dist/{launch-UD36AHUN.js → launch-7N3X2MXB.js} +229 -79
  143. package/dist/launch-7N3X2MXB.js.map +1 -0
  144. package/dist/{lighthouse-VHI77PFB.js → lighthouse-52WSPZ5D.js} +2 -2
  145. package/dist/lighthouse-airtable-M45OPVRV.js +14 -0
  146. package/dist/match-harness-GBCDSVPS.js +417 -0
  147. package/dist/match-harness-GBCDSVPS.js.map +1 -0
  148. package/dist/migrate-XZ7U5DFC.js +7 -0
  149. package/dist/{notify-IISTHNBR.js → notify-K3WVH3DM.js} +4 -4
  150. package/dist/{onboard-TM2KESGF.js → onboard-JQQIMQW7.js} +6 -6
  151. package/dist/{orchestrate-HYVQPRCE.js → orchestrate-L2A5BZFY.js} +13 -10
  152. package/dist/parity-2JGVUCZD.js +14 -0
  153. package/dist/{pipeline-YROAY6DT.js → pipeline-UUPXOS2J.js} +3 -3
  154. package/dist/{preflight-RYIP54NY.js → preflight-O7Q6FWHU.js} +35 -11
  155. package/dist/preflight-O7Q6FWHU.js.map +1 -0
  156. package/dist/{prismic-ci-6GKKZGB5.js → prismic-ci-NAPWOXXD.js} +39 -9
  157. package/dist/prismic-ci-NAPWOXXD.js.map +1 -0
  158. package/dist/{prismic-models-P6FWWVRS.js → prismic-models-LL6ORTQ2.js} +20 -17
  159. package/dist/prismic-models-LL6ORTQ2.js.map +1 -0
  160. package/dist/prospect/types.d.ts +72 -0
  161. package/dist/prospect/types.js +1 -1
  162. package/dist/{prospect-audit-PRHU53HS.js → prospect-audit-FMPGQIRQ.js} +16 -7
  163. package/dist/prospect-audit-FMPGQIRQ.js.map +1 -0
  164. package/dist/{prospect-audits-R3LWF6U7.js → prospect-audits-IZVQY3OQ.js} +4 -2
  165. package/dist/protection-audit-YXJKFU6O.js +413 -0
  166. package/dist/protection-audit-YXJKFU6O.js.map +1 -0
  167. package/dist/recipes/sync-configs.js +3 -3
  168. package/dist/{render-YGNGTX3W.js → render-MHUUHPLN.js} +36 -9
  169. package/dist/render-MHUUHPLN.js.map +1 -0
  170. package/dist/{render-from-row-IFSBHWDH.js → render-from-row-75JTED2Z.js} +6 -4
  171. package/dist/{renovate-dispatch-U5Q52SKT.js → renovate-dispatch-2IHAZDVA.js} +14 -9
  172. package/dist/{renovate-dispatch-U5Q52SKT.js.map → renovate-dispatch-2IHAZDVA.js.map} +1 -1
  173. package/dist/{replay-PCSQOGCZ.js → replay-4FVFOMHH.js} +10 -23
  174. package/dist/replay-4FVFOMHH.js.map +1 -0
  175. package/dist/{report-LQS4ECTM.js → report-IAHXN5CW.js} +103 -57
  176. package/dist/report-IAHXN5CW.js.map +1 -0
  177. package/dist/{report-mirror-HDTOJE64.js → report-mirror-4QM57LMS.js} +34 -12
  178. package/dist/report-mirror-4QM57LMS.js.map +1 -0
  179. package/dist/roster-GDNSIRAK.js +19 -0
  180. package/dist/roster-GDNSIRAK.js.map +1 -0
  181. package/dist/{schema-A4WCPIF4.js → schema-KWUQEZ5O.js} +1 -1
  182. package/dist/schema-KWUQEZ5O.js.map +1 -0
  183. package/dist/{self-updating-MWXIZLL7.js → self-updating-ZUWPGYUP.js} +8 -7
  184. package/dist/{self-updating-MWXIZLL7.js.map → self-updating-ZUWPGYUP.js.map} +1 -1
  185. package/dist/{selftest-VXTHRPRN.js → selftest-G4W3LIBQ.js} +21 -17
  186. package/dist/{selftest-VXTHRPRN.js.map → selftest-G4W3LIBQ.js.map} +1 -1
  187. package/dist/site-create-ZU3ACBTO.js +45 -0
  188. package/dist/site-create-ZU3ACBTO.js.map +1 -0
  189. package/dist/site-lookup-DTOLJ4EA.js +27 -0
  190. package/dist/site-lookup-DTOLJ4EA.js.map +1 -0
  191. package/dist/{site-mirror-WON4FTJ2.js → site-mirror-WR7ACXOV.js} +26 -12
  192. package/dist/site-mirror-WR7ACXOV.js.map +1 -0
  193. package/dist/{smoke-suite-7DGITCTZ.js → smoke-suite-WAUPI6EJ.js} +8 -7
  194. package/dist/{smoke-suite-7DGITCTZ.js.map → smoke-suite-WAUPI6EJ.js.map} +1 -1
  195. package/dist/{submissions-OVZPVBYG.js → submissions-2SHCFOKD.js} +12 -7
  196. package/dist/submissions-2SHCFOKD.js.map +1 -0
  197. package/dist/{submissions-3I3GAQAX.js → submissions-JDZP35JM.js} +49 -9
  198. package/dist/submissions-JDZP35JM.js.map +1 -0
  199. package/dist/{svelte-codemods-WSV2FGNG.js → svelte-codemods-VOLOKKFI.js} +6 -6
  200. package/dist/{sync-K3PKHVLH.js → sync-F4USL4K5.js} +6 -6
  201. package/dist/{sync-configs-RRIHNLIJ.js → sync-configs-OXSWKVZ2.js} +6 -6
  202. package/dist/turso-KQKBBQCK.js +24 -0
  203. package/dist/turso-KQKBBQCK.js.map +1 -0
  204. package/dist/{upgrade-VTD6V4HS.js → upgrade-EVAL3JTO.js} +6 -6
  205. package/dist/util/git.d.ts +49 -10
  206. package/dist/util/git.js +1 -1
  207. package/dist/{webflow-IRKOIT7S.js → webflow-624FEBFD.js} +4 -4
  208. package/dist/{websites-TB4TCAWM.js → websites-Y6FN2XFD.js} +27 -20
  209. package/dist/{write-audits-to-airtable-53EVXKMU.js → write-audits-to-airtable-TI3JMWSY.js} +7 -5
  210. package/package.json +3 -2
  211. package/dist/airtable-JGCPS7JH.js +0 -9
  212. package/dist/announce-CLQYX5I4.js.map +0 -1
  213. package/dist/attachments-NLZIJ5NU.js +0 -9
  214. package/dist/chunk-2ZAZ7ETT.js.map +0 -1
  215. package/dist/chunk-3Z6X3BHU.js.map +0 -1
  216. package/dist/chunk-5EEMTJMT.js.map +0 -1
  217. package/dist/chunk-5GUJ36TL.js +0 -53
  218. package/dist/chunk-5GUJ36TL.js.map +0 -1
  219. package/dist/chunk-5UINJNAJ.js.map +0 -1
  220. package/dist/chunk-6R56OKJZ.js.map +0 -1
  221. package/dist/chunk-AVEQUR44.js.map +0 -1
  222. package/dist/chunk-BVEDKMNG.js.map +0 -1
  223. package/dist/chunk-BYGPUUCT.js.map +0 -1
  224. package/dist/chunk-CWXTNPNZ.js.map +0 -1
  225. package/dist/chunk-DFKBTBO3.js.map +0 -1
  226. package/dist/chunk-F3JWOPTG.js.map +0 -1
  227. package/dist/chunk-FSGICFXB.js.map +0 -1
  228. package/dist/chunk-GASBX52O.js +0 -12
  229. package/dist/chunk-GASBX52O.js.map +0 -1
  230. package/dist/chunk-IY6256GK.js.map +0 -1
  231. package/dist/chunk-KJRVMMM3.js.map +0 -1
  232. package/dist/chunk-LM2NHRCJ.js.map +0 -1
  233. package/dist/chunk-QF6IQQFP.js.map +0 -1
  234. package/dist/chunk-R5IMFAFR.js.map +0 -1
  235. package/dist/chunk-TO7DJYLZ.js.map +0 -1
  236. package/dist/chunk-TR3HFH6J.js.map +0 -1
  237. package/dist/chunk-WJMPCVOR.js.map +0 -1
  238. package/dist/chunk-WSJ7RO54.js.map +0 -1
  239. package/dist/chunk-WVNDEYXL.js.map +0 -1
  240. package/dist/chunk-XHHMM5HX.js.map +0 -1
  241. package/dist/chunk-XN37VTDB.js.map +0 -1
  242. package/dist/chunk-XPJQXSC4.js.map +0 -1
  243. package/dist/chunk-YFAXOD7Z.js +0 -42
  244. package/dist/chunk-YFAXOD7Z.js.map +0 -1
  245. package/dist/chunk-YLYXW5PH.js.map +0 -1
  246. package/dist/chunk-Z2K4JPQ3.js.map +0 -1
  247. package/dist/chunk-ZCL7C5LH.js.map +0 -1
  248. package/dist/client-G2WGWPCA.js +0 -11
  249. package/dist/db-XKZYDCKM.js.map +0 -1
  250. package/dist/digest-7UBGUBRK.js.map +0 -1
  251. package/dist/digest-state-3KHZF7GD.js.map +0 -1
  252. package/dist/ensure-site-OAAE5YE2.js.map +0 -1
  253. package/dist/fleet-events-cF2Om88w.d.ts +0 -24
  254. package/dist/forms-notify-target-UC6PF3AE.js.map +0 -1
  255. package/dist/github-signals-TX5FPYP6.js.map +0 -1
  256. package/dist/header-image-PSPT7CUM.js.map +0 -1
  257. package/dist/launch-UD36AHUN.js.map +0 -1
  258. package/dist/lighthouse-airtable-YMH4UA7R.js +0 -12
  259. package/dist/match-harness-QRG6XZAR.js +0 -70
  260. package/dist/match-harness-QRG6XZAR.js.map +0 -1
  261. package/dist/migrate-Y7R4CESL.js +0 -7
  262. package/dist/parity-CAJ477PS.js +0 -14
  263. package/dist/preflight-RYIP54NY.js.map +0 -1
  264. package/dist/prismic-ci-6GKKZGB5.js.map +0 -1
  265. package/dist/prismic-models-P6FWWVRS.js.map +0 -1
  266. package/dist/prospect-audit-PRHU53HS.js.map +0 -1
  267. package/dist/protection-audit-SJO53MEQ.js +0 -168
  268. package/dist/protection-audit-SJO53MEQ.js.map +0 -1
  269. package/dist/render-YGNGTX3W.js.map +0 -1
  270. package/dist/replay-PCSQOGCZ.js.map +0 -1
  271. package/dist/report-LQS4ECTM.js.map +0 -1
  272. package/dist/report-mirror-HDTOJE64.js.map +0 -1
  273. package/dist/schema-A4WCPIF4.js.map +0 -1
  274. package/dist/site-mirror-WON4FTJ2.js.map +0 -1
  275. package/dist/submissions-3I3GAQAX.js.map +0 -1
  276. package/dist/submissions-OVZPVBYG.js.map +0 -1
  277. /package/dist/{airtable-JGCPS7JH.js.map → attachments-JFGFQRXQ.js.map} +0 -0
  278. /package/dist/{blux-4KNXUP2K.js.map → blux-NXQLMS4W.js.map} +0 -0
  279. /package/dist/{bump-deps-C5G2EFBB.js.map → bump-deps-775VLDYB.js.map} +0 -0
  280. /package/dist/{chunk-FUWFLAWQ.js.map → chunk-3RLDX3Q2.js.map} +0 -0
  281. /package/dist/{chunk-S7RYFUIK.js.map → chunk-6PGXKN6F.js.map} +0 -0
  282. /package/dist/{chunk-HTABUCF4.js.map → chunk-6THEZQLA.js.map} +0 -0
  283. /package/dist/{chunk-2LYOAB2E.js.map → chunk-HSMN35LU.js.map} +0 -0
  284. /package/dist/{chunk-BCKEP5S6.js.map → chunk-JHJNNJLG.js.map} +0 -0
  285. /package/dist/{chunk-ZQV7UQNE.js.map → chunk-LUF52EIY.js.map} +0 -0
  286. /package/dist/{chunk-VSGMCCGQ.js.map → chunk-MMSMZC7S.js.map} +0 -0
  287. /package/dist/{chunk-4763KQ6O.js.map → chunk-PXRN2MER.js.map} +0 -0
  288. /package/dist/{chunk-WMBLR5VA.js.map → chunk-PZZ6HM5T.js.map} +0 -0
  289. /package/dist/{chunk-CJ2RMTT7.js.map → chunk-TV76A6GN.js.map} +0 -0
  290. /package/dist/{chunk-KZRR4NFG.js.map → chunk-TVZ6QCOE.js.map} +0 -0
  291. /package/dist/{chunk-BI2VI6EM.js.map → chunk-YXWBM26P.js.map} +0 -0
  292. /package/dist/{attachments-NLZIJ5NU.js.map → client-DGTO65WB.js.map} +0 -0
  293. /package/dist/{convert-to-pnpm-YTFREUJK.js.map → convert-to-pnpm-KLWA53N5.js.map} +0 -0
  294. /package/dist/{client-G2WGWPCA.js.map → deadletter-G4M3HSVM.js.map} +0 -0
  295. /package/dist/{digest-collectors-DJFN5ZDK.js.map → digest-collectors-CYTN2EUX.js.map} +0 -0
  296. /package/dist/{fleet-state-UEVZ3X3J.js.map → fleet-state-RJROYXKO.js.map} +0 -0
  297. /package/dist/{freeze-A6MUCZU4.js.map → freeze-GUQ43EAU.js.map} +0 -0
  298. /package/dist/{health-mirror-XJAKA3EY.js.map → health-mirror-KU3G7V2Y.js.map} +0 -0
  299. /package/dist/{import-airtable-TAKSN4NV.js.map → import-airtable-UBF5GYAL.js.map} +0 -0
  300. /package/dist/{lighthouse-VHI77PFB.js.map → lighthouse-52WSPZ5D.js.map} +0 -0
  301. /package/dist/{lighthouse-airtable-YMH4UA7R.js.map → lighthouse-airtable-M45OPVRV.js.map} +0 -0
  302. /package/dist/{migrate-Y7R4CESL.js.map → migrate-XZ7U5DFC.js.map} +0 -0
  303. /package/dist/{notify-IISTHNBR.js.map → notify-K3WVH3DM.js.map} +0 -0
  304. /package/dist/{onboard-TM2KESGF.js.map → onboard-JQQIMQW7.js.map} +0 -0
  305. /package/dist/{orchestrate-HYVQPRCE.js.map → orchestrate-L2A5BZFY.js.map} +0 -0
  306. /package/dist/{parity-CAJ477PS.js.map → parity-2JGVUCZD.js.map} +0 -0
  307. /package/dist/{pipeline-YROAY6DT.js.map → pipeline-UUPXOS2J.js.map} +0 -0
  308. /package/dist/{prospect-audits-R3LWF6U7.js.map → prospect-audits-IZVQY3OQ.js.map} +0 -0
  309. /package/dist/{render-from-row-IFSBHWDH.js.map → render-from-row-75JTED2Z.js.map} +0 -0
  310. /package/dist/{svelte-codemods-WSV2FGNG.js.map → svelte-codemods-VOLOKKFI.js.map} +0 -0
  311. /package/dist/{sync-K3PKHVLH.js.map → sync-F4USL4K5.js.map} +0 -0
  312. /package/dist/{sync-configs-RRIHNLIJ.js.map → sync-configs-OXSWKVZ2.js.map} +0 -0
  313. /package/dist/{upgrade-VTD6V4HS.js.map → upgrade-EVAL3JTO.js.map} +0 -0
  314. /package/dist/{webflow-IRKOIT7S.js.map → webflow-624FEBFD.js.map} +0 -0
  315. /package/dist/{websites-TB4TCAWM.js.map → websites-Y6FN2XFD.js.map} +0 -0
  316. /package/dist/{write-audits-to-airtable-53EVXKMU.js.map → write-audits-to-airtable-TI3JMWSY.js.map} +0 -0
@@ -4,20 +4,19 @@ import {
4
4
  import {
5
5
  draftReportForSite,
6
6
  readGaConfig
7
- } from "./chunk-BYGPUUCT.js";
7
+ } from "./chunk-DRNZVORX.js";
8
8
  import {
9
9
  reportTier
10
- } from "./chunk-YFAXOD7Z.js";
10
+ } from "./chunk-UPE6D4AT.js";
11
11
  import {
12
12
  findDueReports,
13
13
  nextDueDate,
14
14
  reportPeriodKey
15
15
  } from "./chunk-PZR4EBPY.js";
16
- import {
17
- listAllReports
18
- } from "./chunk-F3JWOPTG.js";
16
+ import "./chunk-TEMQPSCM.js";
17
+ import "./chunk-ASLDCWBF.js";
19
18
  import "./chunk-VAD43MOR.js";
20
- import "./chunk-IY6256GK.js";
19
+ import "./chunk-YJBSB4LP.js";
21
20
  import {
22
21
  openBase,
23
22
  readAirtableConfig
@@ -26,12 +25,14 @@ import "./chunk-KJGKZLCT.js";
26
25
  import {
27
26
  escapeHtml
28
27
  } from "./chunk-BGTYPVLT.js";
29
- import "./chunk-5UINJNAJ.js";
28
+ import "./chunk-LZMAG73U.js";
30
29
  import {
31
- listWebsites,
32
- siteSlug,
33
30
  updateNextDueDates
34
- } from "./chunk-3Z6X3BHU.js";
31
+ } from "./chunk-TC4GANMX.js";
32
+ import {
33
+ siteSlug
34
+ } from "./chunk-ICSRWW5Q.js";
35
+ import "./chunk-RQJFGK3A.js";
35
36
  import "./chunk-RARREDQE.js";
36
37
  import "./chunk-6VAL7XJT.js";
37
38
 
@@ -76,39 +77,76 @@ function parseSingleSiteReportType(raw) {
76
77
  function dashboardBaseUrl() {
77
78
  return process.env.DASHBOARD_BASE_URL?.trim() || "https://reddoor-maintenance.netlify.app";
78
79
  }
80
+ function lazyFleetDb() {
81
+ let db = null;
82
+ return {
83
+ get: async () => {
84
+ if (!db) {
85
+ const { openDb, readDbConfig } = await import("./client-DGTO65WB.js");
86
+ db = await openDb(readDbConfig());
87
+ }
88
+ return db;
89
+ },
90
+ close: async () => {
91
+ if (db) await db.destroy();
92
+ }
93
+ };
94
+ }
79
95
  async function runReportCommand(slug, opts) {
80
96
  if (opts.digest) {
81
- const { runDigest } = await import("./digest-7UBGUBRK.js");
82
- return runDigest({ baseUrl: dashboardBaseUrl() });
97
+ const { runDigest } = await import("./digest-CWKK2DMR.js");
98
+ const { listSites, listAllReports } = await import("./fleet-state-RJROYXKO.js");
99
+ const fleetDb = lazyFleetDb();
100
+ try {
101
+ return await runDigest({
102
+ baseUrl: dashboardBaseUrl(),
103
+ roster: async () => listSites(await fleetDb.get()),
104
+ allReports: async () => listAllReports(await fleetDb.get())
105
+ });
106
+ } finally {
107
+ await fleetDb.close();
108
+ }
83
109
  }
84
110
  if (opts.sendReady) {
85
- const { sendApprovedReports } = await import("./orchestrate-HYVQPRCE.js");
86
- const { makeSiteMirror } = await import("./site-mirror-WON4FTJ2.js");
87
- const { mirrorWrite } = await import("./freeze-A6MUCZU4.js");
88
- const { openDb, readDbConfig } = await import("./client-G2WGWPCA.js");
89
- const { mirrorReportPatch } = await import("./fleet-state-UEVZ3X3J.js");
90
- return sendApprovedReports({
91
- siteMirror: await makeSiteMirror(),
92
- // stampSent's Turso shadow, routed through mirrorWrite so the freeze
93
- // switch owns the semantics: strict rethrows and the send loop reds the
94
- // run. Mirrors stampSent exactly — the 409 replay path leaves Airtable's
95
- // `Resend message ID` untouched, so the shadow omits it there too.
96
- reportSentMirror: (reportId, sentAt, messageId) => mirrorWrite(`stamp-sent ${reportId}`, async () => {
97
- const db = await openDb(readDbConfig());
98
- await mirrorReportPatch(db, reportId, {
99
- sent_at: sentAt.toISOString(),
100
- ...messageId !== null ? { resend_message_id: messageId } : {}
101
- });
102
- })
103
- });
111
+ const { sendApprovedReports } = await import("./orchestrate-L2A5BZFY.js");
112
+ const { makeSiteMirror } = await import("./site-mirror-WR7ACXOV.js");
113
+ const { mirrorWrite } = await import("./freeze-GUQ43EAU.js");
114
+ const { openDb, readDbConfig } = await import("./client-DGTO65WB.js");
115
+ const { mirrorReportPatch, listSendableReports, listSites } = await import("./fleet-state-RJROYXKO.js");
116
+ const { loadHeaderImage } = await import("./header-images-SQBCE5OD.js");
117
+ const held = { db: null };
118
+ const getFleetDb = async () => held.db ??= await openDb(readDbConfig());
119
+ try {
120
+ return await sendApprovedReports({
121
+ sendable: async () => listSendableReports(await getFleetDb()),
122
+ roster: async () => listSites(await getFleetDb()),
123
+ loadHeaderPlate: async (siteId) => (await loadHeaderImage(await getFleetDb(), siteId))?.bytes ?? null,
124
+ siteMirror: await makeSiteMirror(),
125
+ // stampSent's Turso shadow, routed through mirrorWrite so the freeze
126
+ // switch owns the semantics: strict rethrows and the send loop reds the
127
+ // run. Mirrors stampSent exactly — the 409 replay path leaves Airtable's
128
+ // `Resend message ID` untouched, so the shadow omits it there too. The
129
+ // row count is handed through (#647): a stamp for a report row Turso
130
+ // never held is `missed`, not a green no-op.
131
+ reportSentMirror: (reportId, sentAt, messageId) => mirrorWrite(`stamp-sent ${reportId}`, async () => {
132
+ const db = await openDb(readDbConfig());
133
+ return mirrorReportPatch(db, reportId, {
134
+ sent_at: sentAt.toISOString(),
135
+ ...messageId !== null ? { resend_message_id: messageId } : {}
136
+ });
137
+ })
138
+ });
139
+ } finally {
140
+ if (held.db) await held.db.destroy();
141
+ }
104
142
  }
105
143
  if (opts.rerender) {
106
144
  const { rerenderReport, formatRerenderResult } = await import("./rerender-3FM6DNRH.js");
107
- const { renderReportFromRow } = await import("./render-from-row-IFSBHWDH.js");
108
- const { openDb, readDbConfig } = await import("./client-G2WGWPCA.js");
109
- const { getReportById, getSiteById, storeRenderedHtml } = await import("./fleet-state-UEVZ3X3J.js");
145
+ const { renderReportFromRow } = await import("./render-from-row-75JTED2Z.js");
146
+ const { openDb, readDbConfig } = await import("./client-DGTO65WB.js");
147
+ const { getReportById, getSiteById, storeRenderedHtml } = await import("./fleet-state-RJROYXKO.js");
110
148
  const { loadHeaderImage } = await import("./header-images-SQBCE5OD.js");
111
- const { fetchAttachmentBytes } = await import("./attachments-NLZIJ5NU.js");
149
+ const { fetchAttachmentBytes } = await import("./attachments-JFGFQRXQ.js");
112
150
  const db = await openDb(readDbConfig());
113
151
  const result = await rerenderReport(
114
152
  {
@@ -145,18 +183,24 @@ async function runReportCommand(slug, opts) {
145
183
  }
146
184
  async function runDueDraft() {
147
185
  const base = openBase(readAirtableConfig());
148
- const { makeScheduleMirrorBestEffort } = await import("./health-mirror-XJAKA3EY.js");
149
- const { makeReportMirror } = await import("./report-mirror-HDTOJE64.js");
150
- const { makeSiteMirror } = await import("./site-mirror-WON4FTJ2.js");
151
- const result = await draftDueReports(
152
- base,
153
- /* @__PURE__ */ new Date(),
154
- await makeScheduleMirrorBestEffort(),
155
- await makeReportMirror(),
156
- await makeSiteMirror()
157
- );
158
- await alertOnFleetAnalyticsFailure(result.health);
159
- return { output: result.output, code: result.code };
186
+ const { makeScheduleMirrorBestEffort } = await import("./health-mirror-KU3G7V2Y.js");
187
+ const { makeReportMirror } = await import("./report-mirror-4QM57LMS.js");
188
+ const { makeSiteMirror } = await import("./site-mirror-WR7ACXOV.js");
189
+ const { listSites, listAllReports } = await import("./fleet-state-RJROYXKO.js");
190
+ const fleetDb = lazyFleetDb();
191
+ try {
192
+ const result = await draftDueReports(base, /* @__PURE__ */ new Date(), {
193
+ roster: async () => listSites(await fleetDb.get()),
194
+ allReports: async () => listAllReports(await fleetDb.get()),
195
+ scheduleMirror: await makeScheduleMirrorBestEffort(),
196
+ reportMirror: await makeReportMirror(),
197
+ siteMirror: await makeSiteMirror()
198
+ });
199
+ await alertOnFleetAnalyticsFailure(result.health);
200
+ return { output: result.output, code: result.code };
201
+ } finally {
202
+ await fleetDb.close();
203
+ }
160
204
  }
161
205
  async function alertOnFleetAnalyticsFailure(health) {
162
206
  if (!assessAnalyticsAlert(health).fire) return;
@@ -211,13 +255,14 @@ async function writeNextDueDates(base, websites, reports, today, scheduleMirror
211
255
  const mirrorNote = scheduleMirror ? ` mirrored=${mirrored} mirror_failed=${mirrorFailed} mirror_missed=${mirrorMissed}` : " mirror=absent";
212
256
  console.log(`NEXT_DUE_WRITE wrote=${wrote} skipped=${skipped} failed=${failed}${mirrorNote}`);
213
257
  }
214
- async function draftDueReports(base, today, scheduleMirror = null, reportMirror, siteMirror) {
258
+ async function draftDueReports(base, today, deps) {
259
+ const scheduleMirror = deps.scheduleMirror ?? null;
215
260
  const mirrorOpt = {
216
- ...reportMirror ? { reportMirror } : {},
217
- ...siteMirror ? { siteMirror } : {}
261
+ reportMirror: deps.reportMirror,
262
+ ...deps.siteMirror ? { siteMirror: deps.siteMirror } : {}
218
263
  };
219
- const websites = await listWebsites(base);
220
- const reports = await listAllReports(base);
264
+ const websites = await deps.roster();
265
+ const reports = await deps.allReports();
221
266
  await writeNextDueDates(base, websites, reports, today, scheduleMirror);
222
267
  const due = findDueReports(websites, reports, today);
223
268
  const gaConfigured = readGaConfig() !== null;
@@ -332,13 +377,14 @@ async function draftDueReports(base, today, scheduleMirror = null, reportMirror,
332
377
  }
333
378
  async function runSingleSiteDraft(slug, opts) {
334
379
  const base = openBase(readAirtableConfig());
335
- const websites = await listWebsites(base);
380
+ const { readFleetRoster } = await import("./roster-GDNSIRAK.js");
381
+ const websites = await readFleetRoster();
336
382
  const site = websites.find((w) => siteSlug(w.name) === slug);
337
383
  if (!site) {
338
- throw Object.assign(new Error(`No Websites row matched slug "${slug}"`), { exitCode: 2 });
384
+ throw Object.assign(new Error(`No site matched slug "${slug}"`), { exitCode: 2 });
339
385
  }
340
- const reportMirror = opts.previewOnly ? null : await (await import("./report-mirror-HDTOJE64.js")).makeReportMirror();
341
- const siteMirror = opts.previewOnly ? null : await (await import("./site-mirror-WON4FTJ2.js")).makeSiteMirror();
386
+ const reportMirror = opts.previewOnly ? null : await (await import("./report-mirror-4QM57LMS.js")).makeReportMirror();
387
+ const siteMirror = opts.previewOnly ? null : await (await import("./site-mirror-WR7ACXOV.js")).makeSiteMirror();
342
388
  const result = await draftReportForSite(opts.previewOnly ? null : base, site, opts.reportType, {
343
389
  previewOnly: opts.previewOnly,
344
390
  // Only forced on. Left undefined, draftReportForSite keeps its default
@@ -366,4 +412,4 @@ export {
366
412
  runReportCommand,
367
413
  writeNextDueDates
368
414
  };
369
- //# sourceMappingURL=report-LQS4ECTM.js.map
415
+ //# sourceMappingURL=report-IAHXN5CW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/alerts/analytics-health.ts","../src/cli/commands/report.ts"],"sourcesContent":["import { escapeHtml } from \"../util/html.js\";\n\n/**\n * The GA/Search enrichment outcome of one `report --due` draft run, aggregated\n * across the sites it drafted. `softFailedSites` is how many drafted sites had GA\n * OR Search enrichment ERROR (not \"not configured\" — that's a legitimate skip);\n * `configuredSites` is how many drafted sites had analytics configured at all\n * (the subject is set AND the site has a GA4 property or a search query). The ratio\n * is what distinguishes a fleet-wide subject outage from a single transient blip.\n */\nexport type AnalyticsRunHealth = {\n softFailedSites: number;\n configuredSites: number;\n};\n\nexport type AnalyticsAlert = { fire: boolean; reason: string };\n\n/** A lone failure never alerts — that's a per-site config issue, not the shared-\n * subject SPOF. Two-plus AND a majority of configured sites is the fleet signature. */\nconst MIN_FAILED_SITES = 2;\n\n/**\n * Decide whether a draft run's GA/Search soft-failures look FLEET-WIDE — i.e. the\n * one impersonated subject (`GA_SUBJECT`) lost access — rather than one site's\n * transient blip. PURE. Fires when at least {@link MIN_FAILED_SITES} configured\n * sites failed AND they are a majority (≥ half) of the analytics-configured sites\n * this run. With <2 configured sites it can't distinguish a SPOF from a one-off, so\n * it never fires (at fleet scale there are always many configured sites).\n */\nexport function assessAnalyticsAlert(h: AnalyticsRunHealth): AnalyticsAlert {\n const { softFailedSites, configuredSites } = h;\n const fire =\n configuredSites >= 2 &&\n softFailedSites >= MIN_FAILED_SITES &&\n softFailedSites * 2 >= configuredSites;\n const reason = fire\n ? `${softFailedSites} of ${configuredSites} analytics-configured sites had GA/Search enrichment fail this run — the shared GA_SUBJECT likely lost access (an offboarded user, revoked property access, or a botched role-account cutover). Reports were drafted with BLANK analytics.`\n : \"\";\n return { fire, reason };\n}\n\n/**\n * Compose the operator alert email for a fleet-wide analytics failure. PURE — the\n * caller (the `report --due` cron) sends it best-effort via Resend only when\n * {@link assessAnalyticsAlert} fires. `dashboardUrl` is the fleet homepage link.\n */\nexport function composeAnalyticsAlertEmail(\n h: AnalyticsRunHealth,\n dashboardUrl: string,\n): { subject: string; html: string } {\n const subject = `⚠ Fleet analytics enrichment failing — ${h.softFailedSites}/${h.configuredSites} sites`;\n const { reason } = assessAnalyticsAlert(h);\n const html = `<p><strong>${escapeHtml(reason)}</strong></p>\n<p>This usually means the Google Workspace user the service account impersonates can no longer read the GA4 / Search Console properties. Reports still send — but with blank analytics — until the subject is restored.</p>\n<p>Next step: follow the GA/Search subject runbook (<code>docs/runbooks/ga-search-role-account-cutover.md</code>) to restore or move the subject, then re-run <code>reddoor-maint report --due</code> and confirm the warning clears.</p>\n<p><a href=\"${escapeHtml(dashboardUrl)}\">Open the fleet dashboard →</a></p>`;\n return { subject, html };\n}\n","import { openBase, readAirtableConfig, type AirtableBase } from \"../../reports/airtable/client.js\";\nimport type { Db } from \"../../db/client.js\";\nimport { siteSlug, updateNextDueDates, type WebsiteRow } from \"../../reports/airtable/websites.js\";\nimport type { ReportRow } from \"../../reports/airtable/reports.js\";\nimport { findDueReports, nextDueDate, reportPeriodKey } from \"../../reports/due.js\";\nimport { draftReportForSite } from \"../../reports/draft.js\";\nimport { reportTier } from \"../../reports/queue.js\";\nimport { readGaConfig } from \"../../reports/ga/config.js\";\nimport {\n assessAnalyticsAlert,\n composeAnalyticsAlertEmail,\n type AnalyticsRunHealth,\n} from \"../../alerts/analytics-health.js\";\nimport type { ReportType } from \"../../reports/types.js\";\nimport type { ScheduleMirror } from \"../../audits/health-mirror.js\";\nimport type { ReportMirror } from \"../../reports/report-mirror.js\";\nimport type { SiteMirror } from \"../../db/site-mirror.js\";\nimport { operatorEmail } from \"../../util/operator.js\";\n\nexport type ReportCommandOptions = {\n due?: boolean;\n preview?: boolean;\n enrich?: boolean;\n sendReady?: boolean;\n digest?: boolean;\n rerender?: string;\n type?: string;\n cwd?: string;\n};\n\n/**\n * Summary line for a drafted report, reflecting the single-queue outcome. `queued === false`\n * means a higher-or-equal-tier report was already pending for the site, so this draft was\n * created but deliberately left OUT of the approve queue. A non-empty `supersededIds` means it\n * un-queued that many lower-tier drafts. `null` is the previewOnly path (no Airtable queue).\n */\nfunction draftLine(\n reportId: string | undefined,\n queued: boolean | null,\n supersededIds: string[],\n verb = \"drafted\",\n): string {\n const id = reportId ?? \"(unknown)\";\n if (queued === false) {\n return `• ${verb} but NOT queued: ${id} — a higher-or-equal-tier report is already pending approval`;\n }\n const sup =\n supersededIds.length > 0\n ? ` (superseded ${supersededIds.length} lower-tier draft${supersededIds.length > 1 ? \"s\" : \"\"})`\n : \"\";\n return `✓ ${verb}: ${id}${sup}`;\n}\n\n/**\n * Parse the single-site `--type` flag. Only Maintenance and Testing are draftable\n * this way — Launch has the `launch <site>` command and Announcement has\n * `announce <site>`, each with its own purpose-built flow. Case-insensitive;\n * defaults to Maintenance (the historical single-site behaviour). Throws an\n * exitCode-2 usage error on anything else. PURE.\n */\nexport function parseSingleSiteReportType(raw: string | undefined): ReportType {\n if (raw === undefined || raw.trim() === \"\") return \"Maintenance\";\n const norm = raw.trim().toLowerCase();\n if (norm === \"maintenance\") return \"Maintenance\";\n if (norm === \"testing\") return \"Testing\";\n const hint =\n norm === \"launch\"\n ? \" — use the `launch <site>` command\"\n : norm === \"announcement\"\n ? \" — use the `announce <site>` command\"\n : \"\";\n throw Object.assign(\n new Error(`--type must be Maintenance or Testing (got ${JSON.stringify(raw)})${hint}`),\n { exitCode: 2 },\n );\n}\n\n/** Dashboard origin for digest /s/<slug> links. DASHBOARD_BASE_URL overrides the\n * production default; the trailing slash (if any) is trimmed by runDigest. */\nfunction dashboardBaseUrl(): string {\n return process.env.DASHBOARD_BASE_URL?.trim() || \"https://reddoor-maintenance.netlify.app\";\n}\n\n/** One lazily-opened, once-closed libSQL connection for a command's reads (#646\n * step 4). Lazy because the command that owns it may return before any read\n * happens, and opening a database to do nothing is how a test — or a `--help`\n * path — ends up needing `TURSO_DATABASE_URL`. */\nfunction lazyFleetDb(): { get: () => Promise<Db>; close: () => Promise<void> } {\n let db: Db | null = null;\n return {\n get: async () => {\n if (!db) {\n const { openDb, readDbConfig } = await import(\"../../db/client.js\");\n db = await openDb(readDbConfig());\n }\n return db;\n },\n close: async () => {\n if (db) await db.destroy();\n },\n };\n}\n\nexport async function runReportCommand(\n slug: string | undefined,\n opts: ReportCommandOptions,\n): Promise<{ output: string; code: number }> {\n if (opts.digest) {\n const { runDigest } = await import(\"../../reports/digest.js\");\n // #646 step 4: the digest's two datasets come from Turso. ONE connection for\n // both reads, opened here (the command is the composition root) and closed\n // when the run is done — Airtable is left holding only the digest-state\n // shadow write. Opened LAZILY, on the first read: a run that never reads\n // (a routing test, a caller that fails earlier) must not need a database.\n const { listSites, listAllReports } = await import(\"../../db/fleet-state.js\");\n const fleetDb = lazyFleetDb();\n try {\n return await runDigest({\n baseUrl: dashboardBaseUrl(),\n roster: async () => listSites(await fleetDb.get()),\n allReports: async () => listAllReports(await fleetDb.get()),\n });\n } finally {\n await fleetDb.close();\n }\n }\n\n if (opts.sendReady) {\n const { sendApprovedReports } = await import(\"../../reports/send/orchestrate.js\");\n // #539 Phase 5: a Launch send flips Status + stamps `Launched at` on the\n // Websites row; #643 retired the hourly sync, so these mirrors are the ONLY\n // way either write reaches Turso.\n const { makeSiteMirror } = await import(\"../../db/site-mirror.js\");\n const { mirrorWrite } = await import(\"../../db/freeze.js\");\n const { openDb, readDbConfig } = await import(\"../../db/client.js\");\n const { mirrorReportPatch, listSendableReports, listSites } =\n await import(\"../../db/fleet-state.js\");\n const { loadHeaderImage } = await import(\"../../db/header-images.js\");\n // #646 step 4: the queue, the roster and the header plate all come from Turso,\n // over ONE connection opened on the first of those reads and closed when the\n // run ends. The Airtable calls left on this path are writes (`stampSent`,\n // `updateLaunched`) plus the one-site header fallback inside the orchestrator.\n type FleetDb = Awaited<ReturnType<typeof openDb>>;\n // Held in an object rather than a `let`: the only assignment happens inside the\n // closure below, and TypeScript's flow analysis then narrows the variable to\n // `null` for the `finally` that has to close it.\n const held: { db: FleetDb | null } = { db: null };\n const getFleetDb = async (): Promise<FleetDb> => (held.db ??= await openDb(readDbConfig()));\n try {\n return await sendApprovedReports({\n sendable: async () => listSendableReports(await getFleetDb()),\n roster: async () => listSites(await getFleetDb()),\n loadHeaderPlate: async (siteId) =>\n (await loadHeaderImage(await getFleetDb(), siteId))?.bytes ?? null,\n siteMirror: await makeSiteMirror(),\n // stampSent's Turso shadow, routed through mirrorWrite so the freeze\n // switch owns the semantics: strict rethrows and the send loop reds the\n // run. Mirrors stampSent exactly — the 409 replay path leaves Airtable's\n // `Resend message ID` untouched, so the shadow omits it there too. The\n // row count is handed through (#647): a stamp for a report row Turso\n // never held is `missed`, not a green no-op.\n reportSentMirror: (reportId, sentAt, messageId) =>\n mirrorWrite(`stamp-sent ${reportId}`, async () => {\n const db = await openDb(readDbConfig());\n return mirrorReportPatch(db, reportId, {\n sent_at: sentAt.toISOString(),\n ...(messageId !== null ? { resend_message_id: messageId } : {}),\n });\n }),\n });\n } finally {\n if (held.db) await held.db.destroy();\n }\n }\n\n // Refresh ONE unsent report's stored body so the console preview reflects\n // commentary edited after drafting. Runs here rather than in a Netlify\n // function because rendering needs sharp — see rerender.ts.\n if (opts.rerender) {\n const { rerenderReport, formatRerenderResult } = await import(\"../../reports/send/rerender.js\");\n const { renderReportFromRow } = await import(\"../../reports/send/render-from-row.js\");\n const { openDb, readDbConfig } = await import(\"../../db/client.js\");\n const { getReportById, getSiteById, storeRenderedHtml } =\n await import(\"../../db/fleet-state.js\");\n const { loadHeaderImage } = await import(\"../../db/header-images.js\");\n const { fetchAttachmentBytes } = await import(\"../../reports/airtable/attachments.js\");\n const db = await openDb(readDbConfig());\n const result = await rerenderReport(\n {\n getReport: (id) => getReportById(db, id),\n getSite: (id) => getSiteById(db, id),\n loadHeaderPlate: async (id) => (await loadHeaderImage(db, id))?.bytes ?? null,\n fetchAirtableHeader: async (url) => (await fetchAttachmentBytes(url)).bytes,\n render: (site, report, plate) => renderReportFromRow(site, report, plate),\n store: (id, html) => storeRenderedHtml(db, id, html),\n },\n opts.rerender,\n );\n // Exit 1 on anything but a render, so a dispatched run that refused is RED\n // rather than a green run that silently changed nothing.\n return { output: formatRerenderResult(result), code: result.status === \"rendered\" ? 0 : 1 };\n }\n\n if (opts.due) {\n return runDueDraft();\n }\n\n if (slug) {\n // Validate the type BEFORE any Airtable access so a bad --type fails fast (and\n // without needing credentials).\n const reportType = parseSingleSiteReportType(opts.type);\n return runSingleSiteDraft(slug, {\n previewOnly: Boolean(opts.preview),\n enrich: Boolean(opts.enrich),\n reportType,\n });\n }\n\n throw Object.assign(\n new Error(\n \"Usage: reddoor-maint report [<slug>] [--type <Maintenance|Testing>] [--due] [--preview] [--enrich] [--send-ready] [--digest]\",\n ),\n {\n exitCode: 2,\n },\n );\n}\n\nasync function runDueDraft(): Promise<{ output: string; code: number }> {\n const base = openBase(readAirtableConfig());\n // Phase 3 dual-write (#539): mirror real next-due writes into site_schedule.\n // Null when libSQL creds are absent — the Airtable path is unchanged.\n const { makeScheduleMirrorBestEffort } = await import(\"../../audits/health-mirror.js\");\n // Phase 5 dual-write (#539): mirror this batch's report writes — the created\n // rows, their bodies, and the queue flags. Unlike the schedule mirror this is\n // never null — creds-absent is reported on the REPORT_MIRROR line rather than\n // being indistinguishable from success, the failure mode that hid #585.\n const { makeReportMirror } = await import(\"../../reports/report-mirror.js\");\n const { makeSiteMirror } = await import(\"../../db/site-mirror.js\");\n // #646 step 4: the roster and every report come from Turso, over ONE connection\n // opened on the first read and closed when the run ends. The Airtable calls left\n // on this path are shadow writes (next-due dates, the rendered-body attachment,\n // the queue flag), each skipping a row Airtable cannot hold.\n const { listSites, listAllReports } = await import(\"../../db/fleet-state.js\");\n const fleetDb = lazyFleetDb();\n try {\n const result = await draftDueReports(base, new Date(), {\n roster: async () => listSites(await fleetDb.get()),\n allReports: async () => listAllReports(await fleetDb.get()),\n scheduleMirror: await makeScheduleMirrorBestEffort(),\n reportMirror: await makeReportMirror(),\n siteMirror: await makeSiteMirror(),\n });\n await alertOnFleetAnalyticsFailure(result.health);\n return { output: result.output, code: result.code };\n } finally {\n await fleetDb.close();\n }\n}\n\n/** Best-effort: when a draft run's GA/Search soft-failures look FLEET-WIDE (the shared\n * GA_SUBJECT lost access — see assessAnalyticsAlert), email the operator one alert.\n * NEVER throws — a Resend or config hiccup must not fail the nightly draft cron; the\n * per-site `⚠ GA skipped` warnings + the run-output line still carry the signal. The\n * daily idempotency key dedupes multiple runs in one day (Resend dedupes 24h). */\nasync function alertOnFleetAnalyticsFailure(health: AnalyticsRunHealth): Promise<void> {\n if (!assessAnalyticsAlert(health).fire) return;\n try {\n const to = operatorEmail();\n const { subject, html } = composeAnalyticsAlertEmail(health, dashboardBaseUrl());\n const { defaultResendClient } = await import(\"../../reports/send/resend.js\");\n await defaultResendClient().send({\n from: \"Reddoor Reports <reports@reddoorla.com>\",\n to: [to],\n subject,\n html,\n idempotencyKey: `analytics-alert-${new Date().toISOString().slice(0, 10)}`,\n });\n console.warn(`⚠ ${subject} — operator alerted (${to})`);\n } catch (e) {\n console.warn(`⚠ analytics-failure alert send failed: ${(e as Error).message}`);\n }\n}\n\n/**\n * Write each site's code-computed next-maintenance / next-testing date back to Airtable\n * (date-only, or null when there's no schedule), so the \"next\" dates shown there derive\n * from the SAME `nextDueDate` the scheduler uses — replacing the old Airtable formula +\n * automation. Best-effort and per-site isolated: a missing `Next … at` column or one bad\n * row warns and is skipped, never aborting the nightly draft run.\n *\n * The diff-guard (#539 Phase 3): a site whose computed dates equal what its row\n * already holds is SKIPPED — before it, every one of the 44 sites got a nightly\n * write while only the handful whose schedule actually moved needed one (a\n * never-maintained site re-wrote null over null forever). This also scopes the\n * write to maintained sites by construction: no schedule → computed null →\n * equal to the stored null → skipped. Each real write dual-writes through\n * `scheduleMirror` into site_schedule (null mirror = Turso creds absent; the\n * hourly sync converges either way). The NEXT_DUE_WRITE line is observability,\n * not a CI gate — nothing greps it yet.\n */\nexport async function writeNextDueDates(\n base: AirtableBase,\n websites: WebsiteRow[],\n reports: ReportRow[],\n today: Date,\n scheduleMirror: ScheduleMirror | null = null,\n): Promise<void> {\n const ymd = (d: Date | null): string | null => (d ? d.toISOString().slice(0, 10) : null);\n let wrote = 0;\n let skipped = 0;\n let failed = 0;\n let mirrored = 0;\n let mirrorFailed = 0;\n let mirrorMissed = 0;\n for (const site of websites) {\n // The whole per-site body sits in ONE try — compute included — so a bad\n // row can only cost its own write, exactly the pre-diff-guard blast radius.\n try {\n const maintenanceAt = ymd(nextDueDate(site, reports, \"Maintenance\", today));\n const testingAt = ymd(nextDueDate(site, reports, \"Testing\", today));\n if (maintenanceAt === site.nextMaintenanceAt && testingAt === site.nextTestingAt) {\n skipped++;\n continue;\n }\n const fields = await updateNextDueDates(base, site.id, { maintenanceAt, testingAt });\n wrote++;\n if (scheduleMirror) {\n try {\n // false = the UPDATE matched no site_schedule row (site created in\n // Airtable since the last hourly import) — missed, not mirrored.\n if (await scheduleMirror(site.id, fields, today.toISOString())) mirrored++;\n else mirrorMissed++;\n } catch (e) {\n mirrorFailed++;\n console.warn(`⚠ [schedule-mirror] ${site.name}: ${(e as Error).message}`);\n }\n }\n } catch (e) {\n failed++;\n console.warn(`⚠ next-due write skipped for ${site.name}: ${(e as Error).message}`);\n }\n }\n // failed= keeps a write outage visible: without it wrote+skipped silently\n // undercounts, and a FULL outage prints wrote=0 skipped=0 — indistinguishable\n // from an empty fleet.\n // A null mirror writes nothing and throws nothing, so its only trace used to\n // be an ABSENT suffix — which reads exactly like a healthy run. `mirror=absent`\n // states it instead. Counters stay off in that case deliberately: `mirrored=0`\n // would claim a write that returned nothing, not one that was never attempted.\n const mirrorNote = scheduleMirror\n ? ` mirrored=${mirrored} mirror_failed=${mirrorFailed} mirror_missed=${mirrorMissed}`\n : \" mirror=absent\";\n console.log(`NEXT_DUE_WRITE wrote=${wrote} skipped=${skipped} failed=${failed}${mirrorNote}`);\n}\n\n/** What the nightly draft batch reads and writes, injected at its composition\n * root (`runDueDraft`).\n *\n * #646 step 4: `roster` and `allReports` READ FROM TURSO. They are required\n * rather than defaulted for the reason every other step-4 reader is — this\n * function is called directly by tests, and a default would let a unit suite\n * open a real store. They also had to move together with report creation: a\n * report row now exists only in Turso, so an Airtable `listAllReports` would\n * stop seeing last night's drafts and the period guard would re-draft every\n * site every night. */\nexport type DraftDueDeps = {\n /** Every site in the fleet — `site_<ULID>` sites included, which an Airtable\n * roster cannot see at all. */\n roster: () => Promise<WebsiteRow[]>;\n /** Every report, unfiltered: the period/idempotency guard and `findDueReports`\n * both match on siteId in memory. */\n allReports: () => Promise<ReportRow[]>;\n scheduleMirror?: ScheduleMirror | null;\n /** #539 Phase 5, and since #646 step 4 the store that MINTS and holds each new\n * report row. Forwarded to every draftReportForSite call — the nightly batch is\n * the only unattended creator of report rows. */\n reportMirror: ReportMirror;\n /** #539 Phase 5: the Websites-row twin — drafting stamps `Analytics soft-fail\n * at` on the SITE row, a different Turso table from the report. */\n siteMirror?: SiteMirror;\n};\n\nexport async function draftDueReports(\n base: AirtableBase,\n today: Date,\n deps: DraftDueDeps,\n): Promise<{ output: string; code: number; health: AnalyticsRunHealth }> {\n const scheduleMirror = deps.scheduleMirror ?? null;\n const mirrorOpt = {\n reportMirror: deps.reportMirror,\n ...(deps.siteMirror ? { siteMirror: deps.siteMirror } : {}),\n };\n const websites = await deps.roster();\n const reports = await deps.allReports();\n\n // Refresh every site's code-owned next-due dates first, so they stay current even on\n // a run where nothing is due (the early return below).\n await writeNextDueDates(base, websites, reports, today, scheduleMirror);\n\n const due = findDueReports(websites, reports, today);\n\n // GA/Search enrichment is configured globally (the impersonation subject) AND\n // per-site (a GA4 property or a search query). `gaConfigured` is the global half;\n // the per-site half is checked as each draft runs, to build the fleet-wide\n // analytics-failure alert's denominator (see alertOnFleetAnalyticsFailure).\n const gaConfigured = readGaConfig() !== null;\n // Truthy (not `!== null`) to mirror fetchGaUsers/fetchSearch's own gate exactly\n // (`!siteRow.ga4PropertyId`), so an empty-string cell counts as not-configured in\n // BOTH places and can't inflate the alert denominator.\n const isAnalyticsConfigured = (s: WebsiteRow): boolean =>\n gaConfigured && Boolean(s.ga4PropertyId || s.searchQuery);\n\n if (due.length === 0) {\n return {\n output: \"No reports due.\",\n code: 0,\n health: { softFailedSites: 0, configuredSites: 0 },\n };\n }\n\n const lines: string[] = [];\n let softFailedSites = 0;\n let searchDefaultMisses = 0;\n let searchPropertiesMissing = 0;\n let gaConfiguredSites = 0;\n let skipped = 0;\n for (const item of due) {\n // Idempotency: a re-run must not re-draft a (site, type) already drafted this\n // recurrence. The dueDate's YYYY-MM is the stable per-cycle key. Match against the\n // reports we already fetched — no extra query on the hot path.\n const period = reportPeriodKey(item.dueDate);\n const existing = reports.find(\n (r) => r.siteId === item.site.id && r.reportType === item.reportType && r.period === period,\n );\n\n // A row already exists for THIS period. Two cases:\n // - Draft ready → truly done, skip (the idempotent re-run path).\n // - NOT ready → a crash between createDraft and setDraftReady wedged it: the\n // row exists (so we never re-draft) yet it's never sendable (listSendable\n // needs Draft ready). COMPLETE it in place instead of skipping forever —\n // re-render → re-upload the HTML → flip Draft ready on the EXISTING row.\n if (existing) {\n if (existing.draftReady) {\n skipped++;\n lines.push(`• skipped (already drafted ${period}): ${item.site.name} ${item.reportType}`);\n continue;\n }\n // A not-ready row is normally a crash between createDraft and setDraftReady — re-complete\n // it in place. BUT queueDraft also clears Draft ready on rows it supersedes/blocks, and\n // those must NOT be re-completed: doing so would re-render and APPEND a duplicate HTML\n // attachment every nightly run, only to be re-blocked. Distinguish the two: if a\n // higher-or-equal-tier report is still pending for this site, this row was intentionally\n // un-queued (not crashed) — skip it until the blocker is sent/approved or the month rolls.\n const blockedByPending = reports.some(\n (r) =>\n r.siteId === item.site.id &&\n r.id !== existing.id &&\n r.sentAt === null &&\n r.draftReady &&\n reportTier(r.reportType) >= reportTier(item.reportType),\n );\n if (blockedByPending) {\n skipped++;\n lines.push(\n `• skipped (superseded — a higher-or-equal-tier report is pending): ${item.site.name} ${item.reportType}`,\n );\n continue;\n }\n try {\n const result = await draftReportForSite(base, item.site, item.reportType, {\n period,\n completeRowId: existing.id,\n existingRow: existing,\n ...mirrorOpt,\n });\n existing.draftReady = result.queued === true;\n lines.push(\n draftLine(\n result.reportRow?.reportId ?? existing.reportId,\n result.queued,\n result.supersededIds,\n \"completed half-made draft\",\n ),\n );\n if (isAnalyticsConfigured(item.site)) gaConfiguredSites++;\n if (result.softFailures.length > 0) softFailedSites++;\n if (result.searchDefaultMissed) searchDefaultMisses++;\n if (result.searchPropertyMissing) searchPropertiesMissing++;\n } catch (e) {\n lines.push(`✗ failed: ${item.site.name} ${item.reportType} — ${(e as Error).message}`);\n }\n continue;\n }\n\n // Pile-up guard: don't accrue a fresh new-period draft every recurrence for a\n // site nobody ever approves. The period key follows the DUE month, so each\n // recurrence wants a new (later-period) draft — but if a PRIOR draft is still\n // pending approval, a new one just stacks. Skip creating the new one while an\n // earlier-period draft for this (site, type) sits ready-but-unsent.\n //\n // `r.draftReady` is load-bearing: a draft a higher tier SUPERSEDED has\n // draftReady=false and never gets a Sent at, so without this clause it would\n // match (sentAt null + earlier period) and block EVERY future draft for the\n // site forever. Pending-approval means draftReady=true AND sentAt=null.\n const pendingEarlier = reports.find(\n (r) =>\n r.siteId === item.site.id &&\n r.reportType === item.reportType &&\n r.draftReady &&\n r.sentAt === null &&\n r.period !== null &&\n r.period < period,\n );\n if (pendingEarlier) {\n skipped++;\n lines.push(\n `• skipped: ${item.site.name} ${item.reportType} already has an unsent ${pendingEarlier.period} draft pending approval`,\n );\n continue;\n }\n\n try {\n // Pass the SAME key the guard searches by, so the stamped Period always\n // matches a future run's reportPeriodKey(dueDate) — even if this run lags\n // into a later month than the dueDate.\n const result = await draftReportForSite(base, item.site, item.reportType, {\n period,\n ...mirrorOpt,\n });\n lines.push(draftLine(result.reportRow?.reportId, result.queued, result.supersededIds));\n // Keep the in-memory snapshot current so the guard's `.some()` check on the\n // NEXT iteration of this same run catches a row we JUST created — rather than\n // relying on findDueReports never emitting two items for the same (site, type).\n if (result.reportRow) reports.push(result.reportRow);\n // Count sites (not individual GA/Search failures) so a fleet-wide enrichment\n // outage is one obvious line at the bottom, not 200 buried console.warns.\n if (isAnalyticsConfigured(item.site)) gaConfiguredSites++;\n if (result.softFailures.length > 0) softFailedSites++;\n if (result.searchDefaultMissed) searchDefaultMisses++;\n if (result.searchPropertyMissing) searchPropertiesMissing++;\n } catch (e) {\n lines.push(`✗ failed: ${item.site.name} ${item.reportType} — ${(e as Error).message}`);\n }\n }\n if (skipped > 0) {\n lines.push(`• ${skipped} already drafted or pending this period`);\n }\n if (softFailedSites > 0) {\n lines.push(\n `⚠ ${softFailedSites} site${softFailedSites === 1 ? \"\" : \"s\"} had GA/Search enrichment fail — drafted with blank analytics; check the logs above`,\n );\n }\n if (searchDefaultMisses > 0) {\n lines.push(\n `⚑ ${searchDefaultMisses} site${searchDefaultMisses === 1 ? \"\" : \"s\"} returned no Search Console data for their name — set an explicit \"Search query\" in Airtable to track brand presence.`,\n );\n }\n if (searchPropertiesMissing > 0) {\n lines.push(\n `⚑ ${searchPropertiesMissing} site${searchPropertiesMissing === 1 ? \"\" : \"s\"} matched NO Search Console property — verify the domain property exists and the service account has access (a \"Search query\" change cannot fix this).`,\n );\n }\n return {\n output: lines.join(\"\\n\"),\n code: lines.some((l) => l.startsWith(\"✗\")) ? 1 : 0,\n health: { softFailedSites, configuredSites: gaConfiguredSites },\n };\n}\n\nasync function runSingleSiteDraft(\n slug: string,\n opts: { previewOnly: boolean; enrich: boolean; reportType: ReportType },\n): Promise<{ output: string; code: number }> {\n // Airtable is still opened here: drafting keeps its Airtable SHADOW writes\n // (the rendered-body attachment, the analytics-health stamp, the queue flag),\n // each of which skips a row Airtable cannot hold. What moved in #646 step 4 is\n // the roster READ — an Airtable roster cannot see a `site_<ULID>` site, so this\n // command answered \"No Websites row matched\" for every site created since step 3.\n const base = openBase(readAirtableConfig());\n const { readFleetRoster } = await import(\"../../fleet/roster.js\");\n const websites = await readFleetRoster();\n const site = websites.find((w) => siteSlug(w.name) === slug);\n if (!site) {\n throw Object.assign(new Error(`No site matched slug \"${slug}\"`), { exitCode: 2 });\n }\n // Phase 5 dual-write (#539) — but only on the path that actually creates a\n // row. A preview writes nothing to Airtable, so opening a libSQL handle for\n // it would be pure cost (and `report --preview` is the one draft path that\n // deliberately does no store IO at all).\n const reportMirror = opts.previewOnly\n ? null\n : await (await import(\"../../reports/report-mirror.js\")).makeReportMirror();\n const siteMirror = opts.previewOnly\n ? null\n : await (await import(\"../../db/site-mirror.js\")).makeSiteMirror();\n const result = await draftReportForSite(opts.previewOnly ? null : base, site, opts.reportType, {\n previewOnly: opts.previewOnly,\n // Only forced on. Left undefined, draftReportForSite keeps its default\n // (enrich iff there is a base), so the real drafting path is untouched.\n ...(opts.enrich ? { enrich: true } : {}),\n ...(reportMirror ? { reportMirror } : {}),\n ...(siteMirror ? { siteMirror } : {}),\n });\n if (opts.previewOnly) {\n return { output: `Preview written to ${result.htmlPath}`, code: 0 };\n }\n return {\n output: draftLine(\n result.reportRow?.reportId,\n result.queued,\n result.supersededIds,\n \"Draft created\",\n ),\n code: 0,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAM,mBAAmB;AAUlB,SAAS,qBAAqB,GAAuC;AAC1E,QAAM,EAAE,iBAAiB,gBAAgB,IAAI;AAC7C,QAAM,OACJ,mBAAmB,KACnB,mBAAmB,oBACnB,kBAAkB,KAAK;AACzB,QAAM,SAAS,OACX,GAAG,eAAe,OAAO,eAAe,oPACxC;AACJ,SAAO,EAAE,MAAM,OAAO;AACxB;AAOO,SAAS,2BACd,GACA,cACmC;AACnC,QAAM,UAAU,oDAA0C,EAAE,eAAe,IAAI,EAAE,eAAe;AAChG,QAAM,EAAE,OAAO,IAAI,qBAAqB,CAAC;AACzC,QAAM,OAAO,cAAc,WAAW,MAAM,CAAC;AAAA;AAAA;AAAA,cAGjC,WAAW,YAAY,CAAC;AACpC,SAAO,EAAE,SAAS,KAAK;AACzB;;;ACrBA,SAAS,UACP,UACA,QACA,eACA,OAAO,WACC;AACR,QAAM,KAAK,YAAY;AACvB,MAAI,WAAW,OAAO;AACpB,WAAO,UAA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AAC3D,MAAI,CAAC,MAAM;AACT,UAAM,OAAO,OAAO,IAAI,MAAM,yBAAyB,IAAI,GAAG,GAAG,EAAE,UAAU,EAAE,CAAC;AAAA,EAClF;AAKA,QAAM,eAAe,KAAK,cACtB,OACA,OAAO,MAAM,OAAO,6BAAgC,GAAG,iBAAiB;AAC5E,QAAM,aAAa,KAAK,cACpB,OACA,OAAO,MAAM,OAAO,2BAAyB,GAAG,eAAe;AACnE,QAAM,SAAS,MAAM,mBAAmB,KAAK,cAAc,OAAO,MAAM,MAAM,KAAK,YAAY;AAAA,IAC7F,aAAa,KAAK;AAAA;AAAA;AAAA,IAGlB,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;AAAA,IACtC,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC;AAAA,IACvC,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;AAAA,EACrC,CAAC;AACD,MAAI,KAAK,aAAa;AACpB,WAAO,EAAE,QAAQ,sBAAsB,OAAO,QAAQ,IAAI,MAAM,EAAE;AAAA,EACpE;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,MACN,OAAO,WAAW;AAAA,MAClB,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,IACF;AAAA,IACA,MAAM;AAAA,EACR;AACF;","names":[]}
@@ -1,20 +1,23 @@
1
1
  import {
2
+ TURSO_IS_AUTHORITATIVE
3
+ } from "./chunk-WQLNUEZL.js";
4
+ import {
5
+ getReportById,
6
+ insertReportRow,
7
+ listReportsForSite,
2
8
  mirrorReportInsert,
3
9
  mirrorReportPatch,
4
10
  storeRenderedHtml
5
- } from "./chunk-WVNDEYXL.js";
6
- import "./chunk-6R56OKJZ.js";
7
- import {
8
- TURSO_IS_AUTHORITATIVE
9
- } from "./chunk-SVAAONYB.js";
10
- import "./chunk-F3JWOPTG.js";
11
+ } from "./chunk-BINFZQ2T.js";
12
+ import "./chunk-LF2TJN4X.js";
13
+ import "./chunk-ASLDCWBF.js";
11
14
  import "./chunk-VAD43MOR.js";
12
- import "./chunk-3Z6X3BHU.js";
15
+ import "./chunk-ICSRWW5Q.js";
13
16
  import {
14
17
  openDb,
15
18
  readDbConfig
16
- } from "./chunk-VSGMCCGQ.js";
17
- import "./chunk-C3IQQKXL.js";
19
+ } from "./chunk-MMSMZC7S.js";
20
+ import "./chunk-IOTOOTII.js";
18
21
  import "./chunk-6VAL7XJT.js";
19
22
 
20
23
  // src/reports/report-mirror.ts
@@ -32,8 +35,9 @@ async function makeReportMirror(open = () => openDb(readDbConfig()), strict = TU
32
35
  console.log(`REPORT_MIRROR report=${reportId} op=${op} mirrored=absent reason=${why}`);
33
36
  return;
34
37
  }
38
+ let matched;
35
39
  try {
36
- await work(db);
40
+ matched = await work(db) !== false;
37
41
  } catch (e) {
38
42
  console.log(
39
43
  `REPORT_MIRROR report=${reportId} op=${op} mirrored=0 error=${e.message}`
@@ -41,10 +45,28 @@ async function makeReportMirror(open = () => openDb(readDbConfig()), strict = TU
41
45
  if (strict) throw e;
42
46
  return;
43
47
  }
44
- console.log(`REPORT_MIRROR report=${reportId} op=${op} mirrored=1`);
48
+ console.log(`REPORT_MIRROR report=${reportId} op=${op} mirrored=${matched ? "1" : "missed"}`);
49
+ if (strict && !matched) {
50
+ throw new Error(`REPORT_MIRROR report=${reportId} op=${op}: no such row in Turso`);
51
+ }
52
+ };
53
+ const reading = (op) => {
54
+ if (!db) throw new Error(`REPORT_MIRROR op=${op} unavailable: ${why}`);
55
+ return db;
45
56
  };
46
57
  return {
58
+ create: async (rec) => {
59
+ await run(rec.id, "create", (d) => insertReportRow(d, rec));
60
+ const row = await getReportById(reading("create"), rec.id);
61
+ if (!row)
62
+ throw new Error(`REPORT_MIRROR report=${rec.id} op=create: row not found after insert`);
63
+ return row;
64
+ },
47
65
  created: (rec) => run(rec.id, "created", (d) => mirrorReportInsert(d, rec)),
66
+ // `async` so a missing handle REJECTS rather than throwing synchronously —
67
+ // every caller awaits this, and a synchronous throw would escape a
68
+ // `.catch()` written around the await.
69
+ forSite: async (siteId) => listReportsForSite(reading("forSite"), siteId),
48
70
  body: (reportId, html) => run(reportId, "body", (d) => storeRenderedHtml(d, reportId, html)),
49
71
  patch: (reportId, patch) => run(reportId, "patch", (d) => mirrorReportPatch(d, reportId, patch))
50
72
  };
@@ -52,4 +74,4 @@ async function makeReportMirror(open = () => openDb(readDbConfig()), strict = TU
52
74
  export {
53
75
  makeReportMirror
54
76
  };
55
- //# sourceMappingURL=report-mirror-HDTOJE64.js.map
77
+ //# sourceMappingURL=report-mirror-4QM57LMS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reports/report-mirror.ts"],"sourcesContent":["/** #539 Phase 5: the Turso write-through for the Reports write surface — and,\n * since #646 step 4, the surface itself: `create` MINTS nothing (the creator\n * does) but it is the only place a report row comes into existence, and\n * `forSite` is the drafting path's read.\n *\n * Before this, the only report mirrors were UPDATEs on the request path\n * (approve, override, delivery status, commentary). Everything the DRAFTING\n * path writes — the row itself, the rendered body, the queue flag, a re-run's\n * refreshed scores — reached Turso only via the hourly sync. Two of those are\n * visible to the operator today: a fresh draft's row does not exist, and its\n * preview route answers \"No rendered body stored\" for up to an hour. At the\n * freeze they stop being windows.\n *\n * Deliberately UNLIKE `makeHealthMirrorBestEffort`, this never returns null.\n * #585 is the reason: Phase 3's next-due mirror silently no-opped in production\n * for weeks because the factory returned null without creds, and a dead\n * dual-write then looked exactly like a healthy one — the only tell was an\n * ABSENT log suffix nobody was watching for. Here creds-absent is a state the\n * mirror REPORTS, so every write emits one REPORT_MIRROR line and an absent\n * line means the wiring is gone, not that conditions were quiet.\n */\nimport { openDb, readDbConfig, type Db } from \"../db/client.js\";\nimport {\n getReportById,\n insertReportRow,\n listReportsForSite,\n mirrorReportInsert,\n mirrorReportPatch,\n storeRenderedHtml,\n type ReportMirrorPatch,\n} from \"../db/fleet-state.js\";\nimport type { ReportRow } from \"./report-row.js\";\nimport { TURSO_IS_AUTHORITATIVE } from \"../db/freeze.js\";\n\n/** The drafting path's whole report surface. Injected as ONE object rather than\n * as separate parameters because they share a db handle and always travel\n * together: a caller holding `create` but not `body` produces exactly the\n * half-written state (row present, preview 404) this module exists to prevent.\n *\n * Since #646 step 4 this is no longer only a mirror. `create` is the PRIMARY\n * write — Turso mints the report id and owns the row, and there is no Airtable\n * record for it to shadow (see `src/reports/create-report.ts`) — and `forSite`\n * is a READ the drafting path used to make against Airtable, which cannot see a\n * report for a `site_<ULID>` site. `body` and `patch` keep their older meaning:\n * write-throughs for state whose `rec…` rows Airtable may still shadow. The name\n * is kept because every composition root and every injection site already uses\n * it, and a rename would churn ten files to say what this comment says. */\nexport type ReportMirror = {\n /** Insert a brand-new report row and return what Turso stored. Not a mirror:\n * the row exists nowhere else. */\n create: (rec: { id: string; fields: Record<string, unknown> }) => Promise<ReportRow>;\n /** A row AIRTABLE created, as Airtable echoed it back — the pre-step-4 shape.\n * NO production path calls it any more: it pairs with the legacy Airtable\n * `createDraft`, which nothing calls either. Both are kept rather than\n * deleted because deleting from the Airtable layer is step 6, and both go\n * together when it comes. */\n created: (rec: { id: string; fields: Record<string, unknown> }) => Promise<void>;\n /** Every report for one site — the single-queue rule's and the period\n * derivation's read. */\n forSite: (siteId: string) => Promise<ReportRow[]>;\n /** A freshly rendered body for an existing row. */\n body: (reportId: string, html: string) => Promise<void>;\n /** Columns just written to an existing row. */\n patch: (reportId: string, patch: ReportMirrorPatch) => Promise<void>;\n};\n\n/** Build the drafting-path mirror. Never throws and never returns null:\n * Airtable is still authoritative through Phase 5, so a mirror problem must\n * not cost a draft the operator is waiting on — the hourly sync converges\n * whatever this misses. `open` is injectable for tests. */\nexport async function makeReportMirror(\n open: () => Promise<Db> = () => openDb(readDbConfig()),\n /** #612. `true` = Turso is the store that must succeed, so every failure\n * throws instead of being logged and swallowed. Defaulted from the shipped\n * constant and injected by tests, so both sides stay proven. */\n strict: boolean = TURSO_IS_AUTHORITATIVE,\n): Promise<ReportMirror> {\n let db: Db | null = null;\n let why = \"\";\n try {\n db = await open();\n } catch (e) {\n why = (e as Error).message;\n }\n // Frozen: refuse to hand back a mirror that cannot write — see makeSiteMirror\n // for why this fails at construction rather than per write.\n if (strict && !db) throw new Error(`REPORT_MIRROR unavailable: ${why}`);\n\n const run = async (\n reportId: string,\n op: string,\n /** `false` = the UPDATE matched no row; void = a writer that reports no count. */\n work: (db: Db) => Promise<void | boolean>,\n ) => {\n if (!db) {\n console.log(`REPORT_MIRROR report=${reportId} op=${op} mirrored=absent reason=${why}`);\n return;\n }\n // Every path below logs EXACTLY ONE line, then strict adds a throw — the\n // run log reads the same in both worlds, not just a stack.\n let matched: boolean;\n try {\n matched = (await work(db)) !== false;\n } catch (e) {\n console.log(\n `REPORT_MIRROR report=${reportId} op=${op} mirrored=0 error=${(e as Error).message}`,\n );\n if (strict) throw e;\n return;\n }\n // `missed` is its own outcome (#647), the same one `makeSiteMirror` already\n // reports: the UPDATE matched no row. Before the freeze the hourly sync\n // would import the row — a transient; after it no importer exists, so an\n // absent row stays absent and reporting mirrored=1 would claim a write\n // that never landed.\n console.log(`REPORT_MIRROR report=${reportId} op=${op} mirrored=${matched ? \"1\" : \"missed\"}`);\n if (strict && !matched) {\n throw new Error(`REPORT_MIRROR report=${reportId} op=${op}: no such row in Turso`);\n }\n };\n\n /** The two READS. They take the same handle but none of `run`'s write\n * semantics: there is no `mirrored=` outcome to report for a read, and a read\n * that cannot reach the store is never something to swallow — under the freeze\n * a missing handle already threw at construction, so this only restates it for\n * the non-strict world, where a drafting read silently answering \"no reports\"\n * would break the single-queue rule instead of failing. */\n const reading = (op: string): Db => {\n if (!db) throw new Error(`REPORT_MIRROR op=${op} unavailable: ${why}`);\n return db;\n };\n\n return {\n create: async (rec) => {\n await run(rec.id, \"create\", (d) => insertReportRow(d, rec));\n // Read back rather than map the input: the caller gets what Turso STORED,\n // so a coercion in the mapper can never diverge the returned row from the\n // persisted one. The same rule the Airtable create followed by returning\n // Airtable's echo.\n const row = await getReportById(reading(\"create\"), rec.id);\n if (!row)\n throw new Error(`REPORT_MIRROR report=${rec.id} op=create: row not found after insert`);\n return row;\n },\n created: (rec) => run(rec.id, \"created\", (d) => mirrorReportInsert(d, rec)),\n // `async` so a missing handle REJECTS rather than throwing synchronously —\n // every caller awaits this, and a synchronous throw would escape a\n // `.catch()` written around the await.\n forSite: async (siteId) => listReportsForSite(reading(\"forSite\"), siteId),\n body: (reportId, html) => run(reportId, \"body\", (d) => storeRenderedHtml(d, reportId, html)),\n patch: (reportId, patch) =>\n run(reportId, \"patch\", (d) => mirrorReportPatch(d, reportId, patch)),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsEA,eAAsB,iBACpB,OAA0B,MAAM,OAAO,aAAa,CAAC,GAIrD,SAAkB,wBACK;AACvB,MAAI,KAAgB;AACpB,MAAI,MAAM;AACV,MAAI;AACF,SAAK,MAAM,KAAK;AAAA,EAClB,SAAS,GAAG;AACV,UAAO,EAAY;AAAA,EACrB;AAGA,MAAI,UAAU,CAAC,GAAI,OAAM,IAAI,MAAM,8BAA8B,GAAG,EAAE;AAEtE,QAAM,MAAM,OACV,UACA,IAEA,SACG;AACH,QAAI,CAAC,IAAI;AACP,cAAQ,IAAI,wBAAwB,QAAQ,OAAO,EAAE,2BAA2B,GAAG,EAAE;AACrF;AAAA,IACF;AAGA,QAAI;AACJ,QAAI;AACF,gBAAW,MAAM,KAAK,EAAE,MAAO;AAAA,IACjC,SAAS,GAAG;AACV,cAAQ;AAAA,QACN,wBAAwB,QAAQ,OAAO,EAAE,qBAAsB,EAAY,OAAO;AAAA,MACpF;AACA,UAAI,OAAQ,OAAM;AAClB;AAAA,IACF;AAMA,YAAQ,IAAI,wBAAwB,QAAQ,OAAO,EAAE,aAAa,UAAU,MAAM,QAAQ,EAAE;AAC5F,QAAI,UAAU,CAAC,SAAS;AACtB,YAAM,IAAI,MAAM,wBAAwB,QAAQ,OAAO,EAAE,wBAAwB;AAAA,IACnF;AAAA,EACF;AAQA,QAAM,UAAU,CAAC,OAAmB;AAClC,QAAI,CAAC,GAAI,OAAM,IAAI,MAAM,oBAAoB,EAAE,iBAAiB,GAAG,EAAE;AACrE,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,QAAQ,OAAO,QAAQ;AACrB,YAAM,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAK1D,YAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ,GAAG,IAAI,EAAE;AACzD,UAAI,CAAC;AACH,cAAM,IAAI,MAAM,wBAAwB,IAAI,EAAE,wCAAwC;AACxF,aAAO;AAAA,IACT;AAAA,IACA,SAAS,CAAC,QAAQ,IAAI,IAAI,IAAI,WAAW,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAI1E,SAAS,OAAO,WAAW,mBAAmB,QAAQ,SAAS,GAAG,MAAM;AAAA,IACxE,MAAM,CAAC,UAAU,SAAS,IAAI,UAAU,QAAQ,CAAC,MAAM,kBAAkB,GAAG,UAAU,IAAI,CAAC;AAAA,IAC3F,OAAO,CAAC,UAAU,UAChB,IAAI,UAAU,SAAS,CAAC,MAAM,kBAAkB,GAAG,UAAU,KAAK,CAAC;AAAA,EACvE;AACF;","names":[]}
@@ -0,0 +1,19 @@
1
+ // src/fleet/roster.ts
2
+ async function readFleetRoster(open) {
3
+ const { listSites } = await import("./fleet-state-RJROYXKO.js");
4
+ let opener = open;
5
+ if (!opener) {
6
+ const { openDb, readDbConfig } = await import("./client-DGTO65WB.js");
7
+ opener = () => openDb(readDbConfig());
8
+ }
9
+ const db = await opener();
10
+ try {
11
+ return await listSites(db);
12
+ } finally {
13
+ await db.destroy();
14
+ }
15
+ }
16
+ export {
17
+ readFleetRoster
18
+ };
19
+ //# sourceMappingURL=roster-GDNSIRAK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fleet/roster.ts"],"sourcesContent":["/**\n * The fleet roster for batch jobs — every site row, read from Turso (#646 step 4).\n *\n * Until step 4 each batch job (the audit write-back, `github-signals`,\n * `renovate-dispatch`, `header-image`, the Prismic verdict sink) listed sites\n * with the Airtable `listWebsites` and matched its results against that list.\n * Since step 3 a site created by `ensure-site` has a `site_<ULID>` id and no\n * Airtable record, so an Airtable roster is silently short: the site is never\n * swept, or it is swept and then fails its write-back with \"no Websites row\n * matched\". Turso holds every site.\n *\n * Same contract as `listWebsites` — every site, one `WebsiteRow` each — and the\n * rows are the ones the reader-equivalence instrument pins field-for-field to\n * Airtable's `mapRow` (tests/db/fleet-state.test.ts).\n *\n * The Airtable SHADOW writes these jobs still make are untouched: each Airtable\n * writer skips a non-`rec` id itself (`AIRTABLE_SHADOW skipped=non-rec-id`).\n *\n * `open` defaults to `TURSO_DATABASE_URL`/`TURSO_AUTH_TOKEN`; tests inject a temp\n * `file:` db or a whole `FleetRoster`. The connection this opens is closed before\n * returning — the roster is a snapshot, not a handle. The db stack is imported\n * lazily: `kysely` and the libSQL client are devDependencies.\n */\nimport type { Db } from \"../db/client.js\";\nimport type { WebsiteRow } from \"./site-row.js\";\n\n/** A source of the fleet's site rows. Injected by tests; defaulted to Turso. */\nexport type FleetRoster = () => Promise<WebsiteRow[]>;\n\nexport async function readFleetRoster(open?: () => Promise<Db>): Promise<WebsiteRow[]> {\n const { listSites } = await import(\"../db/fleet-state.js\");\n let opener = open;\n if (!opener) {\n const { openDb, readDbConfig } = await import(\"../db/client.js\");\n opener = () => openDb(readDbConfig());\n }\n const db = await opener();\n try {\n return await listSites(db);\n } finally {\n await db.destroy();\n }\n}\n"],"mappings":";AA6BA,eAAsB,gBAAgB,MAAiD;AACrF,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,2BAAsB;AACzD,MAAI,SAAS;AACb,MAAI,CAAC,QAAQ;AACX,UAAM,EAAE,QAAQ,aAAa,IAAI,MAAM,OAAO,sBAAiB;AAC/D,aAAS,MAAM,OAAO,aAAa,CAAC;AAAA,EACtC;AACA,QAAM,KAAK,MAAM,OAAO;AACxB,MAAI;AACF,WAAO,MAAM,UAAU,EAAE;AAAA,EAC3B,UAAE;AACA,UAAM,GAAG,QAAQ;AAAA,EACnB;AACF;","names":[]}
@@ -15,4 +15,4 @@ var DATABASE_TABLES = [
15
15
  export {
16
16
  DATABASE_TABLES
17
17
  };
18
- //# sourceMappingURL=schema-A4WCPIF4.js.map
18
+ //# sourceMappingURL=schema-KWUQEZ5O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/db/schema.ts"],"sourcesContent":["// The hand-written shape Kysely types every query from. SQLite stores TEXT/INTEGER\n// only, so these are the column *shapes* — the value domains (form_type, status,\n// notify_status) are still narrowed at read time by the validators in\n// src/reports/submission-row.ts. Keep this in lockstep with src/db/migrations.ts;\n// drift is caught by the in-memory tests in tests/db/, not by codegen.\n\nexport interface SubmissionsTable {\n id: string;\n submission_id: number | null;\n site_id: string;\n form_type: string;\n name: string;\n email: string;\n phone: string | null;\n message: string | null;\n extra_fields: string | null;\n source_url: string | null;\n utm: string | null;\n submitted_at: string | null;\n status: string;\n notify_status: string;\n resend_message_id: string | null;\n spam_score: number | null;\n spam_reason: string | null;\n fanout_status: string | null;\n /** Resend's bounce classification (migrations 0018–0020), verbatim from\n * `data.bounce` on the `email.bounced` webhook: `type` is Permanent /\n * Transient / Undetermined, `subtype` the narrower reason (Suppressed,\n * ContentRejected, MailboxFull …), `message` the receiving server's own\n * text. All null for a complaint (which carries no bounce object) and for\n * every row written before 0018. */\n bounce_type: string | null;\n bounce_subtype: string | null;\n bounce_message: string | null;\n /** ISO-8601 of the operator acknowledging this bounce as NOT a dead address\n * (migration 0021). Set, the row keeps its bounce record but stops counting\n * toward the notify-bounce alarm. Null on every unacknowledged row. */\n bounce_ack_at: string | null;\n}\n\nexport interface SpamScreenoutsTable {\n site_id: string;\n date: string;\n honeypot: number;\n too_fast: number;\n marked_spam: number;\n}\n\nexport interface FleetEventsTable {\n id: string;\n ts: string;\n type: string;\n site_id: string | null;\n site_name: string | null;\n summary: string;\n data: string | null;\n created_at: string;\n}\n\nexport interface MigrationsTable {\n id: string;\n applied_at: string;\n}\n\n/** A lead whose site lookup threw mid-ingest (migration 0006). `payload` and\n * `turnstile` are JSON — the raw wire body and the verification computed at\n * receipt — exactly what `db replay-deadletters` feeds back through\n * `ingestSubmission` once the lookup recovers. */\nexport interface SubmissionDeadletterTable {\n id: string;\n site_slug: string;\n payload: string;\n turnstile: string;\n error: string;\n received_at: string;\n replayed_at: string | null;\n replay_outcome: string | null;\n replay_submission_id: string | null;\n /** Resolved by operator DECISION rather than by replay outcome (migrations\n * 0022-0024, #786). A slug that is genuinely dead but still deployed would\n * otherwise queue leads forever, hold `db replay-deadletters` at exit 1, and\n * keep a standing CRITICAL cockpit item. Distinct from `replayed_at`, which\n * means the pipeline actually gave the lead an answer. `by`/`reason` are the\n * audit trail: the decision has to outlive the person who made it. */\n abandoned_at: string | null;\n abandoned_by: string | null;\n abandoned_reason: string | null;\n}\n\n/** Operator-owned fleet config (migration 0007). PK = Airtable rec id (D1).\n * `legacy` holds the 33 populated-but-code-unreferenced Airtable columns as a\n * JSON object keyed by original column name; the plaintext DNS/cms credential\n * cells never migrate (operator ruling 2026-08-23). */\nexport interface SitesTable {\n id: string;\n slug: string;\n name: string;\n url: string | null;\n status: string | null;\n point_of_contact: string | null;\n maintenance_freq: string | null;\n testing_freq: string | null;\n maintenance_day: string | null;\n testing_day: string | null;\n ga4_property_id: string | null;\n search_query: string | null;\n search_console_property: string | null;\n git_repo: string | null;\n netlify_id: string | null;\n report_recipients_to: string | null;\n report_recipients_cc: string | null;\n copy_intro: string | null;\n copy_contact: string | null;\n copy_footer: string | null;\n newsletter_webhook: string | null;\n mailchimp_api_key: string | null;\n mailchimp_audience_id: string | null;\n notify_routing: string | null;\n require_turnstile: number;\n accepted_watch_conditions: string | null;\n prismic_ack_until: string | null;\n launched_at: string | null;\n header_image: Uint8Array | null;\n header_image_filename: string | null;\n header_image_type: string | null;\n header_image_generated_at: string | null;\n legacy: string | null;\n}\n\n/** Nightly-cron-owned health/telemetry (migration 0007) — one row per site,\n * written as one batched upsert per sweep family. `analytics_soft_fail_at` is\n * the \"Analytics soft-fail at\" column code always wrote best-effort but no\n * operator ever created in Airtable. */\nexport interface SiteHealthTable {\n site_id: string;\n p_score: number | null;\n r_score: number | null;\n bp_score: number | null;\n seo_score: number | null;\n lighthouse_at: string | null;\n a11y_violations: number | null;\n deps_drifted: number | null;\n deps_major_behind: number | null;\n deps_outdated: number | null;\n deps_major_outdated: number | null;\n vulns_critical: number | null;\n vulns_high: number | null;\n vulns_moderate: number | null;\n vulns_low: number | null;\n security_audit_at: string | null;\n security_advisories: string | null;\n auto_fix_attempts: number | null;\n analytics_soft_fail_at: string | null;\n cert_days_remaining: number | null;\n domain_checked_at: string | null;\n deploy_status: string | null;\n last_deploy_at: string | null;\n deploy_log_url: string | null;\n deploy_checked_at: string | null;\n function_health: string | null;\n cms_reachable: string | null;\n turnstile_widget: string | null;\n function_health_checked_at: string | null;\n crossbrowser_ok: number | null;\n mobile_ok: number | null;\n links_ok: number | null;\n broken_links: number | null;\n browser_checked_at: string | null;\n uptime_reachable: string | null;\n titles_meta_ok: string | null;\n smoke_ok: string | null;\n last_smoke_at: string | null;\n form_e2e_ok: string | null;\n form_e2e_checked_at: string | null;\n renovate_failing_cis: number | null;\n default_branch_ci: string | null;\n last_commit_at: string | null;\n github_signals_at: string | null;\n prismic_models: string | null;\n prismic_models_checked_at: string | null;\n prismic_models_drift: string | null;\n}\n\n/** Code-derived schedule (migration 0007) — written by updateNextDueDates. */\nexport interface SiteScheduleTable {\n site_id: string;\n next_maintenance_at: string | null;\n next_testing_at: string | null;\n computed_at: string | null;\n}\n\n/** Report rows (migration 0007). PK = Airtable rec id. `checklist` is JSON\n * keyed by the STABLE checklist key (src/reports/checklist.ts), not the\n * Airtable column name; `rendered_html` is the downloaded attachment body. */\nexport interface ReportsTable {\n id: string;\n site_id: string | null;\n report_id: string | null;\n report_type: string | null;\n period: string | null;\n period_start: string | null;\n period_end: string | null;\n completed_on: string | null;\n lighthouse_performance: number | null;\n lighthouse_accessibility: number | null;\n lighthouse_best_practices: number | null;\n lighthouse_seo: number | null;\n ga_users_current: number | null;\n ga_users_previous: number | null;\n search_found_page1: number | null;\n search_position: number | null;\n last_tested_date: string | null;\n commentary: string | null;\n subject_override: string | null;\n draft_ready: number;\n approved_to_send: number;\n approved_at: string | null;\n approved_by: string | null;\n send_override: number;\n override_reason: string | null;\n override_by: string | null;\n override_at: string | null;\n sent_at: string | null;\n delivery_status: string | null;\n resend_message_id: string | null;\n checklist: string | null;\n checklist_auto_evidence: string | null;\n rendered_html: string | null;\n}\n\n/** One prospect-audit run (migration 0009). `token` is the 128-bit unguessable\n * public handle for GET /r/{token}; `result_json` holds the full\n * ProspectAuditResult (src/prospect/types.ts). */\nexport interface ProspectAuditsTable {\n id: string;\n token: string;\n url: string;\n /** One key per site, however its address was written (migration 0013). `url`\n * records what we audited; this is what two audits of one site are grouped\n * by. Null on rows written before the column existed. See siteKey(). */\n site_key: string | null;\n business: string | null;\n created_at: string;\n status: string;\n result_json: string;\n /** Operator edits, `{ \"<key>\": { original, text } }` as JSON. Null on every\n * row written before migration 0015, and on any report never edited. */\n overrides_json: string | null;\n /** ISO-8601 of the last override write. Null when never edited. */\n edited_at: string | null;\n /** ISO-8601 of the last fetch that did NOT carry an edit session. Null when\n * nobody outside the edit flow has opened it. */\n opened_at: string | null;\n /** #676. The operator's hand-chosen search terms and buyer questions, as JSON\n * arrays. NULL means the audit generated its own — deliberately distinct\n * from an empty list, because \"we chose these with you\" and \"we chose these\n * from your site\" are different claims the report has to be able to make. */\n chosen_terms: string | null;\n chosen_questions: string | null;\n}\n\n/** The digest's prior-run snapshot (migration 0011). One row, `id` = the\n * constant singleton key; `snapshot` is the whole DigestSnapshot as JSON. */\nexport interface DigestStateTable {\n id: string;\n snapshot: string;\n updated_at: string | null;\n}\n\n/** Every table the app owns, as a RUNTIME value (#612 review).\n *\n * The `Database` interface below is types-only, so nothing could assert that a\n * backup actually covered it — `tables=N` was printed by the verifier and never\n * checked, meaning a table a migration failed to create would ride green\n * forever. The compile-time check under this list makes forgetting an entry a\n * build error naming the missing table. */\nexport const DATABASE_TABLES = [\n \"submissions\",\n \"spam_screenouts\",\n \"fleet_events\",\n \"_migrations\",\n \"submission_deadletter\",\n \"sites\",\n \"site_health\",\n \"site_schedule\",\n \"reports\",\n \"prospect_audits\",\n \"digest_state\",\n] as const;\n\nexport type DatabaseTable = (typeof DATABASE_TABLES)[number];\n\nexport interface Database {\n submissions: SubmissionsTable;\n spam_screenouts: SpamScreenoutsTable;\n fleet_events: FleetEventsTable;\n _migrations: MigrationsTable;\n submission_deadletter: SubmissionDeadletterTable;\n sites: SitesTable;\n site_health: SiteHealthTable;\n site_schedule: SiteScheduleTable;\n reports: ReportsTable;\n prospect_audits: ProspectAuditsTable;\n digest_state: DigestStateTable;\n}\n\n/** Compile-time exhaustiveness: if a table is added to `Database` and not to\n * `DATABASE_TABLES`, this errors and NAMES it. */\ntype MissingFromDatabaseTables = Exclude<keyof Database, DatabaseTable>;\nconst _everyTableIsListed: MissingFromDatabaseTables extends never\n ? true\n : MissingFromDatabaseTables = true;\nvoid _everyTableIsListed;\n"],"mappings":";AAoRO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  selfUpdating
3
- } from "./chunk-FSGICFXB.js";
3
+ } from "./chunk-IDBPII6G.js";
4
4
  import "./chunk-MNDIED4M.js";
5
5
  import {
6
6
  runRecipeOverSites
@@ -9,18 +9,19 @@ import {
9
9
  appendSkipNotice,
10
10
  fleetWorkdir,
11
11
  prepareFleetSites
12
- } from "./chunk-LM2NHRCJ.js";
12
+ } from "./chunk-DYTYPKFN.js";
13
13
  import {
14
14
  resolveSites
15
- } from "./chunk-Z2K4JPQ3.js";
15
+ } from "./chunk-FP6HOW6J.js";
16
+ import "./chunk-TJLKWQOX.js";
16
17
  import "./chunk-SLFG7Y76.js";
17
- import "./chunk-GASBX52O.js";
18
- import "./chunk-XHHMM5HX.js";
18
+ import "./chunk-MVKNU4QD.js";
19
+ import "./chunk-43SW3FGW.js";
19
20
  import "./chunk-Z3JXLULD.js";
20
21
  import "./chunk-LBYOLBW7.js";
21
22
  import "./chunk-RARREDQE.js";
22
23
  import "./chunk-XXTZBPUY.js";
23
- import "./chunk-AVEQUR44.js";
24
+ import "./chunk-WMF5S2MB.js";
24
25
 
25
26
  // src/cli/commands/self-updating.ts
26
27
  import { resolve } from "path";
@@ -62,4 +63,4 @@ async function runSelfUpdatingCommand(site, opts) {
62
63
  export {
63
64
  runSelfUpdatingCommand
64
65
  };
65
- //# sourceMappingURL=self-updating-MWXIZLL7.js.map
66
+ //# sourceMappingURL=self-updating-ZUWPGYUP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/self-updating.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { resolveSites } from \"../fleet/resolve-sites.js\";\nimport { prepareFleetSites, appendSkipNotice, type SkippedSite } from \"../fleet/prepare-sites.js\";\nimport { runRecipeOverSites } from \"../fleet/run-recipe-over-sites.js\";\nimport { fleetWorkdir } from \"../../util/fleet-workdir.js\";\nimport { selfUpdating } from \"../../recipes/self-updating/index.js\";\nimport type { RecipeResult } from \"../../types.js\";\n\nexport type SelfUpdatingCommandOptions = {\n fleet?: string;\n workdir?: string;\n dry?: boolean;\n cwd?: string;\n};\n\nfunction formatResult(r: RecipeResult): string {\n if (r.status === \"noop\") return `[${r.site}] noop: ${r.notes ?? \"already self-updating\"}`;\n if (r.status === \"failed\") return `[${r.site}] failed: ${r.notes ?? \"\"}`;\n return `[${r.site}] applied\\n${r.notes ?? \"\"}`;\n}\n\nexport async function runSelfUpdatingCommand(\n site: string | undefined,\n opts: SelfUpdatingCommandOptions,\n): Promise<{ output: string; code: number }> {\n const cwd = opts.cwd ? resolve(opts.cwd) : process.cwd();\n\n let sites = await resolveSites({\n ...(site !== undefined ? { site } : {}),\n ...(opts.fleet !== undefined ? { fleet: opts.fleet } : {}),\n cwd,\n });\n\n let skipped: SkippedSite[] = [];\n if (opts.fleet) {\n const workdir = opts.workdir ?? fleetWorkdir();\n const prep = await prepareFleetSites(sites, { workdir });\n sites = prep.prepared;\n skipped = prep.skipped;\n }\n\n if (opts.dry) {\n return {\n output: appendSkipNotice(\n sites.map((s) => `[${s.name || s.path}] would enable self-updating`).join(\"\\n\"),\n skipped,\n ),\n code: 0,\n };\n }\n\n const results = await runRecipeOverSites(\"self-updating\", sites, (s) => selfUpdating(s));\n\n return {\n output: appendSkipNotice(results.map(formatResult).join(\"\\n\"), skipped),\n code: results.some((r) => r.status === \"failed\") ? 1 : 0,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAexB,SAAS,aAAa,GAAyB;AAC7C,MAAI,EAAE,WAAW,OAAQ,QAAO,IAAI,EAAE,IAAI,WAAW,EAAE,SAAS,uBAAuB;AACvF,MAAI,EAAE,WAAW,SAAU,QAAO,IAAI,EAAE,IAAI,aAAa,EAAE,SAAS,EAAE;AACtE,SAAO,IAAI,EAAE,IAAI;AAAA,EAAc,EAAE,SAAS,EAAE;AAC9C;AAEA,eAAsB,uBACpB,MACA,MAC2C;AAC3C,QAAM,MAAM,KAAK,MAAM,QAAQ,KAAK,GAAG,IAAI,QAAQ,IAAI;AAEvD,MAAI,QAAQ,MAAM,aAAa;AAAA,IAC7B,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC;AAAA,IACrC,GAAI,KAAK,UAAU,SAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;AAAA,IACxD;AAAA,EACF,CAAC;AAED,MAAI,UAAyB,CAAC;AAC9B,MAAI,KAAK,OAAO;AACd,UAAM,UAAU,KAAK,WAAW,aAAa;AAC7C,UAAM,OAAO,MAAM,kBAAkB,OAAO,EAAE,QAAQ,CAAC;AACvD,YAAQ,KAAK;AACb,cAAU,KAAK;AAAA,EACjB;AAEA,MAAI,KAAK,KAAK;AACZ,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,MAAM,IAAI,CAAC,MAAM,IAAI,EAAE,QAAQ,EAAE,IAAI,8BAA8B,EAAE,KAAK,IAAI;AAAA,QAC9E;AAAA,MACF;AAAA,MACA,MAAM;AAAA,IACR;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,mBAAmB,iBAAiB,OAAO,CAAC,MAAM,aAAa,CAAC,CAAC;AAEvF,SAAO;AAAA,IACL,QAAQ,iBAAiB,QAAQ,IAAI,YAAY,EAAE,KAAK,IAAI,GAAG,OAAO;AAAA,IACtE,MAAM,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,QAAQ,IAAI,IAAI;AAAA,EACzD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/cli/commands/self-updating.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { resolveSites } from \"../fleet/resolve-sites.js\";\nimport { prepareFleetSites, appendSkipNotice, type SkippedSite } from \"../fleet/prepare-sites.js\";\nimport { runRecipeOverSites } from \"../fleet/run-recipe-over-sites.js\";\nimport { fleetWorkdir } from \"../../util/fleet-workdir.js\";\nimport { selfUpdating } from \"../../recipes/self-updating/index.js\";\nimport type { RecipeResult } from \"../../types.js\";\n\nexport type SelfUpdatingCommandOptions = {\n fleet?: string;\n workdir?: string;\n dry?: boolean;\n cwd?: string;\n};\n\nfunction formatResult(r: RecipeResult): string {\n if (r.status === \"noop\") return `[${r.site}] noop: ${r.notes ?? \"already self-updating\"}`;\n if (r.status === \"failed\") return `[${r.site}] failed: ${r.notes ?? \"\"}`;\n return `[${r.site}] applied\\n${r.notes ?? \"\"}`;\n}\n\nexport async function runSelfUpdatingCommand(\n site: string | undefined,\n opts: SelfUpdatingCommandOptions,\n): Promise<{ output: string; code: number }> {\n const cwd = opts.cwd ? resolve(opts.cwd) : process.cwd();\n\n let sites = await resolveSites({\n ...(site !== undefined ? { site } : {}),\n ...(opts.fleet !== undefined ? { fleet: opts.fleet } : {}),\n cwd,\n });\n\n let skipped: SkippedSite[] = [];\n if (opts.fleet) {\n const workdir = opts.workdir ?? fleetWorkdir();\n const prep = await prepareFleetSites(sites, { workdir });\n sites = prep.prepared;\n skipped = prep.skipped;\n }\n\n if (opts.dry) {\n return {\n output: appendSkipNotice(\n sites.map((s) => `[${s.name || s.path}] would enable self-updating`).join(\"\\n\"),\n skipped,\n ),\n code: 0,\n };\n }\n\n const results = await runRecipeOverSites(\"self-updating\", sites, (s) => selfUpdating(s));\n\n return {\n output: appendSkipNotice(results.map(formatResult).join(\"\\n\"), skipped),\n code: results.some((r) => r.status === \"failed\") ? 1 : 0,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAexB,SAAS,aAAa,GAAyB;AAC7C,MAAI,EAAE,WAAW,OAAQ,QAAO,IAAI,EAAE,IAAI,WAAW,EAAE,SAAS,uBAAuB;AACvF,MAAI,EAAE,WAAW,SAAU,QAAO,IAAI,EAAE,IAAI,aAAa,EAAE,SAAS,EAAE;AACtE,SAAO,IAAI,EAAE,IAAI;AAAA,EAAc,EAAE,SAAS,EAAE;AAC9C;AAEA,eAAsB,uBACpB,MACA,MAC2C;AAC3C,QAAM,MAAM,KAAK,MAAM,QAAQ,KAAK,GAAG,IAAI,QAAQ,IAAI;AAEvD,MAAI,QAAQ,MAAM,aAAa;AAAA,IAC7B,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC;AAAA,IACrC,GAAI,KAAK,UAAU,SAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;AAAA,IACxD;AAAA,EACF,CAAC;AAED,MAAI,UAAyB,CAAC;AAC9B,MAAI,KAAK,OAAO;AACd,UAAM,UAAU,KAAK,WAAW,aAAa;AAC7C,UAA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