81 Commits

Author SHA1 Message Date
Bob Farrell
e12b69985b Fix database CLI environment variables config
Use the same environment setup as the main Jetzig app when running
database CLI commands.
2024-11-16 17:16:29 +00:00
Bob Farrell
2761d7b132 Update JetQuery - fix default migration 2024-11-16 12:42:41 +00:00
Bob Farrell
9ebf0d40e6 Fix initial Schema creation
Update JetQuery - `optional` replaces `not_null` and defaults to `false`,
i.e. columns have a `NOT NULL` constraint by default.
2024-11-14 20:18:28 +00:00
Bob Farrell
d9b5f7af63 Update JetQuery - fixes bool coercion 2024-11-14 08:50:21 +00:00
Bob Farrell
4330cc93e9 Update JetQuery, improve migration CLI docstring 2024-11-14 08:31:38 +00:00
Bob Farrell
c5acaedb73 Strip trailing slash on URIs
`/blogs/` is now the same as `/blogs`.

Root path `/` is a special case.
2024-11-13 20:57:25 +00:00
Bob Farrell
2dd2f7ae74 Add null logger
Silence logs completely when `null` logger is active.

Add pool size/timeout environment variable configuration for JetQuery.
2024-11-12 22:20:13 +00:00
Bob Farrell
a6d1b92f5e Simplify DevelopmentLogger, add ProductionLogger
Add auth helper to create a user from CLI:

```
jetzig auth user:create user@example.com
```
2024-11-11 22:25:35 +00:00
Bob Farrell
88e9136075 Update JetQuery 2024-11-10 21:09:44 +00:00
Bob Farrell
d27907a1c5 WIP 2024-11-09 17:13:32 +00:00
Bob Farrell
4210aa5e83 WIP 2024-11-09 17:13:32 +00:00
Bob Farrell
e4e3b400b2 WIP 2024-11-09 17:13:32 +00:00
Bob Farrell
748710f369 WIP
Actions:

+

Motivation:

+
2024-11-09 17:13:32 +00:00
Bob Farrell
55f7bebb9e WIP 2024-11-09 17:13:32 +00:00
Bob Farrell
058a82582a WIP 2024-11-09 17:13:32 +00:00
Bob Farrell
b179007344 WIP 2024-11-09 17:13:25 +00:00
Bob Farrell
1c2cbaca77 WIP 2024-11-09 17:12:49 +00:00
Bob Farrell
bd15e5c43b WIP 2024-11-09 17:12:49 +00:00
Bob Farrell
ab84e23a8b Update Zmpl - more @for loop fixes 2024-11-08 20:43:40 +00:00
Bob Farrell
b3191060a0 Update Zmpl - improved identifier detection 2024-11-08 19:46:11 +00:00
Bob Farrell
94ce83b425 Update Zmpl - @for fixes and partial arg type coercion 2024-11-08 19:42:39 +00:00
Bob Farrell
3861bd8dea Update Zmpl 2024-11-06 08:53:31 +00:00
Bob Farrell
c7b79f144a Fixes for https://github.com/ziglang/zig/pull/21817 2024-11-06 08:44:07 +00:00
IbrahimOuhamou
cea2781391 updated zmpl and added session.remove() thanks to Allah 2024-11-03 11:39:03 +01:00
Bob Farrell
9b2d6274ff Update http.zig
Resolves overflow vuln.
2024-09-27 18:27:22 +01:00
Bob Farrell
dda433bb73 Update Zmpl - adds Data.Object.items() and Data.Array.items()
`Data.Object` now preserves insertion order.
2024-09-07 12:01:40 +01:00
Bob Farrell
bed877b16a Update Zmpl
Misc. improvements to Zmpl from @T-136
2024-09-07 11:01:40 +01:00
Bob Farrell
47f9455060 Update Zmpl
Includes update that allows using arbitrary structs as Data-compatible
values (thanks @T-136 !)
2024-09-02 21:44:03 +01:00
Bob Farrell
af4de258f0 More Type fixes 2024-08-30 19:02:56 +01:00
Bob Farrell
ca049012b6 Update Zmpl - more Type fixes 2024-08-30 19:00:53 +01:00
Bob Farrell
15b0fa1af9 Latest Zig master compatibility 2024-08-30 18:43:12 +01:00
Bob Farrell
e98c5ec3df Update http.zig
Refactor routes generation to standalone exe (fixes some build-time vs.
run-time issues).
2024-08-24 11:18:08 +01:00
Karl Seguin
3f22e03723 Update the smtp_client dependency.
smtp_client was making a wrong local copy of
an internal buffer.

Diff between current version and this updated one.

964152ad4e...48971bc919
2024-08-11 21:14:48 +08:00
Bob Farrell
9971cde875 Close #89: Implement file upload support
Use `request.file("form-field-name")` to try to find a multipart-encoded
form value for the given name. Returns `jetzig.http.File` if a match is
found which provides `content` (uploaded file content) and `filename`
(filename as passed by browser).
2024-06-19 20:47:05 +01:00
Bob Farrell
e30d340a7a Embed static routes in compiled exe
Remove need for static routes output files to be copied/generated in
deployment.
2024-06-08 19:37:41 +01:00
Bob Farrell
a46bc0ed19 Test helpers
Add `jetzig test` command which runs build step `jetzig:test`.

Add `jetzig.testing` namespace which provides test helpers and a test
app.

Add tests to view generator (i.e. include tests for generated routes).
2024-06-03 21:56:32 +01:00
Bob Farrell
b304a3509b Windows compatibility fixes 2024-06-01 18:05:01 +01:00
Bob Farrell
b6b67f8dd6 Use http.zig arena pool 2024-05-26 21:37:48 +01:00
Bob Farrell
80ca764c0f Update Zmpl for template inheritance
Permit setting template during view render with `request.setTemplate()`

Permit middleware to define custom routes to static content with
`pub const Routes` (implemented for something no longer needed but seems
useful anyway).

Implement globbing on custom routes, `/foo/:bar*` will glob all path
segments including and after `/foo/...`, e.g. `/foo/bar/baz/qux` will
pass invoke the custom view function with an array of `bar`, `baz`,
`qux` as first argument (instead of typical resource ID).
2024-05-26 17:20:21 +01:00
Bob Farrell
3b30ab4625 Update build.zig and deps for 0.13 build system 2024-05-21 19:42:56 +01:00
rimuspp
4952cae74d
Fixed zigargs reference
MasterQ32 changed his github name
2024-05-16 18:42:40 -05:00
Bob Farrell
3519483f34 Switch to http.zig
Use Karl Seguin's http.zig as HTTP server backend:
https://github.com/karlseguin/http.zig

Update loggers to use new `jetzig.loggers.LogQueue` to offload logging
to a background thread.

Numerous other optimizations to remove unneeded allocs.

Performance jump on a simple request from approx. 2k requests/second to
approx. 40k requests/second (Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz).

Color support for Windows

Zmpl partial arg type coercion
2024-05-12 21:33:26 +01:00
Bob Farrell
e4bd14e80d Windows SMTP compatibility 2024-05-06 14:55:53 +01:00
Bob Farrell
deb6f9604b Update JetKV - bugfix 2024-05-06 10:43:49 +01:00
Bob Farrell
65edd20092 Allow mailers to modify mail template params
Remove need to add all mail template params to view response data. This
was originally intended functionality but the wrong value was passed to
the `deliver` function, and no `data` argument was given, making it
cumbersome to create new values.
2024-05-05 20:04:57 +01:00
Bob Farrell
b7d750c54f Formalise JetKV interface for store, cache, jobs
Provide configuration for JetKV backend (memory or file allocator).
2024-05-05 12:27:59 +01:00
Bob Farrell
6b940e8a53 0.13 support
Add support for 0.13. For now, we can be compatible with both 0.12 and
0.13. We will drop 0.12 after a while.
2024-04-27 23:03:53 +01:00
Bob Farrell
9d12b5c717 Update Zmpl, adds Markdown mode formatters
Also adds support for `.md.zmpl` templates - root node is Markdown.
2024-04-27 22:22:30 +01:00
Bob Farrell
47c35632b5 Email framework
Create mailers with `jetzig generate mailer <name>`. Mailers define
default values for email fields (e.g. subject, from address, etc.).
Mailers use Zmpl for rendering text/HTML parts.

Send an email from a request with `request.mail()`. Call
`deliver(.background, .{})` on the return value to use the built-in
mail job to send the email asynchronously.

Improve query/HTTP request body param parsing - unescape `+` and `%XX`
characters.
2024-04-21 21:00:03 +01:00
Bob Farrell
0c7a11497f Background jobs
Use in-memory KV store (JetKV) for simple job queue.

Build script generates an array of Zig modules in `src/app/jobs/` and
stores their name + run function (`run(allocator, params, logger)`).

View functions schedule jobs with arbitrary params.

Thread pool spawns a (configurable) number of workers and pops jobs from
the queue, then invokes the appropriate run function.
2024-04-15 18:12:40 +01:00