Something went wrong. Try again.
My website. cameron.stream
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334// Delete a record by rkey.// Usage: npx tsx scripts/delete-record.ts <collection> <rkey>
import { resolve } from "node:path";import { config } from "dotenv";import { AtpAgent } from "@atproto/api";
config({ path: resolve(process.cwd(), ".env") });
async function main() { const collection = process.argv[2]; const rkey = process.argv[3]; if (!collection || !rkey) { console.error("Usage: npx tsx scripts/delete-record.ts <collection> <rkey>"); process.exit(1); }
const agent = new AtpAgent({ service: process.env.ATP_SERVICE || "https://bsky.social" }); await agent.login({ identifier: process.env.ATP_IDENTIFIER!, password: process.env.ATP_PASSWORD! });
await agent.com.atproto.repo.deleteRecord({ repo: agent.session!.did, collection, rkey, });
console.log(`Deleted ${collection}/${rkey}`);}
main().catch((err) => { console.error(err); process.exit(1);});