@reddoorla/maintenance 0.54.1 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -9
- package/dist/cli/bin.js +23 -5
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/audit.js +1 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/forms/index.d.ts +8 -3
- package/dist/forms/index.js +2 -2
- package/dist/forms/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,6 +294,8 @@ RESEND_API_KEY=re_XXXX
|
|
|
294
294
|
RESEND_WEBHOOK_SECRET=whsec_XXXX # only for the deployed webhook
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
+
> The above is the **report CLI** env. The **deployed Netlify functions** (dashboard + form-ingest) additionally require `TURSO_DATABASE_URL` (+ optional `TURSO_AUTH_TOKEN`) — submissions live in libSQL/Turso, not Airtable. See [Site deployment](#site-deployment-netlify--resend) for the full env table.
|
|
298
|
+
|
|
297
299
|
### Operator flow
|
|
298
300
|
|
|
299
301
|
0. **Prereq: refresh Lighthouse scores on each Websites row.** From each site's checkout:
|
|
@@ -334,25 +336,28 @@ RESEND_WEBHOOK_SECRET=whsec_XXXX # only for the deployed webhook
|
|
|
334
336
|
|
|
335
337
|
Renders + sends every Reports row with `Draft ready=true && Approved to send=true && Sent at IS NULL`. Stamps `Sent at` + `Delivery status=pending` on each.
|
|
336
338
|
|
|
337
|
-
5. **Delivery status updates automatically** via the Resend webhook (Netlify Function at `netlify/functions/resend-webhook.mts`) — `Delivery status` flips to `delivered` / `bounced` / `complained` as events arrive. Deploy procedure: see [
|
|
339
|
+
5. **Delivery status updates automatically** via the Resend webhook (Netlify Function at `netlify/functions/resend-webhook.mts`) — `Delivery status` flips to `delivered` / `bounced` / `complained` as events arrive. Deploy procedure: see [Site deployment](#site-deployment-netlify--resend) below.
|
|
338
340
|
|
|
339
|
-
###
|
|
341
|
+
### Site deployment (Netlify + Resend)
|
|
340
342
|
|
|
341
|
-
|
|
343
|
+
This repo's Netlify site hosts the whole dashboard + forms surface: the Resend delivery webhook (`netlify/functions/resend-webhook.mts`), the cockpit/per-site dashboard, the `/submissions` page, and the form-ingest + submission-status endpoints. Deploying is a one-time operation per environment: connect the repo to a Netlify site, set its env vars, register the deployed URL with Resend.
|
|
342
344
|
|
|
343
345
|
**1. Create the Netlify site:**
|
|
344
346
|
|
|
345
|
-
- New site → Import from Git → pick `
|
|
347
|
+
- New site → Import from Git → pick `reddoorla/reddoor-maintenance`.
|
|
346
348
|
- Branch to deploy: `main`. Build settings are read from [`netlify.toml`](netlify.toml) (no build command needed — functions-only).
|
|
347
349
|
- Site name: pick something stable (e.g. `reddoor-webhooks`) since it ends up in the public webhook URL.
|
|
348
350
|
|
|
349
351
|
**2. Set env vars** in Site settings → Environment variables:
|
|
350
352
|
|
|
351
|
-
| Variable | Value
|
|
352
|
-
| ----------------------- |
|
|
353
|
-
| `AIRTABLE_PAT` | Same PAT used by the CLI (read+write on the Websites + Reports tables)
|
|
354
|
-
| `AIRTABLE_BASE_ID` | `appHG8nLOzULzXOER`
|
|
355
|
-
| `RESEND_WEBHOOK_SECRET` | Generated by Resend in step 4 — paste back here after creating the endpoint
|
|
353
|
+
| Variable | Value |
|
|
354
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
355
|
+
| `AIRTABLE_PAT` | Same PAT used by the CLI (read+write on the Websites + Reports tables) |
|
|
356
|
+
| `AIRTABLE_BASE_ID` | `appHG8nLOzULzXOER` |
|
|
357
|
+
| `RESEND_WEBHOOK_SECRET` | Generated by Resend in step 4 — paste back here after creating the endpoint |
|
|
358
|
+
| `TURSO_DATABASE_URL` | `libsql://<db>-<org>.turso.io` — submissions + spam counters live here; the dashboard + forms functions 500 without it |
|
|
359
|
+
| `TURSO_AUTH_TOKEN` | Auth token for that Turso url (required for a remote `libsql://` url) |
|
|
360
|
+
| `FORMS_INGEST_TOKEN` | Shared secret gating `POST /api/forms/:slug` — the SAME value is set on each fleet site |
|
|
356
361
|
|
|
357
362
|
**3. Trigger a deploy** (Deploys → Trigger deploy → Deploy site). When it goes green, curl the health endpoint:
|
|
358
363
|
|
package/dist/cli/bin.js
CHANGED
|
@@ -361,7 +361,7 @@ function securityFields(counts) {
|
|
|
361
361
|
}
|
|
362
362
|
function domainFields(result) {
|
|
363
363
|
const fields = { "Domain checked at": result.checkedAt };
|
|
364
|
-
|
|
364
|
+
fields["Cert days remaining"] = result.certDaysRemaining;
|
|
365
365
|
return fields;
|
|
366
366
|
}
|
|
367
367
|
function browserFields(r) {
|
|
@@ -2430,17 +2430,30 @@ function readDbConfig() {
|
|
|
2430
2430
|
const authToken = process.env.TURSO_AUTH_TOKEN;
|
|
2431
2431
|
return authToken ? { url, authToken } : { url };
|
|
2432
2432
|
}
|
|
2433
|
+
function ensureMigrated(url, client) {
|
|
2434
|
+
if (url === ":memory:") return runMigrations(client).then(() => void 0);
|
|
2435
|
+
const cached = migrationsByUrl.get(url);
|
|
2436
|
+
if (cached) return cached;
|
|
2437
|
+
const p = runMigrations(client).then(() => void 0).catch((err) => {
|
|
2438
|
+
migrationsByUrl.delete(url);
|
|
2439
|
+
throw err;
|
|
2440
|
+
});
|
|
2441
|
+
migrationsByUrl.set(url, p);
|
|
2442
|
+
return p;
|
|
2443
|
+
}
|
|
2433
2444
|
async function openDb(cfg) {
|
|
2434
2445
|
const clientConfig = cfg.authToken ? { url: cfg.url, authToken: cfg.authToken } : { url: cfg.url };
|
|
2435
2446
|
const client = createClient(clientConfig);
|
|
2436
|
-
await
|
|
2447
|
+
await ensureMigrated(cfg.url, client);
|
|
2437
2448
|
return new Kysely({ dialect: new LibsqlDialect({ client }) });
|
|
2438
2449
|
}
|
|
2450
|
+
var migrationsByUrl;
|
|
2439
2451
|
var init_client2 = __esm({
|
|
2440
2452
|
"src/db/client.ts"() {
|
|
2441
2453
|
"use strict";
|
|
2442
2454
|
init_credentials();
|
|
2443
2455
|
init_migrate();
|
|
2456
|
+
migrationsByUrl = /* @__PURE__ */ new Map();
|
|
2444
2457
|
}
|
|
2445
2458
|
});
|
|
2446
2459
|
|
|
@@ -5101,7 +5114,12 @@ function makeGitHub(deps) {
|
|
|
5101
5114
|
return r.stdout.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
5102
5115
|
},
|
|
5103
5116
|
async secretExists(repo, name) {
|
|
5104
|
-
const out = await gh([
|
|
5117
|
+
const out = await gh([
|
|
5118
|
+
"api",
|
|
5119
|
+
`repos/${repo}/actions/secrets?per_page=100`,
|
|
5120
|
+
"--jq",
|
|
5121
|
+
".secrets[].name"
|
|
5122
|
+
]);
|
|
5105
5123
|
return out.split("\n").map((l) => l.trim()).includes(name);
|
|
5106
5124
|
},
|
|
5107
5125
|
async autoMergeEnabled(repo) {
|
|
@@ -5111,7 +5129,7 @@ function makeGitHub(deps) {
|
|
|
5111
5129
|
async findOpenSelfUpdatingPR(repo) {
|
|
5112
5130
|
const out = await gh([
|
|
5113
5131
|
"api",
|
|
5114
|
-
`repos/${repo}/pulls?state=open`,
|
|
5132
|
+
`repos/${repo}/pulls?state=open&per_page=100`,
|
|
5115
5133
|
"--jq",
|
|
5116
5134
|
'.[] | select(.head.ref | startswith("maint/self-updating-")) | .html_url'
|
|
5117
5135
|
]);
|
|
@@ -6980,7 +6998,7 @@ async function draftDueReports(base, today) {
|
|
|
6980
6998
|
continue;
|
|
6981
6999
|
}
|
|
6982
7000
|
const pendingEarlier = reports.find(
|
|
6983
|
-
(r) => r.siteId === item.site.id && r.reportType === item.reportType && r.sentAt === null && r.period !== null && r.period < period
|
|
7001
|
+
(r) => r.siteId === item.site.id && r.reportType === item.reportType && r.draftReady && r.sentAt === null && r.period !== null && r.period < period
|
|
6984
7002
|
);
|
|
6985
7003
|
if (pendingEarlier) {
|
|
6986
7004
|
skipped++;
|