Releases: tobyzerner/json-api-models
Releases · tobyzerner/json-api-models
Release 0.2.0-beta.9
Fixed
- Fix reactivity systems not picking up when new properties are added
Release 0.2.0-beta.8
Fixed
- Fix Schemas not being passed through to
Model.store
Release 0.2.0-beta.7
Fixed
- Fix model typing
Release 0.2.0-beta.6
Changed
- Revert to non-proxy implementation of model fields
Fixed
- Make model relationship fields optional
Release 0.2.0-beta.5
Fixed
- Fix falsy attribute values not being returned
Release 0.2.0-beta.4
Changed
- Remove index signature from
Model
Release 0.2.0-beta.3
Added
- Allow syncing
null
document data. - Add
exports
field to package.json.
Release 0.2.0-beta.1
⚠️ Breaking Changes
-
Rewrite TypeScript support to allow Intellisense based on JSON:API resource schema. For example:
type UsersSchema = { type: 'users'; id: string; attributes: { name: string; }; relationships: { dog: { data?: { type: 'dogs'; id: string } | null }; }; }; class User extends Model<UsersSchema> {}
To type related resources, you can provide a collection of all models as the second generic.
type DogsSchema = { // ... }; type Schemas = { users: User; dogs: Dog; }; class User extends Model<UsersSchema, Schemas> {} class Dog extends Model<DogsSchema, Schemas> {}
-
The
Store
now returns proxiedModel
instances to implement field getters, instead ofModel
depending onStore
and defining getters for present fields. -
Remove the
Query
helper. UseURLSearchParams
instead. -
Remove
Model
attribute casting functionality. Define getters instead:class User extends Model<UserSchema> { get createdAtDate() { return new Date(this.createdAt); } }
-
Remove the
Model.getAttribute()
andModel.getRelationship()
methods. -
Remove CJS and IIFE exports. Package is now only exported as an ES module.
Release 0.1.0-beta.8
Added
- Support model type inference:
const store = new Store({ users: User });
store.find('users', '1') // User
Removed
- Remove the
Store.model
method. Models must now be defined when the Store is constructed.
Release 0.1.0-beta.7
Fixed
- Fix regression with attribute casting not handling dates correctly, and add more sophisticated handling of primitives, constructables, and callables.