Two operational scripts and their shared library. Both are read-only by default; the pruner requires an explicit --apply flag to touch anything. scripts/webex-rooms-report.ts - Fetches every room the current WEBEX_TOKEN can see (paginated /v1/rooms) - Buckets rooms by lastActivity age (7d, 30d, 3m, 6m, 12m, 18m, 24m, >24m) - Cross-references against legacy/spaces.json to distinguish sendi-managed rooms from others - Prints a summary table plus a sample listing; makes zero writes scripts/prune-stale-spaces.ts - Finds Space rows whose most recent Message.createdAt (falling back to Space.createdAt) is older than --months=N (default 24) - Dry-run by default; --apply performs deletions - Deletes the Webex room via REST (Bearer WEBEX_TOKEN) then removes the Space row (cascade removes Message, BulkJob, Survey, PendingMessage) - --no-webex skips the Webex delete for DB-only pruning - --limit=N caps how many spaces get processed per run src/lib/staleSpaces.ts - Pure `monthsAgo` and `computeLastActivity` helpers used by the pruner - `findStaleSpaces(prisma, months)` runs the query and sorts oldest-first package.json scripts: `webex-rooms-report`, `prune-spaces` Tests: 6 new unit tests for the pure helpers (51 total, all green) Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.5 KiB
JSON
47 lines
1.5 KiB
JSON
{
|
|
"name": "sendi",
|
|
"version": "2.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "node --watch --require ./scripts/navigator-patch.cjs src/index.ts",
|
|
"start": "node --require ./scripts/navigator-patch.cjs src/index.ts",
|
|
"build": "tsc",
|
|
"start:built": "node --require ./scripts/navigator-patch.cjs dist/index.js",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"postinstall": "prisma generate",
|
|
"prisma:generate": "prisma generate",
|
|
"prisma:migrate": "prisma migrate dev",
|
|
"prisma:deploy": "prisma migrate deploy",
|
|
"prune-spaces": "node --require ./scripts/navigator-patch.cjs scripts/prune-stale-spaces.ts",
|
|
"webex-rooms-report": "node --require ./scripts/navigator-patch.cjs scripts/webex-rooms-report.ts",
|
|
"migrate-old": "node legacy/migrate-old-data.ts"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.18.0"
|
|
},
|
|
"dependencies": {
|
|
"@prisma/adapter-better-sqlite3": "^6.19.3",
|
|
"@prisma/client": "^6.19.3",
|
|
"better-sqlite3": "^12.8.0",
|
|
"dotenv": "^16.4.7",
|
|
"express": "^5.2.1",
|
|
"pino": "^9.6.0",
|
|
"pino-pretty": "^13.1.3",
|
|
"prisma": "^6.19.3",
|
|
"twilio": "^5.13.1",
|
|
"webex-node-bot-framework": "^2.5.1",
|
|
"zod": "^3.24.2"
|
|
},
|
|
"devDependencies": {
|
|
"@types/better-sqlite3": "^7.6.13",
|
|
"@types/express": "^5.0.6",
|
|
"@types/node": "^22.13.10",
|
|
"@types/supertest": "^6.0.2",
|
|
"supertest": "^7.0.0",
|
|
"typescript": "^5.8.2",
|
|
"vitest": "^3.2.6"
|
|
}
|
|
}
|