Skip to content

New GraphQL Schema and complex filters

Choose a tag to compare

@adriangmweb adriangmweb released this 03 May 11:11
· 1273 commits to main since this release

Finally, one of the most requested features is here! Complex filters on the GraphQL API. This change will allow users to filter read models like never before, for instance:

query {
  ProductReadModels(filter: { price: { gt: 200 } }) {
    id
    sku
    availability
    price
  }
}

Now you can filter by specific types, complex properties, and even use filter combinators! You can find the complete set of filters in the documentation.

⚠ Breaking Changes

To perform these filters, the GraphQL schema has been redesigned, which introduces breaking changes for existing Booster applications with versions lower than v0.16.0.

Those are the required steps to migrate your app to use Booster v0.16.0 or later successfully.

Update package.json file.

Include the following dependencies to your package.json file on the devDependencies section.

"ttypescript": "1.5.12",
"metadata-booster": "0.3.1"

Also, update the TypeScript dependency version to 4.1.5 a ts-node to 9.1.1.

"typescript": "4.1.5",
"ts-node": "9.1.1",

Finally, change the compile script to use ttsc without npx instead of using npx tsc, it should look like this:

"compile": "ttsc -b tsconfig.json",

Update tsconfig.json file.

Remove the "emitDecoratorMetadata": true line from the tsconfig.json file, and add the following property.

"plugins": [
      { "transform": "metadata-booster" }
 ]

This property allows the application to use the metadata-booster plugin when compiling TypeScript code, allowing the compiled JavaScript files to know the properties of every type created. Ensure you have the following properties:

"experimentalDecorators": true,
"plugins": [
    { "transform": "metadata-booster" }
]

Note: remember to delete the emitDecoratorMetadata property to avoid getting compilation errors.

Upgrade npm

To be able to run the npm scripts properly, especially the compilation one, you will need to upgrade at least to npm v7 or later.

And that's it! 🎉 Your Booster application is ready to upgrade and use the new GraphQL API filters! 🚀