Aral Balkan · @aral
39718 followers · 28525 posts · Server mastodon.ar.al

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:

codeberg.org/kitten/app#databa

¹ codeberg.org/kitten/app
² codeberg.org/small-tech/jsdb

#kitten #SmallWeb #web #dev #database #JavaScriptDatabase #jsdb

Last updated 1 year ago

Aral Balkan · @aral
39607 followers · 28139 posts · Server mastodon.ar.al

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()… already uses proxies so maybe?

#jsdb #js #database

Last updated 1 year ago

Aral Balkan · @aral
38883 followers · 27197 posts · Server mastodon.ar.al

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 (codeberg.org/small-tech/jsdb)

² codeberg.org/small-tech/jsdb/i

#javascript #database #jsdb #nodejs #SmallWeb #web #dev

Last updated 1 year ago

Aral Balkan · @aral
35295 followers · 25455 posts · Server mastodon.ar.al

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: codeberg.org/kitten/app#databa

¹ codeberg.org/kitten/app
² codeberg.org/small-tech/jsdb

#kitten #SmallWeb #smalltech #JavaScriptDatabase #javascript #database #jsdb #web #dev #js #nodejs #commandlineinterface #cli

Last updated 2 years ago

Aral Balkan · @aral
35202 followers · 25369 posts · Server mastodon.ar.al

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.)

¹ codeberg.org/kitten/app
² codeberg.org/small-tech/jsdb

#kitten #SmallWeb #javascript #database #jsdb

Last updated 2 years ago

Aral Balkan · @aral
35116 followers · 25295 posts · Server mastodon.ar.al

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): codeberg.org/small-tech/jsdb/c

Kudos to Pravin Divraniya for stackoverflow.com/a/57958494

¹ codeberg.org/small-tech/jsdb
² npmjs.com/package/@small-tech/

#jsdb #javascript #js #database #smalltech #date #proxy #web #dev

Last updated 2 years ago

Aral Balkan · @aral
34612 followers · 24930 posts · Server mastodon.ar.al

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: codeberg.org/small-tech/jsdb#c

#JavaScriptDatabase #javascript #database #jsdb #accessors #smalltech #SmallWeb #web #dev

Last updated 2 years ago

Aral Balkan · @aral
34536 followers · 24805 posts · Server mastodon.ar.al

@Shini92 Nice. One very similar use case for me is database schemas for JavaScript Database (JSDB)¹, which is part of Kitten² :)

codeberg.org/domain/app/src/br

¹ codeberg.org/small-tech/jsdb
² codeberg.org/kitten/app

#jsdb #kitten #SmallWeb #database #web #dev

Last updated 2 years ago

Aral Balkan · @aral
34354 followers · 24737 posts · Server mastodon.ar.al

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: codeberg.org/domain/app/src/br

¹ codeberg.org/kitten/app#app-mo

#kitten #SmallWeb #jsdb #domain

Last updated 2 years ago

Aral Balkan · @aral
34353 followers · 24736 posts · Server mastodon.ar.al

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: codeberg.org/domain/app/src/br

¹ codeberg.org/kitten/app#app-mo

#kitten #SmallWeb #jsdb #domain

Last updated 2 years ago

Aral Balkan · @aral
34339 followers · 24712 posts · Server mastodon.ar.al
Aral Balkan · @aral
34339 followers · 24711 posts · Server mastodon.ar.al

This is quite a major change internally but since 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 ¹.)

Just goes to stress that 100% code coverage in no way means “bug free.” ;)

¹ codeberg.org/domain/app

#jsdb #domain

Last updated 2 years ago

Aral Balkan · @aral
34339 followers · 24710 posts · Server mastodon.ar.al

Just released ()¹ 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().

¹ codeberg.org/small-tech/jsdb#j
² codeberg.org/small-tech/jsdb/s
³ codeberg.org/small-tech/jsdb#c

#javascript #database #jsdb

Last updated 2 years ago

Aral Balkan · @aral
33869 followers · 24489 posts · Server mastodon.ar.al

Did I mention you can persist class instances in ¹ in ²?

(Well, you can.)

It’s a great way to get type information/auto-completion while building your site/app.

e.g., codeberg.org/domain/app/src/br

I’ll be talking about some of the more advanced features in Kitten on tomorrow’s live stream (follow our from your fediverse account to be notified when we go live): owncast.small-web.org

¹ codeberg.org/small-tech/jsdb
² codeberg.org/kitten/app

#javascript #jsdb #kitten #SmallWeb #smallisbeautiful #owncast

Last updated 2 years ago

Peter Bronez · @PeterBronez
200 followers · 975 posts · Server hachyderm.io

@aral I read through the docs. You did a nice job walking through the project and it’s capabilities 👍🏻

Looks like a neat tool. and are nice choices to bundle. I’d prefer to , but I see what you’re going for. I might try it out with via Dolthub’s SQL API dolthub.com/blog/2020-08-21-do

Overall it feels like a static site generator, but it’s dynamic! very cool 😸

@laura @smallcircles

#kitten #htmx #AlpineJS #sqlite #jsdb #dolt

Last updated 2 years ago

Aral Balkan · @aral
28172 followers · 20079 posts · Server mastodon.ar.al

So after a deep dive into TypedArrays in JavaScript, I’ve decided I can’t really implement support for them in JSDB (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

Last updated 2 years ago

Aral Balkan · @aral
28105 followers · 19998 posts · Server mastodon.ar.al

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 (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 (coderberg.org/kitten/app).

#SmallWeb #smalltech #database #javascript #jsdb #dev

Last updated 2 years ago

Etche_homo · @Etche_homo
150 followers · 394 posts · Server mas.to

It has been a mere 12 years since I posted a meeting report about the last joint meeting (without the great input from at the time)
thenode.biologists.com/meeting
I remember the gorgeous 14th 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, oblige), in Algarve, is online: thenode.biologists.com/meeting

#covid #isdb #HFSP #jsdb #sfbd

Last updated 2 years ago

Etche_homo · @Etche_homo
46 followers · 68 posts · Server mas.to

@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 joint conference this week!

#devbio #HFSP #jsdb #sfbd

Last updated 2 years ago

Etche_homo · @Etche_homo
150 followers · 394 posts · Server mas.to

@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 joint conference this week!

#devbio #HFSP #jsdb #sfbd

Last updated 2 years ago