115 Commits

Author SHA1 Message Date
Bob Farrell
275cc51ece Zmpl partial ZmplValue
Update Zmpl to allow passing `*ZmplValue` as an argument, i.e. this
should work where the ref `foo` is any Zmpl value:

```
@partial($.foo)
```
2025-05-12 17:43:27 +01:00
Bob Farrell
676ec69224 Update Zmpl
Fixes infinite recursion bug/segfault with nested for loops.
2025-05-06 19:09:16 +01:00
Bob Farrell
789f123926 Improve test App requestJob
Detect if provided params are a subset of actual params, provide
informative errors if not.
2025-05-05 13:30:42 +01:00
TheJltres
fdfb740f96
Update jetquery to latest 2025-05-03 23:07:34 +02:00
TheJltres
6f0e731303
Testing seeders 2025-05-01 22:23:39 +02:00
Bob Farrell
4bd9d8b990 Eradicate std.enums.nameCast
Deprecated here: 530228d953
2025-04-19 19:35:55 +01:00
U-Zyn Chua
dc982cf125
Defines minimum supported zig version. 2025-04-15 14:52:47 +08:00
Bob Farrell
c26d563898 Zig 0.15 compatibility
Various dependencies updated after changes to `std.zig.Ast` and
`std.LinkedList` and other things.
2025-04-09 20:08:38 +01:00
Bob Farrell
034ecddfa0 JetQuery: groupBy synthetic columns 2025-03-09 11:38:01 +00:00
Bob Farrell
7eea1e3f0a Minor CLI improvements
Show some progress "..." when running external commands to give the user
a bit of extra feedback while commands run.
2025-03-02 14:14:42 +00:00
Bob Farrell
06674db51f Use fork of zig-args (temporary)
Revert when [this PR](https://github.com/ikskuh/zig-args/pull/67) is
merged.
2025-03-02 13:12:29 +00:00
Bob Farrell
099a2a5349 Use Zig compiler
Default to not using LLVM for application compilation. This gives more
than 2x performance improvement for compilation stage.
2025-03-01 14:33:17 +00:00
Bob Farrell
fb969d9b81 Update JetQuery
Provides "INSERT ... RETURNING" thanks to @Cohors1316
2025-02-15 18:01:28 +00:00
Bob Farrell
ecd66db3dc Fixes for misc. Zig nightly changes
* Removal of std.ArrayList.popOrNull
* Removal of std.mem.page_size
2025-02-13 18:23:04 +00:00
Thomas A. Alvarado Davalos
1ccaa45d34 updated http.zig to newer version, containig fix for 0.14.0-dev.3026+c225b780e 2025-02-03 20:18:12 +01:00
Bob Farrell
a5430ff380 Zig 0.14 test runner config changes
Update dependencies to match new Zig build config API for test runners,
misc. fixes needed after upgrading dependencies.
2025-02-02 11:31:40 +00:00
Bob Farrell
a99999af52 Misc. Zig updates
Changes to latest Zig nightly build required several minor fixes across
multiple dependencies.
2025-01-25 12:22:19 +00:00
Bob Farrell
76f14a89a1 Zig build fixes for latest Zig nightly build 2024-12-22 12:34:11 +00:00
Bob Farrell
35adaf3009 Valkey backend for JetKV 2024-12-06 21:31:02 +00:00
Bob Farrell
9cf6705c88 Per-request database connection
Use JetQuery's new `Repo.bindConnect()` to get a new Repo bound to a
connection for each request. This significantly simplifies connection
management and offloads all the connection pool
management/reconnecting/etc. to pg.zig where it belongs.

Improve development mode SQL syntax highlighting - highlight `SELECT`,
`UPDATE`, `DELETE`, `INSERT` in different bolded colors for clarity.
2024-11-30 12:48:18 +00:00
Bob Farrell
6075708bf4 JetQuery optionals rework
Optionals now supported as param types.
2024-11-28 22:25:39 +00:00
Bob Farrell
54480a7b39 Update JetQuery 2024-11-27 22:39:02 +00:00
Bob Farrell
e27fc06d8c Update JetQuery 2024-11-27 22:32:40 +00:00
Bob Farrell
c91eda51d3 Schema reflection improvements
Reflect foreign keys, fix pk/fk serial type inference, add missing
numeric types.
2024-11-27 22:15:15 +00:00
Bob Farrell
1fa6db77df Make database repo available in background jobs 2024-11-27 20:43:35 +00:00
Bob Farrell
8ffbbbbf6a JetQuery: fix datetime coercion
Fix for coercing datetime values in where/insert/etc. params and
managing optional datetimes in schema.
2024-11-26 19:25:35 +00:00
Bob Farrell
f44a6b33c5 Routing updates
Implement `/foo/1/edit` route/view.

Allow setting HTTP verb by passing e.g. `/_PATCH` as the last segment of
a URL - this allows browsers to submit a `POST` request with a
pseudo-HTTP verb encoded in the URL which Jetzig can translate, i.e.
allowing forms to submit a `PATCH`.
2024-11-24 20:46:56 +00:00
bobf
130a7c81a8
Merge pull request #120 from jetzig-framework/anti-csrf
Closes #108: Anti-CSRF middleware
2024-11-23 12:58:03 +00:00
Bob Farrell
6e6f1bec1b Closes #108: Anti-CSRF middleware
Add to middleware in app's `src/main.zig`:

```zig
pub const jetzig_options = struct {
    pub const middleware: []const type = &.{
        jetzig.middleware.AntiCsrfMiddleware,
    };
};
```

CSRF token available in Zmpl templates:

```
{{context.authenticityToken()}}
```
or render a hidden form element:
```
{{context.authenticityFormElement()}}
```

The following HTML requests are rejected (403 Forbidden) if the
submitted query param does not match the value stored in the encrypted
session (added automatically when the token is generated for a template
value):

* POST
* PUT
* PATCH
* DELETE

JSON requests are not impacted - users should either disable JSON
endpoints or implement a different authentication method to protect
them.
2024-11-23 12:49:49 +00:00
Karl Seguin
7f71d1d6da update pg.zig dep (out of bound fix)
update smtp_client (merged tls PR)
2024-11-21 10:06:09 +08:00
Bob Farrell
92dce21244 Database CLI improvements
Eradication of `data` arg to requests. We no longer need to pass this
value around as we have a) type inference, b) nested object insertion
via `put` and `append`.

Fix `joinPath` numeric type coercion

Detect empty string params and treat them as blank with expectParams()

Fix error logging/stack trace printing.

Update Zmpl - includes debug tokens + error tracing to source template
in debug builds.
2024-11-19 21:39:01 +00:00
Bob Farrell
b95506caf9 Params helpers
Implement `request.expectParams()` to coerce params to a given struct.
`request.paramsInfo()` provides information about each param (present,
blank, failed + original values and errors where applicable).
2024-11-17 19:07:27 +00:00
Bob Farrell
49c5c2db26 Update dependencies
Add assertion to verify compatible jetcommon versions between
dependencies.
2024-11-17 12:34:49 +00:00
Bob Farrell
f3b56e14ea Fix admin database schema detection
Fix missing optional database name type when reading from config
2024-11-17 10:50:03 +00:00
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