@quickback-dev/cli 0.66.5 → 0.66.7

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.
Files changed (109) hide show
  1. package/README.md +0 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/api-client.d.ts +1 -1
  4. package/dist/lib/api-client.d.ts.map +1 -1
  5. package/dist/lib/api-client.js +13 -8
  6. package/dist/lib/api-client.js.map +1 -1
  7. package/dist/lib/api-client.test.js +47 -0
  8. package/dist/lib/api-client.test.js.map +1 -1
  9. package/dist/lib/migrations/drizzle.d.ts.map +1 -1
  10. package/dist/lib/migrations/drizzle.js +6 -1
  11. package/dist/lib/migrations/drizzle.js.map +1 -1
  12. package/dist/lib/migrations/drizzle.test.js +7 -0
  13. package/dist/lib/migrations/drizzle.test.js.map +1 -1
  14. package/dist/lib/migrations/executor.d.ts.map +1 -1
  15. package/dist/lib/migrations/executor.js +4 -0
  16. package/dist/lib/migrations/executor.js.map +1 -1
  17. package/dist/lib/migrations/postprocessors/better-auth-upgrade.d.ts +7 -0
  18. package/dist/lib/migrations/postprocessors/better-auth-upgrade.d.ts.map +1 -0
  19. package/dist/lib/migrations/postprocessors/better-auth-upgrade.js +149 -0
  20. package/dist/lib/migrations/postprocessors/better-auth-upgrade.js.map +1 -0
  21. package/dist/skill/SKILL.md +0 -2
  22. package/dist/skill/docs/api/openapi.md +1 -1
  23. package/dist/skill/docs/configure/auth.md +4 -5
  24. package/dist/skill/docs/configure/domains.md +1 -1
  25. package/dist/skill/docs/configure/index.md +4 -4
  26. package/dist/skill/docs/configure/security.md +3 -3
  27. package/dist/skill/docs/define/access.md +23 -3
  28. package/dist/skill/docs/define/actions/defining.md +2 -2
  29. package/dist/skill/docs/define/actions/index.md +6 -0
  30. package/dist/skill/docs/define/actions/record-and-standalone.md +1 -2
  31. package/dist/skill/docs/define/areas.md +14 -15
  32. package/dist/skill/docs/define/changesets.md +5 -0
  33. package/dist/skill/docs/define/diagnostics.md +2 -2
  34. package/dist/skill/docs/define/fga.md +1 -1
  35. package/dist/skill/docs/define/firewall.md +5 -5
  36. package/dist/skill/docs/define/guards.md +2 -1
  37. package/dist/skill/docs/define/masking.md +2 -2
  38. package/dist/skill/docs/define/relationships.md +8 -10
  39. package/dist/skill/docs/define/scopes.md +1 -1
  40. package/dist/skill/docs/define/transitions.md +11 -0
  41. package/dist/skill/docs/define/triggers.md +4 -0
  42. package/dist/skill/docs/index.md +0 -6
  43. package/dist/skill/docs/platform/auth/index.md +37 -0
  44. package/dist/skill/docs/platform/auth/jwt-optimization.md +2 -2
  45. package/dist/skill/docs/platform/queues/handlers.md +12 -0
  46. package/dist/skill/docs/platform/realtime/durable-objects.md +1 -1
  47. package/dist/skill/docs/platform/realtime/partyserver-rooms.md +4 -4
  48. package/dist/skill/docs/platform/schedules/index.md +3 -1
  49. package/dist/skill/docs/platform/webhooks/inbound.md +1 -1
  50. package/dist/skill/docs/tooling/claude-skill.md +0 -7
  51. package/dist/skill/docs/tooling/cloud-compiler/endpoints.md +11 -1
  52. package/dist/skill/docs/tooling/cloud-compiler/troubleshooting.md +16 -0
  53. package/dist/skill/docs/tooling/output.md +7 -6
  54. package/dist/skill/docs/ui/account/features/admin.md +1 -1
  55. package/dist/skill/docs/ui/account/features/organizations.md +1 -1
  56. package/dist/skill/docs/ui/admin/index.md +1 -1
  57. package/dist/skill/docs/ui/admin/owned-records.md +81 -0
  58. package/dist/skill/docs/ui/admin/schema-format.md +16 -0
  59. package/package.json +1 -1
  60. package/src/skill/SKILL.md +0 -2
  61. package/src/skill/docs/api/openapi.md +1 -1
  62. package/src/skill/docs/configure/auth.md +4 -5
  63. package/src/skill/docs/configure/domains.md +1 -1
  64. package/src/skill/docs/configure/index.md +4 -4
  65. package/src/skill/docs/configure/security.md +3 -3
  66. package/src/skill/docs/define/access.md +23 -3
  67. package/src/skill/docs/define/actions/defining.md +2 -2
  68. package/src/skill/docs/define/actions/index.md +6 -0
  69. package/src/skill/docs/define/actions/record-and-standalone.md +1 -2
  70. package/src/skill/docs/define/areas.md +14 -15
  71. package/src/skill/docs/define/changesets.md +5 -0
  72. package/src/skill/docs/define/diagnostics.md +2 -2
  73. package/src/skill/docs/define/fga.md +1 -1
  74. package/src/skill/docs/define/firewall.md +5 -5
  75. package/src/skill/docs/define/guards.md +2 -1
  76. package/src/skill/docs/define/masking.md +2 -2
  77. package/src/skill/docs/define/relationships.md +8 -10
  78. package/src/skill/docs/define/scopes.md +1 -1
  79. package/src/skill/docs/define/transitions.md +11 -0
  80. package/src/skill/docs/define/triggers.md +4 -0
  81. package/src/skill/docs/index.md +0 -6
  82. package/src/skill/docs/platform/auth/index.md +37 -0
  83. package/src/skill/docs/platform/auth/jwt-optimization.md +2 -2
  84. package/src/skill/docs/platform/queues/handlers.md +12 -0
  85. package/src/skill/docs/platform/realtime/durable-objects.md +1 -1
  86. package/src/skill/docs/platform/realtime/partyserver-rooms.md +4 -4
  87. package/src/skill/docs/platform/schedules/index.md +3 -1
  88. package/src/skill/docs/platform/webhooks/inbound.md +1 -1
  89. package/src/skill/docs/tooling/claude-skill.md +0 -7
  90. package/src/skill/docs/tooling/cloud-compiler/endpoints.md +11 -1
  91. package/src/skill/docs/tooling/cloud-compiler/troubleshooting.md +16 -0
  92. package/src/skill/docs/tooling/output.md +7 -6
  93. package/src/skill/docs/ui/account/features/admin.md +1 -1
  94. package/src/skill/docs/ui/account/features/organizations.md +1 -1
  95. package/src/skill/docs/ui/admin/index.md +1 -1
  96. package/src/skill/docs/ui/admin/owned-records.md +81 -0
  97. package/src/skill/docs/ui/admin/schema-format.md +16 -0
  98. package/dist/skill/docs/changelog/index.md +0 -945
  99. package/dist/skill/docs/changelog/v0.1x.md +0 -1202
  100. package/dist/skill/docs/changelog/v0.2x.md +0 -589
  101. package/dist/skill/docs/changelog/v0.3x.md +0 -1152
  102. package/dist/skill/docs/changelog/v0.4x.md +0 -1108
  103. package/dist/skill/docs/changelog/v0.5x.md +0 -885
  104. package/src/skill/docs/changelog/index.md +0 -945
  105. package/src/skill/docs/changelog/v0.1x.md +0 -1202
  106. package/src/skill/docs/changelog/v0.2x.md +0 -589
  107. package/src/skill/docs/changelog/v0.3x.md +0 -1152
  108. package/src/skill/docs/changelog/v0.4x.md +0 -1108
  109. package/src/skill/docs/changelog/v0.5x.md +0 -885
@@ -1,1108 +0,0 @@
1
- # v0.40 – v0.48
2
-
3
- ## v0.48.1 — July 10, 2026
4
-
5
- > Both entries below were authored under the working label **v0.49** (commit
6
- > `cd5bcd8f`). No `0.49.x` was ever published — the CLI went `0.48.1` →
7
- > `0.50.0` — so `0.48.1` is the release that carries them.
8
-
9
- ### Realtime identity tags — one send reaches a person on either auth door
10
-
11
- WebSocket connections now carry **identity tags**, proven at ticket mint and
12
- signed into the ws-ticket (never client-supplied): `user:<userId>` for every
13
- Better Auth caller, plus `scope:<kind>:<subjectId>` whenever a scope subject is
14
- proven — on **either** door. A sessionless scope principal's claim and a Better
15
- Auth caller's matched relationship lane stamp the **identical** subject-keyed
16
- tag (both derive from the same relationship row), so senders no longer
17
- double-send per recipient to cover `subject: 'both'` roles.
18
-
19
- - **`targetTags` on every send** (`realtime.broadcast`, `realtime.insert`, …):
20
- delivery is the deduplicated union of the runtime's indexed
21
- `getWebSockets(tag)` lookup — no per-frame attachment scan. Replaces the
22
- `userId` identity arm when present; the scope/org bind and `targetRoles`
23
- audience still apply.
24
- - **Fail-closed:** `targetTags: []` delivers to nobody, consistent with the
25
- empty-audience rule.
26
- - Tags are immutable for a socket's lifetime (hibernation-tag semantics);
27
- limits (10/socket, 256 chars) are validated at mint — rejected, never
28
- truncated.
29
-
30
- ### Realtime authorization lease — hibernated sockets no longer outlive revocation
31
-
32
- A ws-ticket was verified once at upgrade, and DO hibernation kept the socket
33
- authorized forever — bans, member removal, and subject revocation never touched
34
- a live connection. Connections now carry a delivery-time **authorization
35
- lease** (default **15 minutes**, from ticket `iat`):
36
-
37
- - The fan-out skips expired connections (they receive nothing) and closes them
38
- with code **4401**; inbound messages — even pings — are enforced the same way.
39
- - **In-place renewal:** `{ type: "reauth", ticket: "<fresh ws-ticket>" }`
40
- extends the lease and refreshes roles without socket churn. Renewal is
41
- strict — same `userId`, same scope/org, exact same tag set (tags are
42
- immutable); identity drift closes with 4401 → reconnect fresh.
43
- - Renewal tickets come from `POST /broadcast/v1/ws-ticket`, which re-runs the
44
- **full** authorization gate (session, KV revocation, relationship/scope-claim
45
- probes) — so revocation propagates within one lease period, with no KV reads
46
- in the Durable Object.
47
- - Configure via `realtime: { lease: '15m' | seconds | false }` (min 60s;
48
- `false` disables — discouraged). Clients that never reauth degrade gracefully
49
- to one forced reconnect per lease.
50
-
51
- ## v0.48.0 — July 8, 2026
52
-
53
- ### Realtime broadcasts are fail-closed — explicit per-resource audience (BREAKING)
54
-
55
- Realtime broadcasting is now opt-in **per resource** with a **mandatory audience**,
56
- mirroring how CRUD is explicit. This closes a fanout footgun where a resource that
57
- never mentioned realtime could still broadcast its rows to an entire room.
58
-
59
- - **`realtime.access: { roles: [...] }`** is the audience — same `{ roles }` shape
60
- as `read.access` / `crud.*.access`. A subscriber receives a live row iff that
61
- role bucket would admit them at REST. Roles may be concrete membership/scope
62
- roles or UPPERCASE pseudo-roles (`PUBLIC`, `AUTHENTICATED`, `USER`, `SYSADMIN`).
63
- - **Fail-closed, at compile time** — a broadcasting resource with no/empty audience
64
- is a **compile error** naming the resource. There is no implicit fanout. To
65
- broadcast to everyone in the room, say so deliberately with `access: { roles: ['PUBLIC'] }`.
66
- - **Fail-closed, at runtime** — the Broadcaster now treats an **empty audience as
67
- nobody** (previously: everybody) and evaluates the uppercase pseudo-roles exactly
68
- as the REST access evaluator does (`userRole` is threaded through the ws-ticket
69
- for `USER`/`SYSADMIN`).
70
- - **No project-wide auto-broadcast** — `providers.database.config.realtime` now
71
- only wires the transport (Broadcaster DO + ws-ticket route); it no longer
72
- enables broadcasts on any resource.
73
- - **Migration** — a project that relied on the project-wide auto-broadcast must add
74
- an explicit `realtime: { enabled: true, access: { roles: [...] } }` block to each
75
- resource that should broadcast. `requiredRoles` is the deprecated spelling of
76
- `access.roles` (still compiles, normalized internally). `q-events` `guests`
77
- demonstrates the staff-lane pattern (`access: { roles: ['admin','member'] }`,
78
- event-scoped, masked).
79
-
80
- ### Deterministic codegen output
81
-
82
- The compiler now sorts every filesystem-discovered collection (features, and each
83
- `services.*` group) by a stable key before generating, so recompiles produce
84
- byte-identical output regardless of the CLI's directory-scan order. Eliminates the
85
- churny, behavior-neutral diffs (queue-consumer case order, auth blocks, schema
86
- imports) that appeared across machines/CLI versions.
87
-
88
- ## v0.47.14 — July 7, 2026
89
-
90
- ### `acceptScope`: one namespaced handler for the user AND the sessionless principal
91
-
92
- A project-level namespace can now **accept an already-minted scope claim as
93
- proof of entry** — the inverse of `mintScope`. Set
94
- **`authz.namespaces.<ns>.acceptScope: '<kind>'`** and the hoisted resolver gains
95
- a fast-path: a scope-only principal (`ctx.scopePrincipal`, no `ctx.userId`)
96
- carrying a verified `ctx.scope.<kind>` claim proves entry by that claim, without
97
- a DB relationship probe. One `/event/:eventId/*` handler then serves **both** the
98
- Better-Auth user and the sessionless invite-principal — retiring the parallel
99
- PUBLIC `/attendee/*` twin.
100
-
101
- - **Named-string only** — the kind is always explicit; a bare `true` is a type
102
- error. Default absent → the resolver never admits a scope principal (fail-closed).
103
- - **Two locks, compile-enforced** — `acceptScope` opts the namespace in, **and**
104
- at least one relationship lane must confer a `<kind>` role declared
105
- `subject: 'supplied' \| 'both'`. A `subject: 'user'` role emits no accept arm;
106
- a kind whose every conferring lane is user-only is a **compile error**, not a
107
- dead fast-path. The kind must be declared and its `requestField` must equal the
108
- prefix's first `:param`.
109
- - **Forging-safe** — the claim is verified (never caller-asserted), the kind is
110
- read by name (not an any-key loop), the instance is pinned twice
111
- (`entry.id === :param` in the gate + `eq(loads.pk, :param)` in hydration), and
112
- each accept arm is one exact `(role, lane)` pair. New proof source, zero new
113
- enforcement surface — firewall, masking, `access`, and scoped-db read the same
114
- `ctx.scope` they read for a userId caller.
115
- - **Composes with `mintScope`** — a userId caller still gets a rolling re-mint;
116
- a scope principal's verified claim is preserved (not re-stamped) so its
117
- `subjectId` / sub-keys survive.
118
- - **Realtime shares the same acceptance** — the `ws-ticket` route now proves a
119
- scope principal through the *same* emitter as the REST gate
120
- (`emitScopeAcceptance`), so the two surfaces can't drift. Bringing the ws-ticket
121
- path onto it tightened it to the named-kind read + supplied-reachable role
122
- filter, closing an any-kind cross-kind match. `q-events` ships a `vendor` scope
123
- role (`subject: 'both'`) + logistics-only view demonstrating the sessionless
124
- supplier end-to-end.
125
- - **Writes work too** — the scoped-db audit wrapper no longer throws when the
126
- caller is a verified scope principal (`ctx.scopePrincipal`, no `ctx.userId`).
127
- Instead of failing on the missing user, it stamps the synthetic, audit-only
128
- principal id (`scope:<kind>:<subjectId>`, the token's `sub`) into
129
- `created_by` / `modified_by`. So the SAME `/event/:eventId/*` handler body
130
- serves both a Better-Auth user and the sessionless principal on **reads AND
131
- writes** — no parallel raw-`db` write path. Still fail-closed: a genuine
132
- no-user write (no scope principal) throws exactly as before. `q-events` adds a
133
- `vendorCheckin` write under the acceptScope namespace exercising it end-to-end.
134
-
135
- See [Scopes → `acceptScope`](/define/scopes#acceptscope--accept-an-incoming-scope-claim-as-proof-of-entry).
136
-
137
- ## v0.47.13 — July 6, 2026
138
-
139
- ### Sessionless scope mint: `ctx.mintScope` + `subject: 'supplied' \| 'both'`
140
-
141
- A scope can now be minted for a principal who has **no Better Auth account** — an
142
- event attendee arriving by email + invite code, a kiosk/handout code, a partner
143
- token. The action proves the relationship its own way and asks Quickback to mint
144
- a disciplined scope token from the row it proved.
145
-
146
- - **`authz.scopes.<kind>.roles.<role>.subject: 'user' \| 'supplied' \| 'both'`** (default `'user'`).
147
- `'both'` makes the *same* `scope:event:attendee` reachable by a logged-in user
148
- (via `/scope/v1/enter`) and a sessionless invite-holder (via `ctx.mintScope`) —
149
- one firewall arm, one masking rule, both principals.
150
- - **`ctx.mintScope({ via, subject })`** — hydrated on `ctx` in any action (including
151
- PUBLIC) when a `supplied`/`both` role is declared. The action supplies only the
152
- conferring row's **primary key**; Quickback reads the role, resource id,
153
- sub-keys, and subject id **off that row** — never caller-asserted, so the role
154
- can't be forged. Returns a **scope-only** JWT (no user identity): `ctx.userId`
155
- stays undefined, so user/org/owner gates and the `AUTHENTICATED`/`USER`
156
- pseudo-roles all fail closed; only `scope:<kind>:<role>` gates admit it.
157
- - **`ctx.scope.<kind>.subjectId`** — a reserved claim carrying the proven subject
158
- row's PK, populated on **both** proof paths. Scope an attendee's self-data
159
- (travel, dietary, todos) with a single firewall arm
160
- (`{ field: 'guestId', equals: 'ctx.scope.event.subjectId' }`) that serves both a
161
- user-attendee and a sessionless one.
162
- - **Realtime** — the ws-ticket authorizes a scope-only principal directly off its
163
- proven `ctx.scope` claim, so accountless attendees join the same rooms with the
164
- same scope role. The `where:` filter runs on the mint probe, so a cancelled row
165
- confers nothing (revocation within one ≤180s mint cycle).
166
-
167
- See [Scopes → Sessionless scope mint](/define/scopes#sessionless-scope-mint--ctxmintscope).
168
-
169
- ### MCP OAuth: split authorization-server / resource-server (multi-app SSO)
170
-
171
- You can now run one canonical authorization server with many resource servers (each
172
- hosting its own `/mcp`) over a shared auth DB:
173
-
174
- - A resource server that sets `agents.mcp.requireAuth` now emits the full OAuth
175
- access-token **verification** path on its own — previously the JWKS-verify block
176
- only emitted when the separate `auth.config.oauth.enabled` flag was set, so a
177
- requireAuth-only resource server fell back to HMAC + session and 401'd every valid
178
- externally-issued bearer.
179
- - Point a resource server at an external AS with `auth.config.oauth.issuerUrl`; the
180
- middleware verifies incoming bearers against the shared JWKS (`iss`/`aud`/`exp` +
181
- live-session binding).
182
- - `auth.config.oauth.audiences` (an array) registers federated resource-server
183
- audiences on the AS (RFC 8707). It now **unions** with the AS's own origin instead
184
- of replacing it, so listing federated servers never drops the AS's own `/mcp`
185
- audience. Also exposed on the plugin-form `oauthProvider.validAudiences`.
186
-
187
- See [Agents → Split authorization server](/configure/agents#split-authorization-server--resource-server-multi-app-sso).
188
-
189
- ### MCP tools: callable path params + typed input schemas
190
-
191
- An action mounted under a path that carries a parameter — a namespace prefix like
192
- `/scope/:scopeId/...`, or any `path:` with `:params` — now produces a fully
193
- callable MCP tool:
194
-
195
- - The mounted route's path params are extracted into the tool's `inputSchema`
196
- (and `_pathParams`), so the model has a field to supply each one. Previously
197
- only record-based actions emitted a param (the hard-coded `id`); a standalone
198
- or namespace path param was absent from the schema, the URL resolved with an
199
- empty segment, and the action was uncallable over MCP.
200
- - Standalone routes are stored in Hono colon form (`:scopeId`); the OpenAPI spec
201
- key (and therefore the tool's `_path`) is now normalized to brace form
202
- (`{scopeId}`) so the runtime's brace-only path interpolation can fill it.
203
-
204
- Action `input` schemas also lower to richer JSON Schema instead of a phantom
205
- empty `{}`: `z.coerce.*`, `z.literal`, unions of literals, and **nested
206
- `z.object`** (child keys stay nested) now emit their real types, so the model —
207
- and the OpenAPI spec — see the actual field shapes. See
208
- [Agents → MCP tools](/configure/agents).
209
-
210
- ### Scaffold surfaces MCP/OAuth + secrets opt-ins
211
-
212
- `quickback create` now seeds the generated `quickback.config.ts` with curated,
213
- commented-out hints for the authenticated MCP server (`agents.mcp.requireAuth`), the
214
- split-AS `oauth.issuerUrl`/`audiences`, and `bindings.secrets` — so these opt-ins are
215
- discoverable in the config itself, not only in the docs.
216
-
217
- ### Custom secrets via `bindings.secrets`
218
-
219
- Declare a custom secret your feature/action code reads off `env` — name and
220
- contract only, never the value:
221
-
222
- ```ts
223
- bindings: {
224
- secrets: [
225
- { name: "WEBHOOK_SIGNING_SECRET", description: "HMAC for webhook callbacks", required: true },
226
- ],
227
- }
228
- ```
229
-
230
- It's emitted into the generated `env.d.ts` `Env` interface so `env.<NAME>`
231
- type-checks, and `required` secrets join the boot-time env guard — the worker
232
- fails closed with `503 MISSING_ENV` if one is unset. The value is set
233
- out-of-band (`wrangler secret put`); the schema rejects any inline value so a
234
- real secret can never be committed. See
235
- [Bindings → secrets](/configure/bindings#secrets).
236
-
237
- ### Auth: `resolve-email-context.ts` hook for per-recipient OTP context
238
-
239
- Drop `quickback/hooks/resolve-email-context.ts` and the emailOTP send calls it
240
- per recipient, spreading the returned object into your email templates — branded
241
- palettes (organizer vs. attendee), plan tier, locale, etc. — without patching
242
- generated output. Fail-open, with the Drizzle handle passed in. See
243
- [Auth Hooks → Email context resolver](/ui/account/hooks#email-context-resolver).
244
-
245
- ### Codegen fixes
246
-
247
- - **Schedules:** handler import paths are now rebased on relocation, so a cron
248
- handler importing `../../features/...` resolves correctly from the generated
249
- `src/lib/schedules.ts` instead of failing the worker build.
250
- - **OAuth/MCP middleware:** the auth-schema tables are imported under aliased
251
- names so a function-scoped `const session` can no longer shadow the `session`
252
- table import — closes a temporal-dead-zone crash that silently 401'd every
253
- OAuth/MCP bearer.
254
- - **MCP route:** the large tool-data literal is split into a `mcp-tools.ts` data
255
- module (suppressed) so it can't overrun `tsc`'s type-instantiation budget; the
256
- `mcp.ts` route logic stays fully type-checked.
257
-
258
- ### Realtime: identity-gated Durable Object rooms (`roomIdEquals`)
259
-
260
- Per-user Durable Object entrypoints (gateway / presence / inbox) can now declare
261
- an identity gate on the binding — `access: { roomIdEquals: 'ctx.userId' }` (or
262
- `'ctx.activeOrgId'`). The compiler emits a Worker-edge gate at
263
- `/realtime/<kebab>/*` that 401s anonymous callers, 400s a missing segment, and
264
- 403s unless the decoded room segment equals the server-resolved `ctx` id — a
265
- string compare with no backing table or DB query. See
266
- [PartyServer rooms → Per-room authorization](/platform/realtime/partyserver-rooms).
267
-
268
- - Closes the cross-user hole that "no `access` declared" leaves open: a per-user
269
- room without a gate falls through to the authenticated-only catchall, so any
270
- authenticated user could open another user's room by guessing the id.
271
- - The gate lives at the edge, not in the DO — a Durable Object has no session
272
- and only sees client-settable headers, so it must never re-authorize from
273
- request data (trusting an `x-user-id` header was the original spoof hole).
274
- - Only `'ctx.userId'` and `'ctx.activeOrgId'` are accepted; anything else is a
275
- compile-time error (fail-closed Zod + generator validation).
276
-
277
- ### OAuth provider: spurious authorization-server warning silenced by default
278
-
279
- The generated `oauthProvider({...})` now emits
280
- `silenceWarnings: { oauthAuthServerConfig: true }` by default. The compiler
281
- always serves the `/.well-known/oauth-authorization-server` discovery route when
282
- the provider is enabled, so `@better-auth/oauth-provider`'s
283
- "please ensure … exists" boot warning was always spurious. Override or extend it
284
- via `plugins.oauthProvider.silenceWarnings`.
285
-
286
- ### `defineSchedule` — cron jobs from a single source
287
-
288
- Declare a cron schedule in `services/schedules/*.ts` and the compiler emits the
289
- Worker's `scheduled()` handler + the matching `[triggers] crons` in
290
- `wrangler.toml` — the trigger-side mirror of `defineQueue`. No separate cron
291
- Worker, no hand-patching the generated entry (which a recompile would strip).
292
- See [Schedules](/platform/schedules).
293
-
294
- ```typescript
295
- // services/schedules/sweepDigests.ts
296
- export default defineSchedule({
297
- name: "sweepDigests",
298
- cron: "* * * * *",
299
- execute: async ({ db, env, services }) => { await runDigestSweep(db, env, services); },
300
- });
301
- ```
302
-
303
- - One `scheduled(event, env, ctx)` dispatcher runs every schedule whose cron
304
- matches `event.cron`; failures are isolated per-schedule.
305
- - The execute context (`{ db, env, services, cron, scheduledTime }`) runs
306
- server-internal with `ctx.internal = true` and an audit actor of
307
- `system:cron-<name>`, plus a `withInternalContext` helper for
308
- `roles: ['INTERNAL']`-gated rows.
309
-
310
- ### Rate limiting — the fifth security pillar
311
-
312
- Per-operation request caps on every CRUD endpoint, backed by Cloudflare's
313
- native [Rate Limiting binding](/define/rate-limit) — no extra
314
- storage, no third-party libraries. Applied to every resource by default
315
- (read 1000/60s, write 200/60s), overridable per-op, per-resource, or
316
- project-wide; `false` opts out at any scope.
317
-
318
- - One middleware per feature router maps method→op, keys the limit by
319
- `<resource>:<op>:<userId>` (falling back to the client IP for anonymous
320
- callers), and returns `429` + `Retry-After` when over the cap.
321
- - Unique `(limit, period)` tuples collapse onto shared bindings — a project
322
- that never declares `rateLimit` ships exactly two (`RL_1000_60`,
323
- `RL_200_60`), emitted as GA `[[ratelimits]]` blocks in `wrangler.toml` and
324
- typed `RateLimit` on `CloudflareBindings`.
325
- - `period` is compile-time constrained to `10` or `60` (Cloudflare binding
326
- limit); the check no-ops when a binding is absent, so local dev never
327
- hard-depends on it.
328
-
329
- ## v0.47.8 — June 12, 2026
330
-
331
- ### Postgres-style table triggers (`defineTable` / `feature` `triggers:`)
332
-
333
- Tables can now declare `before`/`after` triggers on `insert`/`update`/
334
- `delete`, with two lowering lanes and a per-trigger compile report. See
335
- [Triggers](/define/triggers) for the full reference.
336
-
337
- - **`sql:` entries** compile to real SQLite `CREATE TRIGGER` statements,
338
- shipped in the journaled features migration (content-addressed — an
339
- unchanged trigger set appends nothing; removing a trigger drops it on the
340
- next migrate). They fire for **every** write path including raw SQL, run
341
- atomically with the triggering statement (the only transactional option
342
- on D1), support `when:` guards and `RAISE(ABORT, ...)` rejection, and
343
- `OLD.`/`NEW.` column references are validated at compile time. The
344
- compiler owns the `BEGIN`/`END` frame — emitted uppercase, since
345
- lowercase `begin` breaks remote D1's statement splitter. On soft-delete
346
- tables, `*Delete` events map to the `deleted_at` transition (plus a
347
- hard-delete variant) and `*Update` events exclude it, so a soft delete
348
- fires delete triggers exactly once. D1 only.
349
- - **`handler:` entries** run as application hooks at the audit-wrapper
350
- write chokepoint (REST CRUD + actions). `before*` hooks are synchronous
351
- and can mutate the payload or throw to reject — the write never executes
352
- and the request gets `TRIGGER_REJECTED` (422); audit fields are
353
- re-stamped after hooks and cannot be forged. `after*` hooks run once per
354
- returned row and are **awaited** — a throw surfaces as
355
- `TRIGGER_AFTER_FAILED` (500) with `details.committed: true` since the
356
- write already persisted. Handlers get `{ table, op, values|row, ctx, db,
357
- env }`; the `db` is audit-wrapped at cascade depth + 1, so hook writes
358
- stamp audit fields, emit live-view deltas, and fire nested triggers,
359
- bounded by a depth cap of 5. Each table's drizzle object is auto-imported
360
- into the generated registry under its authored name, and handler imports
361
- are usage-filtered and hoisted.
362
-
363
- The compile output includes a lowering/coverage report and fail-closed
364
- warnings: `handler:` triggers do **not** fire for queue handlers, cron, or
365
- raw SQL — guards that must hold universally should use `sql:` +
366
- `RAISE(ABORT)`. `async: true` (queue-dispatched after-hooks) and
367
- `withOld: true` (previous-row access) are reserved and rejected at compile
368
- time until they ship.
369
-
370
- Also in this change:
371
-
372
- - New `trigger` error layer with `TRIGGER_REJECTED` / `TRIGGER_AFTER_FAILED`
373
- codes in the generated error catalog, OpenAPI spec, and SDK types.
374
- - Parser: function-valued properties in `defineTable`/`feature` configs now
375
- parse as compile-time source carriers instead of failing the whole config
376
- with "no dynamic expressions" — unblocks trigger handlers (and
377
- function-form `access:` / custom masks) through the CLI source path.
378
- - Fixed a column-injection bug where a comment merely mentioning a column
379
- name (e.g. `"deleted_at"` in a docblock) suppressed audit/soft-delete
380
- column injection for the table.
381
- - Fixed a silent no-op: a project declaring `services/queues/*.ts` handlers
382
- without embeddings or `additionalQueues` deployed a wired `queue` export
383
- with no `[[queues.consumers]]` to feed it — the handlers were dead code.
384
- The primary queue (and its typed env binding) is now emitted for
385
- handlers-only projects, with a compile notice that Cloudflare Queues
386
- requires the paid Workers plan. Queue emission remains strictly opt-in by
387
- usage: projects with no queue-backed features (embeddings, queue
388
- handlers, `additionalQueues`, webhooks) emit no queue configuration and
389
- deploy on the free plan.
390
-
391
- ## v0.47.7 — June 12, 2026
392
-
393
- ### Envelope encryption — `q.text().encrypted()` (encryption pillar, Phase 1)
394
-
395
- Mark a text column `.encrypted()` and it is AES-256-GCM-encrypted at rest
396
- under a **per-organization key**: a database breach (backup, export, leaked
397
- token, SQL injection, insider read) yields only ciphertext for that column.
398
- See [Encryption](/define/encryption).
399
-
400
- - Per-org DEKs live wrapped under the `ENCRYPTION_KEK` worker secret in a
401
- compiler-owned `org_data_keys` table (lazily created, versioned for
402
- rotation). Deleting an org's row **crypto-shreds** every value it wrote.
403
- - One write chokepoint: CRUD, batch, and action-layer `db.insert/update`
404
- all encrypt through the audit wrapper — audit snapshots, webhook
405
- payloads, and realtime deltas carry ciphertext by construction.
406
- - Reads decrypt behind the firewall then apply masking; encrypted columns
407
- are compile-time excluded from `?search`/`?filter`/`?sort`, view query
408
- allowlists, and embedding sources.
409
- - `ctx.crypto.encrypt/decrypt` for explicit server-side processing in
410
- actions; boot guard refuses to serve without the KEK (503 `MISSING_ENV`);
411
- scaffolded `.dev.vars` now includes a generated `ENCRYPTION_KEK`.
412
- - The sealed (E2EE) and vault tiers remain compile-gated until built —
413
- roadmap in `apps/compiler/research/encryption-vault-spec.md`.
414
-
415
- ## v0.47.0 — June 11, 2026
416
-
417
- ### Breaking: zero-false-positive analyzer checks are now compile errors
418
-
419
- The authz/authn analyzer (v0.37) shipped warn-only. After a release cycle of
420
- data, the checks whose every trip is a definite misconfiguration — never a
421
- legitimate config — are **promoted to compile errors**. Warnings nobody is
422
- forced to read are documentation; the pillar guarantees are now enforced.
423
-
424
- **Breaking** — a config that previously compiled with one of these warnings
425
- now fails the compile:
426
-
427
- - `AUTHZ_EMPTY_PERMISSION` — a permission that is structurally unsatisfiable
428
- (`allOf(a, not(a))`: a fact AND its exact negation at the same AND-level).
429
- - `AUTHZ_CAPABILITY_CEILING` — a resource's firewall grants a
430
- `scope:<kind>:<role>` role access beyond its capability profile (or the
431
- role has no profile at all). This is the M0.2 pillar guarantee — it was
432
- authored as an error all along and is now enforced.
433
- - `AUTHN_ROUTE_COVERAGE`, `AUTHN_SURFACE_INVARIANT`,
434
- `AUTHN_SECRET_CONSISTENCY`, `AUTHN_CREDENTIAL_DELIVERY`,
435
- `AUTHN_CLAIM_PROVENANCE` — the structural-authn set (route auth coverage,
436
- bearer-only `/mcp`/agent surfaces + INTERNAL unreachability, mint↔verify
437
- key/issuer/audience pairing, anchored credential delivery, verifier-only
438
- identity claims). These still run against empty route/credential metadata
439
- on a real compile (no-ops until the generators emit it), but the severity
440
- contract is locked in now — they fail the build the moment they can fire.
441
-
442
- The heuristic/advisory checks are unchanged: `AUTHZ_SHADOWED_ARM`,
443
- `AUTHZ_UNREACHABLE_ROLE`, `AUTHZ_UNREACHABLE_VIEW`, and
444
- `AUTHZ_NOT_OVER_RESOURCE` stay warnings; `AUTHZ_PUSHDOWN_COST` stays an info
445
- report. `QUICKBACK_AUTHZ_STRICT=true` still promotes those warnings too.
446
-
447
- **The override escape hatch** — every promoted finding can be explicitly
448
- accepted, per finding, with a required reason:
449
-
450
- ```ts
451
- authz: {
452
- analyzer: {
453
- allow: [
454
- {
455
- check: 'AUTHZ_CAPABILITY_CEILING',
456
- target: 'sessions/scope:event:organizer', // from the rendered finding
457
- reason: 'organizer grant profile lands with the v2 rollout (TICKET-123)',
458
- },
459
- ],
460
- },
461
- }
462
- ```
463
-
464
- An override downgrades that exact `(check, target)` finding back to a warning
465
- that cites the reason — even under strict mode (it's an explicit, reasoned
466
- acceptance). Every rendered error prints its exact override recipe. Guard
467
- rails: `check` must be one of the promoted ids (unknown or keep-warn ids are
468
- rejected at config validation), `reason` is required, and an `allow` entry
469
- that matches no current finding is itself a compile error — no dead
470
- overrides accumulating after the underlying issue is fixed.
471
-
472
- Analyzer-internal defects are still fail-open: a bug in the analyzer itself
473
- downgrades to a single warning and the compile continues. Only real findings
474
- fail builds.
475
-
476
- ### CLI: live views now compile through the CLI
477
-
478
- `defineView` files under `quickback/services/views/` were never loaded by
479
- the CLI — the compile payload simply omitted them, so
480
- [live views](/platform/realtime/live-views) (v0.35) only worked when driving
481
- the compiler API directly. The CLI now discovers and ships them like every
482
- other service definition, and the compile summary counts them
483
- (`Loaded services: … 1 live view(s)`). If you declared views and wondered
484
- why no surface ever went live: upgrade the CLI and recompile.
485
-
486
- ### CLI: deterministic compile output across machines
487
-
488
- Feature and service discovery used raw `readdir` order, which differs
489
- between macOS and Linux — route registration order, schema re-exports,
490
- OpenAPI paths, and the Neon RLS document's content hash could all churn when
491
- the same project was recompiled on a different machine. All discovery sites
492
- now sort by codepoint, so the same input compiles to the same bytes
493
- everywhere. Expect a one-time diff on the first recompile if your previous
494
- output was generated in a different filesystem order.
495
-
496
- ### Fixes
497
-
498
- - Read-only resources (no `crud` block) generated routes importing a
499
- `CRUD_ACCESS` symbol their resource file never exported — a tsc/bundle
500
- break. The export is now unconditional.
501
- - The `blog` starter template gated writes on the removed `ADMIN`
502
- pseudo-role, which hard-fails current compiles; it now uses the
503
- org-membership `admin` role.
504
- - `reports/operations.manifest.json` and `reports/conformance.manifest.json`
505
- now also cover the realtime (`/broadcast/v1`), storage (`/storage/v1`),
506
- and FGA (`/fga/v1`) surfaces.
507
- - The dead free/pro tier plumbing is gone: no Tier row in
508
- `quickback whoami`, no upsell copy at login. Compiling complete projects
509
- requires login, exactly as before — there was never a paid gate behind it.
510
- - The CLI is published to npm via trusted publishing (GitHub OIDC) — signed
511
- provenance, no long-lived npm token in the pipeline.
512
-
513
- ## v0.46.0 — June 11, 2026
514
-
515
- ### Breaking: "no organization context" responses unified on HTTP 403
516
-
517
- Generated APIs used to answer the same semantic condition — *the caller has no
518
- active organization context* — with two different statuses: `400 ORG_REQUIRED`
519
- from the collection list guard and the create/PUT/batch org validation, but
520
- `403 ACCESS_NO_ORG` from standalone actions and `403
521
- ACCESS_TENANT_SCOPE_REQUIRED` from unsafe org-scoped actions. Clients and SDKs
522
- had to special-case the split.
523
-
524
- **Breaking** — recompile + redeploy required; every "no org context" denial is
525
- now **403**:
526
-
527
- - `GET /api/v1/<resource>` (and views) without an active org or
528
- `?organizationId=` → `403 ORG_REQUIRED` (was 400).
529
- - `POST /`, `PUT /:id`, `POST /batch`, `PUT /batch` without an active org →
530
- `403 ORG_REQUIRED` (was 400).
531
- - Standalone actions (`403 ACCESS_NO_ORG`) and unsafe org-scoped actions
532
- (`403 ACCESS_TENANT_SCOPE_REQUIRED`) were already 403 and are unchanged.
533
-
534
- Error **codes are unchanged** — `ORG_REQUIRED`, `ACCESS_NO_ORG`, and
535
- `ACCESS_TENANT_SCOPE_REQUIRED` keep their identities, so clients that
536
- discriminate on `code` need no changes. Only clients that branch on the raw
537
- `400` status for these responses must update to `403`.
538
-
539
- ### Breaking: root-mounted actions lose their nested alias URLs
540
-
541
- A standalone action whose declared `path:` lives outside its feature prefix
542
- (e.g. `path: "/reports/orders"` in the `orders` feature) mounts at the root:
543
- `/api/v1/reports/orders`. That root URL is the one the OpenAPI spec, the MCP
544
- surface, and the operations manifest have always advertised — but the
545
- generated per-feature routes file *also* carried an undocumented, fully-gated
546
- copy at the nested `/api/v1/<feature><path>` URL (e.g.
547
- `/api/v1/orders/reports/orders`).
548
-
549
- **Breaking** — the nested alias is no longer emitted. One URL per operation:
550
- a root-mounted action exists only at its advertised `/api/v1<path>` mount.
551
- Anything calling the unadvertised nested URL gets a 404 after recompile +
552
- redeploy; switch to the documented root URL. Actions declared *under* the
553
- feature prefix are untouched, and a feature whose standalone actions are all
554
- root-mounted no longer emits an (empty) feature actions routes file.
555
-
556
- ### Behavior change: `PUBLIC` inside `or:` arms admits anonymous callers
557
-
558
- [Access](/define/access) has always documented `PUBLIC` as
559
- working on every access node, but the emitted auth gate only honored it in a
560
- flat `roles: [...]` list. A tree like
561
-
562
- ```ts
563
- access: {
564
- or: [
565
- { roles: ["PUBLIC"] },
566
- { roles: ["admin"] },
567
- ],
568
- }
569
- ```
570
-
571
- still answered anonymous callers with `401`. The auth gate is now tree-aware
572
- and matches the documented semantics: a `PUBLIC` `or:` arm admits anonymous
573
- callers past the authentication gate (an `and:` group admits them only when
574
- *every* arm does), and the access / org / firewall layers still evaluate the
575
- full tree. One shared predicate now drives the emitted gates, the OpenAPI
576
- `security` blocks, and view routes (which gate per view on the
577
- view-effective access).
578
-
579
- **Worth a loud note:** if you have a nested `PUBLIC` arm that was silently
580
- 401-ing, that endpoint becomes anonymously reachable after recompile —
581
- exactly what the config declares, but verify it's what you meant. `PUBLIC`
582
- audit logging applies to the newly-admitted routes as usual.
583
-
584
- ### Realtime broadcasts now enforce `requiredRoles` and masking
585
-
586
- A table's declared realtime gates weren't being applied to the generated
587
- CRUD broadcasts: `realtime: { requiredRoles: [...] }` and column masking were
588
- honored on the HTTP surface but not on the WebSocket fanout. The docs
589
- promised per-role, masked realtime delivery; the generated broadcasts now
590
- match it. **Recompile and redeploy** any project using realtime on
591
- role-gated or masked tables.
592
-
593
- Generated `realtime.insert / update / delete` calls now carry:
594
-
595
- - **`targetRoles`** — the table's `realtime.requiredRoles` (post role-
596
- hierarchy `+` expansion), enforced per subscriber at fanout.
597
- - **`maskingConfig`** — serialized from the same effective masking
598
- (declared + auto-detected sensitive columns) the HTTP mask functions are
599
- generated from. What HTTP masks is what the WebSocket wire masks.
600
-
601
- Live-view `view_changes` deltas honor the same table-level `requiredRoles`
602
- at fanout, so a role-gated table can't leak through a
603
- [live view](/platform/realtime/live-views) subscription either.
604
-
605
- Notes:
606
-
607
- - Recompile suffices — no config change needed.
608
- - If you worked around this with hand-written `realtime.*` calls passing
609
- `targetRoles` / `maskingConfig`, those workaround broadcasts can be
610
- removed.
611
- - `type: 'custom'` mask functions can't ride the wire — the Broadcaster
612
- fails closed and broadcasts `[REDACTED]` for those columns.
613
- - Tables without `requiredRoles` or masking are byte-identical: the open
614
- broadcast default is unchanged.
615
-
616
- ### Batch operations inherit the base operation's access
617
-
618
- When a batch operation was declared without its own `access`, it didn't pick
619
- up the base operation's role requirement:
620
-
621
- ```ts
622
- crud: {
623
- update: { access: { roles: ["admin"] } },
624
- batchUpdate: { maxBatchSize: 25 }, // ← no access of its own
625
- }
626
- ```
627
-
628
- A batch config declared without `access` now inherits the base operation's
629
- access at compile time — fail closed, so runtime, the OpenAPI spec, and the
630
- generated code all agree. Explicit batch `access` still wins (including
631
- per-side on upserts); a base op without access still yields an
632
- authenticated-only batch op. The flat `update: { batch: true }` shape and
633
- auto-promoted batch ops were never affected. **Recompile and redeploy** if
634
- you use the explicit-batch shape without per-batch access.
635
-
636
- ### Record actions, PUT upserts, and legacy firewall arms fail closed
637
-
638
- Three fail-closed hardening fixes, found and verified against the new
639
- conformance catalog (route × principal expectations derived from the
640
- compiler's own IR — see the
641
- [conformance manifest](/api/openapi#operations-manifest)).
642
- All apply on recompile + redeploy; no config change needed:
643
-
644
- - **Record actions evaluate the role gate before fetching the record**, so
645
- the denial response no longer varies with record state — a uniform
646
- `403 ACCESS_ROLE_REQUIRED`. (Bulk actions already had this order; unsafe
647
- actions write their audit row on the pre-record denial.)
648
- - **PUT upsert treats an out-of-scope id as a firewall miss** (`403` reveal /
649
- `404` hide, per your firewall error mode; a standard 207 miss entry on
650
- `PUT /batch`) instead of routing it into the create path. Genuinely new
651
- ids keep the create path.
652
- - **Legacy (array-form) firewall arms deny cleanly when a bound context
653
- claim is absent at runtime** (e.g. no active org), rather than surfacing a
654
- database error — the same deny-when-absent behavior the explicit `all:` /
655
- `any:` group forms already had.
656
-
657
- ### Root-mounted standalone actions use the standard gate stack
658
-
659
- Standalone actions mounted outside their feature prefix
660
- (`path: "/reports/orders"`) were emitted through a separate code path that
661
- did not apply the full access / audit / scoped-database treatment that
662
- in-feature standalone actions receive. They now render through the same
663
- generator, so the same access checks, security-audit writes, and
664
- tenant-scoped database wrapping apply everywhere. If you use root-mounted
665
- standalone actions, recompile and redeploy. (Unifying the two code paths is
666
- also what surfaced the two breaking changes above.)
667
-
668
- ### Namespace routing fixes
669
-
670
- - An action whose declared `path` exactly equals its namespace prefix is now
671
- claimed by the namespace like any nested action (Hono's `/x/*` mount
672
- already matched the bare `/x`) — it's served through the namespace's gate
673
- instead of carrying a second inline copy of the resolver.
674
- - A namespace with zero claimed standalone actions (e.g. record-based-only)
675
- no longer mounts its middleware at all — a dead gate can no longer
676
- intercept requests under its prefix.
677
-
678
- ### Custom org roles work with Better Auth member management
679
-
680
- Custom roles referenced in access trees (e.g. `roles: ["support"]`) are now
681
- auto-registered with the Better Auth organization plugin. They were already
682
- enforceable on routes but unprovisionable through Better Auth —
683
- `invite-member` / `update-member-role` rejected them with
684
- `400 ROLE_NOT_FOUND`, so there was no supported way to actually give a
685
- member the role. Auto-registered roles carry member-equivalent permissions
686
- (this is about assignability; your access trees remain the authorization
687
- model). If you pass your own `roles` / `ac` to the organization plugin
688
- options, those win and auto-registration is skipped. Built-in, pseudo, and
689
- `scope:` roles are excluded; projects with no custom roles emit
690
- byte-identical output.
691
-
692
- ### snake_case tables: dropped record actions and broken helpers fixed
693
-
694
- Two fixes for tables declared with snake_case names (`event_notes`):
695
-
696
- - The generated `.quickback/define-action.ts` helpers imported the camelCase
697
- identifier while the generated alias file exports the verbatim declared
698
- name (`export { event_notes }`) — a TS2724 compile failure for any
699
- snake_case table with action files. The helpers now import the real export
700
- aliased to the camelCase local.
701
- - Record actions on a snake-declared table living in a kebab-named feature
702
- file (`event-notes/actions/pin.ts`) were not emitted — missing from both
703
- the generated routes and OpenAPI. They now emit and document consistently.
704
-
705
- If you have snake_case tables with record actions, recompiling **adds routes
706
- that previously didn't exist** — review the new surface.
707
-
708
- ### First-class MCP OAuth config: `auth.oauth`
709
-
710
- The OAuth 2.1 surface behind `agents.mcp.requireAuth` (v0.42.0) gains a
711
- first-class config block — env-resolvable issuer / login / consent URLs,
712
- scopes, RFC 8707 audiences, and a dynamic-client-registration toggle:
713
-
714
- ```ts
715
- auth: defineAuth("better-auth", {
716
- oauth: {
717
- enabled: true,
718
- issuerUrl: { env: "OAUTH_ISSUER_URL", fallback: "http://localhost:8787/auth/v1" },
719
- loginPage: { env: "OAUTH_LOGIN_URL", fallback: "http://localhost:8787/account/login" },
720
- consentPage: { env: "OAUTH_CONSENT_URL", fallback: "http://localhost:8787/account/consent" },
721
- scopes: ["openid", "profile", "email", "offline_access"],
722
- audiences: [{ env: "OAUTH_MCP_AUDIENCE", fallback: "http://localhost:8787/mcp" }],
723
- allowDynamicClientRegistration: true,
724
- },
725
- }),
726
- ```
727
-
728
- Setting it auto-enables the `oauthProvider`, `jwt`, and `bearer` plugins,
729
- emits the RFC 8414 / RFC 9728 discovery documents, and accepts the
730
- provider's JWKS-signed access tokens in the standard auth middleware. A new
731
- project hook, `quickback/hooks/resolve-oauth-context.ts`, lets you derive
732
- tenant fields (`activeOrgId` / `activeTeamId` / roles) from the validated
733
- OAuth identity. On Neon, the auth schema is now owned by the Better Auth CLI
734
- end to end (the compiler no longer emits its placeholder `src/auth/schema.ts`
735
- or `src/lib/neon.ts`). See
736
- [OAuth Provider (MCP-ready)](/platform/auth/plugins#oauth-provider-mcp-ready)
737
- and [Auth Hooks](/ui/account/hooks#oauth-context-resolver).
738
-
739
- ### Neon RLS covers force-enabled plugin tables
740
-
741
- On Neon, row-level-security policies are generated for the Better Auth
742
- tables. The list of tables receiving policies was derived from your declared
743
- auth config and didn't account for plugins the compiler force-enables
744
- automatically — so some auth-owned tables could be created without RLS
745
- policies. The list now derives from the fully resolved plugin set, so every
746
- generated auth table receives appropriate policies (self-scoped where there
747
- is a clear owner, service-role-only otherwise — fail closed). The RLS
748
- migration is content-addressed, so the update arrives as a new journaled
749
- entry on the next recompile + `db:migrate`. **Neon projects should recompile
750
- and run `db:migrate`.**
751
-
752
- ### New compile reports: operations + conformance manifests
753
-
754
- Every compile now writes two machine-readable reports next to
755
- `openapi.json`:
756
-
757
- - **`reports/operations.manifest.json`** — a stable, sorted index of every
758
- operation: `{ operationId, method, path, auth, feature, kind }`, covering
759
- the resource, action, view, auth, realtime, storage, and FGA surfaces. An
760
- extend-only public contract — the recommended integration point for
761
- scripting against the generated surface.
762
- - **`reports/conformance.manifest.json`** — for each route × principal
763
- class, the expected outcome (allow / 401 / 403 / cross-tenant miss …),
764
- derived from the same IR the emitters consume. This is the artifact the
765
- conformance fixes above were found and verified against.
766
-
767
- The OpenAPI generator itself now reads the same IR as the route emitters, so
768
- the spec follows the emitted surface by construction — including four
769
- accuracy fixes: `PUT /{id}` is documented only when actually enabled, the
770
- batch surface documents the emitter's auto-promotion + access inheritance,
771
- and views document their effective (view-level, falling back to read-level)
772
- access. See
773
- [Operations manifest](/api/openapi#operations-manifest).
774
-
775
- ## v0.45.0 — June 9, 2026
776
-
777
- ### `auth.jwt.revocationCheck: 'kv'` — sub-TTL JWT revocation
778
-
779
- The JWT fast-path trusts signed claims for their full lifetime — that's what
780
- makes it a fast-path. Until now the only revocation bounds were the TTL
781
- (plain claims) and the carry-forward cap (scope claims, v0.44.0). The
782
- long-promised `'kv'` mode is now real on the **Cloudflare runtime**:
783
-
784
- ```ts
785
- auth: { jwt: { revocationCheck: 'kv' } }
786
- ```
787
-
788
- - **Per-principal revocation timestamps, not per-token denylists.** A
789
- revocation event writes "everything for this principal minted before now is
790
- dead" to the project's **existing `KV` binding** (keys prefixed `qbrev:`) —
791
- nothing extra to provision. Entries self-expire after the maximum token
792
- lifetime, so the store never accumulates.
793
- - **The bearer fast-path checks before trusting.** A verified token whose
794
- `iat` (or `sct`, for the relationship-scope claim) predates the stored
795
- timestamp is rejected and falls through to session auth, which re-checks
796
- membership and re-mints — an active legitimate session recovers
797
- transparently. Costs 2+ edge-cached KV reads per bearer verify; the
798
- explicit trade the opt-in buys.
799
- - **Written automatically where revocation actually happens:** org-member
800
- removal and role change (Better Auth `organizationHooks`), and
801
- UPDATE/DELETE of scope-conferring relationship rows — through the same
802
- audit-wrapper write chokepoint Live Views uses, plus the single DELETE
803
- route (which has the row in hand but no `.returning()`). Revoke-on-touch:
804
- a false positive just forces a cheap re-prove.
805
- - **User bans flip automatically.** The Better Auth admin plugin's ban lands
806
- as a user-row update, so a generated `databaseHooks.user.update.after` hook
807
- stamps the user-level revocation the moment `banned` flips — every
808
- outstanding JWT dies on its next use, and the cookie/session path already
809
- rejects banned sessions, completing the lockout. When outbound webhooks are
810
- configured, the same hook emits a `user.banned` event so subscribed
811
- endpoints are notified.
812
- - **App-code helpers** for everything else: `src/lib/jwt-revocation.ts`
813
- exports `revokeUserTokens` / `revokeMemberTokens` / `revokeScopeTokens`
814
- (e.g. call `revokeUserTokens` from a custom revoke-all flow).
815
- - **Fails open.** A KV outage degrades revocation to the TTL /
816
- carry-forward-cap bound — it never locks every bearer out.
817
-
818
- Bun/Node + `'kv'` fails at compile time with a clear message (the store rides
819
- the Cloudflare KV binding; those runtimes own immediate-revoke via the
820
- cookie/session path). Default remains `'none'`; without the flag the emitted
821
- middleware is byte-identical to v0.44.0.
822
-
823
- ### Neon: `npm run db:migrate` now applies the RLS layer
824
-
825
- The RLS SQL (helper functions, policies, triggers) used to be emitted as
826
- orphaned `drizzle/migrations/0099–0102` files that no tool ever applied —
827
- `db:migrate` ran the schema migrations and silently skipped the security
828
- layer. The RLS document now rides the journaled drizzle set in
829
- `quickback/drizzle/` as a content-addressed migration
830
- (`<idx>_quickback_rls_<hash>`), so one `npm run db:migrate` applies schema
831
- **and** security, in dependency order. The migration is idempotent
832
- (`DROP POLICY IF EXISTS` + re-create), so it converges over databases where
833
- the old files were applied by hand; an unchanged security config appends
834
- nothing (the journal stays byte-stable across recompiles), and a changed one
835
- appends a new content-addressed entry — append-only, like every other
836
- migration. Existing Neon projects: recompile + `db:migrate`, nothing breaks.
837
-
838
- ### Neon: `user_sessions` is real, and the SQL layer speaks TEXT ids
839
-
840
- `get_active_org_id()` — the helper every org-scoped RLS policy reads — was
841
- querying a `public.user_sessions` table that **no migration created**, and
842
- the helper layer was typed `uuid` against Better Auth's TEXT ids
843
- (`org_abc123`), which would throw on first contact. Now:
844
-
845
- - `user_sessions` is compiler-owned migration state
846
- (`src/db/rls-support.schema.ts`), created by the normal journaled flow
847
- with a FK to the users table — outside `src/auth/schema.ts`, which the
848
- Better Auth CLI rewrites.
849
- - Generated Better Auth session hooks mirror the session's active
850
- organization (and team, in teams mode) into it on create/update.
851
- Switching to "no org" nulls it through — SQL-side access revokes, fail
852
- closed.
853
- - The RLS helper layer (`get_active_org_id`, `get_active_team_id`,
854
- `is_owner`, the audit helpers) is TEXT-typed to match Better Auth ids.
855
- - Policies for Better Auth's own tables use the plural physical names the
856
- BA CLI actually generates on Neon, and BA tables no longer get Quickback
857
- audit triggers for columns they don't have.
858
-
859
- ### Hard deletes wire into the audit pipeline correctly
860
-
861
- Two codegen bugs around `delete: { mode: 'hard' }`:
862
-
863
- - Firewall auto-detection emitted an `isNull(deletedAt)` predicate for
864
- tables with no soft-delete column — every read on a hard-delete table
865
- referenced a column that doesn't exist.
866
- - Hard-delete routes import the `logHardDelete` audit helper, but the helper
867
- file was only emitted when the project also had unsafe or `PUBLIC` actions
868
- — a project with hard deletes and neither failed at deploy time. Hard
869
- deletes are now a first-class trigger of the security-audit pipeline
870
- (helper file, `AUDIT_DB` binding, env types, audit migration); on D1 that
871
- means [`auditDatabaseId`](/configure/providers) is required, and the
872
- compile error says so.
873
-
874
- ### Generated output is now typechecked — with the first crop of fixes
875
-
876
- Every compiler change now compiles a matrix of fixture projects and runs
877
- `tsc` + `wrangler deploy --dry-run` against the **generated output** — the
878
- class of bug where the compiler emits syntactically valid TypeScript that
879
- fails downstream. The first runs caught real ones, all fixed here:
880
-
881
- - **Neon:** `src/db/org.schema.ts` re-exported tables that don't exist after
882
- the Better Auth CLI's plural rewrite; a missing `AuthDatabase` type
883
- export; transaction callbacks typed bare `(tx)` failing `noImplicitAny`;
884
- the auth middleware's member-table fallback hardcoded the singular name.
885
- - **Embeddings:** the queue consumer's `Ai.run` result and the optional
886
- `EMBEDDINGS_QUEUE` binding both failed strict checks — the route now
887
- returns a structured `503` when the producer binding is missing instead
888
- of crashing.
889
- - **snake_case relationship tables:** relationship/arrow emitters imported
890
- the camelCase identifier where the generated file exports the verbatim
891
- table name (`export { event_guests }`) — TS2724 for any snake_case
892
- relationship table. Imports now alias the real export
893
- (`event_guests as eventGuests`).
894
-
895
- ## v0.44.0 — June 9, 2026
896
-
897
- ### Scope carry-forward is now bounded (revocation fix)
898
-
899
- The auth middleware's rolling refresh re-signs a verified `scope` claim on
900
- every authed call without re-probing the relationship — that's what lets a
901
- scoped session ride past the short JWT TTL with zero per-request DB cost. But
902
- unbounded, it defeated the revocation model the docs promised: a removed
903
- guest/staff who kept polling got a fresh TTL on every request, so "removal
904
- takes effect within one TTL" only held for *idle* clients, and the refresh
905
- also bypassed the ≤180s scope-token ceiling (it re-signed with the raw
906
- `auth.jwt.expiresIn`).
907
-
908
- Scope tokens now carry a proof timestamp (`sct`), stamped exclusively by the
909
- proven mint sites (`POST /scope/v1/enter` and the namespace resolver, via the
910
- shared mint helper). The rolling refresh:
911
-
912
- - **refuses once the claim's proof is older than the carry-forward cap
913
- (15 minutes)** — past it, the token expires within one TTL and the client
914
- re-proves via `enter` or any minting namespace route, which won't re-mint a
915
- revoked role. Worst-case post-revocation window for an active client:
916
- **cap + one TTL** from the last real proof, instead of unbounded.
917
- - **carries `sct` forward verbatim** — the refresh can never restart the
918
- window without an actual relationship probe. Claims without `sct`
919
- (pre-0.44 tokens) fail closed and simply stop refreshing.
920
- - **signs through the same ≤180s ceiling as the mint sites** — an
921
- `auth.jwt.expiresIn` above the ceiling no longer leaks into scope-bearing
922
- tokens via the refresh path.
923
-
924
- No client changes needed: tokens renew exactly as before inside the window,
925
- and re-entering is the existing flow. For tables where even the capped window
926
- is too wide, gate with a `via` arm (live relationship subquery per request)
927
- instead of a bare `ctx.scope.<kind>` arm; immediate revocation
928
- (`auth.jwt.revocationCheck: 'kv'`) remains on the roadmap.
929
-
930
- ## v0.43.0 — June 4, 2026
931
-
932
- ### Better Auth 1.6
933
-
934
- Generated projects are now pinned to Better Auth **1.6**. The `agents.mcp.requireAuth` work in 0.42.0 surfaced a long-standing version drift: the compiler emitted `better-auth: ^1.5.0`, but `@better-auth/oauth-provider` resolves a tree that requires `@better-auth/core ^1.6.14` and imports `@better-auth/core/utils/host` + `/redirect-uri` — subpaths that only exist in 1.6.x. The result was a `wrangler deploy` that failed at bundle time with `Could not resolve …` and never uploaded.
935
-
936
- This release aligns the **entire** Better Auth dependency set to a coherent 1.6.9 floor so npm resolves one consistent tree:
937
-
938
- - `better-auth`, `@better-auth/drizzle-adapter`, `@better-auth/api-key`, `@better-auth/passkey`, `@better-auth/oauth-provider` → `^1.6.9` (generated projects, the baked Docker deps, and the bundled CMS/Account SPAs).
939
- - Added an explicit `kysely ^0.28.16` pin: Better Auth 1.6's migrator imports `DEFAULT_MIGRATION_TABLE` / `DEFAULT_MIGRATION_LOCK_TABLE` from kysely but doesn't *declare* kysely, so the Worker bundle needs it pinned directly.
940
-
941
- No code migration was required — Quickback already uses `@better-auth/oauth-provider` (not the now-deprecated OIDC Provider plugin), and emits no `freshAge`/SAML usage affected by 1.6's behavioral changes. Verified end to end: a `requireAuth` project and a normal project both `npm install` a clean 1.6.14 tree and bundle with `wrangler deploy --dry-run` with zero resolution errors.
942
-
943
- ### Larger migration histories no longer hit the upload ceiling
944
-
945
- Long-lived projects accumulate one full-schema drizzle snapshot per migration, and the whole cumulative meta payload (snapshots + journals + `.sql`, across both the auth and features dirs) is re-sent on **every** compile — even a no-schema-change one. Projects with deep migration histories were hitting the compiler's `existingFiles` size limit and failing to compile, with no schema drift and nothing to fix on their end.
946
-
947
- The server-side ceilings are raised so this is no longer the binding constraint:
948
-
949
- - `existingFiles` payload: **4 MiB → 16 MiB**
950
- - total request body: **8 MiB → 32 MiB** (kept above the per-category limits so it doesn't trip first)
951
-
952
- This is enforced entirely on the compiler, so no CLI upgrade is needed — the new headroom applies as soon as `compiler.quickback.dev` is on this release.
953
-
954
- ### Custom response headers (`security.headers`)
955
-
956
- The generated Worker emitted a fixed set of security headers (CSP, HSTS,
957
- `X-Content-Type-Options`, …) with no supported way to add your own — teams that
958
- wanted, say, an `X-Server-Version` build stamp on every response had to
959
- post-patch the generated middleware after each compile.
960
-
961
- New `security.headers` sets arbitrary response headers natively. Values are
962
- static strings or templates interpolating per-deploy Worker env vars via the
963
- `{{env.VAR_NAME}}` token:
964
-
965
- ```ts
966
- security: {
967
- headers: {
968
- // Both vars must be set, or the header is omitted entirely.
969
- 'X-Server-Version': '{{env.SERVER_VERSION}}+{{env.SERVER_BUILD}}',
970
- 'X-Powered-By': 'Quickback',
971
- },
972
- }
973
- ```
974
-
975
- - **Omit-if-unset** — a header that references env vars is emitted only when
976
- *every* referenced var is set (non-empty) at runtime. A Worker that forgot to
977
- inject the var emits no header, never `X-Server-Version: undefined`. Static
978
- headers are always emitted.
979
- - The value is read from `c.env` per request, so it picks up whatever Worker
980
- var is injected at deploy time — nothing is baked at compile time.
981
- - **Managed headers are rejected** — names owned by a dedicated `security` field
982
- (CSP, HSTS, `X-Frame-Options`, `Referrer-Policy`, …) error at compile so the
983
- two emitters can't race. Malformed `{{env…}}` tokens error too, rather than
984
- leaking literal braces into the wire header.
985
-
986
- Survives a clean `quickback compile` with no post-processing. See
987
- [Security Headers → Custom response headers](/configure/security#custom-response-headers).
988
-
989
- ## v0.42.0 — June 4, 2026
990
-
991
- ### Interactive OAuth for the generated MCP server
992
-
993
- MCP connectors (Claude, Cursor, …) could only connect to a generated `/mcp`
994
- endpoint **anonymously** — they never launched a sign-in flow, so auth-gated
995
- tools stayed invisible. The OAuth machinery was already present (Better Auth's
996
- `oauth-provider` ships `/oauth2/authorize`, `/token`, `/register` + PKCE under
997
- `/auth/v1`); the compiler just never let a connector discover or trigger it.
998
-
999
- New `agents.mcp.requireAuth` makes the MCP surface authenticated-only:
1000
-
1001
- ```ts
1002
- agents: { mcp: { requireAuth: true } },
1003
- ```
1004
-
1005
- When enabled, the compiler:
1006
-
1007
- - **Challenges unauthenticated `/mcp`** with `401` + `WWW-Authenticate: Bearer
1008
- resource_metadata="…"` ([RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728) §5.1) — the signal connectors use to start OAuth.
1009
- - **Force-enables `oauthProvider` + `bearer`**, so `/oauth2/authorize`, `/token`,
1010
- and `/register` ([RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591) dynamic client registration) exist with PKCE.
1011
- - **Delegates `/.well-known/oauth-authorization-server`** to Better Auth's real
1012
- metadata instead of a hand-rolled stub that advertised a non-existent
1013
- authorization endpoint.
1014
- - Adds the `<origin>/mcp` resource to `validAudiences`
1015
- ([RFC 8707](https://datatracker.ietf.org/doc/html/rfc8707)) so the connector's access token isn't rejected.
1016
-
1017
- Login and consent are served by your Account SPA, so users authenticate with
1018
- whatever methods you already enabled. Default is unchanged (anonymous public
1019
- tools); set `requireAuth: true` for servers meant for authenticated users.
1020
-
1021
- ## v0.40.2 — June 3, 2026
1022
-
1023
- ### Passwordless plugins can no longer bypass the signup gate
1024
-
1025
- Better Auth's `emailOtp` and `magicLink` plugins auto-create an account when a
1026
- code/link is verified for an unknown email — and that path is independent of
1027
- `emailAndPassword.disableSignUp`. As a result, `account.auth.signup: false`
1028
- closed `POST /auth/v1/sign-up/email` but left OTP / magic-link verification as an
1029
- open back-door for account creation.
1030
-
1031
- The compiler now emits each plugin's own `disableSignUp` flag, and new
1032
- per-plugin options expose it directly:
1033
-
1034
- ```ts
1035
- auth: defineAuth("better-auth", {
1036
- emailAndPassword: { enabled: true },
1037
- plugins: {
1038
- emailOtp: { disableSignUp: true }, // OTP sign-in only; unknown emails rejected
1039
- magicLink: { disableSignUp: true }, // same for magic links
1040
- },
1041
- }),
1042
- ```
1043
-
1044
- Both default to following the global gate: setting `account.auth.signup: false`
1045
- (→ `emailAndPassword.disableSignUp: true`) now also gates the OTP and magic-link
1046
- paths automatically. Set `{ disableSignUp: false }` on a plugin explicitly to
1047
- keep its sign-up open while password sign-up stays closed.
1048
-
1049
- ## v0.40.1 — June 2, 2026
1050
-
1051
- - The generated `wrangler.toml` and `Env` type now emit the `ASSETS` binding
1052
- type for projects that mount SPAs (CMS / Account), so handler code that
1053
- references `c.env.ASSETS` typechecks.
1054
- - Compiler Docker builds preserve their layer cache across rebuilds, cutting
1055
- local recompile time.
1056
-
1057
- ## v0.40.0 — June 2, 2026
1058
-
1059
- R2 file storage is now **presign-only by default**. Adding
1060
- `defineFileStorage("cloudflare-r2")` emits just the `ctx.storage` signer — no
1061
- FILES_DB database, no `/storage/v1/*` endpoints, no files worker. You sign
1062
- presigned URLs against a bucket and store references in your own table. The
1063
- turnkey managed subsystem is still available, now behind `managed: true`.
1064
-
1065
- This decouples the lightweight primitive from the heavyweight subsystem so you
1066
- can add uploads without standing up a metadata database you don't use.
1067
-
1068
- ### Presign-only by default; managed is opt-in
1069
-
1070
- ```ts
1071
- // Presign-only (default) — ctx.storage against a bucket, nothing else
1072
- defineFileStorage("cloudflare-r2", { bucketName: "my-app-media" })
1073
-
1074
- // Managed subsystem — FILES_DB + /storage/v1/* + files worker
1075
- defineFileStorage("cloudflare-r2", { managed: true })
1076
- ```
1077
-
1078
- - New projects can omit `bucketName` — it defaults to `<project>-media`, so
1079
- setup is one `wrangler r2 bucket create` plus the R2 API-token secrets.
1080
- - Existing projects set `bucketName` to a bucket they already have. Presign-only
1081
- emits **no** R2 bucket binding and **no** FILES_DB binding — nothing to
1082
- provision, nothing to migrate.
1083
-
1084
- ### Per-call bucket + custom secret names
1085
-
1086
- ```ts
1087
- // Sign against a different bucket than the configured default
1088
- await storage.signPutUrl(key, { bucket: "my-app-public", contentType });
1089
- ```
1090
-
1091
- If your project already stores R2 credentials under different env-var names,
1092
- map them so the signer reads yours:
1093
-
1094
- ```ts
1095
- defineFileStorage("cloudflare-r2", {
1096
- bucketName: "my-app-media",
1097
- presign: { accountIdEnv: "CF_ACCOUNT_ID", accessKeyIdEnv: "S3_KEY", secretAccessKeyEnv: "S3_SECRET" },
1098
- })
1099
- ```
1100
-
1101
- ### Fixes
1102
-
1103
- - `maxFileSize` now accepts a human string (`"100mb"`, `"5gb"`) as well as a
1104
- number of bytes — previously a string emitted invalid TypeScript.
1105
- - Presign-only no longer emits a stray `FILES_DB` `[[d1_databases]]` block (with
1106
- an invalid `database_id = "local-files"`) into `wrangler.toml`, which would
1107
- have made `wrangler deploy` reject the worker.
1108
-