Skip to main content

Search

Items tagged with: JSDB


Just deployed a new Kitten¹ version 🎉

• Adds database backup and restore in your app’s Kitten settings page (/💕/settings)

• Upgrades version of JSDB from 4 to 5²

• You can emit and listen for events on the session object you get from `request.session` in your routes now.

¹ https://codeberg.org/kitten/app
² For migration notes, please see: https://codeberg.org/small-tech/jsdb#migrating-from-earlier-versions-of-jsdf

#Kitten #backupAndRestore #JavaScript #NodeJS #database #JSDB #sessions #SmallWeb #web #dev


Watching The Doors live at The Hollywood Bowl (1968)¹ and hacking on Kitten² and Domain³.

All in all, not a bad way to spend a Saturday afternoon in my book.

(I’ve almost got database backup/restore working in Kitten and I’ve just finished porting Domain to the latest Kitten with JSDB 5⁴.)

¹ https://yewtu.be/watch?v=Q76QBhKHQGc
² https://codeberg.org/kitten/app
³ https://codeberg.org/domain/app
https://codeberg.org/small-tech/jsdb

#TheDoors #Kitten #Domain #JSDB #SmallWeb #web #dev #music


Assign properties in a constructor’s parameter object (with defaults) to object being instantiated in JavaScript

https://codeberg.org/aral/gists/src/branch/main/assign-properties-in-a-constructors-parameter-object-with-defaults-to-object-being-instantiated-in-JavaScript.md

This is a little something I ended up playing around with this morning before figuring out how to do it (after spending far too much time down a rabbit hole with object destructuring when what I really needed was creative use of the spread operator).

(Useful for custom objects in JSDB 5 – https://codeberg.org/small-tech/jsdb#custom-data-types)

#JavaScript #parameterObject #defaults #JSDB


To really drive home the above 👆 point that 100% test coverage does not mean ‘bug free’, just found a bug in JSDB¹ 5.0.0 where running JSON.stringify() on a complex custom object (actually: the automatic Proxy of the custom object created by JSDB) results in an error.

Already have a failing test and about to implement fix.

(It’s at this point where the test harness is invaluable.)

¹ https://codeberg.org/small-tech/jsdb

#JavaScriptDatabase #JavaScript #database #JSDB #JSDB5 #NodeJS #SmallWeb #SmallTech



Philosophically, JSDB – which writes out to native JavaScript logs – is very much the JavaScript version of SWX, the native data format for Flash that I released around 2007 (where data was written out in native SWF format). I have to say that I’m glad I didn’t have to reverse engineer SWF bytecode this time around :)

Here’s a video of a younger me doing an impromptu demo of SWX at some conference or other from 16 years ago.

https://m.youtube.com/watch?v=OM9qOADsO3w

#JSDB #SWX #JavaScript #Flash #flashback


JSDB 5.0.0 published 🎉

• Custom classes must have a `constructor` that accepts a parameter object as its only argument. Constructors are run during deserialisation.

• Custom classes can now safely extend other classes (e.g., `EventEmitter`).

• Properties that begin with an underscore (`_`) are treated as private and ignored.

• Objects with null prototypes are supported. i.e., objects created with `Object.create(null, …)`.

Full details: https://codeberg.org/small-tech/jsdb#migrating-from-earlier-versions-of-jsdf

#JSDB #NodeJS #database


100% test coverage doesn’t mean your code’s bug free but it did just lead me to find and fix an issue in JavaScript Database (JSDB)¹ with a code path that wasn’t being hit that I would have otherwise missed because it was causing the relevant test to pass.

¹ JSDB is a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log (an append-only log).

https://codeberg.org/small-tech/jsdb

#JavaScript #database #JSDB


Realised last night that JavaScript Database (JSDB) doesn’t run the constructor on persisted custom objects (https://codeberg.org/small-tech/jsdb#custom-data-types) when deserialising them because I didn’t know that you apparently have to define your constructor manually when using Object.create().

Will fix it today but it’s something to watch out for if you’re using Object.create() directly.

For more info, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

#JSDB #customObjects #constructor #bug #JavaScript #NodeJS #SmallTech #SmallWeb


This is a niche one and will likely not affect any of the (three?) people playing with Kitten¹ right now but, in any case:

If you persist custom types to your Kitten database, you might be hit by this bug that was introduced when I released versions of Kitten with minified identifiers.

I briefly wrote about what happened, how you can identify if you’re affected, and how you can fix it here:

https://codeberg.org/kitten/app/issues/160#issuecomment-1775375

¹ https://codeberg.org/kitten/app

#SmallWeb #Kitten #web #dev #JSDB #JavaScript


Coming soon, views of your databases in your Kitten* app’s Settings page (/💕/settings) pages. And, after that, data export and import.

* https://codeberg.org/kitten/app

#SmallWeb #Kitten #data #databases #JSDB


When I speak about spending the last few years “building infrastructure”, you might be wondering what sorts of things I’m talking about.

Here are some examples:

JSDB: an in-memory, in-process database that writes to a JavaScript append-only transaction log and which you can use as if you were interacting with regular JavaScript objects.

https://codeberg.org/small-tech/jsdb

(I’ve been developing it for the last four years and it is integrated into Kitten.)

#SmallTech #SmallWeb #JSDB