Files
captoys/diigo-cache/wrangler.jsonc
T
dckc a17d287e1d diigo-cache: SQL in .sql files, behind a read-only facet
No SQL text in the cache logic any more. Statements live in two files,
parsed by sqlStatements (`-- name:` sections, as in finquick's
brcal/gcbook.js) and imported as text (wrangler Text rule for *.sql):

- cache-read.sql: selects only, checked when the module loads
- cache-write.sql: schema, the v2 renumbering, etch, drops

store.ts turns them into two frozen facets with domain methods:
makeReader(sql) runs only the read statements (page, knownTotal,
deepestPageSince, pagesThrough); makeWriter(storage) only the write
ones (migrate, etch, dropPagesThrough), each change one transaction.

The cache migrates in its constructor under blockConcurrencyWhile, as
Cloudflare recommends, so readers never meet missing tables; the
migration test plants v1 storage and evicts to get a fresh activation.
A viewer() facet (PageViewer: stored pages and fill progress, from the
reader alone) is added for the public page.

Pure refactor: stored state and behavior unchanged.

Generated-by: Claude Opus 5.5
2026-10-07 09:24:33 -05:00

27 lines
828 B
JSON

{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "diigo-cache",
"main": "src/index.ts",
"compatibility_date": "2026-09-29",
"observability": { "enabled": true },
// capnweb's browser build, served as text at /_capnweb.js (the worker
// itself imports capnweb's workerd build as code)
"rules": [{ "type": "Text", "globs": ["**/capnweb/dist/index.js", "**/*.sql"], "fallthrough": true }],
"services": [
{
"binding": "WEBAPP",
"service": "webapp",
"entrypoint": "WebAppFactory"
}
],
"durable_objects": {
"bindings": [
{ "name": "CACHE_DO", "class_name": "DiigoCache" },
{ "name": "PUBLIC_DO", "class_name": "PublicCache" }
]
},
"exports": {
"DiigoCache": { "type": "durable-object", "storage": "sqlite" },
"PublicCache": { "type": "durable-object", "storage": "sqlite" }
}
}