All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Augmenting the
ModelEvents
interface it is now possible to extend model events with custom events. - The following model events:
modified
,relation-loaded
.
- Model collections are no longer inherited unless they were initialized explicitly.
Key
type is now typed asstring | number | Record<string, string | number>
instead ofany
. This was necessary to avoid values such asnull
orundefined
accepted as valid keys.ProxyEngine
is no longer an interface but a class that can be extended, you can still useIProxyEngine
for backwards compatibility but it'll be removed in future versions.
ModelEvent
andModelEventValue
have been deprecated in favour of theModelEvents
interface.
v0.5.2 - 2023-12-17
- Improved
withEngine
ergonomics. Model operations can now be chained instead of passed as a callback.
v0.5.1 - 2023-03-10
- Tree-shaking by declaring
"sideEffects": false
.
v0.5.0 - 2023-01-20
This is the first release after 2 years under development, so it's a huge update and the changes listed here are not exhaustive. However, although many of the internals have changed, the public API and core concepts are mostly the same. So upgrading should be mostly straightforward. In any case, you should test that everything is working as expected. And be sure to ask for assistance if you need it!
- TypeScript inference.
- Model events.
- Vite helper
bootModelsFromViteGlob
. FieldType.Any
for polymorphic fields (keep in mind that casting won't be applied).- Engine overrides using
Model.setEngine
both at the model and instance level. - Relations can be disabled using calling
relation.disable()
(you'd call it insideinitializeRelationsEnabling
method). $overwrite
engine update operator.
- Upgraded TypeScript version to 4.1.
- The
Relation.resolve
method has been renamed toRelation.load
. - The
Soukai.useEngine
method has been renamed tosetEngine
. - The
Model.modelClass
getter has been removed, you can use theModel.static()
method instead. - The
Model.setRelationModels
method will no longer work for single model relations (hasOne or belongsToOne), usesetRelationModel
instead. - Automatic timestamps are now minted and updated before saving, not when model attributes are updated.
- Single model relations can now be loaded without a related model. When unloaded, the related model will be undefined instead of null.
- The default export (such as
Soukai.useEngine
,Soukai.loadModel
, etc.) has been deprecated in favour of helper functions. - The
definitionsFromContexts
helper has been deprecated in favour ofbootModelsFromWebpackContext
andbootModelsFromViteGlob
. - The
Soukai.loadModel
andSoukai.loadModels
methods have been deprecated in favour ofbootModels
.
- Fixed default casting for Date and Array fields.
v0.4.1 - 2021-01-25
- TransactionInactiveError using IndexedDBEngine as reported here.
- The
loaded
property fromRelation
class was readonly but this wasn't specified in the declaration files.
v0.4.0 - 2020-11-27
$in
filter for individual fields.onDelete
method to relations.wasRecentlyCreated
method toModel
.
SoukaiError
now extends properly from the nativeError
class.BelongsToRelation
class has been renamed toBelongsToOneRelation
, and theModel
methodbelongsTo
tobelongsToOne
.
v0.3.0 - 2020-07-17
IndexedDBEngine
engine.- A bunch of new operators for filtering and updating. Read the docs and see EngineHelper.test.ts for examples.
Soukai.withEngine
has been removed in favor ofSoukai.requireEngine
.- Some method signatures in the
Engine
interface. Check out those changes here. - Model relations have been refactored to better reflect the nature of non-relational databases. Related model instances are now stored in the
Relation
instance, which is exposed in{relation-name}Relation
model properties. Relation definitions have also been renamed to use local/foreign nomenclature. Read the docs and see relations.test.ts for examples. - Models hydration has been extracted and refactored into multiple protected methods:
createFromEngineDocument
,toEngineDocument
,getDirtyEngineDocumentUpdates
,syncDirty
,cleanDirty
, etc.
v0.2.0 - 2019-08-05
- Filters for reading data.
LocalStorageEngine
andEngineHelper
.- Relationships.
classFields
attribute inModel
.
- Engines have been refactored to know nothing about the models, they'll only get attributes now. Multiple methods have been modified and added to the
Model
class in order to control attributes serialization. - InMemoryEngine database format has been changed.
- Some methods and its arguments have changed, be sure to check out the new type definitions.
v0.1.0 - 2019-03-23
- Attribute accessors.
- Polyfills added for CJS (runtime) and UMD (bundled), not with ESM due to zloirock/core-js#385 (and most clients using ESM should already be using modern environments)
- Refactored type definitions.
- Converted attribute names to camelCase (created_at -> createdAt, updated_at -> updatedAt, ...).
v0.0.1 - 2018-05-17
- Everything!