Skip to content

Latest commit

 

History

History
135 lines (84 loc) · 6.81 KB

CHANGELOG.md

File metadata and controls

135 lines (84 loc) · 6.81 KB

Changelog

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.

Unreleased

Added

  • Augmenting the ModelEvents interface it is now possible to extend model events with custom events.
  • The following model events: modified, relation-loaded.

Changed

  • Model collections are no longer inherited unless they were initialized explicitly.
  • Key type is now typed as string | number | Record<string, string | number> instead of any. This was necessary to avoid values such as null or undefined accepted as valid keys.
  • ProxyEngine is no longer an interface but a class that can be extended, you can still use IProxyEngine for backwards compatibility but it'll be removed in future versions.

Deprecated

  • ModelEvent and ModelEventValue have been deprecated in favour of the ModelEvents interface.

v0.5.2 - 2023-12-17

Added

  • Improved withEngine ergonomics. Model operations can now be chained instead of passed as a callback.

v0.5.1 - 2023-03-10

Fixed

  • 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!

Added

  • 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 inside initializeRelationsEnabling method).
  • $overwrite engine update operator.

Changed

  • Upgraded TypeScript version to 4.1.
  • The Relation.resolve method has been renamed to Relation.load.
  • The Soukai.useEngine method has been renamed to setEngine.
  • The Model.modelClass getter has been removed, you can use the Model.static() method instead.
  • The Model.setRelationModels method will no longer work for single model relations (hasOne or belongsToOne), use setRelationModel 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.

Deprecated

  • 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 of bootModelsFromWebpackContext and bootModelsFromViteGlob.
  • The Soukai.loadModel and Soukai.loadModels methods have been deprecated in favour of bootModels.

Fixed

  • Fixed default casting for Date and Array fields.

v0.4.1 - 2021-01-25

Fixed

  • TransactionInactiveError using IndexedDBEngine as reported here.
  • The loaded property from Relation class was readonly but this wasn't specified in the declaration files.

v0.4.0 - 2020-11-27

Added

  • $in filter for individual fields.
  • onDelete method to relations.
  • wasRecentlyCreated method to Model.

Changed

  • SoukaiError now extends properly from the native Error class.
  • BelongsToRelation class has been renamed to BelongsToOneRelation, and the Model method belongsTo to belongsToOne.

v0.3.0 - 2020-07-17

Added

Changed

  • Soukai.withEngine has been removed in favor of Soukai.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

Added

  • Filters for reading data.
  • LocalStorageEngine and EngineHelper.
  • Relationships.
  • classFields attribute in Model.

Changed

  • 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

Added

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

Changed

  • Refactored type definitions.
  • Converted attribute names to camelCase (created_at -> createdAt, updated_at -> updatedAt, ...).

v0.0.1 - 2018-05-17

Added

  • Everything!