Release 0.2.0-beta.1
Pre-release
Pre-release
·
19 commits
to master
since this release
⚠️ 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.