@reddoorla/maintenance 0.65.3 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/airtable-M4AQHRNV.js +9 -0
- package/dist/{announce-WXWOHR2I.js → announce-YPXVHNNP.js} +4 -4
- package/dist/{bump-deps-2MAMI7DB.js → bump-deps-INDDTDSG.js} +2 -2
- package/dist/{chunk-CCXVX5JN.js → chunk-4P6UQG5L.js} +9 -1
- package/dist/{chunk-CCXVX5JN.js.map → chunk-4P6UQG5L.js.map} +1 -1
- package/dist/{chunk-IMMB64VH.js → chunk-CH6K2VMM.js} +2 -2
- package/dist/{chunk-WXNSLK4Q.js → chunk-CWSQZ27M.js} +2 -2
- package/dist/{chunk-JWA4FO2J.js → chunk-G35B5U6F.js} +2 -2
- package/dist/{chunk-MEP6PR32.js → chunk-JD3X3QMP.js} +3 -3
- package/dist/{chunk-VUKSRWRD.js → chunk-LISJ3K3R.js} +2 -2
- package/dist/{chunk-ARHDSMFK.js → chunk-NMGGP5WN.js} +2 -2
- package/dist/{chunk-WVRPOXKH.js → chunk-VKAYZVMI.js} +16 -9
- package/dist/chunk-VKAYZVMI.js.map +1 -0
- package/dist/{chunk-PMIKXAPF.js → chunk-XKSKHHSX.js} +3 -3
- package/dist/{chunk-N5MZ6WRX.js → chunk-YBYWNUT3.js} +2 -2
- package/dist/cli/bin.js +14 -14
- package/dist/cli/commands/audit.js +5 -5
- package/dist/{convert-to-pnpm-3OEHYF76.js → convert-to-pnpm-4GD4667L.js} +2 -2
- package/dist/{digest-BTHXYYQZ.js → digest-SIZUXT67.js} +3 -3
- package/dist/{github-signals-H7VU4EOH.js → github-signals-3O64PFWP.js} +4 -4
- package/dist/index.js +6 -6
- package/dist/{init-VA3H4OHM.js → init-KMWXJZEX.js} +2 -2
- package/dist/{launch-OMHMW5OK.js → launch-5KRCKFYM.js} +5 -5
- package/dist/{lighthouse-airtable-4KWC3P72.js → lighthouse-airtable-5JICCZND.js} +3 -3
- package/dist/{onboard-2PLVVJWN.js → onboard-RCBXS5B3.js} +2 -2
- package/dist/{orchestrate-6PKHJXLF.js → orchestrate-O4KR6JME.js} +3 -3
- package/dist/{renovate-dispatch-K6VO5KWM.js → renovate-dispatch-ABRSIT77.js} +2 -2
- package/dist/{report-X3XPBRBO.js → report-LSGTMXQJ.js} +23 -7
- package/dist/report-LSGTMXQJ.js.map +1 -0
- package/dist/{self-updating-VXVJSV5T.js → self-updating-CPMY3HFY.js} +2 -2
- package/dist/{selftest-FV4MO7TX.js → selftest-7Y5K4PYL.js} +5 -5
- package/dist/{svelte-codemods-5RXRRTMK.js → svelte-codemods-GJRTBLJE.js} +2 -2
- package/dist/{sync-configs-TPJMRNRU.js → sync-configs-NYJNSIRN.js} +2 -2
- package/dist/{upgrade-7TN2XPFK.js → upgrade-LVYRDKDL.js} +2 -2
- package/dist/{websites-EIPNY4DY.js → websites-5ETIXB7F.js} +4 -2
- package/dist/{write-audits-to-airtable-WVWFESZW.js → write-audits-to-airtable-GHR337N7.js} +4 -4
- package/package.json +1 -1
- package/dist/airtable-JUPGAI4R.js +0 -9
- package/dist/chunk-WVRPOXKH.js.map +0 -1
- package/dist/report-X3XPBRBO.js.map +0 -1
- /package/dist/{airtable-JUPGAI4R.js.map → airtable-M4AQHRNV.js.map} +0 -0
- /package/dist/{announce-WXWOHR2I.js.map → announce-YPXVHNNP.js.map} +0 -0
- /package/dist/{bump-deps-2MAMI7DB.js.map → bump-deps-INDDTDSG.js.map} +0 -0
- /package/dist/{chunk-IMMB64VH.js.map → chunk-CH6K2VMM.js.map} +0 -0
- /package/dist/{chunk-WXNSLK4Q.js.map → chunk-CWSQZ27M.js.map} +0 -0
- /package/dist/{chunk-JWA4FO2J.js.map → chunk-G35B5U6F.js.map} +0 -0
- /package/dist/{chunk-MEP6PR32.js.map → chunk-JD3X3QMP.js.map} +0 -0
- /package/dist/{chunk-VUKSRWRD.js.map → chunk-LISJ3K3R.js.map} +0 -0
- /package/dist/{chunk-ARHDSMFK.js.map → chunk-NMGGP5WN.js.map} +0 -0
- /package/dist/{chunk-PMIKXAPF.js.map → chunk-XKSKHHSX.js.map} +0 -0
- /package/dist/{chunk-N5MZ6WRX.js.map → chunk-YBYWNUT3.js.map} +0 -0
- /package/dist/{convert-to-pnpm-3OEHYF76.js.map → convert-to-pnpm-4GD4667L.js.map} +0 -0
- /package/dist/{digest-BTHXYYQZ.js.map → digest-SIZUXT67.js.map} +0 -0
- /package/dist/{github-signals-H7VU4EOH.js.map → github-signals-3O64PFWP.js.map} +0 -0
- /package/dist/{init-VA3H4OHM.js.map → init-KMWXJZEX.js.map} +0 -0
- /package/dist/{launch-OMHMW5OK.js.map → launch-5KRCKFYM.js.map} +0 -0
- /package/dist/{lighthouse-airtable-4KWC3P72.js.map → lighthouse-airtable-5JICCZND.js.map} +0 -0
- /package/dist/{onboard-2PLVVJWN.js.map → onboard-RCBXS5B3.js.map} +0 -0
- /package/dist/{orchestrate-6PKHJXLF.js.map → orchestrate-O4KR6JME.js.map} +0 -0
- /package/dist/{renovate-dispatch-K6VO5KWM.js.map → renovate-dispatch-ABRSIT77.js.map} +0 -0
- /package/dist/{self-updating-VXVJSV5T.js.map → self-updating-CPMY3HFY.js.map} +0 -0
- /package/dist/{selftest-FV4MO7TX.js.map → selftest-7Y5K4PYL.js.map} +0 -0
- /package/dist/{svelte-codemods-5RXRRTMK.js.map → svelte-codemods-GJRTBLJE.js.map} +0 -0
- /package/dist/{sync-configs-TPJMRNRU.js.map → sync-configs-NYJNSIRN.js.map} +0 -0
- /package/dist/{upgrade-7TN2XPFK.js.map → upgrade-LVYRDKDL.js.map} +0 -0
- /package/dist/{websites-EIPNY4DY.js.map → websites-5ETIXB7F.js.map} +0 -0
- /package/dist/{write-audits-to-airtable-WVWFESZW.js.map → write-audits-to-airtable-GHR337N7.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../../chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
ALL_AUDIT_NAMES,
|
|
14
14
|
runOneAudit
|
|
@@ -231,9 +231,9 @@ ${skipNotice}`;
|
|
|
231
231
|
let writeBackFailed = false;
|
|
232
232
|
if (opts.writeAirtable !== void 0) {
|
|
233
233
|
const { openBase, readAirtableConfig } = await import("../../client-EPVO3FEH.js");
|
|
234
|
-
const { listWebsites } = await import("../../websites-
|
|
234
|
+
const { listWebsites } = await import("../../websites-5ETIXB7F.js");
|
|
235
235
|
if (opts.fleet !== void 0) {
|
|
236
|
-
const { writeFleetAuditsToAirtable, formatFleetWriteSummary } = await import("../../write-audits-to-airtable-
|
|
236
|
+
const { writeFleetAuditsToAirtable, formatFleetWriteSummary } = await import("../../write-audits-to-airtable-GHR337N7.js");
|
|
237
237
|
const base = openBase(readAirtableConfig());
|
|
238
238
|
const websites = await listWebsites(base);
|
|
239
239
|
const fleetWrite = await writeFleetAuditsToAirtable({ base, websites, results });
|
|
@@ -249,8 +249,8 @@ ${skipNotice}`;
|
|
|
249
249
|
|
|
250
250
|
${formatFleetWriteSummary(fleetWrite)}`;
|
|
251
251
|
} else {
|
|
252
|
-
const { resolveSlugFromCwd } = await import("../../lighthouse-airtable-
|
|
253
|
-
const { writeAuditsToAirtable } = await import("../../write-audits-to-airtable-
|
|
252
|
+
const { resolveSlugFromCwd } = await import("../../lighthouse-airtable-5JICCZND.js");
|
|
253
|
+
const { writeAuditsToAirtable } = await import("../../write-audits-to-airtable-GHR337N7.js");
|
|
254
254
|
const slug = typeof opts.writeAirtable === "string" && opts.writeAirtable.length > 0 ? opts.writeAirtable : await resolveSlugFromCwd(cwd);
|
|
255
255
|
let writeSummary = null;
|
|
256
256
|
await new Listr(
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
convertToPnpm
|
|
14
14
|
} from "./chunk-2X322ZES.js";
|
|
@@ -50,4 +50,4 @@ async function runConvertToPnpmCommand(site, opts) {
|
|
|
50
50
|
export {
|
|
51
51
|
runConvertToPnpmCommand
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=convert-to-pnpm-
|
|
53
|
+
//# sourceMappingURL=convert-to-pnpm-4GD4667L.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
diffAttention,
|
|
9
9
|
readDigestState,
|
|
10
10
|
writeDigestState
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CH6K2VMM.js";
|
|
12
12
|
import {
|
|
13
13
|
isIdempotencyConflict
|
|
14
14
|
} from "./chunk-OGGRFBL4.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
listWebsites,
|
|
22
22
|
siteSlug
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4P6UQG5L.js";
|
|
24
24
|
import {
|
|
25
25
|
openBase,
|
|
26
26
|
readAirtableConfig
|
|
@@ -226,4 +226,4 @@ export {
|
|
|
226
226
|
renderDigestHtml,
|
|
227
227
|
runDigest
|
|
228
228
|
};
|
|
229
|
-
//# sourceMappingURL=digest-
|
|
229
|
+
//# sourceMappingURL=digest-SIZUXT67.js.map
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "./chunk-PZQ3WED2.js";
|
|
4
4
|
import {
|
|
5
5
|
formatFleetWriteSummary
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-JD3X3QMP.js";
|
|
7
|
+
import "./chunk-YBYWNUT3.js";
|
|
8
8
|
import {
|
|
9
9
|
detectSignalEvents,
|
|
10
10
|
fleetSweptEvent
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
listWebsites,
|
|
23
23
|
siteSlug,
|
|
24
24
|
updateGitHubSignals
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-4P6UQG5L.js";
|
|
26
26
|
import {
|
|
27
27
|
openBase,
|
|
28
28
|
readAirtableConfig
|
|
@@ -134,4 +134,4 @@ export {
|
|
|
134
134
|
githubSignalsExitCode,
|
|
135
135
|
runGitHubSignalsCommand
|
|
136
136
|
};
|
|
137
|
-
//# sourceMappingURL=github-signals-
|
|
137
|
+
//# sourceMappingURL=github-signals-3O64PFWP.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-CH6K2VMM.js";
|
|
2
2
|
import {
|
|
3
3
|
findDueReports
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VKAYZVMI.js";
|
|
5
5
|
import {
|
|
6
6
|
upgradeSvelte4to5
|
|
7
7
|
} from "./chunk-ZO7WNY57.js";
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
} from "./chunk-ZYBOT5PM.js";
|
|
25
25
|
import {
|
|
26
26
|
draftReportForSite
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-G35B5U6F.js";
|
|
28
28
|
import "./chunk-6LIWDIXU.js";
|
|
29
29
|
import {
|
|
30
30
|
sendApprovedReports
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CWSQZ27M.js";
|
|
32
32
|
import "./chunk-OGGRFBL4.js";
|
|
33
33
|
import "./chunk-GECESMVS.js";
|
|
34
34
|
import {
|
|
@@ -78,12 +78,12 @@ import "./chunk-XXTZBPUY.js";
|
|
|
78
78
|
import "./chunk-XTK5VIQB.js";
|
|
79
79
|
import {
|
|
80
80
|
fromAirtableBase
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-NMGGP5WN.js";
|
|
82
82
|
import "./chunk-U5SZ4FOP.js";
|
|
83
83
|
import {
|
|
84
84
|
SEVERITY_RANK,
|
|
85
85
|
siteSlug
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-4P6UQG5L.js";
|
|
87
87
|
import "./chunk-HN6I2XWI.js";
|
|
88
88
|
import "./chunk-WEKL2HYJ.js";
|
|
89
89
|
import "./chunk-6VAL7XJT.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-4NAOR44V.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveSites
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LISJ3K3R.js";
|
|
9
9
|
import {
|
|
10
10
|
init
|
|
11
11
|
} from "./chunk-LCKKIJ22.js";
|
|
@@ -101,4 +101,4 @@ async function runInitCommand(site, opts) {
|
|
|
101
101
|
export {
|
|
102
102
|
runInitCommand
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=init-
|
|
104
|
+
//# sourceMappingURL=init-KMWXJZEX.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writeAuditsToAirtable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JD3X3QMP.js";
|
|
4
4
|
import {
|
|
5
5
|
hasRealScores,
|
|
6
6
|
lighthouseScoresFromResult
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YBYWNUT3.js";
|
|
8
8
|
import {
|
|
9
9
|
selfUpdating
|
|
10
10
|
} from "./chunk-IRRZG66U.js";
|
|
11
11
|
import "./chunk-5L3FPQIJ.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveSites
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LISJ3K3R.js";
|
|
15
15
|
import {
|
|
16
16
|
queueDraft
|
|
17
17
|
} from "./chunk-6LIWDIXU.js";
|
|
@@ -42,7 +42,7 @@ import "./chunk-U5SZ4FOP.js";
|
|
|
42
42
|
import {
|
|
43
43
|
listWebsites,
|
|
44
44
|
siteSlug
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-4P6UQG5L.js";
|
|
46
46
|
import {
|
|
47
47
|
openBase,
|
|
48
48
|
readAirtableConfig
|
|
@@ -212,4 +212,4 @@ async function runLaunchCommand(site, opts) {
|
|
|
212
212
|
export {
|
|
213
213
|
runLaunchCommand
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=launch-
|
|
215
|
+
//# sourceMappingURL=launch-5KRCKFYM.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
hasRealScores,
|
|
3
3
|
lighthouseScoresFromResult,
|
|
4
4
|
resolveSlugFromCwd
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-YBYWNUT3.js";
|
|
6
|
+
import "./chunk-4P6UQG5L.js";
|
|
7
7
|
export {
|
|
8
8
|
hasRealScores,
|
|
9
9
|
lighthouseScoresFromResult,
|
|
10
10
|
resolveSlugFromCwd
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=lighthouse-airtable-
|
|
12
|
+
//# sourceMappingURL=lighthouse-airtable-5JICCZND.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
onboard
|
|
14
14
|
} from "./chunk-ZYBOT5PM.js";
|
|
@@ -70,4 +70,4 @@ async function runOnboardCommand(site, opts) {
|
|
|
70
70
|
export {
|
|
71
71
|
runOnboardCommand
|
|
72
72
|
};
|
|
73
|
-
//# sourceMappingURL=onboard-
|
|
73
|
+
//# sourceMappingURL=onboard-RCBXS5B3.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseAddresses,
|
|
5
5
|
sendApprovedReports,
|
|
6
6
|
withGlobalCc
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CWSQZ27M.js";
|
|
8
8
|
import "./chunk-OGGRFBL4.js";
|
|
9
9
|
import "./chunk-GECESMVS.js";
|
|
10
10
|
import "./chunk-SYTPVYIK.js";
|
|
@@ -13,7 +13,7 @@ import "./chunk-G2YRXV26.js";
|
|
|
13
13
|
import "./chunk-PTPTVVY7.js";
|
|
14
14
|
import "./chunk-XKKTK6WA.js";
|
|
15
15
|
import "./chunk-U5SZ4FOP.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-4P6UQG5L.js";
|
|
17
17
|
import "./chunk-HN6I2XWI.js";
|
|
18
18
|
import "./chunk-WEKL2HYJ.js";
|
|
19
19
|
import "./chunk-6VAL7XJT.js";
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
sendApprovedReports,
|
|
25
25
|
withGlobalCc
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=orchestrate-
|
|
27
|
+
//# sourceMappingURL=orchestrate-O4KR6JME.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isDashboardVisible,
|
|
10
10
|
listWebsites,
|
|
11
11
|
updateAutoFixAttempts
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4P6UQG5L.js";
|
|
13
13
|
import {
|
|
14
14
|
openBase,
|
|
15
15
|
readAirtableConfig
|
|
@@ -136,4 +136,4 @@ No active repo-backed sites with critical/high vulnerabilities \u2014 nothing to
|
|
|
136
136
|
export {
|
|
137
137
|
runRenovateDispatchCommand
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=renovate-dispatch-
|
|
139
|
+
//# sourceMappingURL=renovate-dispatch-ABRSIT77.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findDueReports,
|
|
3
|
+
nextDueDate,
|
|
3
4
|
reportPeriodKey
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VKAYZVMI.js";
|
|
5
6
|
import {
|
|
6
7
|
draftReportForSite,
|
|
7
8
|
readGaConfig
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-G35B5U6F.js";
|
|
9
10
|
import {
|
|
10
11
|
reportTier
|
|
11
12
|
} from "./chunk-6LIWDIXU.js";
|
|
@@ -17,8 +18,9 @@ import {
|
|
|
17
18
|
import "./chunk-U5SZ4FOP.js";
|
|
18
19
|
import {
|
|
19
20
|
listWebsites,
|
|
20
|
-
siteSlug
|
|
21
|
-
|
|
21
|
+
siteSlug,
|
|
22
|
+
updateNextDueDates
|
|
23
|
+
} from "./chunk-4P6UQG5L.js";
|
|
22
24
|
import {
|
|
23
25
|
openBase,
|
|
24
26
|
readAirtableConfig
|
|
@@ -68,11 +70,11 @@ function dashboardBaseUrl() {
|
|
|
68
70
|
}
|
|
69
71
|
async function runReportCommand(slug, opts) {
|
|
70
72
|
if (opts.digest) {
|
|
71
|
-
const { runDigest } = await import("./digest-
|
|
73
|
+
const { runDigest } = await import("./digest-SIZUXT67.js");
|
|
72
74
|
return runDigest({ baseUrl: dashboardBaseUrl() });
|
|
73
75
|
}
|
|
74
76
|
if (opts.sendReady) {
|
|
75
|
-
const { sendApprovedReports } = await import("./orchestrate-
|
|
77
|
+
const { sendApprovedReports } = await import("./orchestrate-O4KR6JME.js");
|
|
76
78
|
return sendApprovedReports();
|
|
77
79
|
}
|
|
78
80
|
if (opts.due) {
|
|
@@ -115,9 +117,23 @@ async function alertOnFleetAnalyticsFailure(health) {
|
|
|
115
117
|
console.warn(`\u26A0 analytics-failure alert send failed: ${e.message}`);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
120
|
+
async function writeNextDueDates(base, websites, reports, today) {
|
|
121
|
+
const ymd = (d) => d ? d.toISOString().slice(0, 10) : null;
|
|
122
|
+
for (const site of websites) {
|
|
123
|
+
try {
|
|
124
|
+
await updateNextDueDates(base, site.id, {
|
|
125
|
+
maintenanceAt: ymd(nextDueDate(site, reports, "Maintenance", today)),
|
|
126
|
+
testingAt: ymd(nextDueDate(site, reports, "Testing", today))
|
|
127
|
+
});
|
|
128
|
+
} catch (e) {
|
|
129
|
+
console.warn(`\u26A0 next-due write skipped for ${site.name}: ${e.message}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
118
133
|
async function draftDueReports(base, today) {
|
|
119
134
|
const websites = await listWebsites(base);
|
|
120
135
|
const reports = await listAllReports(base);
|
|
136
|
+
await writeNextDueDates(base, websites, reports, today);
|
|
121
137
|
const due = findDueReports(websites, reports, today);
|
|
122
138
|
const gaConfigured = readGaConfig() !== null;
|
|
123
139
|
const isAnalyticsConfigured = (s) => gaConfigured && Boolean(s.ga4PropertyId || s.searchQuery);
|
|
@@ -237,4 +253,4 @@ export {
|
|
|
237
253
|
parseSingleSiteReportType,
|
|
238
254
|
runReportCommand
|
|
239
255
|
};
|
|
240
|
-
//# sourceMappingURL=report-
|
|
256
|
+
//# sourceMappingURL=report-LSGTMXQJ.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 {\n listWebsites,\n siteSlug,\n updateNextDueDates,\n type WebsiteRow,\n} from \"../../reports/airtable/websites.js\";\nimport { listAllReports, 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\";\n\nexport type ReportCommandOptions = {\n due?: boolean;\n preview?: boolean;\n sendReady?: boolean;\n digest?: boolean;\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\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 return runDigest({ baseUrl: dashboardBaseUrl() });\n }\n\n if (opts.sendReady) {\n const { sendApprovedReports } = await import(\"../../reports/send/orchestrate.js\");\n return sendApprovedReports();\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, { previewOnly: Boolean(opts.preview), reportType });\n }\n\n throw Object.assign(\n new Error(\n \"Usage: reddoor-maint report [<slug>] [--type <Maintenance|Testing>] [--due] [--preview] [--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 const result = await draftDueReports(base, new Date());\n await alertOnFleetAnalyticsFailure(result.health);\n return { output: result.output, code: result.code };\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 = process.env.OPERATOR_EMAIL?.trim() || \"info@reddoorla.com\";\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 */\nasync function writeNextDueDates(\n base: AirtableBase,\n websites: WebsiteRow[],\n reports: ReportRow[],\n today: Date,\n): Promise<void> {\n const ymd = (d: Date | null): string | null => (d ? d.toISOString().slice(0, 10) : null);\n for (const site of websites) {\n try {\n await updateNextDueDates(base, site.id, {\n maintenanceAt: ymd(nextDueDate(site, reports, \"Maintenance\", today)),\n testingAt: ymd(nextDueDate(site, reports, \"Testing\", today)),\n });\n } catch (e) {\n console.warn(`⚠ next-due write skipped for ${site.name}: ${(e as Error).message}`);\n }\n }\n}\n\nexport async function draftDueReports(\n base: AirtableBase,\n today: Date,\n): Promise<{ output: string; code: number; health: AnalyticsRunHealth }> {\n const websites = await listWebsites(base);\n // ONE unfiltered fetch for the whole fleet. Per-site queries can't be pushed to\n // Airtable anyway (linked-record fields aren't formula-filterable by record id),\n // and findDueReports + the period guard below match on siteId in memory.\n const reports = await listAllReports(base);\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);\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 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 });\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 } 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, { period });\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 } 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 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; reportType: ReportType },\n): Promise<{ output: string; code: number }> {\n const base = openBase(readAirtableConfig());\n const websites = await listWebsites(base);\n const site = websites.find((w) => siteSlug(w.name) === slug);\n if (!site) {\n throw Object.assign(new Error(`No Websites row matched slug \"${slug}\"`), { exitCode: 2 });\n }\n const result = await draftReportForSite(opts.previewOnly ? null : base, site, opts.reportType, {\n previewOnly: opts.previewOnly,\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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AK,YAAY;AAAA,IAC7F,aAAa,KAAK;AAAA,EACpB,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":[]}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-4NAOR44V.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveSites
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LISJ3K3R.js";
|
|
15
15
|
import "./chunk-CASCWQQX.js";
|
|
16
16
|
import "./chunk-GASBX52O.js";
|
|
17
17
|
import "./chunk-YEGHUODU.js";
|
|
@@ -61,4 +61,4 @@ async function runSelfUpdatingCommand(site, opts) {
|
|
|
61
61
|
export {
|
|
62
62
|
runSelfUpdatingCommand
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=self-updating-
|
|
64
|
+
//# sourceMappingURL=self-updating-CPMY3HFY.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildReportDataForSite,
|
|
3
3
|
scoresFromRow
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-XKSKHHSX.js";
|
|
5
|
+
import "./chunk-G35B5U6F.js";
|
|
6
6
|
import "./chunk-6LIWDIXU.js";
|
|
7
7
|
import {
|
|
8
8
|
isProbablyEmail,
|
|
9
9
|
parseAddresses,
|
|
10
10
|
prepareHeaderImage,
|
|
11
11
|
renderReportEmail
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CWSQZ27M.js";
|
|
13
13
|
import "./chunk-OGGRFBL4.js";
|
|
14
14
|
import "./chunk-GECESMVS.js";
|
|
15
15
|
import {
|
|
@@ -23,7 +23,7 @@ import "./chunk-U5SZ4FOP.js";
|
|
|
23
23
|
import {
|
|
24
24
|
listWebsites,
|
|
25
25
|
siteSlug
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4P6UQG5L.js";
|
|
27
27
|
import {
|
|
28
28
|
openBase,
|
|
29
29
|
readAirtableConfig
|
|
@@ -158,4 +158,4 @@ async function runSelftestCommand(kind, site, opts) {
|
|
|
158
158
|
export {
|
|
159
159
|
runSelftestCommand
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=selftest-
|
|
161
|
+
//# sourceMappingURL=selftest-7Y5K4PYL.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
svelteCodemods
|
|
14
14
|
} from "./chunk-BTEBRTW4.js";
|
|
@@ -50,4 +50,4 @@ async function runSvelteCodemodsCommand(site, opts) {
|
|
|
50
50
|
export {
|
|
51
51
|
runSvelteCodemodsCommand
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=svelte-codemods-
|
|
53
|
+
//# sourceMappingURL=svelte-codemods-GJRTBLJE.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
ALL_CONFIG_NAMES,
|
|
14
14
|
CANONICAL_GITIGNORE_ENTRIES,
|
|
@@ -112,4 +112,4 @@ async function runSyncConfigsCommand(site, opts) {
|
|
|
112
112
|
export {
|
|
113
113
|
runSyncConfigsCommand
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=sync-configs-
|
|
115
|
+
//# sourceMappingURL=sync-configs-NYJNSIRN.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-4NAOR44V.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveSites
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LISJ3K3R.js";
|
|
12
12
|
import {
|
|
13
13
|
upgradeSvelte4to5
|
|
14
14
|
} from "./chunk-ZO7WNY57.js";
|
|
@@ -59,4 +59,4 @@ async function runUpgradeCommand(upgradeName, site, opts = {}) {
|
|
|
59
59
|
export {
|
|
60
60
|
runUpgradeCommand
|
|
61
61
|
};
|
|
62
|
-
//# sourceMappingURL=upgrade-
|
|
62
|
+
//# sourceMappingURL=upgrade-LVYRDKDL.js.map
|
|
@@ -17,10 +17,11 @@ import {
|
|
|
17
17
|
updateDepsCounts,
|
|
18
18
|
updateGitHubSignals,
|
|
19
19
|
updateLaunched,
|
|
20
|
+
updateNextDueDates,
|
|
20
21
|
updateScores,
|
|
21
22
|
updateSecurityCounts,
|
|
22
23
|
updateSiteField
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4P6UQG5L.js";
|
|
24
25
|
export {
|
|
25
26
|
ACTIVE_STATUSES,
|
|
26
27
|
SEVERITY_RANK,
|
|
@@ -40,8 +41,9 @@ export {
|
|
|
40
41
|
updateDepsCounts,
|
|
41
42
|
updateGitHubSignals,
|
|
42
43
|
updateLaunched,
|
|
44
|
+
updateNextDueDates,
|
|
43
45
|
updateScores,
|
|
44
46
|
updateSecurityCounts,
|
|
45
47
|
updateSiteField
|
|
46
48
|
};
|
|
47
|
-
//# sourceMappingURL=websites-
|
|
49
|
+
//# sourceMappingURL=websites-5ETIXB7F.js.map
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
formatFleetWriteSummary,
|
|
3
3
|
writeAuditsToAirtable,
|
|
4
4
|
writeFleetAuditsToAirtable
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-JD3X3QMP.js";
|
|
6
|
+
import "./chunk-YBYWNUT3.js";
|
|
7
7
|
import "./chunk-5L3FPQIJ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-4P6UQG5L.js";
|
|
9
9
|
export {
|
|
10
10
|
formatFleetWriteSummary,
|
|
11
11
|
writeAuditsToAirtable,
|
|
12
12
|
writeFleetAuditsToAirtable
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=write-audits-to-airtable-
|
|
14
|
+
//# sourceMappingURL=write-audits-to-airtable-GHR337N7.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/reports/due.ts"],"sourcesContent":["import type { WebsiteRow, Frequency, Status } from \"./airtable/websites.js\";\nimport type { ReportRow } from \"./airtable/reports.js\";\nimport type { ReportType } from \"./types.js\";\n\n/** Statuses where reports are appropriate. Drops \"deprecated\" and\n * \"probably not our problem\" — even if the operator left a freq set, we don't\n * want to surface those sites in --due output. Sites with status=null pass\n * through (existing data is partial; better to surface than silently skip). */\nconst ELIGIBLE_STATUSES: ReadonlySet<Status> = new Set<Status>([\n \"in development\",\n \"launch period\",\n \"maintenance\",\n \"hosting\",\n]);\n\nexport type DueItem = {\n site: WebsiteRow;\n reportType: ReportType;\n /** Inclusive: the day the next report became due. */\n dueDate: Date;\n /** ISO date of the last `Sent at` for this (site, type), or null if there's never been one. */\n lastSent: string | null;\n};\n\nconst MONTHS: Record<Exclude<Frequency, \"None\">, number> = {\n Monthly: 1,\n Quarterly: 3,\n Yearly: 12,\n};\n\n/**\n * Add `n` calendar months in UTC, clamped to the last day of the target month.\n * Jan 31 + 1 month = Feb 28 (not Mar 3, which is what naive setMonth produces).\n * All-UTC accessors mean the result is timezone-independent.\n */\nfunction addMonths(d: Date, n: number): Date {\n const out = new Date(d);\n const day = out.getUTCDate();\n out.setUTCDate(1);\n out.setUTCMonth(out.getUTCMonth() + n);\n const lastDayOfTargetMonth = new Date(\n Date.UTC(out.getUTCFullYear(), out.getUTCMonth() + 1, 0),\n ).getUTCDate();\n out.setUTCDate(Math.min(day, lastDayOfTargetMonth));\n return out;\n}\n\n/** Truncate to UTC midnight. Avoids local-TZ skew when comparing Airtable date-only fields. */\nfunction startOfDay(d: Date): Date {\n const out = new Date(d);\n out.setUTCHours(0, 0, 0, 0);\n return out;\n}\n\nfunction lastSentForType(reports: ReportRow[], siteId: string, type: ReportType): string | null {\n const candidates = reports\n .filter((r) => r.siteId === siteId && r.reportType === type && r.sentAt !== null)\n .map((r) => r.sentAt!)\n .sort();\n return candidates[candidates.length - 1] ?? null;\n}\n\n/**\n * Computes which (site, type) pairs are due as of `today`.\n *\n * Algorithm per (site, type):\n * 1. If freq === \"None\", skip.\n * 2. baseDate = max(last Sent at for this type, site's `maintenance/testing day` fallback).\n * 3. If no baseDate exists at all, the site is due now.\n * 4. dueDate = baseDate + frequency months.\n * 5. Due iff startOfDay(today) >= startOfDay(dueDate).\n */\nexport function findDueReports(\n websites: WebsiteRow[],\n reports: ReportRow[],\n today: Date,\n): DueItem[] {\n const out: DueItem[] = [];\n const todayStart = startOfDay(today);\n\n for (const site of websites) {\n // Skip explicitly-non-active statuses (deprecated, \"probably not our problem\").\n // Null status is treated as active for backwards compat with rows that pre-date\n // the Status convention.\n if (site.status !== null && !ELIGIBLE_STATUSES.has(site.status)) continue;\n\n for (const type of [\"Maintenance\", \"Testing\"] as const) {\n const rawFreq = type === \"Maintenance\" ? site.maintenanceFreq : site.testingFreq;\n // Normalize obvious whitespace so a trailing-space typo (\"Quarterly \") still\n // schedules. The LOUD warning below is the real safety net for genuine\n // casing/spelling mistakes (\"monthly\", \"Quaterly\").\n const freq = (typeof rawFreq === \"string\" ? rawFreq.trim() : rawFreq) as Frequency;\n // Intentional silent skip — \"None\" (and the empty/blank default) means \"no\n // schedule\", not a mistake.\n if (freq === \"None\" || freq === (\"\" as Frequency)) continue;\n // A non-empty, non-None value that doesn't match a known schedule used to\n // silently produce no due date — the site just vanished from the loop. Warn\n // LOUDLY so a casing/typo Airtable value is fixable instead of invisible.\n if (!(freq in MONTHS)) {\n console.warn(\n `⚠ ${site.name}: unrecognized ${type === \"Maintenance\" ? \"maintenance\" : \"testing\"} frequency '${rawFreq}' — not scheduling; fix the Airtable value`,\n );\n continue;\n }\n\n const lastSent = lastSentForType(reports, site.id, type);\n const fallback = type === \"Maintenance\" ? site.maintenanceDay : site.testingDay;\n const baseIso = lastSent ?? fallback;\n\n if (!baseIso) {\n out.push({ site, reportType: type, dueDate: todayStart, lastSent });\n continue;\n }\n\n const dueDate = addMonths(new Date(baseIso), MONTHS[freq]);\n if (todayStart.getTime() >= startOfDay(dueDate).getTime()) {\n out.push({ site, reportType: type, dueDate, lastSent });\n }\n }\n }\n\n return out;\n}\n\n/**\n * The UTC `YYYY-MM` of a `dueDate` from {@link findDueReports} — the per-recurrence\n * idempotency key for drafting. Monthly recurrences land in distinct months; quarterly\n * and yearly land in distinct due-months too, so this uniquely names one draft per cycle.\n * UTC accessors keep it timezone-independent, consistent with the rest of this module.\n */\nexport function reportPeriodKey(dueDate: Date): string {\n if (Number.isNaN(dueDate.getTime())) throw new TypeError(\"reportPeriodKey: invalid Date\");\n const year = dueDate.getUTCFullYear();\n const month = String(dueDate.getUTCMonth() + 1).padStart(2, \"0\");\n return `${year}-${month}`;\n}\n"],"mappings":";AAQA,IAAM,oBAAyC,oBAAI,IAAY;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWD,IAAM,SAAqD;AAAA,EACzD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AACV;AAOA,SAAS,UAAU,GAAS,GAAiB;AAC3C,QAAM,MAAM,IAAI,KAAK,CAAC;AACtB,QAAM,MAAM,IAAI,WAAW;AAC3B,MAAI,WAAW,CAAC;AAChB,MAAI,YAAY,IAAI,YAAY,IAAI,CAAC;AACrC,QAAM,uBAAuB,IAAI;AAAA,IAC/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AM,SAAS,YAAY,SAAS,CAAC;AAClE;AAAA,MACF;AAEA,YAAM,UAAU,UAAU,IAAI,KAAK,OAAO,GAAG,OAAO,IAAI,CAAC;AACzD,UAAI,WAAW,QAAQ,KAAK,WAAW,OAAO,EAAE,QAAQ,GAAG;AACzD,YAAI,KAAK,EAAE,MAAM,YAAY,MAAM,SAAS,SAAS,CAAC;AAAA,MACxD;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAQO,SAAS,gBAAgB,SAAuB;AACrD,MAAI,OAAO,MAAM,QAAQ,QAAQ,CAAC,EAAG,OAAM,IAAI,UAAU,+BAA+B;AACxF,QAAM,OAAO,QAAQ,eAAe;AACpC,QAAM,QAAQ,OAAO,QAAQ,YAAY,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AAC/D,SAAO,GAAG,IAAI,IAAI,KAAK;AACzB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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 { listWebsites, siteSlug, type WebsiteRow } from \"../../reports/airtable/websites.js\";\nimport { listAllReports } from \"../../reports/airtable/reports.js\";\nimport { findDueReports, 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\";\n\nexport type ReportCommandOptions = {\n due?: boolean;\n preview?: boolean;\n sendReady?: boolean;\n digest?: boolean;\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\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 return runDigest({ baseUrl: dashboardBaseUrl() });\n }\n\n if (opts.sendReady) {\n const { sendApprovedReports } = await import(\"../../reports/send/orchestrate.js\");\n return sendApprovedReports();\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, { previewOnly: Boolean(opts.preview), reportType });\n }\n\n throw Object.assign(\n new Error(\n \"Usage: reddoor-maint report [<slug>] [--type <Maintenance|Testing>] [--due] [--preview] [--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 const result = await draftDueReports(base, new Date());\n await alertOnFleetAnalyticsFailure(result.health);\n return { output: result.output, code: result.code };\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 = process.env.OPERATOR_EMAIL?.trim() || \"info@reddoorla.com\";\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\nexport async function draftDueReports(\n base: AirtableBase,\n today: Date,\n): Promise<{ output: string; code: number; health: AnalyticsRunHealth }> {\n const websites = await listWebsites(base);\n // ONE unfiltered fetch for the whole fleet. Per-site queries can't be pushed to\n // Airtable anyway (linked-record fields aren't formula-filterable by record id),\n // and findDueReports + the period guard below match on siteId in memory.\n const reports = await listAllReports(base);\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 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 });\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 } 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, { period });\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 } 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 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; reportType: ReportType },\n): Promise<{ output: string; code: number }> {\n const base = openBase(readAirtableConfig());\n const websites = await listWebsites(base);\n const site = websites.find((w) => siteSlug(w.name) === slug);\n if (!site) {\n throw Object.assign(new Error(`No Websites row matched slug \"${slug}\"`), { exitCode: 2 });\n }\n const result = await draftReportForSite(opts.previewOnly ? null : base, site, opts.reportType, {\n previewOnly: opts.previewOnly,\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;;;AC5BA,SAAS,UACP,UACA,QACA,eACA,OAAO,WACC;AACR,QAAM,KAAK,YAAY;AACvB,MAAI,WAAW,OAAO;AACpB,WAAO,UAAK,IAAI,oBAAoB,EAAE;AAAA,EACxC;AACA,QAAM,MACJ,cAAc,SAAS,IACnB,gBAAgB,cAAc,MAAM,oBAAoB,cAAc,SAAS,IAAI,MAAM,EAAE,MAC3F;AACN,SAAO,UAAK,IAAI,KAAK,EAAE,GAAG,GAAG;AAC/B;AASO,SAAS,0BAA0B,KAAqC;AAC7E,MAAI,QAAQ,UAAa,IAAI,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,YAAY;AAAA,IAC7F,aAAa,KAAK;AAAA,EACpB,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":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|