Skip to content

2x faster GraphQL requests, Authentication improvements, and more!

Pre-release
Pre-release
Compare
Choose a tag to compare
@alvaroloes alvaroloes released this 21 Sep 11:37

This release contains a lot of additions, huge improvements in usability, performance, and stability, so we encourage you to update right away. There are some breaking changes, but they are easily addressable (minor syntax changes)

⚠ Breaking Changes

  • Command handlers are now static methods that receive the command data in the first parameter. If you are upgrading form a previous Booster version, you will get a compilation error. To fix it, you need to change the command handler signature:
    If we have the following command:
@Command(...)
export class CreatePost {
  public constructor(
    readonly postId: UUID
  ) {}

  public async handle(register: Register): Promise<void> {
    if(this.postId) {
      ...
    }
  }
}

Then we need to make the handle method static, receive the command data as the first parameter, and change any usages of this by the name of the first parameters:

  public static async handle(command: CreatePost, register: Register): Promise<void> {
    if(command.postId) {
      ...
    }
  • If you use roles, they have some changes in the attributes they accept. allowSelfSignup is no longer used and was replaced by the property auth, which is an object with some new options. For more information, go to this section of the documentation. If you want to strictly fix the syntax while keeping the exact same behavior, then replace roles with allowSelfSignUp: false like this:
@Role({
  allowSelfSignUp: false,
})
export class Admin {}

By this:

@Role({
  auth: {
    signUpMethods: [],
  },
})
export class Admin {}

And roles with allowSelfSignUp: true like this:

@Role({
  allowSelfSignUp: true,
})
export class User {}

By this:

@Role({
  auth: {
    signUpMethods: ['email']
  },
})
export class User {}
  • Finally, you would get a compilation error in the index.tx file after upgrading, saying that boosterRequestAuthorizer doesn't exist. Just remove that export, it ware refactored out.
    image

🔥 New

  • Authorization gets better!
    • You can specify now that some roles are allowed to signup by phone. Everything will be handled and they will be sent an SMS, instead of an email, for confirmation.
    • You can configure a role to skip the confirmation step

🚀 Improvements

  • Removed the need for an authorizer function, meaning that the GraphQL requests are now almost 2x faster!
  • You can now call the new auth API method /refresh-token to refresh expired access tokens
  • GraphQL now supports the standard authentication mechanism, both in HTTP calls and in WebSocket calls. This means that you can now correctly authorize any request using the standard GraphQL client of your choice (Android, iOS, etc.)
  • Added and improved a lot of documentation!

🩹 Fixes

  • Improved integration tests and make them execute in parallel, reducing tremendously the time you need to wait for them.
  • Fix how auth related errors were returned after a GraphQL request. Now they properly follow the standard ({errors: [...]})