0.370 (26 Oct 2023)

26 October, 2023

These changes have been released with version 0.370 of the CLI.

Watch mode for client generation

Run keel client --watch to generate your Keel Client in real time!

We have added a watch mode to the keel client generation command using the --watch flag which will continuously detect changes to your Keel schema files and subsequently regenerate your client code.

The generate command

Looking up models with composite keys

Composite unique fields can now be used to lookup a model with the get, update and delete Action types.

This provides a lot of convenience when you already have real-world, unique identifiers for your models and don't necessarily always need or want to look them up by id. Take the following example below where we update a Product by looking up its composite unique fields.

model Product {
    fields {
        name Text
        supplierCode Text
        supplierSku Text
    }
 
    @unique([supplierSku, supplierCode])
 
    actions {
        update updateProduct(supplierSku, supplierCode) with (name)
    }
}

Looking up models using relationships

We have further extended the get, update, and delete Action types to support an even smarter way to look up models using relationships. We amend the previous example to demonstrate this.

model Supplier {
    fields {
        code @unique
    }
}
 
model Product {
    fields {
        name Text
        supplierSku Text
    }
 
    @unique([supplierSku, supplier])
 
    actions {
        update updateProduct(supplierSku, supplier.code) with (name)
    }
}

Fixes and Improvements

  • keel init will now generate files in non-empty directories, but won't overwrite any existing files.
  • A faster experience when running keel generate as we now pull NPM dependencies when we really need to.
  • keel generate not blocking if secrets are not set.
  • keel generate will politely amend, rather than overwrite, the tsconfig.json file if it exists.
  • General improvements to how we pipe output to the terminal when running keel test and keel generate.

For any issues or feedback, please visit the support channel on our community discord (opens in a new tab) or contact us at help@keel.so.

Thank you for using Keel!