Skip to content

Releases: leafo/lapis

v1.8.2

22 Sep 01:39
Compare
Choose a tag to compare

Additions

  • db.delete can take additional arguments for RETURNINGModel\delete method also supports additional arguments to control returning clause
  • get_X_paginated model relation method now supports passing where and order options to the paginator constructor

Fixes

  • Using order and group at the same time with Model\include_in will no longer generate an invalid query
  • When running lapis command, the environment is immediately loaded when checking what commands are available for the server, fixes #665
  • lapis.nginx.cache can correctly serialize array and boolean types that can result from parameter parsing, fixes 683
  • The substring - is no longer matched by accident for route pattern filters #696

Changes

  • When running in busted, the test environment is set as the default environment any tests are run. It is not longer necessary to have a setup or use_test_env call to configure the environment
  • Default buffer size and timout for parsing multipart form data has been increased to allow for slower connections (4k bytes per 5 seconds)
  • All logging goes stdout when not running in Nginx
  • Compatibility patches for Lua 5.2, 5.3, 5.4
  • Improved error message for some lapis commands when using an incomplete configuration
  • Improved error message when file can not be written when generating app files
  • (Internal) default_environment function moved to lapis.environment module, added set_default_environment function
  • Better error message when trying to use belongs_to with composite key (has_one should be used instead)
  • Better error when trying to use default composite primary key with a has_one relation

Misc

v1.8.0

25 Apr 06:15
Compare
Choose a tag to compare

Deprecations

Additions

  • Add support for a column mapping table when specifying the key for include_in and any relations. See more documentation for Model\include_in
  • Add support for composite foreign keys with include_in and relations
  • each_item method for Paginators that will return a Lua iterator for going over every row but queries in batches set by per_page
  • An ordered option can be passed to Model\paginated an get_X_paginated to create an OrderedPaginator instead of a OffsetPaginator
  • Add skip_render action render option to prevent Lapis from writing anything (Suitable for manually writing to output buffer with something like ngx.print)
  • fetch relations can now specify if they return a collection of items with many so nested preloading can traverse the loaded objects
  • add serve alias for the lapis server command line command
  • add app_only code cache option for cqueues to attempt to load app on every dispatch
  • resty_mysql object can be included in the MySQL configuration object to provide additional parameters when initializng a resty.mysql connection
  • Pgmoon connections will now read the timeout field from the PostgreSQL config object (Contributed by turbo 679)
  • Add set_logger and get_logger functions to the lapis.db.mysql and lapis.db.postgres module
  • (lapis.db.postgresescape_identifier function will now flatten db.list objects into raw SQL
  • (lapis.db.postgres.schemacreate_index support a concurrently option to create index concurrently (Contributed by Michael Ball 659)
  • add test validation for manually specifying a function to test input

Changes

  • assert_error will now fail with error if the error it yielded was not captured and execution attempted to continue
  • initial project templates use content_by_lua_block (Contributed by ryanford 674)
  • each_page method on paginators no longer allocates a coroutine, a plain function iterator is used
  • attempting to preload an object that isn't a class will throw an error
  • attempting to use an invalid order with OrderedPaginator will throw an error
  • measure_performance now works even when outside of nginx when reporting query time
  • (lapis.htmlclassnames ignores empty strings and will return first argument directly if passed a string
  • (lapis.loggingquery log function can now take a prefix and duration
  • Removed undocumented locals action render option

Fixes

  • Fix bug where internal shell_escape function would strip ' characters
  • Returning { json = false } in action render will actually render false as json instead of skipping json render

Documentation

  • Started rewriting how options tables are described in the documentation. Uses a grid layout with collapsing examples.
  • Many parts of Models documentation have been rewritten for clarity
  • Remove outdated references to fields that are deprecated/removed (eg. cmd_url)
  • Add documentation for the timestamp option for model\update
  • Updated colors of site to be blue

Misc

  • Specs now run on GitHub actions with matrix for LuaJIT, OpenResty's LuaJIT, and all versions of Lua
  • We now have a MoonScript Discord, join here: https://discord.gg/Y75ZXrD
  • Fix typo in docs from Chris Tanner 621
  • Fix typo in docs from TangentFoxy 634 685 672

v1.7.0

03 May 18:27
Compare
Choose a tag to compare

Changes

  • Replaced the CSRF implementation, removed the key parameter and replaced with it randomly generated string stored in cookie.
  • Sessions now use the lapis.encoding module to encode an decode. Session loading error messages have changed to include the error from encode_with_secret and decode_with_secret
  • Remove all support for luacrypto, luaossl is required

Additions

  • Add support for chaning HMAC function, add sha256 HMAC config option
  • Support parsing cookies when there are multiple cookie headers
  • Add enum type fro MySQL
  • Add support for encoding NULL and empty arrays for to_json and JSON render
  • Add config template for cqueues/lua-http support
  • Request object for cqueues/lua-http contains all the same fields as OpenResty counterpart
  • Performance object is available for cqueues/lua-http
  • Environment name is shown on server start log
  • Add bind_host config option to set which interface cqueues/lua-http binds to, defaults to 0.0.0.0

Fixes

  • Fix issue with MySQL migrations where query result was not being converted to number
  • Fix a crash when request args could not be parsed
  • Fix a crash when the query parameter type changes when being parsed (between table and literal)
  • json_params works with cqueues/lua-http
  • cqeueus/lua-http test server now works correctly, is now part of CI
  • cqeueus/lua-http will no longer get stuck in infinite loop when port is already taken
  • cqeueus/lua-http will only ready & parse body for form encoded content type
  • Terminal output buffering is disabled for cqeueus/lua-http so service files can read logs from stdout/stderr

Lapis 1.6.0

20 Jul 04:56
Compare
Choose a tag to compare

Additions

  • Add a new general purpose preload function that can preload many relations
    at once for many kinds of model instances, including recursively preloading relations
  • Addition of cqueues and lua-http server backend
  • Pgmoon connection status is logged to performance table for each request when
    performance measurements are enable
  • fetch relations can provide a method for preloading with the preload option
  • default_url_params has been added to request support object for extending the default parameters passed into `url_for
  • matches_pattern validation can be used to test an input against a Lua pattern
  • relation_is_loaded function can be used to test if a model has a relation loaded
  • mock_request can insert a session via a Lua table
  • lapis.time module with a sleep function that executes correct implementation for the current backend server
  • If you use when instead of where when creating an index an error is thrown
  • lapis.spec.request, the mock_request function supports cookies option
  • Add render_to_file method for widgets
  • Add documentation for Flow

Changes

  • Route precedence sorting now uses a score based approach where multiple variables or splats can affect the final order
  • Mocked requests have ngx.md5 implemented with luacrypto
  • Query logs use luasocket to measure time elapsed for a more accurate measurement
  • URL parsing uses find and sub instead of match to parse very long paths faster (#498)
  • db.NULL values are always stripped when inserting a new row from a model's create method
  • Test server can be run even if there isn't a database configured
  • Refactor backend implementation to be extensible to allow for cqueues/lua-http implementation
  • Add support for test server to run on cqueues backend
  • Replace luacrypto with luaossl

Minor changes

  • Lua and MoonScript are added as mime types in default mime.types file (#513)
  • Various improvements to the documentation

Fixes

  • Encoding a query string with a parameter with a boolean value will no longer throw an error
  • Fix issue where *.lua would be included in .gitignore for Lua projects (#501)
  • A user set content type will no longer be overwritten when outputting with the json action return handler
  • Check for Content-Disposition header for file uploads is no longer case sensitive

Note on cqueues/lua-http

With this release we're adding a new server backend for Lapis. Although the
backend is functional, there are some things that aren't available yet.
Database connections are shared across all requests so you have to be careful
about leaving transactions or state open. Additionally, there's no way to spawn
multiple workers. For production environments we still recommend OpenResty.