v0.4.0
Breaking changes
There are a few structure breaking changes to clean up compatibility with old code-gen. Make sure that the API is updated before any consumer is.
- feat(cli,store): align migration related functions
bacfe3
- Renamed
newMigrateContext
tomigrationsInitContext
. It also accepts an object withmigrationsDirectory
instead of a 'string' as the second argument. As before, if you don't provide amigrationsDirectory
it defaults to$cwd/migrations
. - Renamed
getMigrationsToBeApplied
tomigrationsGetInfo
. The result is wrapped in a promise. - Renamed
runMigrations
tomigrationsRun
. - All individual functions now acquire and release a Postgres lock instead of keeping the lock alive for the whole connection. This allows you to use these functions more easily in application code.
- Dropped
--keep-alive
and--without-lock
fromcompas migrate
. If you need this functionality, you are better off calling the migration functions on application startup.
- Renamed
- feat(code-gen): drop
T.any().raw()
andT.any().validator()
9d4f7a
T.any().raw()
andT.any().validator()
were not implemented in the new code-gen. UseT.any().implementations()
instead.
- feat(code-gen): drop
T.bool().convert()
,T.number().convert()
andT.string().convert()
d704a6
- The new code-gen automatically converts booleans, numbers and dates from their string representation.
- feat(code-gen): re-instantiate
T.array().convert()
d3aabb
- JS validators don't automatically convert single values to arrays anymore. Adding this as the default caused performance problems with the Typescript compiler and complex recursive types. It also caused a bad DX, where setting an empty array and trying to push later would result in a type error. Also not every planned target language has support to type this correctly anyway, so it should be used sparingly.
- feat(code-gen): drop
R.files()
569b2b
- Use
R.body()
instead ofR.files()
- When using the Koa router, change usages of
ctx.validatedFiles
withctx.validatedBody
- Auto-generated type names for files inputs like
PostSetHeaderImageFiles
will be renamed toPostSetHeaderImageBody
. - Executing this change on the server doesn't require immediate regeneration of api clients. The way they currently send files is compatible.
- Use
Features
- feat(code-gen): add expected patterns to docs if no docs exist on
T.uuid()
,T.date().{timeOnly,dateOnly}()
41e3e3
- feat(code-gen): add stricter validation on
R.params()
andR.query()
21c9b7
- feat(code-gen): improve react-query DX by accepting a partial object on
useQuery
hooks430449
- feat(code-gen): define behavior for
T.file()
inR.body()
(#2597)80429b
Bug fixes
- fix(code-gen): don't throw a 404 on no match in the router
077da8
Other
- chore(docs): add
T.array().convert()
to the docs9744e6
- chore: add a quick citgm command for testing unreleased Compas versions on local projects
4b7ba7