feat: replace MongoDB driver with Cloudflare KV storage

Drops the mongodb dependency entirely; all four logical collections
(admin singleton, group, apple_app, google_app) now live in a single KV
namespace bound as STORE_KV with prefixed keys. Cache TTL is delegated
to KV via expirationTtl (clamped to the 60s minimum). Document shape,
field names, and Java parity at the doc level are preserved.

- Adds src/repository/kv.js helper (getJson/putJson/del with TTL clamp)
- Rewrites all four *-repository.js modules on top of KV
- Removes src/repository/mongodb.js and the MONGODB_URI env requirement
- Adds an early STORE_KV-binding guard in src/index.js
- Bumps to 0.3.0
This commit is contained in:
tiennm99 committed 2026-05-05 20:39:01 +07:00
1 parent 00f49531e0
commit 9898f408a2
12 files changed
+81 -108

No files matched your search

+2 -5
View File
@@ -1,7 +1,7 @@
{
"name": "js-store-scraper-bot",
"version": "0.2.0",
"description": "JavaScript port of store-scraper-bot — Telegram bot tracking Apple App Store + Google Play app updates. Deploys to Cloudflare Workers.",
"version": "0.3.0",
"description": "JavaScript port of store-scraper-bot — Telegram bot tracking Apple App Store + Google Play app updates. Deploys to Cloudflare Workers, backed by Cloudflare KV.",
"type": "module",
"private": true,
"engines": {
@@ -15,9 +15,6 @@
"register:dry": "node --env-file=.env.deploy scripts/register-webhook.js --dry-run",
"lint": "node scripts/check-secret-leaks.js"
},
"dependencies": {
"mongodb": "^6.10.0"
},
"devDependencies": {
"wrangler": "^3.90.0"
},