@quickback-dev/cli 0.65.1 → 0.66.0
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 +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +13 -0
- package/dist/commands/compile.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/action-harvest.d.ts.map +1 -1
- package/dist/lib/action-harvest.js +14 -6
- package/dist/lib/action-harvest.js.map +1 -1
- package/dist/lib/action-harvest.test.js +26 -0
- package/dist/lib/action-harvest.test.js.map +1 -1
- package/dist/lib/migrations/drizzle.d.ts.map +1 -1
- package/dist/lib/migrations/drizzle.js +6 -1
- package/dist/lib/migrations/drizzle.js.map +1 -1
- package/dist/lib/migrations/drizzle.test.js +3 -0
- package/dist/lib/migrations/drizzle.test.js.map +1 -1
- package/dist/skill/docs/api/batch-operations.md +1 -1
- package/dist/skill/docs/api/crud.md +1 -1
- package/dist/skill/docs/api/index.md +1 -1
- package/dist/skill/docs/api/query-params.md +5 -8
- package/dist/skill/docs/changelog/index.md +79 -1
- package/dist/skill/docs/configure/auth.md +20 -12
- package/dist/skill/docs/configure/index.md +16 -27
- package/dist/skill/docs/configure/providers.md +1 -1
- package/dist/skill/docs/define/actions/defining.md +2 -2
- package/dist/skill/docs/define/actions/record-and-standalone.md +1 -1
- package/dist/skill/docs/define/actions/scoped-db.md +1 -1
- package/dist/skill/docs/define/changesets.md +7 -8
- package/dist/skill/docs/define/feature.md +0 -1
- package/dist/skill/docs/define/read.md +2 -2
- package/dist/skill/docs/platform/api-contract/index.md +52 -42
- package/dist/skill/docs/platform/auth/jwt-optimization.md +1 -1
- package/dist/skill/docs/platform/database/neon.md +1 -1
- package/dist/skill/docs/platform/realtime/durable-objects.md +69 -36
- package/dist/skill/docs/platform/realtime/index.md +8 -10
- package/dist/skill/docs/platform/realtime/named-invalidations.md +23 -9
- package/dist/skill/docs/platform/realtime/using-realtime.md +58 -34
- package/dist/skill/docs/platform/webhooks/outbound.md +4 -5
- package/dist/skill/docs/tooling/output.md +1 -1
- package/dist/skill/docs/ui/account/hooks.md +0 -1
- package/package.json +1 -1
- package/src/skill/docs/api/batch-operations.md +1 -1
- package/src/skill/docs/api/crud.md +1 -1
- package/src/skill/docs/api/index.md +1 -1
- package/src/skill/docs/api/query-params.md +5 -8
- package/src/skill/docs/changelog/index.md +79 -1
- package/src/skill/docs/configure/auth.md +20 -12
- package/src/skill/docs/configure/index.md +16 -27
- package/src/skill/docs/configure/providers.md +1 -1
- package/src/skill/docs/define/actions/defining.md +2 -2
- package/src/skill/docs/define/actions/record-and-standalone.md +1 -1
- package/src/skill/docs/define/actions/scoped-db.md +1 -1
- package/src/skill/docs/define/changesets.md +7 -8
- package/src/skill/docs/define/feature.md +0 -1
- package/src/skill/docs/define/read.md +2 -2
- package/src/skill/docs/platform/api-contract/index.md +52 -42
- package/src/skill/docs/platform/auth/jwt-optimization.md +1 -1
- package/src/skill/docs/platform/database/neon.md +1 -1
- package/src/skill/docs/platform/realtime/durable-objects.md +69 -36
- package/src/skill/docs/platform/realtime/index.md +8 -10
- package/src/skill/docs/platform/realtime/named-invalidations.md +23 -9
- package/src/skill/docs/platform/realtime/using-realtime.md +58 -34
- package/src/skill/docs/platform/webhooks/outbound.md +4 -5
- package/src/skill/docs/tooling/output.md +1 -1
- package/src/skill/docs/ui/account/hooks.md +0 -1
|
@@ -212,16 +212,20 @@ await realtime.insert('applications', {
|
|
|
212
212
|
Broadcasts:
|
|
213
213
|
```json
|
|
214
214
|
{
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
215
|
+
"specversion": "1.0",
|
|
216
|
+
"id": "evt_…",
|
|
217
|
+
"source": "/broadcast/v1/websocket",
|
|
218
|
+
"type": "dev.quickback.myapp.applications.insert",
|
|
219
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
220
|
+
"datacontenttype": "application/json",
|
|
221
|
+
"qbframe": "postgres_changes",
|
|
222
|
+
"data": {
|
|
223
|
+
"table": "applications",
|
|
224
|
+
"schema": "public",
|
|
225
|
+
"eventType": "INSERT",
|
|
226
|
+
"new": { "id": "app_123", "candidateId": "cnd_456", "stage": "applied" },
|
|
227
|
+
"old": null
|
|
228
|
+
}
|
|
225
229
|
}
|
|
226
230
|
```
|
|
227
231
|
|
|
@@ -238,12 +242,20 @@ await realtime.update('applications',
|
|
|
238
242
|
Broadcasts:
|
|
239
243
|
```json
|
|
240
244
|
{
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
245
|
+
"specversion": "1.0",
|
|
246
|
+
"id": "evt_…",
|
|
247
|
+
"source": "/broadcast/v1/websocket",
|
|
248
|
+
"type": "dev.quickback.myapp.applications.update",
|
|
249
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
250
|
+
"datacontenttype": "application/json",
|
|
251
|
+
"qbframe": "postgres_changes",
|
|
252
|
+
"data": {
|
|
253
|
+
"table": "applications",
|
|
254
|
+
"schema": "public",
|
|
255
|
+
"eventType": "UPDATE",
|
|
256
|
+
"new": { "id": "app_123", "stage": "interview" },
|
|
257
|
+
"old": { "id": "app_123", "stage": "screening" }
|
|
258
|
+
}
|
|
247
259
|
}
|
|
248
260
|
```
|
|
249
261
|
|
|
@@ -259,12 +271,20 @@ await realtime.delete('applications',
|
|
|
259
271
|
Broadcasts:
|
|
260
272
|
```json
|
|
261
273
|
{
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
"
|
|
274
|
+
"specversion": "1.0",
|
|
275
|
+
"id": "evt_…",
|
|
276
|
+
"source": "/broadcast/v1/websocket",
|
|
277
|
+
"type": "dev.quickback.myapp.applications.delete",
|
|
278
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
279
|
+
"datacontenttype": "application/json",
|
|
280
|
+
"qbframe": "postgres_changes",
|
|
281
|
+
"data": {
|
|
282
|
+
"table": "applications",
|
|
283
|
+
"schema": "public",
|
|
284
|
+
"eventType": "DELETE",
|
|
285
|
+
"new": null,
|
|
286
|
+
"old": { "id": "app_123" }
|
|
287
|
+
}
|
|
268
288
|
}
|
|
269
289
|
```
|
|
270
290
|
|
|
@@ -290,9 +310,14 @@ subscriber) or `['PUBLIC']`.
|
|
|
290
310
|
Broadcasts:
|
|
291
311
|
```json
|
|
292
312
|
{
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
313
|
+
"specversion": "1.0",
|
|
314
|
+
"id": "evt_…",
|
|
315
|
+
"source": "/broadcast/v1/websocket",
|
|
316
|
+
"type": "screening-complete",
|
|
317
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
318
|
+
"datacontenttype": "application/json",
|
|
319
|
+
"qbframe": "broadcast",
|
|
320
|
+
"data": {
|
|
296
321
|
"applicationId": "app_123",
|
|
297
322
|
"candidateId": "cnd_456",
|
|
298
323
|
"stage": "interview"
|
|
@@ -545,13 +570,16 @@ Tickets expire after 60 seconds, so fetch a fresh one before each connection or
|
|
|
545
570
|
|
|
546
571
|
### Handling Messages
|
|
547
572
|
|
|
573
|
+
Data frames are [CloudEvents 1.0 envelopes](/platform/realtime/using-realtime#cloudevents-envelopes).
|
|
574
|
+
Discriminate on `qbframe`, never on `type`, and read the body from `data`:
|
|
575
|
+
|
|
548
576
|
```typescript
|
|
549
577
|
ws.onmessage = (event) => {
|
|
550
578
|
const msg = JSON.parse(event.data);
|
|
551
579
|
|
|
552
580
|
// Handle CRUD events
|
|
553
|
-
if (msg.
|
|
554
|
-
const { table, eventType, new: newRecord, old: oldRecord } = msg;
|
|
581
|
+
if (msg.qbframe === 'postgres_changes') {
|
|
582
|
+
const { table, eventType, new: newRecord, old: oldRecord } = msg.data;
|
|
555
583
|
|
|
556
584
|
if (eventType === 'INSERT') {
|
|
557
585
|
addRecord(table, newRecord);
|
|
@@ -562,9 +590,10 @@ ws.onmessage = (event) => {
|
|
|
562
590
|
}
|
|
563
591
|
}
|
|
564
592
|
|
|
565
|
-
// Handle custom broadcasts
|
|
566
|
-
if (msg.
|
|
567
|
-
const
|
|
593
|
+
// Handle custom broadcasts — `type` is your wire name verbatim.
|
|
594
|
+
if (msg.qbframe === 'broadcast') {
|
|
595
|
+
const event = msg.type;
|
|
596
|
+
const payload = msg.data;
|
|
568
597
|
|
|
569
598
|
if (event === 'screening-complete') {
|
|
570
599
|
refreshApplication(payload.applicationId);
|
|
@@ -715,15 +744,19 @@ export const execute: ActionExecutor = async ({ ctx, input }) => {
|
|
|
715
744
|
|
|
716
745
|
### Event Format
|
|
717
746
|
|
|
718
|
-
Custom namespace events
|
|
747
|
+
Custom namespace events carry `qbframe: "broadcast"`; the namespaced event
|
|
748
|
+
name is the CloudEvents `type`, verbatim:
|
|
719
749
|
|
|
720
750
|
```json
|
|
721
751
|
{
|
|
722
|
-
"
|
|
723
|
-
"
|
|
724
|
-
"
|
|
725
|
-
|
|
726
|
-
|
|
752
|
+
"specversion": "1.0",
|
|
753
|
+
"id": "evt_…",
|
|
754
|
+
"source": "/broadcast/v1/websocket",
|
|
755
|
+
"type": "screening:started",
|
|
756
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
757
|
+
"datacontenttype": "application/json",
|
|
758
|
+
"qbframe": "broadcast",
|
|
759
|
+
"data": { "applicationId": "app_123" }
|
|
727
760
|
}
|
|
728
761
|
```
|
|
729
762
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Quickback ships **two parallel realtime primitives**, both backed by Cloudflare Durable Objects:
|
|
4
4
|
|
|
5
|
-
- **`/broadcast/v1/*` — server fan-out.** One DO instance per subscription scope. Postgres-changes events from CRUD routes plus custom broadcast events flow out to every subscriber, with role filtering and per-role field masking applied. Best for "tell every client in this shared scope that something changed." The scope can be an organization, a specific user, or a compiler-resolved resource key like `events:evt_123`. The `/broadcast/v1` version segment tracks `contract.routes` — set it to `"v2"` and the same surface mounts at `/broadcast/v2` (no hidden v1 alias).
|
|
5
|
+
- **`/broadcast/v1/*` — server fan-out.** One DO instance per subscription scope. Postgres-changes events from CRUD routes plus custom broadcast events flow out to every subscriber, with role filtering and per-role field masking applied. Best for "tell every client in this shared scope that something changed." The scope can be an organization, a specific user, or a compiler-resolved resource key like `events:evt_123`. The `/broadcast/v1` version segment tracks `contract.routes` — set it to `"v2"` and the same surface mounts at `/broadcast/v2` (no hidden v1 alias). Framing is independent of the path: frames are [CloudEvents 1.0](/platform/realtime/using-realtime#cloudevents-envelopes) envelopes regardless of which prefix you serve them on. Documented on this page. For **typed, targeted "this changed — refresh" signals** fired from an action after commit (with optional per-recipient narrowing), see [Named invalidations](/platform/realtime/named-invalidations).
|
|
6
6
|
- **`/realtime/<binding>/<room-id>` — bidirectional rooms.** One DO instance per room (per document, per interview, per game). Client↔client messages, presence, and CRDT-friendly state. Use these for collaborative editing. See [PartyServer rooms](/platform/realtime/partyserver-rooms).
|
|
7
7
|
|
|
8
8
|
Both share the same auth model and ride on the same compiled worker; they solve different problems.
|
|
@@ -194,20 +194,18 @@ There are **three declarative emission surfaces** — pick by what did the write
|
|
|
194
194
|
| A custom action | **`invalidates:`** on the action | [Named invalidations](/platform/realtime/named-invalidations) |
|
|
195
195
|
| An [aggregate changeset](/define/changesets) (`owns`) | **`afterCommit`** on the aggregate root — one CloudEvent after commit | [changesets → afterCommit](/define/changesets#aftercommit--emit-a-realtime-signal-after-the-changeset-commits) |
|
|
196
196
|
|
|
197
|
-
## CloudEvents
|
|
197
|
+
## CloudEvents + AsyncAPI
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
[Using Realtime](/platform/realtime/using-realtime#cloudevents-envelopes
|
|
199
|
+
Realtime data frames are delivered as CloudEvents 1.0 envelopes (control
|
|
200
|
+
frames stay raw), on whatever path `contract.routes` mounts. Match frames on
|
|
201
|
+
the `qbframe` extension, never on `type`. See
|
|
202
|
+
[Using Realtime](/platform/realtime/using-realtime#cloudevents-envelopes)
|
|
203
203
|
for the frame mapping.
|
|
204
204
|
|
|
205
205
|
The project's event surface — realtime channels, named-invalidation events,
|
|
206
206
|
and outbound webhook messages — is published as an AsyncAPI 3.0 document at
|
|
207
|
-
`GET /asyncapi.json` (same auth gating as `/openapi.json`)
|
|
208
|
-
|
|
209
|
-
or webhooks (v1 included); only the message payload *schemas* are shaped by
|
|
210
|
-
the pinned contract — raw frames on v1, CloudEvents envelopes on v2.
|
|
207
|
+
`GET /asyncapi.json` (same auth gating as `/openapi.json`), for any project
|
|
208
|
+
with realtime or webhooks.
|
|
211
209
|
|
|
212
210
|
## Realtime emit from actions
|
|
213
211
|
|
|
@@ -32,7 +32,7 @@ export const attendRealtime = defineRealtime({
|
|
|
32
32
|
events: {
|
|
33
33
|
mobileBundleChanged: {
|
|
34
34
|
wireName: "event.mobile-bundle.changed", // clients listen for this
|
|
35
|
-
version: 1, //
|
|
35
|
+
version: 1, // event version (rides as qbversion)
|
|
36
36
|
variants: {
|
|
37
37
|
documentCreated: {
|
|
38
38
|
reason: "document.created", // clients branch on this
|
|
@@ -121,26 +121,40 @@ Each `invalidate.<binding>.<variant>(payload)` call queues **one** after-commit
|
|
|
121
121
|
- **After-commit, best-effort.** Calls queue frames that fire only after `execute` returns successfully; a `throw` or a `dryRun` discards them (they ride the after-commit effects collector). A rolled-back batch record fires nothing.
|
|
122
122
|
- **Fail-closed targeting.** An unresolvable scope room or a missing recipient set delivers to nobody — never a broad fan-out.
|
|
123
123
|
- **Projection.** The frame payload is projected to the variant's declared keys; undeclared fields never reach the wire.
|
|
124
|
-
- **Contract fields.** `version` and `reason` are baked from the registry and always present.
|
|
124
|
+
- **Contract fields.** `version` and `reason` are baked from the registry and always present, riding as the `qbversion` / `qbreason` CloudEvents extensions.
|
|
125
125
|
|
|
126
126
|
## The wire frame
|
|
127
127
|
|
|
128
|
-
Clients receive a
|
|
128
|
+
Clients receive a [CloudEvents 1.0](/platform/realtime/using-realtime#cloudevents-envelopes)
|
|
129
|
+
frame on `/broadcast/v{n}` (the segment tracks `contract.routes`):
|
|
129
130
|
|
|
130
131
|
```jsonc
|
|
131
132
|
{
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
"specversion": "1.0",
|
|
134
|
+
"id": "evt_9f2…",
|
|
135
|
+
"source": "/broadcast/v1/websocket",
|
|
136
|
+
"type": "event.mobile-bundle.changed", // the wireName, VERBATIM
|
|
137
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
138
|
+
"datacontenttype": "application/json",
|
|
139
|
+
"qbframe": "broadcast", // the discriminator — match on this
|
|
140
|
+
"qbversion": 1, // event version → negotiation
|
|
141
|
+
"qbreason": "document.created", // what changed → what to refresh
|
|
142
|
+
"data": { // payload MINUS version/reason
|
|
137
143
|
"eventId": "evt_1",
|
|
138
144
|
"documentId": "doc_9"
|
|
139
145
|
}
|
|
140
146
|
}
|
|
141
147
|
```
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
`version` and `reason` ride as the `qbversion` / `qbreason` extension
|
|
150
|
+
attributes, not inside `data` — the projected payload keys are `data`'s only
|
|
151
|
+
contents. Your `wireName` is the `type` verbatim: author-supplied event names
|
|
152
|
+
are never reverse-DNS prefixed.
|
|
153
|
+
|
|
154
|
+
Match on `qbframe === "broadcast"` (never on `type`, whose shape is not a
|
|
155
|
+
stable contract), then dispatch on `type` for the wireName, use `qbversion` for
|
|
156
|
+
negotiation, and branch on `qbreason` to decide which query/cache to
|
|
157
|
+
invalidate. Role gating (`targetRoles`) and — when a recipient resolver is used — identity narrowing (`targetTags`) are applied by the Broadcaster before the frame reaches any socket; the client just receives the frames meant for it.
|
|
144
158
|
|
|
145
159
|
## Related
|
|
146
160
|
|
|
@@ -56,14 +56,16 @@ If the ticket is invalid or expired, the WebSocket upgrade is rejected with a 40
|
|
|
56
56
|
|
|
57
57
|
### CRUD Events
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Data frames are [CloudEvents 1.0 envelopes](#cloudevents-envelopes).
|
|
60
|
+
Discriminate on the `qbframe` extension — **never** on `type`, whose shape is
|
|
61
|
+
not a stable contract — and read the row from `data`:
|
|
60
62
|
|
|
61
63
|
```typescript
|
|
62
64
|
ws.onmessage = (event) => {
|
|
63
65
|
const msg = JSON.parse(event.data);
|
|
64
66
|
|
|
65
|
-
if (msg.
|
|
66
|
-
const { table, eventType, new: newRecord, old: oldRecord } = msg;
|
|
67
|
+
if (msg.qbframe === "postgres_changes") {
|
|
68
|
+
const { table, eventType, new: newRecord, old: oldRecord } = msg.data;
|
|
67
69
|
|
|
68
70
|
switch (eventType) {
|
|
69
71
|
case "INSERT":
|
|
@@ -84,12 +86,20 @@ ws.onmessage = (event) => {
|
|
|
84
86
|
|
|
85
87
|
```json
|
|
86
88
|
{
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
89
|
+
"specversion": "1.0",
|
|
90
|
+
"id": "evt_5b1c…",
|
|
91
|
+
"source": "/broadcast/v1/websocket",
|
|
92
|
+
"type": "dev.quickback.myapp.applications.insert",
|
|
93
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
94
|
+
"datacontenttype": "application/json",
|
|
95
|
+
"qbframe": "postgres_changes",
|
|
96
|
+
"data": {
|
|
97
|
+
"table": "applications",
|
|
98
|
+
"schema": "public",
|
|
99
|
+
"eventType": "INSERT",
|
|
100
|
+
"new": { "id": "app_123", "candidateId": "cnd_456", "stage": "interview" },
|
|
101
|
+
"old": null
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
```
|
|
95
105
|
|
|
@@ -97,11 +107,13 @@ For UPDATE events, both `new` and `old` are populated. For DELETE events, only `
|
|
|
97
107
|
|
|
98
108
|
### Custom Broadcasts
|
|
99
109
|
|
|
100
|
-
Custom events
|
|
110
|
+
Custom events carry `qbframe: "broadcast"`. Their `type` is your wire name
|
|
111
|
+
verbatim — author-supplied names are never prefixed:
|
|
101
112
|
|
|
102
113
|
```typescript
|
|
103
|
-
if (msg.
|
|
104
|
-
const
|
|
114
|
+
if (msg.qbframe === "broadcast") {
|
|
115
|
+
const event = msg.type;
|
|
116
|
+
const payload = msg.data;
|
|
105
117
|
|
|
106
118
|
if (event === "screening-complete") {
|
|
107
119
|
refreshApplication(payload.applicationId);
|
|
@@ -115,9 +127,14 @@ if (msg.type === "broadcast") {
|
|
|
115
127
|
|
|
116
128
|
```json
|
|
117
129
|
{
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
130
|
+
"specversion": "1.0",
|
|
131
|
+
"id": "evt_a71f…",
|
|
132
|
+
"source": "/broadcast/v1/websocket",
|
|
133
|
+
"type": "screening-complete",
|
|
134
|
+
"time": "2026-08-17T10:04:11.921Z",
|
|
135
|
+
"datacontenttype": "application/json",
|
|
136
|
+
"qbframe": "broadcast",
|
|
137
|
+
"data": {
|
|
121
138
|
"applicationId": "app_123",
|
|
122
139
|
"candidateId": "cnd_456",
|
|
123
140
|
"stage": "interview"
|
|
@@ -125,6 +142,9 @@ if (msg.type === "broadcast") {
|
|
|
125
142
|
}
|
|
126
143
|
```
|
|
127
144
|
|
|
145
|
+
`type` is your wire name verbatim — author-supplied event names are never
|
|
146
|
+
prefixed. Match on `qbframe`, not `type`.
|
|
147
|
+
|
|
128
148
|
Custom namespaces (from `defineRealtime()`) use the format `namespace:event` — e.g., `screening:started`, `screening:progress`.
|
|
129
149
|
|
|
130
150
|
## Security
|
|
@@ -212,26 +232,32 @@ tag = "v1"
|
|
|
212
232
|
new_classes = ["Broadcaster"]
|
|
213
233
|
```
|
|
214
234
|
|
|
215
|
-
## CloudEvents envelopes
|
|
235
|
+
## CloudEvents envelopes
|
|
216
236
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
`contract.routes` (so `/broadcast/v1` unless you also set `routes: "v2"`);
|
|
221
|
-
`version` changes only the frame format. Control frames (`pong`, `error`,
|
|
222
|
-
`reauth_ok`) stay raw on both versions, and pinned-v1 projects keep the raw
|
|
223
|
-
frames byte-identically.
|
|
237
|
+
Every **data frame** is wrapped in a [CloudEvents 1.0](https://cloudevents.io)
|
|
238
|
+
envelope at the Durable Object's send boundary. Control frames (`pong`,
|
|
239
|
+
`error`, `reauth_ok`) stay raw.
|
|
224
240
|
|
|
225
|
-
|
|
241
|
+
The endpoint path is independent of the framing — it tracks `contract.routes`,
|
|
242
|
+
so `/broadcast/v1` unless you set `routes: "v2"`. Frames are CloudEvents on
|
|
243
|
+
either path.
|
|
244
|
+
|
|
245
|
+
| Frame | CloudEvents `type` | `data` | extensions |
|
|
226
246
|
|---|---|---|---|
|
|
227
247
|
| `broadcast` (named invalidation) | the wire name verbatim | payload minus `version`/`reason` | `qbframe: "broadcast"`, `qbversion`, `qbreason` |
|
|
228
|
-
| `postgres_changes` |
|
|
229
|
-
| `view_changes` |
|
|
248
|
+
| `postgres_changes` | `dev.quickback.<project>.<table>.<insert\|update\|delete>` | `{ table, schema, eventType, new, old }` | `qbframe: "postgres_changes"` |
|
|
249
|
+
| `view_changes` | `dev.quickback.<project>.view.<viewName>.changed` | `{ view, rootId, delta }` | `qbframe: "view_changes"`, `qbseq` (the per-surface monotonic seq — your reconnect/gap-detection contract) |
|
|
250
|
+
|
|
251
|
+
**Discriminate frames on the `qbframe` extension.** Never on `type`, whose
|
|
252
|
+
shape is not a stable contract, and never on payload keys — named-invalidation
|
|
253
|
+
payloads are author-supplied maps, so a broadcast whose payload happens to
|
|
254
|
+
carry `view`/`delta` or `table`/`eventType` keys must not be mistaken for a
|
|
255
|
+
system frame.
|
|
230
256
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
257
|
+
Compiler-defined types carry the `dev.quickback.` reverse-DNS prefix, per the
|
|
258
|
+
CloudEvents core spec: the prefixed domain names whoever defines the event's
|
|
259
|
+
semantics. Your own broadcast wire names are **not** prefixed — that vocabulary
|
|
260
|
+
is yours.
|
|
235
261
|
|
|
236
262
|
A changeset's [`afterCommit`](/define/changesets#aftercommit--emit-a-realtime-signal-after-the-changeset-commits)
|
|
237
263
|
broadcast rides the **same `broadcast` frame** (the referenced typed event's
|
|
@@ -254,10 +280,8 @@ as a normal `postgres_changes` frame on the table's room.
|
|
|
254
280
|
|
|
255
281
|
The bundled CMS unwraps envelopes automatically. The full channel/message
|
|
256
282
|
catalog ships as `GET /asyncapi.json` (AsyncAPI 3.0), served under the same
|
|
257
|
-
auth gating as `/openapi.json`.
|
|
258
|
-
|
|
259
|
-
what the pinned contract shapes is the message payload schemas it documents
|
|
260
|
-
(raw frames on v1, the CloudEvents envelopes above on v2).
|
|
283
|
+
auth gating as `/openapi.json`. Any project with realtime or webhooks serves
|
|
284
|
+
it, and it documents the CloudEvents envelopes above.
|
|
261
285
|
|
|
262
286
|
## Cloudflare Only
|
|
263
287
|
|
|
@@ -339,11 +339,10 @@ format:
|
|
|
339
339
|
| `webhook-timestamp` | unix seconds |
|
|
340
340
|
| `webhook-signature` | `v1,<base64 HMAC-SHA256 over id.timestamp.body>` |
|
|
341
341
|
|
|
342
|
-
|
|
343
|
-
`X-Webhook-Signature` / `X-Webhook-Event` / `X-Webhook-Delivery` set,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
(and its Stripe-format signature) is dropped.
|
|
342
|
+
These are the **only** signature headers sent. The legacy
|
|
343
|
+
`X-Webhook-Signature` / `X-Webhook-Event` / `X-Webhook-Delivery` set, and its
|
|
344
|
+
Stripe-format signature, are gone — a receiver still reading them sees no
|
|
345
|
+
signature at all, so move verification onto `webhook-signature` first.
|
|
347
346
|
|
|
348
347
|
Receiver verification (any Standard Webhooks library works):
|
|
349
348
|
|
|
@@ -378,7 +378,7 @@ For each feature, the compiler generates a routes file at `src/features/{name}/r
|
|
|
378
378
|
| `POST /{action}` | Standalone actions defined |
|
|
379
379
|
|
|
380
380
|
Routes are mounted under `/api/v1/{feature}` by default, or
|
|
381
|
-
`/api/v2/{feature}` when `contract: { routes: "v2" }` is set.
|
|
381
|
+
`/api/v2/{feature}` when `contract: { routes: "v2" }` is set. The standard API shape
|
|
382
382
|
selects semantics and leaves these paths alone.
|
|
383
383
|
|
|
384
384
|
## Migrations
|
|
@@ -45,7 +45,6 @@ the business decision.
|
|
|
45
45
|
|
|
46
46
|
This surface is deliberately explicit and narrow. It requires all of:
|
|
47
47
|
|
|
48
|
-
- `contract.version: "v2"`
|
|
49
48
|
- Cloudflare Workers
|
|
50
49
|
- one Neon database using `connectionMode: "hyperdrive"`
|
|
51
50
|
- the Better Auth `emailOtp` plugin with effective `disableSignUp: true`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quickback-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
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",
|
|
@@ -286,7 +286,7 @@ fail-fast per-record loop, `meta.transactional: false`.
|
|
|
286
286
|
| `PUT /batch` (upsert) | cloudflare-d1, neon over http (Cloudflare default) | `true` | `false` | Bulk insert commits; per-record update loop is fail-fast without rollback. |
|
|
287
287
|
| `POST /batch` (create) | (any) | (any) | `true` | Single bulk `INSERT` — atomic at the DB level. |
|
|
288
288
|
| `DELETE /batch` | (any) | (any) | `true` | Single bulk `UPDATE` (soft) or `DELETE` (hard) — atomic at the DB level. |
|
|
289
|
-
| [Changeset](/define/changesets) (`application/vnd.quickback.changeset+json
|
|
289
|
+
| [Changeset](/define/changesets) (`application/vnd.quickback.changeset+json`) | tx-supporting (postgres, neon over websocket/hyperdrive) | n/a | `true` | Root op + every child op share one transaction; any op failure rolls back the whole changeset. |
|
|
290
290
|
| [Changeset](/define/changesets) | cloudflare-d1, neon over http (Cloudflare default) | n/a | `false` | Deterministic parent-first fail-fast — the first op failure stops the changeset; already-applied ops stay committed (a consistent, independently-authorized prefix). |
|
|
291
291
|
|
|
292
292
|
### Reading `meta.transactional` in clients
|
|
@@ -117,7 +117,7 @@ GET /jobs/views/summary # Named view projection
|
|
|
117
117
|
`view` names the projection behind the response and is `null` for the default
|
|
118
118
|
collection read. `total` and `totalPages` join `pagination` only when the
|
|
119
119
|
request passed `?total=true`. A view that declares aggregations adds a
|
|
120
|
-
top-level `aggregations` object;
|
|
120
|
+
top-level `aggregations` object; `?include=` adds a top-level
|
|
121
121
|
`included` map. See
|
|
122
122
|
[Query Parameters](/api/query-params).
|
|
123
123
|
|
|
@@ -6,7 +6,7 @@ When you run `quickback compile`, Quickback generates a complete REST API from y
|
|
|
6
6
|
|
|
7
7
|
Generated endpoints use the contract selected in `quickback.config.ts`. The
|
|
8
8
|
backward-compatible default is `/api/v1/`; projects with
|
|
9
|
-
`contract: {
|
|
9
|
+
`contract: { routes: "v2" }` use `/api/v2/` (and `/auth/v2/` for Better Auth):
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
https://your-api.com/api/v1/{resource}
|
|
@@ -233,21 +233,18 @@ This request:
|
|
|
233
233
|
| `field.op=value` | LIST, VIEW | Filter with operator (gt, gte, lt, lte, ne, like, in) |
|
|
234
234
|
| `starting_after` | LIST, VIEW | Opaque keyset cursor — rows strictly after the boundary |
|
|
235
235
|
| `ending_before` | LIST, VIEW | Opaque keyset cursor — rows strictly before the boundary |
|
|
236
|
-
| `include` | LIST, VIEW, GET | FK-graph embedding (
|
|
237
|
-
| `fields[<fk>]` | LIST, VIEW, GET | Sparse fields for an embedded include target
|
|
236
|
+
| `include` | LIST, VIEW, GET | FK-graph embedding (allowlisted — see below) |
|
|
237
|
+
| `fields[<fk>]` | LIST, VIEW, GET | Sparse fields for an embedded include target |
|
|
238
238
|
|
|
239
|
-
## Include & Sparse Fields
|
|
239
|
+
## Include & Sparse Fields
|
|
240
240
|
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
A resource can allowlist FK columns for **FK-graph embedding**, collapsing
|
|
242
|
+
client-side N+1 fetches:
|
|
243
243
|
|
|
244
|
-
{/* doc-compile: skip — needs contract v2 at the project level; the gate's HARNESS_CONFIG pins v1 */}
|
|
245
244
|
```ts title="quickback/features/orders/order-items.ts"
|
|
246
245
|
import { feature, q } from "@quickback/compiler";
|
|
247
246
|
import { orders } from "../orders/orders";
|
|
248
247
|
|
|
249
|
-
// quickback.config.ts must pin the v2 contract for `read.include` to compile:
|
|
250
|
-
// export default defineConfig({ contract: { version: "v2" }, /* … */ });
|
|
251
248
|
export default feature("orderItems", {
|
|
252
249
|
columns: {
|
|
253
250
|
id: q.id(),
|
|
@@ -8,6 +8,84 @@ The current release series. Older entries are archived by version range:
|
|
|
8
8
|
- [v0.20 – v0.29](/changelog/v0.2x)
|
|
9
9
|
- [v0.18 and earlier](/changelog/v0.1x)
|
|
10
10
|
|
|
11
|
+
## Unreleased — the standard API shape
|
|
12
|
+
|
|
13
|
+
### BREAKING: `contract.version` is retired
|
|
14
|
+
|
|
15
|
+
There is one standard API shape, so there is nothing to select. Pinning
|
|
16
|
+
`contract.version` is now a **compile error** on either value.
|
|
17
|
+
|
|
18
|
+
**Delete that one line and keep `contract.routes` if you have it.** `routes`
|
|
19
|
+
is the surviving axis and is what decides whether your URLs read `/api/v1` or
|
|
20
|
+
`/api/v2` — removing it would move them.
|
|
21
|
+
|
|
22
|
+
{/* doc-compile: skip — config fragment, not a compilable project */}
|
|
23
|
+
```typescript
|
|
24
|
+
contract: { version: "v2", routes: "v1" } // before
|
|
25
|
+
contract: { routes: "v1" } // after — same URLs, same behavior
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Deleting `version: "v2"` changes **no** behavior: it selected what is now
|
|
29
|
+
simply the standard shape. Deleting `version: "v1"` is a real migration — see
|
|
30
|
+
[the contract page](/platform/api-contract#contractversion-is-retired) for the
|
|
31
|
+
four behaviors that pin opted out of, all now unconditional.
|
|
32
|
+
|
|
33
|
+
### BREAKING: CloudEvents `type` is reverse-DNS prefixed
|
|
34
|
+
|
|
35
|
+
Realtime `postgres_changes` and `view_changes` frames now carry a
|
|
36
|
+
`dev.quickback.` prefix on the CloudEvents `type`:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
myapp.registrations.insert → dev.quickback.myapp.registrations.insert
|
|
40
|
+
myapp.view.agendaBoard.changed → dev.quickback.myapp.view.agendaBoard.changed
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**`qbframe` is the supported discriminator — do not match on `type`.** Its
|
|
44
|
+
shape is not a stable contract; `qbframe` (`"broadcast"` / `"postgres_changes"`
|
|
45
|
+
/ `"view_changes"`) is. A client switching on `type` breaks here.
|
|
46
|
+
|
|
47
|
+
**Author-supplied broadcast event names are unchanged.** A named-invalidation
|
|
48
|
+
frame's `type` is still your `wireName` verbatim — that vocabulary is yours,
|
|
49
|
+
not ours to prefix.
|
|
50
|
+
|
|
51
|
+
`/asyncapi.json` documents the new `type` patterns, and its `info.version` is
|
|
52
|
+
now the event-document version rather than a contract version.
|
|
53
|
+
|
|
54
|
+
### BREAKING: outbound webhooks are Standard Webhooks only
|
|
55
|
+
|
|
56
|
+
The legacy `X-Webhook-Signature` / `X-Webhook-Event` / `X-Webhook-Delivery`
|
|
57
|
+
headers and the Stripe-format `signPayload` / `verifySignature` pair are gone
|
|
58
|
+
from the generated project — including from the public webhooks module's
|
|
59
|
+
exports. Receivers must verify with `webhook-signature`. This is the one
|
|
60
|
+
change a **receiver** absorbs without any config change of its own, so tell
|
|
61
|
+
your endpoint partners.
|
|
62
|
+
|
|
63
|
+
### BREAKING: `include` and `fields[...]` are reserved query params
|
|
64
|
+
|
|
65
|
+
`?include=` is always available now (where allowlisted), which makes `include`
|
|
66
|
+
a reserved parameter and any `fields[`-prefixed key reserved too. **A column
|
|
67
|
+
literally named `include` is no longer filterable** via `?include=…`. Unknown
|
|
68
|
+
`?fields=` and `fields[<fk>]=` names return **400** instead of being dropped.
|
|
69
|
+
|
|
70
|
+
### Fixed: scoped projects without `auth.jwt` could not admit their own scope tokens
|
|
71
|
+
|
|
72
|
+
Scope admission used to be emitted only inside the JWT credential lane, so a
|
|
73
|
+
project with `authz.scopes` and no `auth.jwt` minted scope tokens that no
|
|
74
|
+
generated code could accept — 401 on every presentation, with no diagnostic.
|
|
75
|
+
Live since v0.64.0, when that lane stopped being on by default.
|
|
76
|
+
|
|
77
|
+
Admission is now emitted whenever the project declares scopes, independent of
|
|
78
|
+
`auth.jwt`. **No config change is needed** — and declaring scopes does not
|
|
79
|
+
open the credential surface: no `POST /token` route, no identity fast-path,
|
|
80
|
+
no bearer fast-path unless you separately declare `auth.jwt`.
|
|
81
|
+
|
|
82
|
+
This covers **sessionless** scope tokens (`ctx.mintScope`). A token minted
|
|
83
|
+
from a session — `POST /scope/v1/enter`, or a namespace with
|
|
84
|
+
`mintScope: true` — carries user claims rather than the scope-only marker, so
|
|
85
|
+
without `auth.jwt` it still cannot be admitted: 200 from the mint, 401 on
|
|
86
|
+
presentation. The compiler now warns instead of failing silently. Declare
|
|
87
|
+
`auth: { jwt: {} }` if you use those routes.
|
|
88
|
+
|
|
11
89
|
## v0.65.x — August 16, 2026
|
|
12
90
|
|
|
13
91
|
### Passkeys no longer silently degrade to `rpID: 'localhost'`
|
|
@@ -161,7 +239,7 @@ total lost `required`, with sampled paths.
|
|
|
161
239
|
|
|
162
240
|
An unset `contract.version` resolves to `'v1'` today. That default becomes
|
|
163
241
|
`'v2'` in **v0.64.0**. See the
|
|
164
|
-
[contract matrix](/platform/api-contract#
|
|
242
|
+
[contract matrix](/platform/api-contract#contractversion-is-retired).
|
|
165
243
|
|
|
166
244
|
> v0.64.0 shipped this **without** moving any URLs — semantics and routes became
|
|
167
245
|
> independent axes, so `/api/v1` stays put. This entry originally said the flip
|