Also, not immediately relevant to your current issue but something that might be worth considering for the future: using the htmx websocket extension, you can basically implement a streaming HTML approach (example using Kitten: https://ar.al/2024/03/08/streaming-html/) where you can just stream errors to the page as they happen.
Sitting outside on a rare sunny day at a lovely pub in Bray, refactoring Kitten* to pull out the settings page sections into their own pages (and use Kitten’s new Streaming HTML workflow**) and enjoying a yummy pint of Tundra IPA.
The Evergreen Web section in Kitten’s¹ settings now has its own page too (and uses Kitten’s new Streaming HTML² workflow).
If you have the previous version of your site up somewhere, you can use the 404-to-307 technique³ to forward missing pages to your old site so as not to break the Web.
Lots to do yet but the new Kitten¹ settings section (that’s common to all Kitten apps / Small Web places) is coming along nicely. (With the general style/layout borrowed from Domain².)
(It’s currently a single page and I’m breaking it up into multiple ones because it’s time.)
Once I’m done with this I should really record a screencast of Kitten’s new backup and restore feature/data portability.
It uses the latest version of JSDB (5.1.3) which fixes an issue where instances of EventEmitter subclasses persisted to the database were erroneously persisting their (by convention private) _events arrays containing AsyncFunction instances and thereby causing a crash on the database open attempt when the AsyncFunction class could not be found as it wasn’t provided to the JSDB.open() method.
… JSDB, by the way, is short for JavaScript Database, which is, umm, a JavaScript database.
It’s an in-process, in-memory database for Node.js for Small Web use that persists to an append-only JavaScript – not JSON, JavaScript – transaction log.
JSDB’s very easy to work with because you just use native JavaScript objects and they just automatically get persisted for you.
e.g., Here’s a quick 6-line Kitten app that persists a counter:
Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:
This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).
🎉 Got database backup and restore working in Kitten (so every Kitten app gets it for free) and, with the new JSDB 5 support in Kitten, you can now make your model classes EventEmitters.
The session object is now an EventEmitter so you can now listen for events on the current session. In fact, I did just that in Kitten itself to implement the upload of the backup file during the restore process to make the Streaming HTML handler get notified once the POST route has the upload.