Releases: featurist/sworm
v3.8.1
- Update cooperative version in package 7210fd3
websql
concurrency fixes
it was possible that if object A was already being saved
and object B required A.id, then it would take A.id
before A was saved.
This is now fixed such that all dependent objects strictly
wait for their dependencies to be saved before attempting
to get their ids. This happens even if the object is already
being saved by another operation. (the promise is shared)
On the other hand, we don't wait for all one to many objects
for an object - which don't have a dependency relationship.
These objects are added to a queue of objects that need to
be saved before the top level object can be considered
completely saved.
can save empty rows
- can save empty rows, as noticed by @artemave in #9
- can return undefined from relationship functions, which can allow you to optionally return a related object. See https://github.com/featurist/sworm/blob/v2.3.0/test/spec.js#L633
throws error when not connected
Throws errors when trying to query or save when the database isn't connected yet.
objects with relationships can be saved twice
There was an issue where if you saved an object with function relationships, i.e. functions that returned more objects, those objects would be saved, fine. Problem occurred the next time you saved the same object, it would call the function again and return new objects to save. The fix is to set the return values of those functions as fields on the object, overwriting the function, and thus allowing the object to be saved again without problem.
Connect on query
This release breaks the API, please upgrade carefully. In particular, the sworm.db(config)
return is no longer a promise, but a db
instance.
- Previously
sworm.db(config)
returned a promise, now it returns a newdb
instance. The firstdb.query()
or the firstdb.connect()
will connect to the database. - Now supporting
setupSession
to setup session properties before querying.