387 Commits

Author SHA1 Message Date
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
bobf
be3ca8d5cb
Merge pull request #112 from jetzig-framework/fix-default-migration
Update JetQuery - fix default migration
2024-11-16 12:58:53 +00:00
Bob Farrell
2761d7b132 Update JetQuery - fix default migration 2024-11-16 12:42:41 +00:00
Bob Farrell
ef80b43279 Move CI badge above logo in README 2024-11-14 21:41:30 +00:00
Bob Farrell
d82178397f Add CI build badge to README 2024-11-14 21:41:06 +00:00
Bob Farrell
5b285df07b Add new to view generator 2024-11-14 21:36:45 +00:00
Bob Farrell
3ca7ade6a6 Update CLI JetQuery version 2024-11-14 20:22:33 +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
bobf
7e973bbc3b
Merge pull request #111 from jetzig-framework/github-actions-upload-artifact-v4
GH actions fixes
2024-11-14 19:01:24 +00:00
Bob Farrell
b1dc086afb GH actions fixes
Fix `/.json` root path detection
2024-11-14 18:54:26 +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
c8ae44b508 Accept password at command line for auth user create
Intended for local development only
2024-11-13 20:35:50 +00:00
Bob Farrell
f9c6f9f38f Fix memory leak in auth CLI command 2024-11-13 20:15:24 +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
bed91b2131 Fix development logger colors on Windows 2024-11-12 08:52:32 +00:00
Bob Farrell
e4da5bc9c8 Fix broken type detection in database setup 2024-11-12 08:21:51 +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
d219a3ce83 Fix environment for bundle command 2024-11-10 22:24:27 +00:00
Bob Farrell
bd577cc4c2 Fix jetquery dependency for CLI 2024-11-10 21:18:03 +00:00
Bob Farrell
88e9136075 Update JetQuery 2024-11-10 21:09:44 +00:00