Skip to content

Releases: tobyzerner/json-api-models

Release 0.2.0-beta.3

03 Sep 02:25
4b0df34
Compare
Choose a tag to compare
Release 0.2.0-beta.3 Pre-release
Pre-release

Added

  • Allow syncing null document data.
  • Add exports field to package.json.

Release 0.2.0-beta.1

14 May 06:47
c9661f9
Compare
Choose a tag to compare
Release 0.2.0-beta.1 Pre-release
Pre-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 proxied Model instances to implement field getters, instead of Model depending on Store and defining getters for present fields.

  • Remove the Query helper. Use URLSearchParams 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() and Model.getRelationship() methods.

  • Remove CJS and IIFE exports. Package is now only exported as an ES module.

Release 0.1.0-beta.8

05 Jun 02:29
4cb3441
Compare
Choose a tag to compare
Release 0.1.0-beta.8 Pre-release
Pre-release

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

01 Sep 01:10
Compare
Choose a tag to compare
Release 0.1.0-beta.7 Pre-release
Pre-release

Fixed

  • Fix regression with attribute casting not handling dates correctly, and add more sophisticated handling of primitives, constructables, and callables.

Release 0.1.0-beta.6

01 Sep 00:29
Compare
Choose a tag to compare
Release 0.1.0-beta.6 Pre-release
Pre-release

Fixed

  • Fix attribute cast type definition and invoke as function rather than with new.

Release 0.1.0-beta.5

31 Aug 05:32
Compare
Choose a tag to compare
Release 0.1.0-beta.5 Pre-release
Pre-release

Added

  • Query: add append, set, and delete methods.
  • Export useful JSON:API types: JsonApiDocument, JsonApiIdentifier, JsonApiResource, JsonApiRelationships, and JsonApiRelationship.

Removed

  • Query: remove push method.

Release 0.1.0-beta.4

26 May 04:39
Compare
Choose a tag to compare
Release 0.1.0-beta.4 Pre-release
Pre-release

Fixed

  • Fix casts not working correctly.

Release 0.1.0-beta.3

26 May 04:25
Compare
Choose a tag to compare
Release 0.1.0-beta.3 Pre-release
Pre-release

Added

  • Added ability to define typecasts for attributes on custom models.

Changed

  • Change compilation target to es2017 for Object.entries support.

v0.1.0-beta.1

17 Jan 06:54
Compare
Choose a tag to compare
v0.1.0-beta.1 Pre-release
Pre-release
Recompile