@quickback-dev/cli 0.60.9 → 0.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +10 -1
- package/dist/commands/compile.js.map +1 -1
- package/dist/docs/content.d.ts +7 -0
- package/dist/docs/content.d.ts.map +1 -0
- package/dist/docs/content.js +737 -0
- package/dist/docs/content.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/lib/compiler-stubs.d.ts +4 -0
- package/dist/lib/compiler-stubs.d.ts.map +1 -1
- package/dist/lib/compiler-stubs.js +4 -0
- package/dist/lib/compiler-stubs.js.map +1 -1
- package/dist/lib/file-loader.d.ts +11 -0
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +35 -0
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/helpers.d.ts +39 -0
- package/dist/lib/helpers.d.ts.map +1 -0
- package/dist/lib/helpers.js +299 -0
- package/dist/lib/helpers.js.map +1 -0
- package/dist/skill/SKILL.md +3 -0
- package/dist/skill/docs/api/errors.md +1 -0
- package/dist/skill/docs/api/query-params.md +26 -0
- package/dist/skill/docs/changelog/index.md +85 -0
- package/dist/skill/docs/configure/auth.md +17 -12
- package/dist/skill/docs/configure/domains.md +1 -1
- package/dist/skill/docs/configure/index.md +6 -6
- package/dist/skill/docs/define/actions/defining.md +37 -1
- package/dist/skill/docs/define/actions/index.md +18 -0
- package/dist/skill/docs/define/areas.md +90 -7
- package/dist/skill/docs/define/feature.md +88 -27
- package/dist/skill/docs/define/index.md +7 -1
- package/dist/skill/docs/define/scopes.md +1 -1
- package/dist/skill/docs/define/security.md +10 -0
- package/dist/skill/docs/define/transitions.md +11 -35
- package/dist/skill/docs/platform/auth/jwt-optimization.md +15 -3
- package/dist/skill/docs/platform/database/d1.md +6 -1
- package/dist/skill/docs/platform/email/index.md +112 -0
- package/dist/skill/docs/platform/index.md +1 -0
- package/dist/skill/docs/platform/realtime/index.md +17 -0
- package/dist/skill/docs/platform/webhooks/outbound.md +31 -6
- package/dist/skill/docs/start/deploy-browser.md +15 -6
- package/dist/skill/docs/start/first-api.md +16 -0
- package/dist/skill/docs/ui/account/features/admin.md +29 -5
- package/dist/skill/docs/ui/account/features/index.md +22 -0
- package/dist/skill/docs/ui/admin/connecting.md +6 -4
- package/dist/skill/docs/ui/admin/index.md +49 -10
- package/dist/skill/docs/ui/admin/security.md +6 -7
- package/package.json +2 -10
- package/src/skill/SKILL.md +3 -0
- package/src/skill/docs/api/errors.md +1 -0
- package/src/skill/docs/api/query-params.md +26 -0
- package/src/skill/docs/changelog/index.md +85 -0
- package/src/skill/docs/configure/auth.md +17 -12
- package/src/skill/docs/configure/domains.md +1 -1
- package/src/skill/docs/configure/index.md +6 -6
- package/src/skill/docs/define/actions/defining.md +37 -1
- package/src/skill/docs/define/actions/index.md +18 -0
- package/src/skill/docs/define/areas.md +90 -7
- package/src/skill/docs/define/feature.md +88 -27
- package/src/skill/docs/define/index.md +7 -1
- package/src/skill/docs/define/scopes.md +1 -1
- package/src/skill/docs/define/security.md +10 -0
- package/src/skill/docs/define/transitions.md +11 -35
- package/src/skill/docs/platform/auth/jwt-optimization.md +15 -3
- package/src/skill/docs/platform/database/d1.md +6 -1
- package/src/skill/docs/platform/email/index.md +112 -0
- package/src/skill/docs/platform/index.md +1 -0
- package/src/skill/docs/platform/realtime/index.md +17 -0
- package/src/skill/docs/platform/webhooks/outbound.md +31 -6
- package/src/skill/docs/start/deploy-browser.md +15 -6
- package/src/skill/docs/start/first-api.md +16 -0
- package/src/skill/docs/ui/account/features/admin.md +29 -5
- package/src/skill/docs/ui/account/features/index.md +22 -0
- package/src/skill/docs/ui/admin/connecting.md +6 -4
- package/src/skill/docs/ui/admin/index.md +49 -10
- package/src/skill/docs/ui/admin/security.md +6 -7
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Email (Inbound)
|
|
2
|
+
|
|
3
|
+
`defineEmail` is the inbound-mail mirror of [`defineSchedule`](/platform/schedules). Drop a file in `services/email/` and the compiler emits a shared `deliverInboundEmail()` dispatcher. **Execute is provider-agnostic** — you parse RFC 822 bytes and write the store. Ingress is an adapter:
|
|
4
|
+
|
|
5
|
+
| Provider | Ingress | How it reaches `execute` |
|
|
6
|
+
|----------|---------|--------------------------|
|
|
7
|
+
| Cloudflare (`email.provider: 'cloudflare'`, default) | Email Routing → Worker `email()` | Compiler emits `email` on the Worker export. Buffers `message.raw` once, then calls `deliverInboundEmail`. |
|
|
8
|
+
| Amazon SES (`email.provider: 'aws-ses'`) | Receipt rule → S3 + SNS | Build the same `InboundEmailMessage` (`provider: 'ses'`, `raw` = the `.eml` bytes) and call `deliverInboundEmail(message, env)`. |
|
|
9
|
+
|
|
10
|
+
Outbound sending is a separate surface (`email.provider` already switches Cloudflare `send_email` vs AWS SES) — see [Email Configuration](/configure#email-configuration).
|
|
11
|
+
|
|
12
|
+
## Define a handler
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
// services/email/inbound.ts
|
|
16
|
+
import { defineEmail } from "quickback";
|
|
17
|
+
import { ingestMessage } from "../../features/mail/lib/ingest";
|
|
18
|
+
|
|
19
|
+
export default defineEmail({
|
|
20
|
+
name: "inbound", // identifier + audit actor (system:email-<name>)
|
|
21
|
+
to: "paul@kardoe.com", // optional; omit to match every recipient
|
|
22
|
+
description: "Ingest inbound mail",
|
|
23
|
+
execute: async ({ message, db, env, services }) => {
|
|
24
|
+
// message.raw is already-buffered RFC 822 bytes (not a stream).
|
|
25
|
+
await ingestMessage(db, env, services, message.raw);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
One file per handler under `services/email/*.ts`. Files prefixed with `_` are ignored. `name` must be a valid camelCase identifier (it's used as a generated symbol and the audit actor). The same file is what runs on Cloudflare and on SES — do not import `ForwardableEmailMessage` or SES receipt types in `execute`.
|
|
31
|
+
|
|
32
|
+
## Envelope matching
|
|
33
|
+
|
|
34
|
+
| `to` | Behavior |
|
|
35
|
+
|------|----------|
|
|
36
|
+
| omitted | Handler runs for every inbound message |
|
|
37
|
+
| `"user@example.com"` | Exact, case-insensitive match against `message.to` |
|
|
38
|
+
|
|
39
|
+
Multiple handlers can match the same message (a catch-all plus an address-specific handler). Failures are isolated so one throwing handler does not abort the others.
|
|
40
|
+
|
|
41
|
+
If **no** handler matches, the runner logs a warning and returns. It does **not** call Cloudflare `setReject()` — Email Routing can still fall through, and SES has already accepted the message.
|
|
42
|
+
|
|
43
|
+
## Importing feature code
|
|
44
|
+
|
|
45
|
+
Email files live at `quickback/services/email/<name>.ts`, so imports are relative to **that** location. To reach a feature table, a feature `lib/` helper, or `db/`, climb up to the `quickback/` root first (`../../`):
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// quickback/services/email/inbound.ts
|
|
49
|
+
import { messages } from "../../features/mail/messages";
|
|
50
|
+
import { ingestMessage } from "../../features/mail/lib/ingest";
|
|
51
|
+
import { parseRfc822 } from "../../lib/rfc822";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Two `../` — up from `services/email/` to `quickback/`, then down into `features/` (or `lib/`, `db/`). The compiler relocates the handler into the generated `src/lib/email.ts` and **rewrites these paths to resolve from there automatically** — you always write them relative to your own source file, exactly as your editor resolves them.
|
|
55
|
+
|
|
56
|
+
> A single `../features/…` is the common mistake — from `services/email/` that resolves to `services/features/…`, which doesn't exist. Use `../../features/…`.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## What the compiler emits
|
|
60
|
+
|
|
61
|
+
1. **`deliverInboundEmail(message, env)`** in `src/lib/email.ts` — the shared dispatcher.
|
|
62
|
+
2. **`email(cfMessage, env, ctx)`** on the Worker default export — Cloudflare adapter. Regenerated on every `quickback compile`.
|
|
63
|
+
3. **No wrangler inbound binding.** Cloudflare: configure Email Routing in the dashboard. SES: Receipt rule + S3 + SNS; call `deliverInboundEmail` with the fetched `.eml`.
|
|
64
|
+
4. The existing outbound `[[send_email]]` binding (Cloudflare) / SES plugin (aws-ses) is unchanged.
|
|
65
|
+
|
|
66
|
+
## Execute context
|
|
67
|
+
|
|
68
|
+
| Field | Type | Notes |
|
|
69
|
+
|-------|------|-------|
|
|
70
|
+
| `message` | `InboundEmailMessage` | `{ provider, from, to, headers, raw }`. `raw` is `ArrayBuffer`. |
|
|
71
|
+
| `message.provider` | `'cloudflare' \| 'ses'` | Ingress tag for logs. Parse `raw`, don't branch on this. |
|
|
72
|
+
| `db` | Drizzle instance | The same DB the queue/schedule handlers get |
|
|
73
|
+
| `env` | `CloudflareBindings` | All worker bindings |
|
|
74
|
+
| `services` | `Services` | The services layer (`createServices(env)`) |
|
|
75
|
+
| `withInternalContext` | helper | Opt into the `INTERNAL` trust zone for `roles: ['INTERNAL']`-gated rows |
|
|
76
|
+
|
|
77
|
+
Cloudflare-only methods (`setReject`, `forward`, `reply`) are **not** on `InboundEmailMessage`. SES has already accepted the mail; Cloudflare fall-through is the adapter's job (it does not reject unmatched recipients).
|
|
78
|
+
|
|
79
|
+
## Amazon SES inbound
|
|
80
|
+
|
|
81
|
+
SES cannot invoke a Worker `email()` export — receipt is S3 + SNS. After you verify the SNS signature and fetch the object:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { deliverInboundEmail } from "../lib/email";
|
|
85
|
+
|
|
86
|
+
await deliverInboundEmail({
|
|
87
|
+
provider: "ses",
|
|
88
|
+
from: receipt.mail.source,
|
|
89
|
+
to: receipt.receipt.recipients[0],
|
|
90
|
+
headers: new Headers(/* from the .eml or commonHeaders */),
|
|
91
|
+
raw: await s3.getObject(bucket, key).arrayBuffer(),
|
|
92
|
+
}, env);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`execute` does not change. MX, Receipt rules, the S3 bucket, and the SNS subscription stay in AWS — the compiler does not emit those.
|
|
96
|
+
|
|
97
|
+
## Audit & trust
|
|
98
|
+
|
|
99
|
+
Inbound email runs are **server-internal**: there's no authenticated user, no request, no org scope. A delivered message gets a plain `db` (unscoped Drizzle) plus a `withInternalContext` helper:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
execute: async ({ db, withInternalContext, message }) => {
|
|
103
|
+
// `db` here is unscoped — no firewall WHERE, no audit actor.
|
|
104
|
+
|
|
105
|
+
await withInternalContext(async ({ ctx, db, services }) => {
|
|
106
|
+
// ctx.internal = true, ctx.userId = "system:email-<name>"
|
|
107
|
+
// audited writes are attributable to e.g. system:email-inbound
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`withInternalContext` builds a context with `internal: true` and `userId: "system:email-<name>"`, so audited writes made through it are attributable to the handler and can reach `roles: ['INTERNAL']`-gated rows.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
| [Realtime](/platform/realtime) | Durable Objects | WebSocket for live updates |
|
|
12
12
|
| [Queues](/platform/queues) | Cloudflare Queues | Background jobs, webhook delivery |
|
|
13
13
|
| [Schedules](/platform/schedules) | Cron Triggers | `defineSchedule` cron jobs, server-internal |
|
|
14
|
+
| [Email](/platform/email) | Email Workers | `defineEmail` inbound handlers, server-internal |
|
|
14
15
|
| [Vector & AI](/platform/vector) | Workers AI | Embeddings, semantic search |
|
|
15
16
|
| [Webhooks](/platform/webhooks) | Hono + Queues | Signed inbound, retried outbound |
|
|
16
17
|
| [Push](/platform/push) | Web Push | VAPID subscriptions, typed payloads |
|
|
@@ -90,6 +90,23 @@ export default feature("applications", {
|
|
|
90
90
|
> `access.roles` — it still compiles but should be migrated.)
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
Omitting it fails the compile:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
Resource "conversations" enables realtime broadcasts but declares no audience.
|
|
97
|
+
A broadcast fans out to every subscriber in the room, so the audience is not
|
|
98
|
+
optional. Declare realtime.access: { roles: [...] } naming who may receive it
|
|
99
|
+
(use roles: ['PUBLIC'] to broadcast to everyone in the room, deliberately).
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**The audience is a second read surface, and it does not inherit `read.access`.**
|
|
103
|
+
Whatever gates the REST read must gate the broadcast too, or the live channel
|
|
104
|
+
publishes rows the REST route would have withheld — private messages being the
|
|
105
|
+
usual casualty. Copy the read rule across, and where the read is gated by a
|
|
106
|
+
relationship (participants of a conversation, accepted followers), use
|
|
107
|
+
`access: { authzRole: "<relationship-role>" }` here rather than falling back to
|
|
108
|
+
`roles: ["AUTHENTICATED"]`, which reaches every signed-in subscriber.
|
|
109
|
+
|
|
93
110
|
And enable the realtime **transport** in your database config. This is a
|
|
94
111
|
project-level switch that stands up the Broadcaster Durable Object + the
|
|
95
112
|
connection route; it does **not** by itself make any resource broadcast
|
|
@@ -170,13 +170,38 @@ Endpoints are scoped by `userId` or `organizationId`. Users can only manage thei
|
|
|
170
170
|
|
|
171
171
|
### URL Validation (anti-SSRF)
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
The destination policy lives in `src/lib/webhooks/url-policy.ts` and runs at **four** points: on register, on update, and again immediately before **each** test send and **each** queued delivery attempt. Re-checking before every send is the point — a name that was public when it was registered can be re-pointed afterwards.
|
|
174
|
+
|
|
175
|
+
The default policy rejects:
|
|
174
176
|
|
|
175
177
|
- Any scheme other than `https:` (matches Stripe, GitHub, and Slack webhook conventions)
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
178
|
+
- URLs carrying credentials (`https://user:pass@host/`)
|
|
179
|
+
- Loopback, private, and reserved **IPv4** literals: `0/8`, `10/8`, `100.64/10` (CGNAT), `127/8`, `169.254/16` (link-local + cloud metadata), `172.16/12`, `192.0.0/24`, `192.0.2/24`, `192.88.99/24`, `192.168/16`, `198.18/15`, `198.51.100/24`, `203.0.113/24`, `224/4` (multicast), `240/4` (reserved), and the broadcast address — in any notation the URL parser accepts, including octal and decimal
|
|
180
|
+
- The equivalent **IPv6** literals: `::`, `::1`, unique-local `fc00::/7`, link-local `fe80::/10`, site-local `fec0::/10`, multicast `ff00::/8`, documentation `2001:db8::/32` and `3fff::/20`, `2001::/23` (Teredo), `2002::/16` (6to4), `64:ff9b::/96` (NAT64), `100::/64`, and IPv4-mapped forms such as `[::ffff:127.0.0.1]`
|
|
181
|
+
- Internal names: `localhost`, `metadata.goog`, anything ending in `.localhost`, `.local`, `.internal`, or `.home.arpa`, and any single-label host (`http://intranet/`)
|
|
182
|
+
|
|
183
|
+
> **Host names are resolved, not just pattern-matched.** For any name that survives the checks above, the runtime resolves both **A and AAAA** records and rejects the destination if **any** answer is a non-public address. One private record among several public ones is enough to refuse the whole name — that is the case a literal-only check misses.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
Resolution is fail-closed. If the resolver errors, times out, returns a malformed answer, or is unavailable, the destination is **not** contacted:
|
|
187
|
+
|
|
188
|
+
| Outcome | Register / update | Queued delivery |
|
|
189
|
+
|---------|-------------------|-----------------|
|
|
190
|
+
| All answers public | Accepted | Delivered |
|
|
191
|
+
| Any answer non-public | `400` | Terminal failure, no retry |
|
|
192
|
+
| No A/AAAA records (NXDOMAIN) | `400` | Terminal failure, no retry |
|
|
193
|
+
| Resolver error, timeout, or malformed answer | `503` | Failed **attempt**, retried with backoff |
|
|
194
|
+
| Answer larger than 32 records | `503` | Failed **attempt**, retried with backoff |
|
|
195
|
+
|
|
196
|
+
DNS is always resolved through a fixed trusted resolver — an endpoint never gets to nominate who answers for it. An answer of more than 32 records is refused rather than truncated: silently cutting the list would let a zone owner pad it with public records and hide a private one past the cut.
|
|
197
|
+
|
|
198
|
+
> **A resolver outage fails deliveries permanently, and it fails them all at once.** The three retries above elapse in seconds, so a DNS outage lasting longer than that exhausts them and marks every in-flight delivery `failed` — across every endpoint and every project on the same resolver. There is no outbound replay endpoint (`/webhooks/v1/inbound/events/:id/retry` covers inbound events only), so those deliveries are not recoverable; the source event has to be re-emitted.
|
|
199
|
+
>
|
|
200
|
+
> This is the deliberate cost of fail-closed: the runtime will not contact a destination it could not verify. It also means outbound webhook failures are **correlated** — a shared dependency, not independent per-endpoint faults. Alert on a spike in `failed` deliveries rather than on any single endpoint.
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
> **This validates the DNS answer, not the socket.** It is not connection pinning, so a deployment that attaches private egress (a VPC, a tunnel, a service binding) must **also** enforce a network-layer egress policy. Application-level DNS validation cannot close the gap between the answer it checked and the address the runtime later connects to.
|
|
204
|
+
|
|
180
205
|
|
|
181
206
|
Plaintext `http:` is rejected by default. To allow `http:` (e.g. for a self-hosted dev environment without TLS), set `webhookAllowInsecure: true` on the database provider config:
|
|
182
207
|
|
|
@@ -193,7 +218,7 @@ providers: {
|
|
|
193
218
|
}
|
|
194
219
|
```
|
|
195
220
|
|
|
196
|
-
|
|
221
|
+
`webhookAllowInsecure` relaxes the **scheme and nothing else**. Every address rule above — including DNS resolution and the fail-closed behaviour — still applies when the flag is on. There is no configuration that permits a private destination.
|
|
197
222
|
|
|
198
223
|
### Redirect Handling
|
|
199
224
|
|
|
@@ -69,7 +69,12 @@ Blocked, fail-closed at the compile phase — the deploy stops with the reason,
|
|
|
69
69
|
|
|
70
70
|
## Connecting your Cloudflare account
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
Deploying takes two distinct grants, and the card labels them differently on purpose:
|
|
73
|
+
|
|
74
|
+
- **Continue with Cloudflare** signs you in to Quickback. Identity only — none of the deploy permissions below.
|
|
75
|
+
- **Grant deploy access** gives Quickback permission to deploy into your Cloudflare account — a standard OAuth consent against Cloudflare's own dashboard, shown by the **Quickback** OAuth client. You pick the account, see exactly which permissions are requested, and can revoke at any time from Cloudflare under **My Profile → Access Management → Connected Applications** (or disconnect from Start).
|
|
76
|
+
|
|
77
|
+
One click covers both: if you weren't signed in yet, sign-in chains straight into the deploy consent. First-time users see two Cloudflare screens back to back; after that, Cloudflare skips consent screens it has already approved, so re-authenticating is a ribbon of silent redirects.
|
|
73
78
|
|
|
74
79
|
What's requested, and why:
|
|
75
80
|
|
|
@@ -85,7 +90,7 @@ What's requested, and why:
|
|
|
85
90
|
|
|
86
91
|
Nothing broader is requested — no zone, DNS, billing, or account-management access.
|
|
87
92
|
|
|
88
|
-
If you cancel at Cloudflare's consent screen — or Cloudflare ends the attempt for any other reason — you land back in Start with the card explaining what happened and a **Try
|
|
93
|
+
If you cancel at Cloudflare's consent screen — or Cloudflare ends the attempt for any other reason — you land back in Start with the card explaining what happened and a **Try again** button. Nothing is stored on a cancelled attempt, and a connection you already had is left untouched.
|
|
89
94
|
|
|
90
95
|
## Connection states and recovery
|
|
91
96
|
|
|
@@ -93,10 +98,10 @@ The deploy card is the whole connection UI: it reports the state of your Cloudfl
|
|
|
93
98
|
|
|
94
99
|
| What you see | What happened | What to do |
|
|
95
100
|
|---|---|---|
|
|
96
|
-
|
|
|
101
|
+
| "Grant Quickback permission to deploy…" | Signed in, but no deploy permission stored yet | **Grant deploy access** |
|
|
97
102
|
| Masked email badge, green | Connected and healthy | Deploy |
|
|
98
|
-
|
|
|
99
|
-
|
|
|
103
|
+
| Badge turns amber, "· reconnect" | Grant revoked in Cloudflare, or the connection was deleted (plain expiry never surfaces — tokens refresh server-side) | **Reconnect Cloudflare** — one consent, same connection record |
|
|
104
|
+
| "…also linked to a different Quickback login" | This Cloudflare account is connected under another Quickback account too — apps deployed there are listed there, not here | Nothing, unless an app you expected is missing: sign in with the Quickback account you deployed it from |
|
|
100
105
|
| "This Cloudflare connection can't …" | The grant is missing a permission a deploy needs (an older connection, or a scope your OAuth client didn't allow) | **Reconnect Cloudflare** to grant the rest |
|
|
101
106
|
| "This Cloudflare login isn't a member of any account" | The identity you connected belongs to no Cloudflare account | Create or join an account in the Cloudflare dashboard, then reconnect |
|
|
102
107
|
| "Couldn't reach the deploy service…" | Transient failure talking to Quickback or Cloudflare | **Try again** |
|
|
@@ -114,6 +119,8 @@ Deploy is disabled while a reconnect is pending, so a deploy never starts on a c
|
|
|
114
119
|
|
|
115
120
|
Connect a second Cloudflare login with **Connect another** and the card grows a login picker above the account picker. Start remembers which one you deployed with last and preselects it.
|
|
116
121
|
|
|
122
|
+
To make every Cloudflare login land on the **same** Quickback account (rather than each minting its own), link them under **Connected accounts** in the [Account UI](/ui/account) — after that, "Continue with Cloudflare" signs you in to that one account no matter which Cloudflare identity your dashboard is holding.
|
|
123
|
+
|
|
117
124
|
### Disconnecting vs. revoking
|
|
118
125
|
|
|
119
126
|
Two different things, and you usually want both:
|
|
@@ -129,7 +136,9 @@ The OAuth token never reaches your browser, the chat model, or the compiler. It
|
|
|
129
136
|
- bound to its connection record (the ciphertext is unusable if copied elsewhere);
|
|
130
137
|
- decrypted only inside the API calls of an active deploy, then discarded.
|
|
131
138
|
|
|
132
|
-
|
|
139
|
+
The grant is standing permission carried by short-lived credentials. The token that can actually touch your account expires every hour; the deploy service refreshes it server-side, so expiry never reaches you as a prompt — a leaked working token goes stale within the hour either way. What persists is the sealed refresh token, which can only mint the next short-lived token.
|
|
140
|
+
|
|
141
|
+
Revoking in Cloudflare (**My Profile → Access Management → Connected Applications**) kills the whole chain immediately — the stored ciphertext becomes useless, and the card turns the next failed call into a reconnect prompt. See [Connection states and recovery](#connection-states-and-recovery) for the full set.
|
|
133
142
|
|
|
134
143
|
## Secrets on the deployed app
|
|
135
144
|
|
|
@@ -436,3 +436,19 @@ POST /candidates
|
|
|
436
436
|
3. **All layers work together** - Firewall -> Access -> Guards -> Masking
|
|
437
437
|
4. **Code is readable and auditable** - no magic, just TypeScript
|
|
438
438
|
5. **Type-safe from definition to API** - Drizzle schema drives everything
|
|
439
|
+
|
|
440
|
+
## Keep going in the same file
|
|
441
|
+
|
|
442
|
+
Everything above is one config object, and it takes more keys than security and
|
|
443
|
+
CRUD. Each adds a real endpoint on the same pipeline, so reach for these before
|
|
444
|
+
writing a custom action:
|
|
445
|
+
|
|
446
|
+
- [`transitions`](/define/transitions) — a guarded state change (`publish`,
|
|
447
|
+
`approve`, `checkIn`) generated as `POST /candidates/:id/{name}`
|
|
448
|
+
- [`realtime`](/platform/realtime/using-realtime) — broadcast inserts, updates,
|
|
449
|
+
and deletes to subscribed clients
|
|
450
|
+
- [`triggers`](/define/triggers) — run a data rule or side-effect on every write
|
|
451
|
+
- [`owns`](/define/changesets) — write a parent row and its children atomically
|
|
452
|
+
|
|
453
|
+
The `views` you already declared are the same idea: a whole endpoint from a few
|
|
454
|
+
lines. See [the full option list](/define#other-resource-options).
|
|
@@ -22,25 +22,49 @@ When `auth.admin` is `false` (the default), the admin surface does not exist for
|
|
|
22
22
|
|
|
23
23
|
## What It Can Do
|
|
24
24
|
|
|
25
|
+
**Users** — every account in the app, independent of organization:
|
|
26
|
+
|
|
25
27
|
- **View all users** — Paginated list with search
|
|
26
28
|
- **Create users** — Manually create accounts with email/password
|
|
27
29
|
- **Ban/unban users** — Suspend or reactivate user accounts
|
|
28
30
|
- **Reset passwords** — Generate password reset for any user
|
|
29
31
|
- **View sessions** — See active sessions for any user
|
|
30
32
|
|
|
33
|
+
**Organizations** — every tenant, whether or not you belong to it:
|
|
34
|
+
|
|
35
|
+
- **List all organizations** — cross-tenant, not just your memberships
|
|
36
|
+
- **Create an organization** — you name the **owner**; the operator creating it is deliberately not seated (see below)
|
|
37
|
+
- **Seat, re-role and remove members** — manage a tenant's roster without joining it
|
|
38
|
+
|
|
39
|
+
These run on `/auth/v1/admin/*`, emitted by Quickback because Better Auth's organization plugin cannot serve them: every one of its endpoints resolves through the *caller's* membership, and an operator administers organizations it does not belong to.
|
|
40
|
+
|
|
41
|
+
> **Users sign themselves up.** Self-serve signup stays on — a new account simply has no organization, and lands on a screen saying so until someone invites or seats them. What operators control is *organizations*, not accounts.
|
|
42
|
+
|
|
43
|
+
|
|
31
44
|
## Access Control
|
|
32
45
|
|
|
33
|
-
The admin panel is restricted to
|
|
46
|
+
The admin panel is restricted to platform roles on the Better Auth user record: **`appmanager`** (the control plane) and **`sysadmin`** (which adds cross-tenant data access on top). Everyone else is redirected away from `/admin`.
|
|
34
47
|
|
|
35
|
-
|
|
48
|
+
> **`role: "admin"` is not a platform role.** The compiler seeds the admin plugin with `adminRoles: ["appmanager", "sysadmin"]`, so a user set to `"admin"` passed the UI guard and then got `403` from every admin API call — an operator who looked promoted and could not act. Removed in v0.62; migrate those rows to `"appmanager"`.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
To grant operator access to a user:
|
|
36
52
|
|
|
37
53
|
```bash
|
|
38
54
|
curl -X POST https://api.example.com/auth/v1/admin/set-role \
|
|
39
55
|
-H "Authorization: Bearer $TOKEN" \
|
|
40
56
|
-H "Content-Type: application/json" \
|
|
41
|
-
-d '{ "userId": "user_123", "role": "
|
|
57
|
+
-d '{ "userId": "user_123", "role": "appmanager" }'
|
|
42
58
|
```
|
|
43
59
|
|
|
60
|
+
### Why creating an organization names an owner
|
|
61
|
+
|
|
62
|
+
Better Auth's `organization.create` seats whoever calls it. For an operator that is an escalation rather than a convenience: the membership it grants is tenant-data access — under `cms.access: "member"`, access to that organization's records — which is exactly what the `appmanager`/`sysadmin` split withholds.
|
|
63
|
+
|
|
64
|
+
So organization creation asks for an `ownerUserId`, seats that user, and never seats the caller. Self-serve creation (`POST /auth/v1/organization/create`) is closed by default for the same reason; a project that wants it sets `plugins.organization.allowUserToCreateOrganization: true`.
|
|
65
|
+
|
|
66
|
+
An operator who genuinely wants their own organization creates one naming themselves as owner — explicit, and visible in the audit trail rather than implied by whoever happened to make the call.
|
|
67
|
+
|
|
44
68
|
## Custom Admin Domain
|
|
45
69
|
|
|
46
70
|
Give the admin panel its own subdomain with `adminDomain`:
|
|
@@ -64,10 +88,10 @@ The admin domain serves the same Account SPA at root (`/`). The SPA's client-sid
|
|
|
64
88
|
When both CMS and Account UI are enabled, the admin panel's profile page shows a "Go to CMS" button. You can restrict this to admin users only:
|
|
65
89
|
|
|
66
90
|
```typescript
|
|
67
|
-
cms: { domain: "cms.example.com", access: "
|
|
91
|
+
cms: { domain: "cms.example.com", access: "sysadmin" },
|
|
68
92
|
```
|
|
69
93
|
|
|
70
|
-
With `access: "
|
|
94
|
+
With `access: "sysadmin"`, only the cross-tenant `sysadmin` tier reaches the CMS: the link is hidden in Account UI, `/api/v1/schema` returns `403`, and `custom_view` CRUD is locked to `userRole: ["sysadmin"]`. Note that an **appmanager does not get in** — `/account/admin` (this page) is the appmanager's surface, and the CMS is not. See [CMS access gate](/ui/admin#access-gate) for the full model.
|
|
71
95
|
|
|
72
96
|
## Related
|
|
73
97
|
|
|
@@ -179,6 +179,28 @@ VITE_ENABLE_GOOGLE_OAUTH=false # default: false
|
|
|
179
179
|
**Requirements:**
|
|
180
180
|
- Google OAuth credentials configured on the Better Auth side
|
|
181
181
|
|
|
182
|
+
### Cloudflare OAuth
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
VITE_ENABLE_CLOUDFLARE_OAUTH=false # default: false
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**When enabled:**
|
|
189
|
+
- "Continue with Cloudflare" button on the login and signup pages
|
|
190
|
+
- Cloudflare rows in the profile page's Connected Accounts card — unlike
|
|
191
|
+
Google, more than one Cloudflare identity can be linked to the same user
|
|
192
|
+
(**Connect another Cloudflare account**), and every linked identity signs
|
|
193
|
+
in to this user. Link work and personal Cloudflare logins here so each one
|
|
194
|
+
doesn't mint its own separate account.
|
|
195
|
+
|
|
196
|
+
**When disabled:**
|
|
197
|
+
- No Cloudflare sign-in button, no Connected Accounts rows
|
|
198
|
+
|
|
199
|
+
**Requirements:**
|
|
200
|
+
- `socialProviders.cloudflare.enabled` in the auth config (Cloudflare rides
|
|
201
|
+
the genericOAuth plugin, not a Better Auth built-in) and the
|
|
202
|
+
`AUTH_CLOUDFLARE_CLIENT_ID` / `AUTH_CLOUDFLARE_CLIENT_SECRET` secrets
|
|
203
|
+
|
|
182
204
|
## Account Management Features
|
|
183
205
|
|
|
184
206
|
### File Uploads
|
|
@@ -136,22 +136,24 @@ cms: { domain: "cms.example.com" }
|
|
|
136
136
|
|
|
137
137
|
This adds a custom domain route to `wrangler.toml`. Both `api.example.com` and `cms.example.com` point to the same Worker. The compiler auto-configures hostname-based routing and cross-subdomain cookies.
|
|
138
138
|
|
|
139
|
-
CMS access defaults to `access: "
|
|
139
|
+
CMS access defaults to `access: "sysadmin"` — only `user.role === "sysadmin"` (the cross-tenant data-plane tier) can use `/cms/*`. Set `access: "member"` to also admit anyone holding an organization membership. `user.role === "appmanager"` opens the CMS in neither mode: it is the control-plane tier and belongs at `/account/admin`. The gate is enforced at multiple layers:
|
|
140
140
|
|
|
141
141
|
- **Account UI** hides the "Go to CMS" button for callers outside those roles.
|
|
142
142
|
- **CMS SPA shell** — the Worker returns `403` (or redirects unauthenticated requests to login) before serving `index.html` to a non-operator. A non-operator who types the CMS URL directly cannot load the app.
|
|
143
143
|
- **`/api/v1/schema`** returns `403 Platform operator access required` to callers outside those roles, so schema metadata can't be scraped by hitting the API directly.
|
|
144
144
|
- **`custom_view` routes** are gated on `userRole: ["appmanager"]` rather than org membership, so saved views can't be listed or modified without platform-control-plane rights.
|
|
145
|
-
- **In-SPA
|
|
145
|
+
- **In-SPA screen** — a signed-in caller who isn't admitted is served the shell and shown a screen naming what they'd need. There is no wrong-role redirect.
|
|
146
146
|
|
|
147
147
|
Your resource API endpoints (the ones generated for your features) are unaffected — they continue to use the per-resource `read`, `create`, `update`, `delete`, and `upsert` access rules you defined.
|
|
148
148
|
|
|
149
|
-
To
|
|
149
|
+
To let organization members in as well as sysadmins:
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
|
-
cms: { access: "
|
|
152
|
+
cms: { access: "member" }
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
See [Access gate](/ui/admin#access-gate) for the full model — including why `appmanager` opens the CMS in neither mode.
|
|
156
|
+
|
|
155
157
|
See [Multi-Domain Architecture](/configure/domains) for details on multi-domain routing.
|
|
156
158
|
|
|
157
159
|
## Default Org Mode vs Pinned Organization Mode
|
|
@@ -112,22 +112,61 @@ cms: { domain: "cms.example.com" }
|
|
|
112
112
|
|
|
113
113
|
This adds a custom domain route to `wrangler.toml`. Both domains serve the same Worker — `api.example.com` for the API, `cms.example.com` for the CMS. The compiler also auto-infers a unified `quickback.example.com` domain where everything is available. See [Multi-Domain Architecture](/configure/domains).
|
|
114
114
|
|
|
115
|
-
### Access gate
|
|
115
|
+
### Access gate
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
`cms.access` answers one question: **can anyone in the organization hierarchy use the CMS, or only a platform sysadmin?**
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
| Value | Who gets in |
|
|
120
|
+
|-------|-------------|
|
|
121
|
+
| `"sysadmin"` (default) | Only `user.role === "sysadmin"` — the cross-tenant data-plane tier. They choose a tenant from the org picker. |
|
|
122
|
+
| `"member"` | The above, **plus** any caller holding a membership in an organization, scoped to that organization. |
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
cms: { access: "member" } // let organization members in
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **`user.role === "appmanager"` does not open the CMS in either mode.** appmanager is the *control plane* — users, organizations, and subscriptions at [`/account/admin`](/ui/account) — and deliberately holds no tenant-data powers. Keeping those separable is the entire point of the appmanager/sysadmin split. An appmanager who is also a member of an organization gets in as that member, on the membership, not on the platform role.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
#### Where the gate actually lives
|
|
132
|
+
|
|
133
|
+
The CMS **shell** is served to any signed-in caller. Authorization is decided in the SPA, which renders a screen naming the caller's state and what to do about it — a signed-in user who can't get in is told why, instead of being silently bounced.
|
|
134
|
+
|
|
135
|
+
That is a deliberate trade: the old gate answered a wrong-role caller with a `302` so it couldn't be used to probe roles. The shell is a generic prebuilt bundle with no project data in it, and being unable to distinguish a permissions problem from a broken deploy cost more than the deniability was worth.
|
|
136
|
+
|
|
137
|
+
The gates that carry real data:
|
|
138
|
+
|
|
139
|
+
1. **`/api/v1/schema`** — the metadata endpoint. Admits `sysadmin`, plus any caller with a membership when `access: "member"`. Otherwise `403` with `CMS_ACCESS_DENIED` and a hint naming the requirement. Without the registry there is no CMS.
|
|
140
|
+
2. **`custom_view` routes** — saved views follow whoever is admitted: the `sysadmin` tier in `"sysadmin"` mode, org membership *or* sysadmin in `"member"` mode.
|
|
141
|
+
3. **Account UI link** — the "Go to CMS" button is hidden for callers who wouldn't get in.
|
|
123
142
|
|
|
124
143
|
Your resource API endpoints (`/api/v1/<resource>`) are **not** affected — they continue to use the per-resource `read`, `create`, `update`, `delete`, and `upsert` access rules you defined.
|
|
125
144
|
|
|
126
|
-
|
|
145
|
+
> **Breaking in v0.62.** `cms.access` was renamed from `"admin" | "user"`, and both old values meant something different: `"admin"` admitted `appmanager`, and `"user"` admitted *any* authenticated caller — including one belonging to no organization, who then reached a CMS with nothing in it. The old spellings are rejected at compile time rather than aliased, because aliasing would preserve the old behaviour under a familiar name. Migrate `"admin"` → `"sysadmin"`, `"user"` → `"member"`.
|
|
127
146
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
147
|
+
|
|
148
|
+
#### What a blocked caller actually sees
|
|
149
|
+
|
|
150
|
+
The shell is served to any signed-in caller, and the SPA resolves one of six states — each its own screen naming what is true and what to do next. Nothing redirects: a signed-in user bounced elsewhere cannot tell a permissions problem from a broken deploy.
|
|
151
|
+
|
|
152
|
+
| State | Screen |
|
|
153
|
+
|-------|--------|
|
|
154
|
+
| Not signed in | Redirect to sign-in (the one redirect that remains — it is where you were going anyway) |
|
|
155
|
+
| `sysadmin`, no tenant chosen | Tenant picker, filterable, with **All organizations** as a first-class choice |
|
|
156
|
+
| `sysadmin`, tenant chosen | The CMS, scoped to that tenant |
|
|
157
|
+
| `appmanager`, `access: "sysadmin"` | *"The CMS shows organization data"* → **Go to admin** |
|
|
158
|
+
| Anyone else, `access: "sysadmin"` | *"This CMS is restricted"* — names the config value that would admit them |
|
|
159
|
+
| `access: "member"`, no membership | *"You're not in any organization yet"* → **View invitations** (an appmanager gets **Go to admin** instead — telling them to ask an admin for an invite when they are the admin is a dead end) |
|
|
160
|
+
| `access: "member"`, one membership | Auto-selected; straight in |
|
|
161
|
+
| `access: "member"`, several | Membership picker |
|
|
162
|
+
|
|
163
|
+
The decision is a pure function (`resolveCmsAccess`), so the table above is tested rather than described.
|
|
164
|
+
|
|
165
|
+
Sysadmin scope lives in the browser and rides every request as `?organizationId=` — it is not part of the session, because a sysadmin holds no membership row for Better Auth to make active. Change it from the sidebar.
|
|
166
|
+
|
|
167
|
+
#### `access: "sysadmin"` without `cms.sysadmin`
|
|
168
|
+
|
|
169
|
+
A sysadmin can still pin a single tenant — `?organizationId=` cross-tenant addressing is admitted for sysadmins unconditionally. The **"All organizations"** unfiltered view is what needs the firewall escape that `cms.sysadmin: true` emits.
|
|
131
170
|
|
|
132
171
|
### Optional: Skip SPA rebuild
|
|
133
172
|
|
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The CMS respects all four Quickback security layers. Every UI element — buttons, form fields, table columns, action menus — adapts based on the current user's role and the security rules defined in your feature files.
|
|
4
4
|
|
|
5
|
-
## CMS Access
|
|
5
|
+
## CMS Access
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`cms.access` decides whether the CMS is for platform sysadmins only (`"sysadmin"`, the default) or for organization members too (`"member"`). `user.role === "appmanager"` opens it in neither mode — that tier is the control plane, not the data plane.
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
cms: { access: "
|
|
10
|
+
cms: { access: "member" }
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The shell is served to any signed-in caller so the SPA can explain who is and isn't admitted; the gates that carry data are:
|
|
14
14
|
|
|
15
|
-
1. **Account UI** — the "Go to CMS" button is hidden.
|
|
16
|
-
2.
|
|
17
|
-
3. **`/api/v1/schema`** — the CMS metadata endpoint returns `403` to callers outside those roles.
|
|
15
|
+
1. **Account UI** — the "Go to CMS" button is hidden for callers who wouldn't get in.
|
|
16
|
+
2. **`/api/v1/schema`** — the metadata endpoint returns `403` with `CMS_ACCESS_DENIED` and a hint naming the requirement. Without the registry there is no CMS.
|
|
18
17
|
4. **`custom_view` routes** — the CMS-internal saved-views table uses `userRole: ["appmanager"]` (and, when `cms.sysadmin: true`, also admits `sysadmin`), so saved views can't be read or modified from outside the CMS by non-operator accounts.
|
|
19
18
|
5. **In-SPA gate** — if any earlier layer is bypassed, the SPA still redirects the user to `/account/profile`.
|
|
20
19
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quickback-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.1",
|
|
4
4
|
"description": "CLI for Quickback — define your backend in TypeScript, compile to a fully wired Cloudflare Worker (or Bun / Node) with auth, database, migrations, security, CMS, and Account UI.",
|
|
5
5
|
"author": "Kardoe Incorporated <paul@kardoe.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://docs.quickback.dev/
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/paulstenhouse/quickback-compiler.git",
|
|
11
|
-
"directory": "packages/cli"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/paulstenhouse/quickback-compiler/issues"
|
|
15
|
-
},
|
|
7
|
+
"homepage": "https://docs.quickback.dev/tooling/cli",
|
|
16
8
|
"keywords": [
|
|
17
9
|
"quickback",
|
|
18
10
|
"cli",
|
package/src/skill/SKILL.md
CHANGED
|
@@ -29,6 +29,8 @@ Everything you need around the compiled API for a complete Supabase alternative
|
|
|
29
29
|
| **Storage** | KV (sessions, cache) and R2 (files) | Cloudflare KV + R2 |
|
|
30
30
|
| **Realtime** | WebSocket for live updates | Durable Objects |
|
|
31
31
|
| **Queues** | Background jobs, webhook delivery | Cloudflare Queues |
|
|
32
|
+
| **Schedules** | Cron jobs via `defineSchedule` | Cron Triggers |
|
|
33
|
+
| **Email** | Inbound handlers via `defineEmail` | Email Workers |
|
|
32
34
|
| **Vector & AI** | Embeddings, semantic search | Workers AI |
|
|
33
35
|
| **Webhooks** | Signed inbound, retried outbound | Hono + Queues |
|
|
34
36
|
| **CMS** | Schema-driven admin UI | Embedded SPA |
|
|
@@ -402,6 +404,7 @@ The path layout mirrors the public docs site (https://docs.quickback.dev). Open
|
|
|
402
404
|
- `api-contract` — the HTTP contract layer: RFC 9457 Problem Details, keyset cursors, `Idempotency-Key`, `?include=`/sparse fields, the contract `v1`→`v2` matrix
|
|
403
405
|
- `push` — Web Push (VAPID + aes128gcm), queue fan-out, identity-tag targeting, hardened subscriptions schema
|
|
404
406
|
- `schedules` — `defineSchedule` cron jobs
|
|
407
|
+
- `email` — `defineEmail` inbound Email Worker handlers
|
|
405
408
|
|
|
406
409
|
**Bundled UIs** (`docs/ui/<topic>.md`)
|
|
407
410
|
- `admin` — schema-driven admin UI, dashboard, record layouts, table views, schema registry
|
|
@@ -98,6 +98,7 @@ Missing or invalid authentication tokens.
|
|
|
98
98
|
| `AUTH_EXPIRED` | Token has expired |
|
|
99
99
|
| `AUTH_RATE_LIMITED` | Too many auth attempts |
|
|
100
100
|
| `AUTH_SESSION_REQUIRED` | The endpoint requires session (cookie) authentication — returned by `POST /api/v1/token` when called with a JWT, API key, or OAuth bearer, so a stolen or revoked token can't mint its own replacement |
|
|
101
|
+
| `AUTH_REVOCATION_UNAVAILABLE` | **503, retryable.** Only with [`revocationCheck: 'kv'`](/configure/auth#revocationcheck-none--kv--token-revocation-strategy): the bearer's signature verified, but its revocation state could not be read (KV binding missing or unreachable), so it was not trusted. Retry, or authenticate with a session cookie |
|
|
101
102
|
|
|
102
103
|
### Firewall (403)
|
|
103
104
|
|
|
@@ -31,6 +31,27 @@ GET /api/v1/jobs?title.like=Engineer
|
|
|
31
31
|
GET /api/v1/jobs?department.in=Engineering,Design,Product
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
### Unknown filters are rejected, not ignored
|
|
35
|
+
|
|
36
|
+
A filter the handler cannot apply returns `400` (`VALIDATION_INVALID_INPUT`).
|
|
37
|
+
It is never dropped:
|
|
38
|
+
|
|
39
|
+
| Request | Result |
|
|
40
|
+
|---------|--------|
|
|
41
|
+
| `?guestId=g_1` where `guestId` isn't a column | `400` — `Unknown filter field "guestId"` |
|
|
42
|
+
| `?status=open` on a view whose `query.filterable` omits `status` | `400` — `Field "status" is not filterable on this view` |
|
|
43
|
+
| `?title.matches=x` (no such operator) | `400` — `Unknown filter operator "matches"` |
|
|
44
|
+
| `?ssn=123` where `ssn` is masked for your role | `400` — see [Masking](/define/masking) |
|
|
45
|
+
|
|
46
|
+
Silently dropping a predicate would return **every row the firewall allows**
|
|
47
|
+
while still reading as a scoped list — a typo'd or join-table field turns a
|
|
48
|
+
narrow query into a full dump. The same rule closes `?search=` and `?sort=`.
|
|
49
|
+
|
|
50
|
+
> Filtering on a relationship that lives in a join table is not a column filter.
|
|
51
|
+
> `GET /travel-bookings?guestId=...` cannot work when membership is
|
|
52
|
+
> `travel_booking_guests` — expose a view or an `include` for it instead.
|
|
53
|
+
|
|
54
|
+
|
|
34
55
|
## Pagination
|
|
35
56
|
|
|
36
57
|
| Parameter | Default | Description |
|
|
@@ -110,6 +131,11 @@ GET /api/v1/jobs?sort=title&order=asc
|
|
|
110
131
|
|
|
111
132
|
When the multi-sort format is detected (comma or `-` prefix), the `order` parameter is ignored.
|
|
112
133
|
|
|
134
|
+
A client-supplied `?sort=` naming an unknown column — or one outside a view's
|
|
135
|
+
`query.sortable` — returns `400`, for the same reason unknown filters do: rows
|
|
136
|
+
would come back in some other order that reads as the requested one. A view's
|
|
137
|
+
own `defaultSort` fallback is config, not caller input, and is never rejected.
|
|
138
|
+
|
|
113
139
|
## Field Selection
|
|
114
140
|
|
|
115
141
|
Select which columns to return using `?fields=`. Available on LIST and GET routes (not Views — they define their own field set).
|