Skip to content

v0.4.0

Compare
Choose a tag to compare
@dirkdev98 dirkdev98 released this 21 May 10:02
· 417 commits to main since this release
96d9973

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 to migrationsInitContext. It also accepts an object with migrationsDirectory instead of a 'string' as the second argument. As before, if you don't provide a migrationsDirectory it defaults to $cwd/migrations.
    • Renamed getMigrationsToBeApplied to migrationsGetInfo. The result is wrapped in a promise.
    • Renamed runMigrations to migrationsRun.
    • 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 from compas migrate. If you need this functionality, you are better off calling the migration functions on application startup.
  • feat(code-gen): drop T.any().raw() and T.any().validator() 9d4f7a
    • T.any().raw() and T.any().validator() were not implemented in the new code-gen. Use T.any().implementations() instead.
  • feat(code-gen): drop T.bool().convert(), T.number().convert() and T.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 of R.files()
    • When using the Koa router, change usages of ctx.validatedFiles with ctx.validatedBody
    • Auto-generated type names for files inputs like PostSetHeaderImageFiles will be renamed to PostSetHeaderImageBody.
    • Executing this change on the server doesn't require immediate regeneration of api clients. The way they currently send files is compatible.

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() and R.query() 21c9b7
  • feat(code-gen): improve react-query DX by accepting a partial object on useQuery hooks 430449
  • feat(code-gen): define behavior for T.file() in R.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 docs 9744e6
  • chore: add a quick citgm command for testing unreleased Compas versions on local projects 4b7ba7

Dependency updates

  • build(deps): bump recast from 0.22.0 to 0.23.2 (#2585)
    • Major version bump
  • build(deps): bump tar from 6.1.14 to 6.1.15 (#2591)
  • build(deps): bump eslint-plugin-jsdoc from 44.2.3 to 44.2.4 (#2588)