Miragejs Versions Save

A client-side server to build, test and share your JavaScript app

v0.1.38

4 years ago

🚀 Enhancements

  • Improvement to TS typings #406
  • Adds basic Serializer TS type #397

🏠 Internal

  • Dependency updates

v0.1.37

4 years ago

🐛 Bugfixes

🏠 Internal

  • Dependency updates

v0.1.36

4 years ago

🚀 Enhancements

  • #262 #383 TypeScript support

🏠 Internal

  • Upgrade to Pretender 3.4.0

  • Dependency updates

v0.1.35

4 years ago

🚀 Enhancements

  • #328 Make serializer.schema public

    A reference to the schema instance. Useful to reference registered schema information.

  • #325 Relationship introspection

    This is a new feature that allows you to introspect a model's associations.

    Given

    import { Server, Model, hasMany, belongsTo }
    
    new Server({
      models: {
        user: Model,
        post: Model.extend({
          user: belongsTo(),
          comments: hasMany()
        }),
        comments: Model
      }
    })
    

    you can now introspect the post's associations, either through schema or an actual instance of the Post model:

    server.schema.associationsFor('post')
    // or
    post.associations
    

    Both methods will return the same data structure:

    {
      user: BelongsToAssociation,
      comments: HasManyAssociation
    }
    

    and you can use the new properties exposed on the Association class to get the type, name, modelName, and foreign key:

    let userAssociation = post.associations.user
    
    userAssociation.type // "belongsTo"
    userAssociation.name // "user"
    userAssociation.modelName // "user"
    userAssociation.foreignKey // "userId"
    

    This feature can be useful if you need to build up something dynamically based on a model's relationships.

  • #327 Pass the primary resource to serializer.include()

    This is an update to the Serializer.include method that lets you use the primary resource being serialized to determine what the included associations should be.

    For example, when combined with the previous feature, you can use it to configure your Serializer to include all of a model's relationships by default:

    new Server({
      serializers: {
        application: Serializer.extend({
          include(request, resource) {
            let associations = this.schema.associationsFor(resource.modelName);
    
            return Object.keys(associations)
          }
        })
      }
    })
    

🏠 Internal

  • Dependency updates

v0.1.34

4 years ago

🐛 Bugfixes

  • #211 JSONAPISerializer now handles empty include string and trailing commas

📝 Docs

  • Update docs

🏠 Internal

  • Dependency updates

v0.1.33

4 years ago

🐛 Bugfixes

  • #281 Fix passthrough function with queryParams

📝 Docs

  • #233 Change baseConfig to routes in docs.

🏠 Internal

  • #234 Have CI run prettier check
  • Dependency updates

v0.1.32

4 years ago

🚀 Enhancements

🐛 Bugfixes

📝 Docs

🏠 Internal

  • Dev dependency updates

v0.1.31

4 years ago

🚀 Enhancements

  • Rename rest of old @miragejs/server references to miragejs

v0.1.30

4 years ago

🚀 Enhancements

  • This release updates the npm package name from from @miragejs/server to miragejs.

    If you're using @miragejs/server directly in your project, swap it out for the latest 0.1.x version of miragejs and change all import paths from "@miragejs/server" to "miragejs".

    If you're using ember-cli-mirage, you can upgrade to v1.1.4 or later to address this deprecation.

v0.1.29

4 years ago

🚀 Enhancements

🏡 Internal

  • Dependency updates