// Row counts across the delivery-note collections. Read-only. // // The two that matter during rollout are delivery_notes and // delivery_note_items: the staged pipeline must never move them on its // own, so take a reading before a test and compare it afterwards. // // npx tsx --env-file=.env.local scripts/dn-snapshot.mts // // .mts, not .ts: top-level await, and the package has no "type": "module". import { pbAdmin } from "../src/lib/pb"; const COLLECTIONS = [ "dn_batches", "dn_batch_sources", "dn_batch_pages", "dn_batch_notes", "dn_pipeline_locks", "dn_review_events", "delivery_notes", "delivery_note_items", ]; const pb = await pbAdmin(); const counts: Record = {}; for (const collection of COLLECTIONS) { const page = await pb.collection(collection).getList(1, 1, { fields: "id" }); counts[collection] = page.totalItems; } console.log(JSON.stringify(counts, null, 2));