@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
|
@@ -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`
|