aral, to javascript
@aral@mastodon.ar.al avatar

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:

https://www.npmjs.com/package/@small-tech/jsdb

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

¹ https://codeberg.org/small-tech/jsdb#custom-data-types
² https://codeberg.org/kitten/app

aral, to programming
@aral@mastodon.ar.al avatar

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

aral,
@aral@mastodon.ar.al avatar

JSDB 5.0.1 published 🎉

• Fixes #14: Crash if DataProxy getHandler() called on object with null prototype. (https://codeberg.org/small-tech/jsdb/issues/14)

To install update:

npm install @small/jsdb@5.0.1

Learn more about JSDB:

https://codeberg.org/small-tech/jsdb#javascript-database-jsdb

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

aral,
@aral@mastodon.ar.al avatar

JSDB 5.1.0 published¹ 🎉

• Forgetting to pass a custom class that’s persisted in your database in your JSDB.open() call now throws instead of corrupting your database by falling back to using an untyped object.

• Added JSDF ver. 2 to 3 database migration script (i.e., JSDB version 2-4 to 5)²

To install update:

npm install @small/jsdb@5.1.0

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

² https://codeberg.org/small-tech/jsdb#version-2-to-3

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

aral, to javascript
@aral@mastodon.ar.al avatar

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

aral,
@aral@mastodon.ar.al avatar

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

aral, to SmallWeb
@aral@mastodon.ar.al avatar

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

aral, (edited ) to SmallWeb
@aral@mastodon.ar.al avatar

It’s so cool to be able to tail your database (append-only JavaScript log¹) when playing with Kitten².

(If I do say so myself.)

The output on the right is the initial state of running the following command on your project folder to tail the domains table when the project is being served on the domain dev.ar.al:

kitten db tail domains --domain=dev.ar.al --all

:kitten: 💕

¹ https://codeberg.org/kitten/app#using-javascript-database-jsdb-a-not-so-scary-database
² https://codeberg.org/kitten/app#kitten

aral, to SmallWeb
@aral@mastodon.ar.al avatar

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

aral, to javascript
@aral@mastodon.ar.al avatar

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

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • thenastyranch
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • cisconetworking
  • slotface
  • vwfavf
  • everett
  • Durango
  • rosin
  • tester
  • GTA5RPClips
  • khanakhh
  • osvaldo12
  • ngwrru68w68
  • normalnudes
  • anitta
  • ethstaker
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • JUstTest
  • All magazines