458 Commits

Author SHA1 Message Date
bobf
475ed26952
Merge pull request #133 from jetzig-framework/jetkv-valkey
Valkey backend for JetKV
2024-12-06 21:36:26 +00:00
Bob Farrell
35adaf3009 Valkey backend for JetKV 2024-12-06 21:31:02 +00:00
Zackary Housend
31f8a4a93c
Merge pull request #131 from z1fire/wip
New custom print function to handle windows unicode
2024-11-30 16:39:22 -05:00
z1fire
be8e517a06 unicode for windows 2024-11-30 16:25:31 -05:00
z1fire
6cabafc63f unicode for windows 2024-11-30 15:31:36 -05:00
z1fire
63cd638149 Merge branch 'wip' of https://github.com/z1fire/jetzig into wip 2024-11-30 15:24:19 -05:00
z1fire
f9d8ef3776 update allow unicode images in windows terminal 2024-11-30 15:13:02 -05:00
Zackary Housend
2f7687a0e5
Merge branch 'jetzig-framework:main' into wip 2024-11-30 14:25:03 -05:00
bobf
7b03850593
Merge pull request #130 from jetzig-framework/per-request-database-connection
Per-request database connection
2024-11-30 12:58:57 +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
z1fire
22badde8c0 Jetzigg init direction update 2024-11-30 07:18:06 -05:00
bobf
e8ce232700
Merge pull request #129 from z1fire/wip
Added imports to mailers
2024-11-29 23:20:01 +00:00
z1fire
50bcda1cbe Added imports to mailers 2024-11-29 17:55:09 -05:00
bobf
ac600326a9
Merge pull request #127 from jetzig-framework/jetquery-optionals-rework
JetQuery optionals rework
2024-11-28 22:39:13 +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
bobf
6dbeed7109
Merge pull request #125 from jetzig-framework/schema-reflection-improvements
Schema reflection improvements
2024-11-27 22:20: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
bobf
a3e3cb6dfe
Merge pull request #124 from jetzig-framework/database-in-jobs
Make database repo available in background jobs
2024-11-27 20:52:08 +00:00
Bob Farrell
1fa6db77df Make database repo available in background jobs 2024-11-27 20:43:35 +00:00
bobf
b4b7251021
Merge pull request #123 from jetzig-framework/jetquery-fix-datetime-coercion
JetQuery: fix datetime coercion
2024-11-26 19:33:17 +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
4e1a26a5f9 Add zUI to related projects
Add Karl as a contributor (pg.zig and http.zig author + a few PRs direct
to Jetzig/JetQuery)
2024-11-24 21:35:42 +00:00
Bob Farrell
6bd0273e2d Fix default production cookie value 2024-11-24 21:14:28 +00:00
bobf
937efd9121
Merge pull request #122 from jetzig-framework/pseudo-http-verbs-and-edit-action
Routing updates
2024-11-24 20:53:48 +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
835885a947
Merge pull request #121 from jetzig-framework/debug-console
Debug console
2024-11-23 20:12:34 +00:00
Bob Farrell
773eb1dc6e Add --debug option to jetzig server
Defaults to true, allow disabling new debug console.
2024-11-23 19:58:52 +00:00
Bob Farrell
9684181c64 Fix middleware render detection 2024-11-23 19:31:37 +00:00
Bob Farrell
1565ae3b73 Debug console
Use `jetzig server` or `zig build -Ddebug_console=true run` to launch a
development server with the debug console enabled.

When an error is encountered a formatted stack trace is dumped to the
browser along with the current response data. Both outputs are
syntax-highlighted using Prism JS.
2024-11-23 18:07:19 +00:00
Bob Farrell
8095bbcb76 Implement request.renderTemplate
Clean up request state.
2024-11-23 13:42:14 +00:00
Bob Farrell
036aec1682 Misc. tidying 2024-11-23 13:14:11 +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
bobf
b1becfd6ec
Merge pull request #119 from karlseguin/update_karl_deps
update pg.zig dep (out of bound fix)
2024-11-21 18:15:22 +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
bobf
d887cd5bd8
Merge pull request #118 from jetzig-framework/deprecate-data-arg
Database CLI improvements
2024-11-19 22:17:47 +00: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
bobf
d054e58fa0
Merge pull request #116 from jetzig-framework/params-helpers
Params helpers
2024-11-17 19:56:09 +00:00
Bob Farrell
78b6938530 Fix custom routes
Fix CLI view generator
2024-11-17 19:32:46 +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
e3ab49fa5a Refactor Route
Move all route types into a single union and remove leftover junk.

Deprecate view functions that receive a `*jetzig.Data` argument (we will
stay backward-compatible until we have a valid reason to drop support
for legacy view functions - the extra code overhead is pretty minimal).
2024-11-17 15:08:54 +00:00
Bob Farrell
49c5c2db26 Update dependencies
Add assertion to verify compatible jetcommon versions between
dependencies.
2024-11-17 12:34:49 +00:00
bobf
c156dbeeaa
Merge pull request #115 from jetzig-framework/fix-database-name-detection
Fix admin database schema detection
2024-11-17 11:01:23 +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
bobf
b8f3020b2d
Merge pull request #114 from jetzig-framework/fix-database-cli-environment-variables-config
Fix database CLI environment variables config
2024-11-16 17:26:46 +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
bobf
3063615e26
Merge pull request #113 from jetzig-framework/fix-database-launch-message
Fix database launch message
2024-11-16 16:14:24 +00:00
Bob Farrell
2cff123de7 Fix database launch message
When an environment variable configures the database name we connect to,
we need to wrap the field access in a comptime check even if the
`orelse` block never runs.
2024-11-16 16:04:16 +00:00