@quickback-dev/cli 0.46.0 → 0.47.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 (44) hide show
  1. package/dist/commands/compile.d.ts +1 -1
  2. package/dist/commands/compile.js +1 -1
  3. package/dist/docs/content.js +11 -11
  4. package/dist/docs/content.js.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/lib/file-loader.d.ts +1 -1
  7. package/dist/lib/file-loader.d.ts.map +1 -1
  8. package/dist/lib/file-loader.js +16 -3
  9. package/dist/lib/file-loader.js.map +1 -1
  10. package/dist/skill/docs/changelog.md +389 -0
  11. package/dist/skill/docs/compiler/definitions/access.md +17 -0
  12. package/dist/skill/docs/compiler/definitions/actions.md +9 -4
  13. package/dist/skill/docs/compiler/definitions/diagnostics.md +88 -57
  14. package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +27 -8
  15. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +2 -1
  16. package/dist/skill/docs/stack/account-ui/features/organizations.md +1 -1
  17. package/dist/skill/docs/stack/cms/pages.md +1 -1
  18. package/dist/skill/docs/stack/realtime/durable-objects.md +9 -0
  19. package/dist/skill/docs/stack/realtime/live-views.md +4 -0
  20. package/dist/skill/docs/stack/realtime/using-realtime.md +2 -2
  21. package/package.json +1 -1
  22. package/src/skill/docs/changelog.md +389 -0
  23. package/src/skill/docs/compiler/definitions/access.md +17 -0
  24. package/src/skill/docs/compiler/definitions/actions.md +9 -4
  25. package/src/skill/docs/compiler/definitions/diagnostics.md +88 -57
  26. package/src/skill/docs/compiler/targets/hono-api/database/neon.md +27 -8
  27. package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +2 -1
  28. package/src/skill/docs/stack/account-ui/features/organizations.md +1 -1
  29. package/src/skill/docs/stack/cms/pages.md +1 -1
  30. package/src/skill/docs/stack/realtime/durable-objects.md +9 -0
  31. package/src/skill/docs/stack/realtime/live-views.md +4 -0
  32. package/src/skill/docs/stack/realtime/using-realtime.md +2 -2
  33. package/dist/commands/init.d.ts +0 -6
  34. package/dist/commands/init.d.ts.map +0 -1
  35. package/dist/commands/init.js +0 -405
  36. package/dist/commands/init.js.map +0 -1
  37. package/dist/lib/sweep-stale.d.ts +0 -25
  38. package/dist/lib/sweep-stale.d.ts.map +0 -1
  39. package/dist/lib/sweep-stale.js +0 -179
  40. package/dist/lib/sweep-stale.js.map +0 -1
  41. package/dist/lib/sweep-stale.test.d.ts +0 -2
  42. package/dist/lib/sweep-stale.test.d.ts.map +0 -1
  43. package/dist/lib/sweep-stale.test.js +0 -130
  44. package/dist/lib/sweep-stale.test.js.map +0 -1
@@ -19,54 +19,46 @@ a stable, greppable **code**:
19
19
  [quickback:authz] AUTHZ_EMPTY_PERMISSION: permission "event:locked" can never be satisfied — it requires organizerOf AND its negation simultaneously.
20
20
  at resource=sessions authz.permissions["event:locked"]
21
21
  hint: Remove the contradictory arm, or split into separate permissions.
22
+ override: authz: { analyzer: { allow: [{ check: 'AUTHZ_EMPTY_PERMISSION', target: 'event:locked', reason: '<why this is acceptable>' }] } }
22
23
  ```
23
24
 
24
25
  The first line stays greppable (`[quickback:<channel>] CODE: message`); the
25
- source location and fix hint render on continuation lines.
26
+ source location, fix hint, and — for promoted errors — the exact override
27
+ recipe render on continuation lines.
26
28
 
27
- ## Warn by default, opt-in strict
29
+ ## Errors vs warnings (v0.47+)
28
30
 
29
- The analyzer is **warn-by-default, compile-continues**. This is deliberate:
30
- the analyzer runs on the shared compiler that serves every project, so a new
31
- check must never break an existing build on upgrade. In the default path
32
- every diagnostic — *including* the one check authored at `error` severity
33
- (the capability ceiling) — is rendered as a warning line and the compile
34
- proceeds.
31
+ The checks split into two tiers:
35
32
 
36
- Set **`QUICKBACK_AUTHZ_STRICT=true`** to promote every `warn` to `error`.
37
- Under strict mode the compile **fails** (throws an aggregate error listing the
38
- codes) if any diagnostic is — after promotion — an error. `info` lines
39
- (the pushdown-cost report) stay informational and never fail a build.
33
+ - **Promoted (compile errors).** A trip is a *definite misconfiguration* —
34
+ never a legitimate config. These fail the build by default. Each one can be
35
+ explicitly accepted per finding via
36
+ [`authz.analyzer.allow`](#the-override-surface).
37
+ - **Heuristic (warnings) and reports (info).** Advisory findings where a
38
+ legitimate config could trip the detector. These print and the compile
39
+ continues. Set **`QUICKBACK_AUTHZ_STRICT=true`** to promote these warnings
40
+ to errors as well (overridden findings stay warnings even under strict —
41
+ an override is an explicit, reasoned acceptance).
40
42
 
41
- ```bash
42
- # warn-only (default): prints diagnostics, compile succeeds
43
- quickback compile
44
-
45
- # strict: any warn or error fails the compile
46
- QUICKBACK_AUTHZ_STRICT=true quickback compile
47
- ```
48
-
49
- > The analyzer is compile-time only — zero runtime blast radius. A defect in
50
- > the analyzer itself is caught and downgraded to a single warning in the
51
- > default path, so an analyzer bug can never take down an otherwise-valid
52
- > compile. (Strict mode re-raises, because there the throw is the intended
53
- > hard failure.)
43
+ The analyzer remains compile-time only — zero runtime blast radius. A defect
44
+ in the analyzer *itself* is caught and downgraded to a single warning, so an
45
+ analyzer bug can never take down an otherwise-valid compile. Only real
46
+ findings fail builds.
54
47
 
55
48
  ## Authz codes
56
49
 
57
- These read the permission graph projected from the policy IR. All are `warn`
58
- severity (so `info` for the pushdown report) **except** the capability ceiling,
59
- which is authored as `error`.
50
+ These read the permission graph projected from the policy IR and run on every
51
+ compile.
60
52
 
61
- | Code | Severity | What it catches |
53
+ | Code | Tier | What it catches |
62
54
  |---|---|---|
63
- | `AUTHZ_EMPTY_PERMISSION` | warn | A permission that can never be satisfied — e.g. `allOf(a, not(a))`, which requires a fact and its negation at the same AND-level. |
55
+ | `AUTHZ_EMPTY_PERMISSION` | **error** | A permission that can never be satisfied — `allOf(a, not(a))`, a fact and its exact negation at the same AND-level. The detector is conservative (exact-leaf contradictions only), so a trip is structurally unsatisfiable. |
56
+ | `AUTHZ_CAPABILITY_CEILING` | **error** | A resource's firewall grants a `scope:<kind>:<role>` role read access **beyond its capability profile** — either the role has no profile at all, or the profile doesn't list this resource. The M0.2 pillar guarantee. |
64
57
  | `AUTHZ_SHADOWED_ARM` | warn | An `anyOf` arm subsumed by a broader arm: a leaf `X` and an `allOf(X, …)` in the same union — the narrower arm can never widen the result. |
65
- | `AUTHZ_UNREACHABLE_ROLE` | warn | A scoped role declared under `authz.scopes` with **no grant profile** — it can authorize no read, action, or channel, so it's dead config. |
66
- | `AUTHZ_UNREACHABLE_VIEW` | warn | A grant's `read` names a `resource:view` whose resource has no firewall — no role can reach that view. |
67
- | `AUTHZ_PUSHDOWN_COST` | info | Per-permission report: how many SQL subqueries the permission lowers to, plus the max recursive-CTE depth (from recursive arrows). Advisory, never fails a build. |
68
- | `AUTHZ_CAPABILITY_CEILING` | **error** | A resource's firewall grants a `scope:<kind>:<role>` role read access **beyond its capability profile** — either the role has no profile at all, or the profile doesn't list this resource. |
69
- | `AUTHZ_NOT_OVER_RESOURCE` | warn | A `not` whose operand resolves to a **resource (SQL) site** — `NOT EXISTS` over a nullable join can silently pass (the null-trap). The analyzer resolves the operand's site from its leaves, so it fires even when the lowering left the site unset. |
58
+ | `AUTHZ_UNREACHABLE_ROLE` | warn | A scoped role declared under `authz.scopes` with **no grant profile** — it can authorize no read, action, or channel. Dead config, deny-safe. |
59
+ | `AUTHZ_UNREACHABLE_VIEW` | warn | A grant's `read` names a `resource:view` whose resource has no firewall — no role can reach that view. (A reachability proxy — heuristic by design.) |
60
+ | `AUTHZ_NOT_OVER_RESOURCE` | warn | A `not` whose operand resolves to a **resource (SQL) site** — `NOT EXISTS` over a nullable join can silently pass (the null-trap). The site resolution is conservative, so this stays advisory. |
61
+ | `AUTHZ_PUSHDOWN_COST` | info | Per-permission report: how many SQL subqueries the permission lowers to, plus the max recursive-CTE depth. Advisory, never fails a build. |
70
62
 
71
63
  A few codes are reserved in the diagnostic enum for the milestones that emit
72
64
  them and don't fire on a shipped config today: `AUTHZ_UNBOUNDED_RECURSION`
@@ -76,38 +68,78 @@ error raised at config validation, before the analyzer runs),
76
68
 
77
69
  ### The capability ceiling
78
70
 
79
- The one `error`-severity authz check. It is the M0.2 deliverable that backs
80
- [scope grant profiles](/compiler/definitions/scopes): a scoped role is
81
- deny-by-default and may touch only what its `grants` profile lists. The
82
- analyzer walks every resource firewall, follows each `{ permission }` arm
83
- into the permission graph to find the scope roles it references, and fails the
84
- build (in strict mode) if a resource grants a scope role access the profile
85
- doesn't cover. In the default path it warns loudly. This is what makes the
86
- grant profile the single auditable manifest of what an external principal can
87
- see.
71
+ The check that backs [scope grant profiles](/compiler/definitions/scopes): a
72
+ scoped role is deny-by-default and may touch only what its `grants` profile
73
+ lists. The analyzer walks every resource firewall, follows each
74
+ `{ permission }` arm into the permission graph to find the scope roles it
75
+ references, and **fails the build** if a resource grants a scope role access
76
+ the profile doesn't cover. This is what makes the grant profile the single
77
+ auditable manifest of what an external principal can see.
88
78
 
89
79
  ## Authn codes
90
80
 
91
- Four **structural authentication** checks — proving properties over the
92
- generated route + credential surface rather than the authz policy:
81
+ Five **structural authentication** checks — proving properties over the
82
+ generated route + credential surface rather than the authz policy. All are
83
+ promoted (compile errors):
93
84
 
94
- | Code | Severity | What it catches |
85
+ | Code | Tier | What it catches |
95
86
  |---|---|---|
96
- | `AUTHN_ROUTE_COVERAGE` | warn | A route that reaches data with an **unclassified** auth gate and isn't declared `PUBLIC` — the signup / flag-gap bug class (data delivered to an unauthenticated ctx). |
97
- | `AUTHN_SECRET_CONSISTENCY` | error | A credential's mint site and verify site don't share key / issuer / audience — every minted token would fail verification (the ws-ticket "401 on every upgrade" trap). |
98
- | `AUTHN_CREDENTIAL_DELIVERY` | error | A fire-and-forget credential send (the OTP-email shape) not anchored to `waitUntil` / `await` — the Worker may drop the promise and never deliver (the OTP-500 bug class). |
99
- | `AUTHN_CLAIM_PROVENANCE` | error | An identity `ctx` field written from **request input** rather than a credential verifier — client-asserted identity, which is forbidden. |
100
- | `AUTHN_SURFACE_INVARIANT` | warn / error | A surface contract breach: an `/mcp` or agent route not gated bearer-only (warn), or an `INTERNAL`-gated route mounted on an HTTP-reachable surface (error). |
87
+ | `AUTHN_ROUTE_COVERAGE` | **error** | A route that reaches data with an **unclassifiable** auth gate and isn't declared `PUBLIC` — the signup / flag-gap bug class (data delivered to an unauthenticated ctx). Fires only on a gate the compiler cannot classify; zero-FP by construction. |
88
+ | `AUTHN_SURFACE_INVARIANT` | **error** | A surface contract breach: an `/mcp` or agent route not gated bearer-only, or an `INTERNAL`-gated route mounted on an HTTP-reachable surface. |
89
+ | `AUTHN_SECRET_CONSISTENCY` | **error** | A credential's mint site and verify site don't share key / issuer / audience — every minted token would fail verification (the ws-ticket "401 on every upgrade" trap). |
90
+ | `AUTHN_CREDENTIAL_DELIVERY` | **error** | A fire-and-forget credential send (the OTP-email shape) not anchored to `waitUntil` / `await` — the Worker may drop the promise and never deliver (the OTP-500 bug class). |
91
+ | `AUTHN_CLAIM_PROVENANCE` | **error** | An identity `ctx` field written from **request input** rather than a credential verifier — client-asserted identity, which is forbidden. Unprovable provenance also fails (fail closed). |
101
92
 
102
93
  These check definitions are **wired and fully unit-tested**, but their inputs
103
94
  — the per-route and per-credential metadata (`RouteNode` / `MintSite` /
104
95
  `VerifySite` / `ClaimWrite`) — are not yet emitted by the route, middleware,
105
96
  and credential generators. Until those generators emit that metadata the
106
97
  analyzer runs the authn checks against **empty** route/credential graphs, so
107
- they are effectively no-ops on a real compile. The check logic needs no change
108
- when the metadata lands — the route/credential coverage activates the moment
109
- the generators emit it. The authz / permission-graph checks above run
110
- unconditionally today, because the policy IR is always present.
98
+ they are effectively no-ops on a real compile. The severity contract is
99
+ locked in now: they fail builds the moment they can fire. (The emitted route
100
+ surface is separately guarded today by the IR's unbound-route invariant — a
101
+ hard error that predates this promotion and owns that surface; one subject,
102
+ one error.)
103
+
104
+ ## The override surface
105
+
106
+ Every promoted finding can be explicitly accepted — per finding, with a
107
+ required reason:
108
+
109
+ ```ts
110
+ authz: {
111
+ analyzer: {
112
+ allow: [
113
+ {
114
+ check: 'AUTHZ_CAPABILITY_CEILING',
115
+ target: 'sessions/scope:event:organizer',
116
+ reason: 'organizer grant profile lands with the v2 rollout (TICKET-123)',
117
+ },
118
+ ],
119
+ },
120
+ }
121
+ ```
122
+
123
+ An entry downgrades the exact `(check, target)` finding back to a warning
124
+ that cites the reason. The rendered error prints the exact recipe — copy the
125
+ `check` and `target` from it. Target formats:
126
+
127
+ | Check | `target` format |
128
+ |---|---|
129
+ | `AUTHZ_EMPTY_PERMISSION` | the permission name — `event:locked` |
130
+ | `AUTHZ_CAPABILITY_CEILING` | `<resource>/scope:<kind>:<role>` — `sessions/scope:event:organizer` |
131
+ | `AUTHN_ROUTE_COVERAGE`, `AUTHN_SURFACE_INVARIANT` | `<METHOD> <path>` — `GET /mcp` |
132
+ | `AUTHN_SECRET_CONSISTENCY`, `AUTHN_CREDENTIAL_DELIVERY` | the credential kind — `ws-ticket` |
133
+ | `AUTHN_CLAIM_PROVENANCE` | the ctx field — `ctx.userId` |
134
+
135
+ Guard rails, all compile errors:
136
+
137
+ - `check` must be a **promoted** id — unknown ids and keep-warn ids (there is
138
+ nothing to override) are rejected at config validation.
139
+ - `reason` is required and non-empty: overrides are self-documenting.
140
+ - An `allow` entry that matches **no current finding** is a *dead override*
141
+ and fails the compile — fix or remove the stale entry. Override lists can
142
+ never silently outlive the problems they suppressed.
111
143
 
112
144
  ## Reading the pushdown-cost report
113
145
 
@@ -133,4 +165,3 @@ not an error, but worth a look.
133
165
  profiles the capability-ceiling check enforces.
134
166
  - [Firewall](/compiler/definitions/firewall) — the `{ permission }` arms the
135
167
  ceiling check follows into the permission graph.
136
- ```
@@ -53,9 +53,17 @@ Neon uses PostgreSQL migrations, distinct from D1's SQLite migrations:
53
53
 
54
54
  ```bash
55
55
  quickback compile # generates migrations under quickback/drizzle/
56
- npm run db:migrate # applies them
56
+ npm run db:migrate # applies them — schema AND the RLS layer
57
57
  ```
58
58
 
59
+ The RLS layer (helper functions, policies, triggers) rides the same
60
+ journaled migration set as your schema (v0.45+): the compiler appends a
61
+ content-addressed `<idx>_quickback_rls_<hash>` migration, so one
62
+ `db:migrate` applies everything in order. The RLS migration is idempotent
63
+ (`DROP POLICY IF EXISTS` + re-create) and only a *changed* security config
64
+ appends a new entry — recompiles with unchanged security append nothing. No
65
+ manual SQL application step exists anymore.
66
+
59
67
  ## Row Level Security
60
68
 
61
69
  Quickback emits RLS policies from your `firewall` and `access` config. The Neon target uses Neon Authorize's `auth.user_id()` JWT claim function (the Supabase target uses `auth.uid()` instead — same pattern, different function).
@@ -107,6 +115,18 @@ CREATE POLICY "categories_all" ON categories FOR ALL TO authenticated USING (tru
107
115
  | `is_org_member()` | Checks org membership |
108
116
  | `is_owner(owner_id)` | Checks record ownership |
109
117
 
118
+ All helpers are TEXT-typed to match Better Auth's prefixed ids
119
+ (`org_abc123`). The `user_sessions` table the org helpers read is
120
+ compiler-owned migration state (`src/db/rls-support.schema.ts`), created by
121
+ the journaled migrations and kept in sync automatically: generated Better
122
+ Auth session hooks mirror the session's active organization (and team) into
123
+ it on every session create/update. Switching to "no org" revokes SQL-side
124
+ access — fail closed.
125
+
126
+ RLS coverage includes Better Auth's own tables — including those the
127
+ compiler force-enables (organization, admin, `apikeys`; plus the OAuth/agent
128
+ table families when those surfaces are on, locked to service-role only).
129
+
110
130
  ## Setting up Neon Authorize
111
131
 
112
132
  1. Open **Project Settings → Authorize** in the Neon console
@@ -117,14 +137,13 @@ CREATE POLICY "categories_all" ON categories FOR ALL TO authenticated USING (tru
117
137
 
118
138
  ```
119
139
  quickback/drizzle/
120
- ├── migrations/
121
- │ ├── 0100_create_rls_helpers.sql
122
- │ ├── 0101_create_rls_policies.sql
123
- │ └── 0102_create_indexes.sql
140
+ ├── 0000_<name>.sql # schema migrations (drizzle-kit)
141
+ ├── 0001_quickback_rls_<hash>.sql # journaled RLS layer (content-addressed)
142
+ └── meta/_journal.json # one journal covers both
124
143
  src/
125
- ├── db/schema.ts # Drizzle schema
126
- ├── auth/schema.ts # Better Auth schema
127
- └── lib/neon.ts # Connection helper
144
+ ├── db/schema.ts # Drizzle schema barrel
145
+ ├── db/rls-support.schema.ts # user_sessions + RLS support tables
146
+ └── auth/schema.ts # Better Auth schema (owned by the BA CLI)
128
147
  ```
129
148
 
130
149
  ## When to choose Neon vs D1
@@ -209,7 +209,8 @@ Or enable the in-project browser via the [`docs` config option](#interactive-api
209
209
 
210
210
  Alongside the spec, every compile writes `reports/operations.manifest.json` — a
211
211
  stable, machine-readable index of the full route surface (resource, action,
212
- view, and auth routes):
212
+ view, and auth routes; since v0.47 also the realtime, storage, and FGA
213
+ surfaces):
213
214
 
214
215
  ```json
215
216
  [
@@ -15,7 +15,7 @@ Account UI provides a complete organization management interface when `VITE_ENAB
15
15
  - Change roles and remove members — actions are filtered per-target by the role hierarchy (non-owners can't manage owner-role members)
16
16
  - Leave the organization
17
17
 
18
- > **Note:** These three roles (`owner`, `admin`, `member`) are Better Auth's built-in organization roles and map directly to Account UI's role picker. Use the same roles in your Quickback [Access](/compiler/definitions/access) rules — with [`auth.roleHierarchy`](/compiler/definitions/access#role-hierarchy) configured, you can write `roles: ["member+"]` to mean "member and above."
18
+ > **Note:** These three roles (`owner`, `admin`, `member`) are Better Auth's built-in organization roles and map directly to Account UI's role picker. Use the same roles in your Quickback [Access](/compiler/definitions/access) rules — with [`auth.roleHierarchy`](/compiler/definitions/access#role-hierarchy) configured, you can write `roles: ["member+"]` to mean "member and above." [Custom org roles](/compiler/definitions/access#custom-org-roles) declared in your access trees are auto-registered with the organization plugin (v0.46+), so `invite-member` / `update-member-role` accept them too.
19
19
 
20
20
  ## Invitations
21
21
 
@@ -7,7 +7,7 @@ Custom pages extend the CMS beyond standard table views. Define split-panel layo
7
7
  Pages are defined in your feature directory under a `pages/` folder:
8
8
 
9
9
  ```
10
- quickback/definitions/features/
10
+ quickback/features/
11
11
  banking/
12
12
  bank-accounts.ts # One table per file — any filename
13
13
  bank-transactions.ts
@@ -107,6 +107,15 @@ attendee — their realtime socket now opens.
107
107
 
108
108
  Quickback emits auto-broadcasts in **only one place**: the generated CRUD route handlers (`POST /` create, `PATCH /:id` update, `DELETE /:id` delete) for resources with `realtime.enabled` (or covered by `dbConfig.realtime: true`'s project-level default). Those handlers wrap each successful write with a `realtime.insert / update / delete` call before responding.
109
109
 
110
+ Auto-broadcasts carry the table's declared gates (v0.46+): the
111
+ `realtime.requiredRoles` list becomes the broadcast's `targetRoles` (with
112
+ role-hierarchy `+` expanded), and the table's effective masking config —
113
+ declared plus auto-detected sensitive columns — is applied per subscriber
114
+ role at fanout, matching what the HTTP routes mask. A `type: 'custom'` mask
115
+ function can't be replicated by the Broadcaster, so those columns broadcast
116
+ as `[REDACTED]` (fail closed). Tables that declare neither broadcast openly,
117
+ as before.
118
+
110
119
  Everywhere else — action handlers, queue consumers, scheduled jobs, custom Hono routes — you broadcast manually. In action handlers on realtime-enabled projects, Quickback now injects a typed `realtime` helper directly into `execute(...)`; outside actions you still call `createRealtime(env)` yourself.
111
120
 
112
121
  | Mutation site | Auto-broadcast? | Why |
@@ -145,6 +145,10 @@ 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
152
  - **Stricter-child guard.** When a reverse-FK child's firewall is *stricter*
149
153
  than the root's (e.g. an owner-scoped note under an org-scoped person), the
150
154
  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.
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).
134
134
 
135
135
  ### Per-Role Masking
136
136
 
@@ -145,7 +145,7 @@ masking: {
145
145
  - **Owner sees:** `{ ssn: "123-45-6789" }`
146
146
  - **Recruiter sees:** `{ ssn: "*****6789" }`
147
147
 
148
- Masking is pre-computed per-role (O(roles), not O(subscribers)) for efficiency.
148
+ Masking is pre-computed per-role (O(roles), not O(subscribers)) for efficiency. A `type: 'custom'` mask function can't run inside the Broadcaster — those columns broadcast as `[REDACTED]` (fail closed).
149
149
 
150
150
  ### User-Specific Events
151
151
 
@@ -1,6 +0,0 @@
1
- interface InitOptions {
2
- path?: string;
3
- }
4
- export declare function init(options?: InitOptions): Promise<void>;
5
- export {};
6
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA2Z/D"}