HTTP and OpenResty
- Added
lapis.nginx.resty_http, an HTTP client backed bylua-resty-http. lapis.nginx.httpnow automatically uses thelua-resty-httpimplementation from timer phase callbacks, wherengx.location.captureis unavailable.- Added documentation for HTTPS certificate verification for both the proxy-pass HTTP client and the new
lua-resty-httpclient. - The two-argument
http.request(url, body)shorthand now setsContent-Lengthwhen using thelua-resty-httppath.
Models and Database
-
include_innow supports computed key functions returningdb.list(...), allowing a single source object to match multiple related rows.Tags\include_in pages, { name: (page) -> db.list page\get_tag_names! }, many: true, as: "tags"
-
include_inpreserves transformed values from thevalueoption when assigning results for computeddb.listkeys.Tags\include_in pages, { id: (page) -> db.list page.tag_ids }, many: true, as: "tag_names", value: (tag) -> tag.name
-
Polymorphic
belongs_topreloading now forwards preload options, such asskip_included, to the underlying model preload calls.preload items, object: { [preload]: { skip_included: true } }
-
Added
db.clause + db.clausesyntax for combining clauses withOR.active = db.clause status: "active" invited = db.clause invite_pending: true Users\select "where ?", active + invited
-
json_encodablenow preserves table metatables, includingcjson.array_mt, so empty JSON arrays remain arrays.util.to_json { items: setmetatable {}, cjson.array_mt } -- {"items":[]}
-
OrderedPaginator:each_page(...)now accepts an initial cursor.pager = Posts\paginated "order by id asc", per_page: 50, ordered: "id" for posts in pager\each_page 500 -- starts after id 500
Testing
- Added
simulate_requestandsimulate_actionas clearer names for request simulation helpers. The oldmock_requestandmock_actionnames remain as deprecated aliases. stub_requestnow sets up request params, GET/POST tables, session, cookies, headers, request method, URL fields, and custom request classes more completely.- Request simulation now uses higher-resolution time from LuaSocket.
Application and Flows
- Requests now expose
route_patternin addition toroute_name. - Renamed
is_flowtois_flow_classto clarify that the helper checks flow classes, not flow instances. - Expanded and reorganized the flow documentation.
CLI
- Third-party command modules can now be resolved directly as top-level commands, so packages no longer need to rely on the generic
_command path. - Added a shortcut action for
lapis-exceptions. - Command discovery now checks module availability without requiring the module, avoiding swallowed load-time errors.
Documentation
- Reworked the testing documentation around request simulation and
stub_request. - Added documentation for computed
db.listkeys in model preloading. - Updated utility, flow, and exception handling documentation.