@quickback-dev/cli 0.47.15 → 0.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +13 -2
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/commands/migrations.d.ts +10 -0
  5. package/dist/commands/migrations.d.ts.map +1 -1
  6. package/dist/commands/migrations.js +113 -79
  7. package/dist/commands/migrations.js.map +1 -1
  8. package/dist/commands/migrations.test.js +96 -1
  9. package/dist/commands/migrations.test.js.map +1 -1
  10. package/dist/docs/content.js +12 -12
  11. package/dist/docs/content.js.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/skill/docs/changelog.md +119 -0
  15. package/dist/skill/docs/compiler/config/providers.md +23 -2
  16. package/dist/skill/docs/compiler/definitions/actions.md +12 -2
  17. package/dist/skill/docs/compiler/definitions/encryption.md +2 -0
  18. package/dist/skill/docs/compiler/definitions/schema.md +2 -0
  19. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +306 -35
  20. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +14 -8
  21. package/dist/skill/docs/stack/realtime/durable-objects.md +151 -10
  22. package/dist/skill/docs/stack/realtime/index.md +22 -3
  23. package/dist/skill/docs/stack/realtime/live-views.md +6 -4
  24. package/dist/skill/docs/stack/realtime/using-realtime.md +1 -1
  25. package/dist/skill/docs/stack/webhooks/outbound.md +23 -0
  26. package/package.json +1 -1
  27. package/src/skill/docs/changelog.md +119 -0
  28. package/src/skill/docs/compiler/config/providers.md +23 -2
  29. package/src/skill/docs/compiler/definitions/actions.md +12 -2
  30. package/src/skill/docs/compiler/definitions/encryption.md +2 -0
  31. package/src/skill/docs/compiler/definitions/schema.md +2 -0
  32. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +306 -35
  33. package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +14 -8
  34. package/src/skill/docs/stack/realtime/durable-objects.md +151 -10
  35. package/src/skill/docs/stack/realtime/index.md +22 -3
  36. package/src/skill/docs/stack/realtime/live-views.md +6 -4
  37. package/src/skill/docs/stack/realtime/using-realtime.md +1 -1
  38. package/src/skill/docs/stack/webhooks/outbound.md +23 -0
@@ -49,7 +49,9 @@ The Broadcaster Durable Object runs **inline** in your main Quickback worker —
49
49
 
50
50
  ## Enabling Realtime
51
51
 
52
- Add `realtime` to individual table definitions:
52
+ Broadcasting is **opt-in per resource**, exactly like CRUD — a table broadcasts
53
+ only if it declares its own `realtime` block. Add `realtime` to individual table
54
+ definitions:
53
55
 
54
56
  ```typescript
55
57
  export default defineTable(applications, {
@@ -59,13 +61,30 @@ export default defineTable(applications, {
59
61
  onInsert: true,
60
62
  onUpdate: true,
61
63
  onDelete: true,
62
- requiredRoles: ["recruiter", "hiring-manager"],
64
+ // Audience — WHO may receive these live rows. Same { roles } shape as
65
+ // read.access / crud.*.access. MANDATORY and fail-closed: a broadcast
66
+ // reaches every subscriber in the room, so the audience is not optional.
67
+ // Omit it (or leave it empty) and compilation fails. Roles may be concrete
68
+ // membership/scope roles or UPPERCASE pseudo-roles.
69
+ access: { roles: ["recruiter", "hiring-manager"] },
63
70
  fields: ["id", "candidateId", "stage"],
64
71
  },
65
72
  });
66
73
  ```
67
74
 
68
- And enable the realtime binding in your database config. The compiler generates the Durable Object class, helper functions, and wrangler bindings — all within your main worker.
75
+ > There is **no implicit fanout**. A resource with a broadcasting `realtime` block
76
+ > must declare a non-empty `access.roles`, and an empty audience delivers to *no
77
+ > one*. To broadcast to everyone in the room, say so deliberately with
78
+ > `access: { roles: ["PUBLIC"] }`. (`requiredRoles` is the deprecated spelling of
79
+ > `access.roles` — it still compiles but should be migrated.)
80
+
81
+
82
+ And enable the realtime **transport** in your database config. This is a
83
+ project-level switch that stands up the Broadcaster Durable Object + the
84
+ ws-ticket connection route; it does **not** by itself make any resource
85
+ broadcast (that's the per-resource `realtime` block above). The compiler
86
+ generates the Durable Object class, helper functions, and wrangler bindings —
87
+ all within your main worker.
69
88
 
70
89
  ```typescript
71
90
  providers: {
@@ -145,10 +145,12 @@ are emitted as `DELETE` so the row leaves the surface.
145
145
  - Each included table's `firewall` + `masking` apply on both the initial
146
146
  materialize and the live deltas (masking is applied per subscriber role at
147
147
  fanout), so the two are consistent.
148
- - A table-level `realtime.requiredRoles` declaration is honored on view
149
- deltas too (v0.46+): `view_changes` for that table fan out only to
150
- subscribers holding one of the required roles, exactly like its row-stream
151
- broadcasts. Tables without `requiredRoles` are unaffected.
148
+ - A table-level `realtime.access.roles` audience is honored on view deltas
149
+ too: `view_changes` for that table fan out only to subscribers within the
150
+ declared audience (evaluated with the same pseudo-role semantics as REST),
151
+ exactly like its row-stream broadcasts. Tables that don't declare a
152
+ broadcasting `realtime` block don't emit row-stream broadcasts, but their
153
+ rows can still surface through a live view they participate in.
152
154
  - **Stricter-child guard.** When a reverse-FK child's firewall is *stricter*
153
155
  than the root's (e.g. an owner-scoped note under an org-scoped person), the
154
156
  raw child row is **never broadcast**. Instead the server emits a *resync
@@ -130,7 +130,7 @@ Custom namespaces (from `defineRealtime()`) use the format `namespace:event` —
130
130
 
131
131
  ### Role-Based Filtering
132
132
 
133
- Events are only delivered to users whose role matches the broadcast's `targetRoles`. If a table's realtime config specifies `requiredRoles: ["hiring-manager", "recruiter"]`, only users with those roles receive the events. This applies to generated CRUD broadcasts and to [live view](/stack/realtime/live-views) `view_changes` deltas alike, enforced at fanout (v0.46+ — recompile and redeploy to pick up the enforcement).
133
+ Events are only delivered to subscribers who fall within the broadcast's audience. A broadcasting table's realtime config **must** declare `access: { roles: [...] }` — e.g. `access: { roles: ["hiring-manager", "recruiter"] }` delivers only to those roles. The audience is evaluated at fanout with the same uppercase pseudo-role semantics as REST (`PUBLIC` = everyone in the room, `AUTHENTICATED`, `USER`, `SYSADMIN`), plus concrete membership/scope roles. This is **fail-closed**: an empty or omitted audience delivers to no one (and is a compile error for a broadcasting resource). Applies to generated CRUD broadcasts and to [live view](/stack/realtime/live-views) `view_changes` deltas alike.
134
134
 
135
135
  ### Per-Role Masking
136
136
 
@@ -275,6 +275,29 @@ database: defineDatabase("cloudflare-d1", {
275
275
 
276
276
  This generates the webhook database schema, routes, queue consumer, and all supporting code.
277
277
 
278
+ ### On Neon (Postgres)
279
+
280
+ Webhooks are supported on the `neon` provider too. `webhooksBinding` acts as a
281
+ pure enable flag — there is no separate webhooks database. The webhook tables
282
+ live in a dedicated `webhooks` Postgres schema of your single Neon database,
283
+ created by the standard drizzle migration set, and are locked down by an RLS
284
+ policy so only the Worker's internal service-role handle can touch them:
285
+
286
+ ```typescript
287
+ database: defineDatabase("neon", {
288
+ connectionMode: "http", // required for webhooks
289
+ webhooksBinding: "WEBHOOKS_DB", // enable flag; no D1 binding is emitted
290
+ // queue names stay configurable on any provider:
291
+ webhooksQueueName: "my-app-webhooks-queue",
292
+ webhooksDlqName: "my-app-webhooks-dlq",
293
+ })
294
+ ```
295
+
296
+ The D1-only keys `webhooksDatabaseId` / `webhooksDatabaseName` are rejected at
297
+ compile time on Neon, and webhooks require `connectionMode: 'http'` (the
298
+ Cloudflare default). Queue wiring (`WEBHOOKS_QUEUE`, the consumer, and the
299
+ dead letter queue) is identical across providers.
300
+
278
301
  ## See Also
279
302
 
280
303
  - [Inbound Webhooks](/stack/webhooks/inbound) — Receive webhooks from external services