Kitten¹ now keeps two JSDB² databases per project: an internal one ('kitten._db`) that holds data Kitten manages (sessions, uploads, etc.) and the default one (`kitten.db`) that holds your own tables.
You’ll mostly only care about the latter.
I also took the opportunity to create a Database App Module example and document it in the readme:
https://codeberg.org/kitten/app#database-app-module
¹ https://codeberg.org/kitten/app
² https://codeberg.org/small-tech/jsdb
#Kitten #SmallWeb #web #dev #database #JavaScriptDatabase #jsdb
#kitten #SmallWeb #web #dev #database #JavaScriptDatabase #jsdb
I’m actually now wondering if implementing lazy migrations at the object level is madness or not.
e.g., myDatabase.someTable.someObject.latest().someProperty
Where the latest method ensures migrations for the object are lazily run as necessary.
Of course, that would complicate authoring quite a bit because if you forgot that latest() call things would go poof!
Hmm… if only there was a way to run an initiliser when using Object.create()… #JSDB already uses proxies so maybe?
Just released JavaScript Database (JSDB)¹ version 3.0.3
This is a bug fix patch that fixes options defaults not being applied when an options object is passed to the JSDB and JSTable constructors².
¹ 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 (https://codeberg.org/small-tech/jsdb)
#javascript #database #jsdb #nodejs #SmallWeb #web #dev
Just published Kitten’s¹ new database² commands:
- kitten db [table name] to see info the database/a specific table
- kitten db delete [table name] to delete the database/a specific table
- kitten db tail <table name> to follow a specific table
Full docs: https://codeberg.org/kitten/app#database-commands
¹ https://codeberg.org/kitten/app
² https://codeberg.org/small-tech/jsdb
#Kitten #SmallWeb #SmallTech #JavaScriptDatabase #javascript #database #JSDB #web #dev #js #NodeJS #commandLineInterface #CLI
#kitten #SmallWeb #smalltech #JavaScriptDatabase #javascript #database #jsdb #web #dev #js #nodejs #commandlineinterface #cli
Sitting at the hotel bar in Paris, sipping some red wine and adding a new database command to the Kitten¹ command-line interface.
You will soon be able to tail JavaScript Database (JSDB)² tables with:
kitten db <table name>
(Remember that JSDB writes its tables as append-only JavaScript logs.)
¹ https://codeberg.org/kitten/app
² https://codeberg.org/small-tech/jsdb
#kitten #SmallWeb #javascript #database #jsdb
Right, implemented workaround to JavaScript’s Proxy / Date object incompatibility in JavaScript Database (JSDB)¹ and released in version 3.0.1².
Calling methods on persisted Date objects read back into memory now works as it should.
Workaround (diff): https://codeberg.org/small-tech/jsdb/commit/9e039e76f7a149df2fa7ecbbf626f813e44c0ab2
Kudos to Pravin Divraniya for https://stackoverflow.com/a/57958494
¹ https://codeberg.org/small-tech/jsdb
² https://www.npmjs.com/package/@small-tech/jsdb
#JSDB #JavaScript #JS #database #SmallTech #Date #Proxy #web #dev
#jsdb #javascript #js #database #smalltech #date #proxy #web #dev
An interesting JavaScript Database (JSDB) edge case I just encountered:
If you’re persisting custom objects, please do NOT use setter methods (`set something () {…}`).
Use regular methods instead (`setSomething () {…}`) for predictable behaviour that likely matches your conceptual model of how things should work.
(This is due to how setters interact with proxies.)
Details: https://codeberg.org/small-tech/jsdb#custom-data-types
#JavaScriptDatabase #javascript #database #jsdb #accessors #SmallTech #SmallWeb #web #dev
#JavaScriptDatabase #javascript #database #jsdb #accessors #smalltech #SmallWeb #web #dev
@Shini92 Nice. One very similar use case for me is database schemas for JavaScript Database (JSDB)¹, which is part of Kitten² :)
https://codeberg.org/domain/app/src/branch/main/app_modules/database/database.js
¹ https://codeberg.org/small-tech/jsdb
² https://codeberg.org/kitten/app
#jsdb #kitten #SmallWeb #database #web #dev
Right, I just updated Kitten so it includes JSDB version 3.0.0 and it now has built-in support for database app modules.
A database app module is an app module¹ for your database where you can provide a schema for it using JavaScript class hierarchies and register those classes with the database so your custom objects maintain their types when they are written and read in.
You can see it in use in Domain here: https://codeberg.org/domain/app/src/branch/main/app_modules/database/database.js#L198
#kitten #SmallWeb #jsdb #domain
Right, I just updated Kitten so it includes JSDB version 3.0.0 and it now has built-in support for database app modules.
A database app module is an app module¹ for your database where you can provide a schema for it using JavaScript class hierarchies and register those classes with the database so your custom objects maintain their types when they are written and read in.
You can see it in use in Domain here: https://codeberg.org/domain/app/src/branch/main/app_modules/database/database.js#L198
#kitten #SmallWeb #jsdb #domain
This is quite a major change internally but since #JSDB has 100% code coverage, I’m *pretty* certain, I didn’t break anything else.
Then again, JSDB had 100% code coverage before this too and the issue this update fixes was around for several years. (Likely because no one, including me, was really persisting custom objects… something I’m now starting to use while building #Domain¹.)
Just goes to stress that 100% code coverage in no way means “bug free.” ;)
Just released #JavaScript #Database (#JSDB)¹ version 3.0.0
Breaking change²: data is now evaluated in virtual machine contexts.
If you were persisting custom objects³ and referencing classes from global scope (`globalThis`) to have your objects keep their types when read, you must now explicitly register your list of custom classes using the new `classes` property of the `options` object when calling JSDB.open().
¹ https://codeberg.org/small-tech/jsdb#javascript-database-jsdb
² https://codeberg.org/small-tech/jsdb/src/branch/main/CHANGELOG.md#3-0-0-2023-04-28
³ https://codeberg.org/small-tech/jsdb#custom-data-types
Did I mention you can persist #JavaScript class instances in #JSDB¹ in #Kitten²?
(Well, you can.)
It’s a great way to get type information/auto-completion while building your #SmallWeb site/app.
e.g., https://codeberg.org/domain/app/src/branch/main/app_modules/database/database.js
I’ll be talking about some of the more advanced features in Kitten on tomorrow’s #SmallIsBeautiful live stream (follow our #owncast from your fediverse account to be notified when we go live): https://owncast.small-web.org
¹ https://codeberg.org/small-tech/jsdb
² https://codeberg.org/kitten/app
#javascript #jsdb #kitten #SmallWeb #smallisbeautiful #owncast
@aral I read through the #Kitten docs. You did a nice job walking through the project and it’s capabilities 👍🏻
Looks like a neat tool. #HTMX and #alpinejs are nice choices to bundle. I’d prefer #SQLite to #JSDB, but I see what you’re going for. I might try it out with #Dolt via Dolthub’s SQL API https://dolthub.com/blog/2020-08-21-dolthub-repository-apis/
Overall it feels like a static site generator, but it’s dynamic! very cool 😸
#kitten #htmx #AlpineJS #sqlite #jsdb #dolt
So after a deep dive into TypedArrays in JavaScript, I’ve decided I can’t really implement support for them in JSDB (https://codeberg.org/small-tech/jsdb), they’re just too inconsistent with every other data type in the language (can’t be proxied, etc.) If you need to persist them, serialise them to a hex string of some sort and persist that.
#SmallWeb #smalltech #javascript #typedarray #jsdb
The reason I’m running into these edge cases is because I’m adding TypedArray support to JSDB – my in-process Node.js database that writes to a JavaScript append-only log (https://codeberg.org/small-tech/jsdb) – and, given all the gotchas with float and BigInt arrays, I think I’m just going to limit it to Uint8Array support. My use case is to easily persist public cryptographic key material in its native form in Kitten (https://coderberg.org/kitten/app).
#SmallWeb #smalltech #database #javascript #jsdb #dev
It has been a mere 12 years since I posted a meeting report about the last joint #sfbd #jsdb meeting (without the great input from #hfsp at the time)
https://thenode.biologists.com/meeting-report-from-the-2nd-joint-meeting-of-the-sfbd-and-jsdb-2010-from-cells-to-organs/events/
I remember the gorgeous 14th #ISDB in Kyoto, when the SFDB gave me a prize to present my work there, back in 2001. Now a meeting report from the 19th meeting (every 4 years but this year in 2022, #COVID oblige), in Algarve, is online: https://thenode.biologists.com/meeting-report-19th-international-congress-of-developmental-biology-isdb2021/meeting-reports/
#covid #isdb #HFSP #jsdb #sfbd
@cellysally For future conferences, check out our awesome and beautifully illustrated nametag lanyards on sturdy paper that double as easily-consulted programs when around the neck for the #sfbd #jsdb #hfsp joint #DevBio conference this week!
@cellysally For future conferences, check out our awesome and beautifully illustrated nametag lanyards on sturdy paper that double as easily-consulted programs when around the neck for the #sfbd #jsdb #hfsp joint #DevBio conference this week!