Releases: leafo/lapis
Releases · leafo/lapis
v1.8.2
Additions
db.delete
can take additional arguments forRETURNING
,Model\delete
method also supports additional arguments to control returning clauseget_X_paginated
model relation method now supports passingwhere
andorder
options to the paginator constructor
Fixes
- Using
order
andgroup
at the same time withModel\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
, thetest
environment is set as the default environment any tests are run. It is not longer necessary to have asetup
oruse_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 tolapis.environment
module, addedset_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
- Test suites run across on all versions of Lua on GitHub actions
- Added docs for how request parameters are parsed and merged
- Added docs for how the default environment works
- Fixed bug in docs generator where code snippets were not appearing
- The
--trace
option for thelapis
command is enabled by default when running in test - Fix minor typos in docs
v1.8.0
Deprecations
- The
flip
andlocal_key
used withinclude_in
or any relations are now deprecated. Replacement syntax available in documentation forModel\include_in
Additions
- Add support for a column mapping table when specifying the key for
include_in
and any relations. See more documentation forModel\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 byper_page
- An
ordered
option can be passed toModel\paginated
anget_X_paginated
to create anOrderedPaginator
instead of aOffsetPaginator
- Add
skip_render
action render option to prevent Lapis from writing anything (Suitable for manually writing to output buffer with something likengx.print
) fetch
relations can now specify if they return a collection of items withmany
so nested preloading can traverse the loaded objects- add
serve
alias for thelapis server
command line command - add
app_only
code cache option for cqueues to attempt to load app on every dispatch - A
resty_mysql
object can be included in the MySQL configuration object to provide additional parameters when initializng aresty.mysql
connection - Pgmoon connections will now read the
timeout
field from the PostgreSQL config object (Contributed by turbo 679) - Add
set_logger
andget_logger
functions to thelapis.db.mysql
andlapis.db.postgres
module - (
lapis.db.postgres
)escape_identifier
function will now flattendb.list
objects into raw SQL - (
lapis.db.postgres.schema
)create_index
support aconcurrently
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 witherror
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.html
)classnames
ignores empty strings and will return first argument directly if passed a string - (
lapis.logging
)query
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 formodel\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
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 fromencode_with_secret
anddecode_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 to0.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
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
andlua-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 thepreload
optiondefault_url_params
has been added to request support object for extending the default parameters passed into `url_formatches_pattern
validation can be used to test an input against a Lua patternrelation_is_loaded
function can be used to test if a model has a relation loadedmock_request
can insert a session via a Lua tablelapis.time
module with asleep
function that executes correct implementation for the current backend server- If you use
when
instead ofwhere
when creating an index an error is thrown lapis.spec.request
, themock_request
function supportscookies
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 withluacrypto
- Query logs use luasocket to measure time elapsed for a more accurate measurement
- URL parsing uses
find
andsub
instead ofmatch
to parse very long paths faster (#498) db.NULL
values are always stripped when inserting a new row from a model'screate
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
withluaossl
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.