Skip to content

v1.11.0

Compare
Choose a tag to compare
@leafo leafo released this 16 Dec 21:09
· 272 commits to master since this release

Install

luarocks install lapis

Highlights

  • Substantially improved performance for url_for generation
  • Introduce db.clause
  • Lua is now first class. Etlua improvements. Application class APIs match Lua & MoonScript. Documentation and APIs show Lua by default
  • Homepage and documentation have been substantially updated

Additions

  • lapis.db Add the db.clause constructor for safely building SQL fragments including clauses and conditionals
  • All db related methods can now take db.clause objects when appropriate for configuring filtering (eg. Model:find, relation where: clause, etc.)
  • lapis.db The lapis.db.encode_clause function can be used to convert a db.clause object a fragment of SQL code
  • lapis.application Add Application:extend() method to create a sub-class of Application when MoonScript is not available
  • lapis.application All route related methods are now consistently available for both application instances and classes. This includes include, match, extend, find_action, before_filter, get, post, put, delete
  • lapis.session The get_session function can now take a string object as first argument, as an alternative to the request object, to decode a session from a cookie's string value
  • lapis.html Add Widget:extend() method for creating sublcass of the Widget class when MoonScript is not available
  • lapis.html The classnames function will now recurisvely evaluate any tables in the argument
  • lapis.html Add is_mixins_class function to determine if a class is a dynamically generated mixin class created by Widget:include
  • lapis.etlua The element function has been added to the template scope to allow rendering HTML elements programmatically (similar to the HTML builder syntax)
  • lapis.etlua self has been added to the template scope to allow accessing the instance of the EtluaWidget
  • The lapis migrate command now supports a --transaction flag, can be set to global to apply a transaction across all migrations to be run, or individual to apply a transaction to each migration run.
  • lapis.flow Add Flow:extend() method for sublcassing the Flow class

Changes

  • lapis.db Internally, queries now use db.clause to generate SQL conditional statements . This means that order of certain fields may now be different when using where clauses.
  • lapis.db It is no longer possible to override fields configured by a relation when specifying a where: option. This also applies to paginators generated for relations
  • lapis.db.model Relations can now be specified with a direct reference to a Model class, or a function that should resolve to a Model class (existing support for relation name has not changed)
  • lapis.application Inheritance of routes is now more well defined, allowing for route names and paths to be overidden by subclasses or instances during the creation of the router. If you aren't using application inheritance then this will not affect you.
  • lapis.application Lazy action loading is now supported for actions generated by include and actions built by the HTTP verb match helpers (get, post, etc.). Previously, if provided an action name (or true), it would load the action module immediately. Now all named actions are consistently loaded on first request regardless of where they are used
  • lapis.application The find_action method now searches up inheritance hierarchy, and can be used on both app classes and instances
  • lapis.application Trying to call enable or match directly on the lapis.Application class reference will now throw an error to help prevent accidentally mutating the global object
  • lapis.html The Widget:render() method will now return nothing instead of nil
  • lapis.router Router URL creation (aka url_for) has been rewritten to be substantially faster. Previously routes were re-parsed on calls to url_for but will not generate from a cached intermediate form that will allow the URL to be generated with little overhead.
  • lapis.cqueues Add error capturing around the app boot process to provide better error message when attempting to load a faulty app, and prevent infinite loop processing bug from lua-http
  • The environment variable LAPIS_FORCE_LOGGING can not be set to 0 to force logging off
  • The application field is no longer present on the lapis.init module. This was never documented. Use require("lapis.application") instead.
  • Many error messages have been rewritten to be prefixed with the module or method they originate from

Internal Changes

These changes should have no effect on the end user implementing an app, but
they are documented here in case you were depending on the undocumented
structure of lapis

  • lapis.application The internal structure used by the HTTP verb match helpers has been changed (get, post, etc.)
  • lapis.router Parsed routes are now stored, and the arguments for fill_path have changed
  • lapis.application The way routes are internally managed and iterated has been rewritten to provide unified interface based on metatable inheritance. The lapis.application.route_group module has been added to work with this interface.

Misc

  • Substantial updates to documentation, including rewrites for clarify and documenting fields that were previously not documented.
  • Changes to the homepage to prioritize Lua syntax over MoonScript to reduce confusion about what & who the framework is for

Full Changelog: v1.10.0...v1.11.0