@quickback-dev/cli 0.66.0 → 0.66.2
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/README.md +7 -4
- package/dist/commands/build.d.ts +51 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +793 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/build.test.d.ts +2 -0
- package/dist/commands/build.test.d.ts.map +1 -0
- package/dist/commands/build.test.js +150 -0
- package/dist/commands/build.test.js.map +1 -0
- package/dist/commands/check.d.ts +2 -2
- package/dist/commands/check.js +4 -4
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.js +7 -7
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/deploy.d.ts +6 -6
- package/dist/commands/deploy.js +23 -23
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/example.js +1 -1
- package/dist/commands/example.js.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/migrate.d.ts +1 -1
- package/dist/commands/migrate.js +3 -3
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/migrations.js +2 -2
- package/dist/commands/migrations.js.map +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/start.js +1 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/cursor/quickback.mdc +1 -1
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/auth.js +1 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/compiler-floor.d.ts +1 -1
- package/dist/lib/compiler-floor.js +1 -1
- package/dist/lib/file-loader.js +2 -2
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/file-writer.d.ts +2 -0
- package/dist/lib/file-writer.d.ts.map +1 -1
- package/dist/lib/file-writer.js +16 -0
- package/dist/lib/file-writer.js.map +1 -1
- package/dist/lib/file-writer.test.js +16 -0
- package/dist/lib/file-writer.test.js.map +1 -1
- package/dist/lib/migrations/file-envelopes.js +3 -3
- package/dist/lib/migrations/file-envelopes.js.map +1 -1
- package/dist/lib/prepare-output.test.js +1 -1
- package/dist/lib/prepare-output.test.js.map +1 -1
- package/dist/lib/schema-sync/index.js +1 -1
- package/dist/lib/schema-sync/index.test.js +1 -1
- package/dist/lib/schema-sync/index.test.js.map +1 -1
- package/dist/lib/wrangler-resources.d.ts.map +1 -1
- package/dist/lib/wrangler-resources.js +5 -2
- package/dist/lib/wrangler-resources.js.map +1 -1
- package/dist/lib/wrangler-resources.test.js +6 -0
- package/dist/lib/wrangler-resources.test.js.map +1 -1
- package/dist/skill/SKILL.md +24 -9
- package/dist/skill/docs/api/crud.md +7 -0
- package/dist/skill/docs/api/index.md +1 -1
- package/dist/skill/docs/api/openapi.md +1 -1
- package/dist/skill/docs/changelog/index.md +27 -1
- package/dist/skill/docs/configure/agents.md +1 -1
- package/dist/skill/docs/configure/domains.md +1 -1
- package/dist/skill/docs/configure/index.md +11 -5
- package/dist/skill/docs/configure/providers.md +6 -3
- package/dist/skill/docs/configure/single-tenant.md +7 -3
- package/dist/skill/docs/configure/variables.md +3 -3
- package/dist/skill/docs/define/access.md +10 -0
- package/dist/skill/docs/define/actions/defining.md +35 -7
- package/dist/skill/docs/define/actions/index.md +1 -1
- package/dist/skill/docs/define/actions/record-and-standalone.md +7 -4
- package/dist/skill/docs/define/actions/scoped-db.md +68 -21
- package/dist/skill/docs/define/areas.md +1 -1
- package/dist/skill/docs/define/diagnostics.md +1 -0
- package/dist/skill/docs/define/encryption.md +1 -1
- package/dist/skill/docs/define/feature.md +17 -8
- package/dist/skill/docs/define/firewall.md +2 -0
- package/dist/skill/docs/define/guards.md +27 -3
- package/dist/skill/docs/define/index.md +1 -1
- package/dist/skill/docs/define/relationships.md +7 -0
- package/dist/skill/docs/define/schema.md +44 -14
- package/dist/skill/docs/define/security.md +1 -1
- package/dist/skill/docs/define/transitions.md +35 -4
- package/dist/skill/docs/define/triggers.md +14 -3
- package/dist/skill/docs/define/views.md +33 -0
- package/dist/skill/docs/index.md +2 -2
- package/dist/skill/docs/platform/auth/api-keys.md +2 -2
- package/dist/skill/docs/platform/auth/using-auth.md +37 -0
- package/dist/skill/docs/platform/database/d1.md +15 -3
- package/dist/skill/docs/platform/database/neon.md +4 -4
- package/dist/skill/docs/platform/email/index.md +1 -1
- package/dist/skill/docs/platform/queues/handlers.md +1 -1
- package/dist/skill/docs/platform/queues/using-queues.md +1 -1
- package/dist/skill/docs/platform/realtime/using-realtime.md +6 -4
- package/dist/skill/docs/platform/schedules/index.md +1 -1
- package/dist/skill/docs/platform/storage/index.md +3 -3
- package/dist/skill/docs/platform/storage/r2.md +87 -37
- package/dist/skill/docs/platform/storage/using-r2.md +99 -19
- package/dist/skill/docs/platform/webhooks/inbound.md +40 -0
- package/dist/skill/docs/start/deploy-browser.md +40 -45
- package/dist/skill/docs/start/deploy-owner-access.md +60 -52
- package/dist/skill/docs/start/deploy.md +4 -4
- package/dist/skill/docs/start/first-api.md +2 -2
- package/dist/skill/docs/start/hand-crafted.md +3 -3
- package/dist/skill/docs/start/index.md +3 -3
- package/dist/skill/docs/start/patterns.md +17 -2
- package/dist/skill/docs/start/quickstart.md +3 -3
- package/dist/skill/docs/start/template-blog.md +2 -2
- package/dist/skill/docs/start/template-cloudflare.md +3 -3
- package/dist/skill/docs/start/template-empty.md +1 -1
- package/dist/skill/docs/start/templates.md +1 -1
- package/dist/skill/docs/tooling/claude-skill.md +1 -1
- package/dist/skill/docs/tooling/cli.md +21 -16
- package/dist/skill/docs/tooling/cloud-compiler/authentication.md +2 -2
- package/dist/skill/docs/tooling/cloud-compiler/endpoints.md +5 -3
- package/dist/skill/docs/tooling/cloud-compiler/index.md +1 -1
- package/dist/skill/docs/tooling/cloud-compiler/local-compiler.md +2 -2
- package/dist/skill/docs/tooling/cloud-compiler/troubleshooting.md +74 -1
- package/dist/skill/docs/tooling/output.md +23 -2
- package/dist/skill/docs/tooling/troubleshooting.md +1 -1
- package/dist/skill/docs/ui/account/customization.md +1 -1
- package/dist/skill/docs/ui/account/environment-variables.md +2 -2
- package/dist/skill/docs/ui/account/features/admin.md +1 -1
- package/dist/skill/docs/ui/account/features/api-keys.md +10 -8
- package/dist/skill/docs/ui/account/features/avatars.md +24 -8
- package/dist/skill/docs/ui/account/features/index.md +16 -11
- package/dist/skill/docs/ui/account/features/organizations.md +3 -2
- package/dist/skill/docs/ui/account/hooks.md +2 -0
- package/dist/skill/docs/ui/account/index.md +10 -5
- package/dist/skill/docs/ui/account/with-quickback.md +2 -2
- package/dist/skill/docs/ui/admin/actions.md +97 -3
- package/dist/skill/docs/ui/admin/components.md +4 -6
- package/dist/skill/docs/ui/admin/connecting.md +15 -3
- package/dist/skill/docs/ui/admin/index.md +71 -6
- package/dist/skill/docs/ui/admin/inline-editing.md +38 -4
- package/dist/skill/docs/ui/admin/record-layouts.md +22 -21
- package/dist/skill/docs/ui/admin/schema-format.md +39 -2
- package/dist/skill/docs/ui/admin/schema-registry.md +107 -7
- package/dist/skill/docs/ui/admin/security.md +19 -4
- package/dist/skill/docs/ui/admin/table-views.md +59 -12
- package/package.json +1 -1
- package/src/cursor/quickback.mdc +1 -1
- package/src/skill/SKILL.md +24 -9
- package/src/skill/docs/api/crud.md +7 -0
- package/src/skill/docs/api/index.md +1 -1
- package/src/skill/docs/api/openapi.md +1 -1
- package/src/skill/docs/changelog/index.md +27 -1
- package/src/skill/docs/configure/agents.md +1 -1
- package/src/skill/docs/configure/domains.md +1 -1
- package/src/skill/docs/configure/index.md +11 -5
- package/src/skill/docs/configure/providers.md +6 -3
- package/src/skill/docs/configure/single-tenant.md +7 -3
- package/src/skill/docs/configure/variables.md +3 -3
- package/src/skill/docs/define/access.md +10 -0
- package/src/skill/docs/define/actions/defining.md +35 -7
- package/src/skill/docs/define/actions/index.md +1 -1
- package/src/skill/docs/define/actions/record-and-standalone.md +7 -4
- package/src/skill/docs/define/actions/scoped-db.md +68 -21
- package/src/skill/docs/define/areas.md +1 -1
- package/src/skill/docs/define/diagnostics.md +1 -0
- package/src/skill/docs/define/encryption.md +1 -1
- package/src/skill/docs/define/feature.md +17 -8
- package/src/skill/docs/define/firewall.md +2 -0
- package/src/skill/docs/define/guards.md +27 -3
- package/src/skill/docs/define/index.md +1 -1
- package/src/skill/docs/define/relationships.md +7 -0
- package/src/skill/docs/define/schema.md +44 -14
- package/src/skill/docs/define/security.md +1 -1
- package/src/skill/docs/define/transitions.md +35 -4
- package/src/skill/docs/define/triggers.md +14 -3
- package/src/skill/docs/define/views.md +33 -0
- package/src/skill/docs/index.md +2 -2
- package/src/skill/docs/platform/auth/api-keys.md +2 -2
- package/src/skill/docs/platform/auth/using-auth.md +37 -0
- package/src/skill/docs/platform/database/d1.md +15 -3
- package/src/skill/docs/platform/database/neon.md +4 -4
- package/src/skill/docs/platform/email/index.md +1 -1
- package/src/skill/docs/platform/queues/handlers.md +1 -1
- package/src/skill/docs/platform/queues/using-queues.md +1 -1
- package/src/skill/docs/platform/realtime/using-realtime.md +6 -4
- package/src/skill/docs/platform/schedules/index.md +1 -1
- package/src/skill/docs/platform/storage/index.md +3 -3
- package/src/skill/docs/platform/storage/r2.md +87 -37
- package/src/skill/docs/platform/storage/using-r2.md +99 -19
- package/src/skill/docs/platform/webhooks/inbound.md +40 -0
- package/src/skill/docs/start/deploy-browser.md +40 -45
- package/src/skill/docs/start/deploy-owner-access.md +60 -52
- package/src/skill/docs/start/deploy.md +4 -4
- package/src/skill/docs/start/first-api.md +2 -2
- package/src/skill/docs/start/hand-crafted.md +3 -3
- package/src/skill/docs/start/index.md +3 -3
- package/src/skill/docs/start/patterns.md +17 -2
- package/src/skill/docs/start/quickstart.md +3 -3
- package/src/skill/docs/start/template-blog.md +2 -2
- package/src/skill/docs/start/template-cloudflare.md +3 -3
- package/src/skill/docs/start/template-empty.md +1 -1
- package/src/skill/docs/start/templates.md +1 -1
- package/src/skill/docs/tooling/claude-skill.md +1 -1
- package/src/skill/docs/tooling/cli.md +21 -16
- package/src/skill/docs/tooling/cloud-compiler/authentication.md +2 -2
- package/src/skill/docs/tooling/cloud-compiler/endpoints.md +5 -3
- package/src/skill/docs/tooling/cloud-compiler/index.md +1 -1
- package/src/skill/docs/tooling/cloud-compiler/local-compiler.md +2 -2
- package/src/skill/docs/tooling/cloud-compiler/troubleshooting.md +74 -1
- package/src/skill/docs/tooling/output.md +23 -2
- package/src/skill/docs/tooling/troubleshooting.md +1 -1
- package/src/skill/docs/ui/account/customization.md +1 -1
- package/src/skill/docs/ui/account/environment-variables.md +2 -2
- package/src/skill/docs/ui/account/features/admin.md +1 -1
- package/src/skill/docs/ui/account/features/api-keys.md +10 -8
- package/src/skill/docs/ui/account/features/avatars.md +24 -8
- package/src/skill/docs/ui/account/features/index.md +16 -11
- package/src/skill/docs/ui/account/features/organizations.md +3 -2
- package/src/skill/docs/ui/account/hooks.md +2 -0
- package/src/skill/docs/ui/account/index.md +10 -5
- package/src/skill/docs/ui/account/with-quickback.md +2 -2
- package/src/skill/docs/ui/admin/actions.md +97 -3
- package/src/skill/docs/ui/admin/components.md +4 -6
- package/src/skill/docs/ui/admin/connecting.md +15 -3
- package/src/skill/docs/ui/admin/index.md +71 -6
- package/src/skill/docs/ui/admin/inline-editing.md +38 -4
- package/src/skill/docs/ui/admin/record-layouts.md +22 -21
- package/src/skill/docs/ui/admin/schema-format.md +39 -2
- package/src/skill/docs/ui/admin/schema-registry.md +107 -7
- package/src/skill/docs/ui/admin/security.md +19 -4
- package/src/skill/docs/ui/admin/table-views.md +59 -12
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
# Actions
|
|
2
2
|
|
|
3
|
-
Actions are custom operations defined in your feature files (e.g., `approve`, `void`, `post`, `applyPayment`). The CMS renders
|
|
3
|
+
Actions are custom operations defined in your feature files (e.g., `approve`, `void`, `post`, `applyPayment`). The CMS renders eligible declared or generated actions as clickable buttons with auto-generated input forms — no UI code required. It never invents an action from `cms` metadata alone.
|
|
4
|
+
|
|
5
|
+
## When an Action Control Exists
|
|
6
|
+
|
|
7
|
+
An action must first exist in the generated schema registry: author it with
|
|
8
|
+
`defineAction`, or declare a table transition so the compiler generates it.
|
|
9
|
+
The CMS then applies the action's access rules for the current membership role,
|
|
10
|
+
omits `cms.hidden` actions, and evaluates record/state conditions. A role that
|
|
11
|
+
is not admitted never sees the control. On a record page, an admitted action
|
|
12
|
+
whose `access.record` condition fails is shown disabled with the reason; an
|
|
13
|
+
action whose `transition` cannot fire from the record's current state (no
|
|
14
|
+
`fromTo` entry admits the target, already in the target state, or a literal
|
|
15
|
+
`guard` fails) is **hidden** — the route would answer `409
|
|
16
|
+
ACCESS_ACTION_NOT_ALLOWED_FOR_STATE`, so the control is never offered.
|
|
17
|
+
|
|
18
|
+
The optional `cms` block changes presentation and placement. It cannot create
|
|
19
|
+
the action, add CRUD, or widen `access`.
|
|
20
|
+
|
|
21
|
+
For a transition-managed `status`, give the column an initial schema default,
|
|
22
|
+
omit it from `guards.createable` and `guards.updatable`, and declare it only in
|
|
23
|
+
`guards.protected` with the allowed transition/action names. The CMS will offer
|
|
24
|
+
those eligible lifecycle controls instead of a direct status editor. A
|
|
25
|
+
protected field cannot also be `createable` or `updatable`: the schema default
|
|
26
|
+
sets the initial status, and only the named transitions/actions may write it.
|
|
4
27
|
|
|
5
28
|
## Where Actions Appear
|
|
6
29
|
|
|
@@ -10,6 +33,12 @@ Actions show up in two places:
|
|
|
10
33
|
|
|
11
34
|
In Table mode, the three-dot menu on each row includes a section for custom actions. Actions are separated from standard operations (view, edit, delete) by a divider.
|
|
12
35
|
|
|
36
|
+
A record-bound action has no `path:` and needs an existing record ID. It cannot
|
|
37
|
+
appear as a table-level control, and an empty table has no row menu in which to
|
|
38
|
+
show it. If the operation creates the first row—booking a reservation, joining
|
|
39
|
+
a waitlist, importing records—author it as a standalone action and place it in
|
|
40
|
+
the table toolbar.
|
|
41
|
+
|
|
13
42
|
### Action Bar (Detail View)
|
|
14
43
|
|
|
15
44
|
In the record detail view, an "Actions" card displays all available actions as buttons. Each button shows the action name, and hovering reveals the description as a tooltip.
|
|
@@ -32,13 +61,32 @@ The dialog generates the appropriate input control for each field:
|
|
|
32
61
|
|
|
33
62
|
| Zod Type | Input Control | Notes |
|
|
34
63
|
|----------|--------------|-------|
|
|
35
|
-
| `string` | Text input | Free
|
|
64
|
+
| `string` | Text input or FK typeahead | Free text unless the field resolves to an emitted `fkTarget` |
|
|
36
65
|
| `number` | Number input | Step 0.01, supports decimals |
|
|
37
66
|
| `boolean` | Checkbox | With label text |
|
|
38
67
|
| `array<string>` | Text input | Comma-separated values, split on save |
|
|
39
68
|
|
|
40
69
|
Required fields are marked with a red asterisk. Default values from the schema are pre-filled.
|
|
41
70
|
|
|
71
|
+
Field names are humanized for their labels, so `sessionId` appears as
|
|
72
|
+
**Session** rather than exposing the storage-oriented suffix. When that input
|
|
73
|
+
name corresponds to a parent-table column with an emitted `fkTarget`, the
|
|
74
|
+
dialog resolves the lookup through that column metadata, then renders a
|
|
75
|
+
selector for the FK target table and shows its `displayColumn` labels. Declare
|
|
76
|
+
the feature-table relationship in the schema with
|
|
77
|
+
`.references(() => sessions.id)` so plural or otherwise non-conventional target
|
|
78
|
+
names resolve reliably. Without `fkTarget`, the action input remains a plain
|
|
79
|
+
text field.
|
|
80
|
+
|
|
81
|
+
If the target has named views, the selector uses only a role-accessible authored
|
|
82
|
+
`read.defaultView` and calls its named-view endpoint. It never falls back to a
|
|
83
|
+
bare list or silently chooses another projection. The default view must include
|
|
84
|
+
the target primary key and `displayColumn`; otherwise the dialog disables the
|
|
85
|
+
lookup with an actionable explanation. Put the `displayColumn` in the view's
|
|
86
|
+
effective `query.searchable` allowlist for typeahead search. If that allowlist
|
|
87
|
+
is empty, the dialog instead shows the first 50 options in a non-searching
|
|
88
|
+
chooser and sends no `?search` request.
|
|
89
|
+
|
|
42
90
|
### Example
|
|
43
91
|
|
|
44
92
|
Given this action definition:
|
|
@@ -92,7 +140,26 @@ The action's `access.record` conditions are evaluated against the current record
|
|
|
92
140
|
| `notEquals` | `{ status: { notEquals: 'void' } }` | Field must not equal value |
|
|
93
141
|
| `in` | `{ status: { in: ['pending', 'draft'] } }` | Field must be one of values |
|
|
94
142
|
|
|
95
|
-
All conditions must pass
|
|
143
|
+
All conditions must pass before the action can execute. In record menus and the
|
|
144
|
+
detail action bar, a role-admitted action whose record condition fails is
|
|
145
|
+
disabled with an explanation. This means an "approve" control cannot run after
|
|
146
|
+
the record is approved, and "void" cannot run on a non-voidable record.
|
|
147
|
+
|
|
148
|
+
### Transition State
|
|
149
|
+
|
|
150
|
+
A record action with a `transition` policy ([Transitions](/define/transitions))
|
|
151
|
+
is hidden when the record's current state cannot take it. The registry carries
|
|
152
|
+
the policy's `field`, `fromTo`, `to`/`via`, literal `guard`, and `idempotent`;
|
|
153
|
+
the CMS evaluates them against the row exactly as the route does:
|
|
154
|
+
|
|
155
|
+
- `fromTo[current]` must list the target (`to`), or be non-empty when the
|
|
156
|
+
target comes from input (`via`).
|
|
157
|
+
- A record already in the `to` state never sees the control.
|
|
158
|
+
- Literal guards (`{ col: value }`, `{ null: true }`, `{ notNull: true }`) must
|
|
159
|
+
hold. A `custom` function guard is opaque to the CMS and does not hide.
|
|
160
|
+
|
|
161
|
+
So an application in `applied` with `fromTo: { interview: ["offer"] }` shows no
|
|
162
|
+
"To Offer" control; once it reaches `interview`, the control appears.
|
|
96
163
|
|
|
97
164
|
## CMS Metadata
|
|
98
165
|
|
|
@@ -179,6 +246,33 @@ This provides a visual cue that the action has permanent consequences.
|
|
|
179
246
|
|
|
180
247
|
Actions with `path:` set are standalone — not tied to a specific record. They appear in a separate section and don't receive a `recordId` when executed. The CMS passes `null` as the record ID for standalone actions.
|
|
181
248
|
|
|
249
|
+
This is the right shape for a business-controlled create flow when generic CRUD
|
|
250
|
+
create would expose too much. For example, a reservation action can enforce
|
|
251
|
+
capacity, uniqueness, and status defaults while still giving an empty
|
|
252
|
+
reservations table a visible **New reservation** toolbar action:
|
|
253
|
+
|
|
254
|
+
{/* doc-compile: skip — abbreviated CMS-placement example. */}
|
|
255
|
+
```typescript
|
|
256
|
+
export default defineAction({
|
|
257
|
+
path: "/reservations/make-reservation",
|
|
258
|
+
method: "POST",
|
|
259
|
+
input: z.object({ sessionId: z.string().min(1) }),
|
|
260
|
+
access: { roles: ["member+"] },
|
|
261
|
+
cms: {
|
|
262
|
+
label: "New reservation",
|
|
263
|
+
placement: "tables",
|
|
264
|
+
tables: ["reservations"],
|
|
265
|
+
},
|
|
266
|
+
async execute({ db, ctx, input }) {
|
|
267
|
+
// Check capacity/duplicates, then insert the protected default status.
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
By contrast, define table `create.access` and `guards.createable` when the
|
|
273
|
+
generic **New** form is intentionally safe. Do not add raw create merely to get
|
|
274
|
+
a button if the action is where the business invariants live.
|
|
275
|
+
|
|
182
276
|
### Placement in Multi-Table Features
|
|
183
277
|
|
|
184
278
|
When a standalone action belongs to a feature with multiple tables, the CMS needs to know where to render it.
|
|
@@ -6,7 +6,7 @@ The CMS is built from composable React components organized by function. Every c
|
|
|
6
6
|
|
|
7
7
|
### Sidebar
|
|
8
8
|
|
|
9
|
-
The main navigation sidebar. Reads the schema registry to build a collapsible feature-grouped table list.
|
|
9
|
+
The main navigation sidebar. Reads the schema registry to build a collapsible feature-grouped table list and renders the active organization and signed-in user in its footer.
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
interface SidebarProps {
|
|
@@ -20,11 +20,9 @@ interface SidebarProps {
|
|
|
20
20
|
| Feature icons | Each feature gets a contextual icon (e.g., Calculator for accounting) |
|
|
21
21
|
| Active state | Current table highlighted with primary color |
|
|
22
22
|
| Internal filter | Tables with `internal: true` are hidden |
|
|
23
|
-
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Top bar with tagline, organization switcher, and the signed-in user's role.
|
|
23
|
+
| Organization | One membership is a static name; multiple memberships add a switcher dropdown |
|
|
24
|
+
| Pinned mode | Hides the organization switcher because the scope is fixed |
|
|
25
|
+
| Profile footer | Shows the signed-in user, organization role, and sign-out action |
|
|
28
26
|
|
|
29
27
|
### Role context
|
|
30
28
|
|
|
@@ -119,7 +119,7 @@ export default defineConfig({
|
|
|
119
119
|
});
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
When you run `quickback
|
|
122
|
+
When you run `quickback build`, the CLI:
|
|
123
123
|
1. Builds the CMS SPA from source and places assets in `src/apps/cms/`
|
|
124
124
|
2. Adds `[assets]` config to `wrangler.toml` with `run_worker_first = true`
|
|
125
125
|
3. Generates Worker routing to serve the CMS SPA
|
|
@@ -166,8 +166,9 @@ By default, the CMS gates access behind organization membership:
|
|
|
166
166
|
|
|
167
167
|
1. User logs in via Better Auth session
|
|
168
168
|
2. CMS fetches the user's organization memberships
|
|
169
|
-
3. If the user belongs to
|
|
170
|
-
4.
|
|
169
|
+
3. If the user belongs to one organization, its name is shown without a dropdown
|
|
170
|
+
4. If the user belongs to multiple organizations, the sidebar displays an **org selector**
|
|
171
|
+
5. Once an org is selected, the user's role within that org determines their CMS permissions
|
|
171
172
|
|
|
172
173
|
This is the default behavior for Quickback projects with no pinned org.
|
|
173
174
|
|
|
@@ -182,6 +183,17 @@ When your project sets `features.pinnedOrganizationId`, the CMS keeps org-backed
|
|
|
182
183
|
|
|
183
184
|
Pinned organization mode is useful for internal tools, blogs, and one-customer deployments that still want org-backed roles and schema conventions without runtime org switching.
|
|
184
185
|
|
|
186
|
+
> **File uploads need valid R2 credentials**
|
|
187
|
+
>
|
|
188
|
+
> The CMS does not upload profile pictures or organization logos — those are
|
|
189
|
+
> Account UI, gated on `account.fileUploads`. They only work with
|
|
190
|
+
> [managed R2](/platform/storage/r2) and the `R2_ACCOUNT_ID` /
|
|
191
|
+
> `R2_ACCESS_KEY_ID` / `R2_SECRET_ACCESS_KEY` secrets. Start apps leave that
|
|
192
|
+
> flag off: a browser deploy can create the bucket, but it cannot mint those
|
|
193
|
+
> credentials. A `q.url()` field in the CMS stores a string; it does not
|
|
194
|
+
> upload to R2.
|
|
195
|
+
|
|
196
|
+
|
|
185
197
|
## Next Steps
|
|
186
198
|
|
|
187
199
|
- **[Table Views](/ui/admin/table-views)** — Browse and Data Table view modes
|
|
@@ -29,9 +29,60 @@ The CMS generates its entire UI from your Quickback definitions. Define a table
|
|
|
29
29
|
- **FK typeahead** — Server-side search for foreign key fields with debounced queries and keyboard navigation.
|
|
30
30
|
- **Field masking** — Email, phone, SSN, and redaction patterns applied per role. Masked fields show a lock icon.
|
|
31
31
|
- **Custom actions** — Action dialogs with auto-generated input forms, access filtering, CMS metadata (icons, categories, confirmations), and side effects warnings.
|
|
32
|
-
- **Views** — Named column-level projections per role
|
|
33
|
-
- **Auto-form generation** — Create and edit forms built from guards (createable/updatable fields).
|
|
34
|
-
- **
|
|
32
|
+
- **Views** — Named column-level projections per role, with an explicit default projection for CMS table entry.
|
|
33
|
+
- **Auto-form generation** — Create and edit forms built from guards (createable/updatable fields). Inputs follow the column's constraints — `q.enum` renders a select, `q.url` a URL input, `q.text({ maxLength })` a length-capped field — required columns are marked and constraints shown as helper text, untouched optional fields are omitted from the request (cleared ones are sent as `null`), and a `VALIDATION_ERROR` from the API is shown inline under the offending fields.
|
|
34
|
+
- **Human-readable relationships** — FK labels and selectors use the target table's `displayColumn` and an authored schema reference.
|
|
35
|
+
|
|
36
|
+
## CMS Readiness Review
|
|
37
|
+
|
|
38
|
+
Enabling the CMS makes the definitions visible; it does not invent a safe UI
|
|
39
|
+
workflow. Before compiling a CMS-backed project, review every visible table
|
|
40
|
+
against this checklist:
|
|
41
|
+
|
|
42
|
+
1. **Collection entry** — A table with no named views can use its ordinary
|
|
43
|
+
collection projection. Once `read.views` contains a named view, there is no
|
|
44
|
+
implicit full-row fallback. Set `read.defaultView` to an accessible named
|
|
45
|
+
view when the CMS must open the table directly. Without it, bare
|
|
46
|
+
`GET /api/v1/<table>` correctly returns `400 VIEW_REQUIRED`; callers must use
|
|
47
|
+
`GET /api/v1/<table>/views/<name>`. The registry marks that intentional
|
|
48
|
+
state with `requiresExplicitView: true`, so the CMS shows **Choose a view**
|
|
49
|
+
and makes no data request until one is selected. It never silently chooses
|
|
50
|
+
the first accessible projection. `defaultSort` only chooses ordering and
|
|
51
|
+
cannot satisfy view selection or fix `VIEW_REQUIRED`.
|
|
52
|
+
2. **Labels** — Set `displayColumn` on tables used as FK targets or record
|
|
53
|
+
titles. Auto-detection is a convenience, but an explicit value makes the
|
|
54
|
+
intended human label stable.
|
|
55
|
+
3. **Relationships** — For feature-table foreign keys, declare the relationship
|
|
56
|
+
in the schema with `.references(() => target.id)`. The CMS needs the emitted
|
|
57
|
+
`fkTarget` for selector/typeahead controls. Treat a matching `*Id` sibling
|
|
58
|
+
table name as a compiler diagnostic suggestion, not as proof of a
|
|
59
|
+
relationship. Better Auth ids are the exception: they live in `AUTH_DB` and
|
|
60
|
+
remain plain text, not cross-database FKs. When a target has named views,
|
|
61
|
+
its role-accessible `read.defaultView` must include its primary key and
|
|
62
|
+
`displayColumn`; the CMS lookup uses that named route only. Add the label to
|
|
63
|
+
the view's effective `query.searchable` for typeahead, or it becomes a
|
|
64
|
+
first-50 chooser with no search request.
|
|
65
|
+
4. **CRUD controls** — **New** requires generated `create` CRUD, admitted
|
|
66
|
+
`create.access`, and all required non-default inputs in
|
|
67
|
+
`guards.createable`. Edit controls require generated `update` CRUD,
|
|
68
|
+
admitted `update.access`, and fields in `guards.updatable`. A protected
|
|
69
|
+
workflow field belongs in neither generic write list. Give it a schema
|
|
70
|
+
default for creation; only its named transitions/actions may write it.
|
|
71
|
+
5. **Business actions** — A record-bound action needs an existing row. A
|
|
72
|
+
workflow that creates the first row should be a standalone action with
|
|
73
|
+
`path:` and explicit table-toolbar placement, such as
|
|
74
|
+
`cms: { placement: "tables", tables: ["reservations"] }`. Check action
|
|
75
|
+
roles and record conditions, and use `cms.hidden` only when the action is
|
|
76
|
+
intentionally API-only. Action input names are humanized (`sessionId`
|
|
77
|
+
becomes **Session**). The CMS resolves a matching `fkTarget` through the
|
|
78
|
+
parent-table column metadata, then reads the FK target through its safe
|
|
79
|
+
collection or named-default-view route. It renders search only when that
|
|
80
|
+
route supports it. Without an explicit schema relationship, the action
|
|
81
|
+
dialog falls back to plain text.
|
|
82
|
+
|
|
83
|
+
Read [Schema Registry](/ui/admin/schema-registry),
|
|
84
|
+
[Table Views](/ui/admin/table-views), and [Actions](/ui/admin/actions) before
|
|
85
|
+
authoring or reviewing a CMS-backed schema.
|
|
35
86
|
|
|
36
87
|
## Architecture
|
|
37
88
|
|
|
@@ -91,7 +142,7 @@ export default defineConfig({
|
|
|
91
142
|
### 2. Compile
|
|
92
143
|
|
|
93
144
|
```bash
|
|
94
|
-
quickback
|
|
145
|
+
quickback build
|
|
95
146
|
```
|
|
96
147
|
|
|
97
148
|
The compiler generates `schema-registry.json` and copies CMS static assets to `src/apps/`. It also adds an `[assets]` section to `wrangler.toml` so Cloudflare serves the CMS SPA automatically.
|
|
@@ -125,6 +176,20 @@ This adds a custom domain route to `wrangler.toml`. Both domains serve the same
|
|
|
125
176
|
cms: { access: "member" } // let organization members in
|
|
126
177
|
```
|
|
127
178
|
|
|
179
|
+
Start apps ship that setting. A sysadmin who also holds an organization membership uses the seat (`owner` / `admin` / `member`) rather than the cross-tenant picker — the picker is only for a sysadmin who belongs to nothing.
|
|
180
|
+
|
|
181
|
+
> **File uploads need valid R2 credentials**
|
|
182
|
+
>
|
|
183
|
+
> Profile pictures and organization logos are **Account UI**, not the CMS — they
|
|
184
|
+
> live at `/account/profile` and `/account/<slug>/settings`. They only work with
|
|
185
|
+
> `account.fileUploads: true`, [managed R2](/platform/storage/r2)
|
|
186
|
+
> (`defineFileStorage("cloudflare-r2", { managed: true })`), and the
|
|
187
|
+
> `R2_ACCOUNT_ID` / `R2_ACCESS_KEY_ID` / `R2_SECRET_ACCESS_KEY` secrets. A
|
|
188
|
+
> Start `workers.dev` deploy can create the bucket; it cannot mint those
|
|
189
|
+
> credentials, so Start leaves uploads off. Pasting a URL into a `q.url()`
|
|
190
|
+
> column in the CMS is just a string — it does not upload bytes.
|
|
191
|
+
|
|
192
|
+
|
|
128
193
|
> **`user.role === "appmanager"` does not open the CMS in either mode.** appmanager is the *control plane* — users, organizations, and subscriptions at [`/account/admin`](/ui/account) — and deliberately holds no tenant-data powers. Keeping those separable is the entire point of the appmanager/sysadmin split. An appmanager who is also a member of an organization gets in as that member, on the membership, not on the platform role.
|
|
129
194
|
|
|
130
195
|
|
|
@@ -138,7 +203,7 @@ The gates that carry real data:
|
|
|
138
203
|
|
|
139
204
|
1. **`/api/v1/schema`** — the metadata endpoint. Admits `sysadmin`, plus any caller with a membership when `access: "member"`. Otherwise `403` with `CMS_ACCESS_DENIED` and a hint naming the requirement. Without the registry there is no CMS.
|
|
140
205
|
2. **`custom_view` routes** — saved views follow whoever is admitted: the `sysadmin` tier in `"sysadmin"` mode, org membership *or* sysadmin in `"member"` mode.
|
|
141
|
-
3. **Account UI link** — the
|
|
206
|
+
3. **Account UI link** — the profile CMS action is hidden for callers who wouldn't get in. For admitted members it activates the selected organization before opening the CMS.
|
|
142
207
|
|
|
143
208
|
Your resource API endpoints (`/api/v1/<resource>`) are **not** affected — they continue to use the per-resource `read`, `create`, `update`, `delete`, and `upsert` access rules you defined.
|
|
144
209
|
|
|
@@ -162,7 +227,7 @@ The shell is served to any signed-in caller, and the SPA resolves one of six sta
|
|
|
162
227
|
|
|
163
228
|
The decision is a pure function (`resolveCmsAccess`), so the table above is tested rather than described.
|
|
164
229
|
|
|
165
|
-
|
|
230
|
+
For a zero-membership sysadmin in explicit cross-tenant mode, scope lives in the browser and rides every request as `?organizationId=` because Better Auth has no membership row to make active. Change it from the sidebar. A sysadmin who also holds memberships follows the ordinary membership flow instead; selecting a membership clears any older cross-tenant override. The sidebar shows the sole organization as static text and becomes a dropdown only when the user belongs to multiple organizations.
|
|
166
231
|
|
|
167
232
|
#### `access: "sysadmin"` without `cms.sysadmin`
|
|
168
233
|
|
|
@@ -17,6 +17,30 @@ The CMS determines which fields are editable from the table's guards:
|
|
|
17
17
|
|
|
18
18
|
If a table has no explicit guard config, the CMS falls back to making all non-system columns editable (excluding `id`, audit fields, `organizationId`, and `deletedAt`).
|
|
19
19
|
|
|
20
|
+
### When Create and Edit Controls Exist
|
|
21
|
+
|
|
22
|
+
The CMS does not invent write operations. It shows **New** only when the schema
|
|
23
|
+
registry contains generated `create` CRUD for the table and the current
|
|
24
|
+
membership role passes `create.access`. It shows edit links and inline editors
|
|
25
|
+
only when generated `update` CRUD exists, `update.access` admits that role, and
|
|
26
|
+
the field is updatable. The API enforces the same rules even if someone calls
|
|
27
|
+
it without the CMS.
|
|
28
|
+
|
|
29
|
+
For a table that should be manageable in the CMS:
|
|
30
|
+
|
|
31
|
+
- Define `create` with CMS-appropriate access and include every required,
|
|
32
|
+
caller-supplied field in `guards.createable`. Required fields supplied by a
|
|
33
|
+
schema default or by the system stay out of the form.
|
|
34
|
+
- Define `update` with CMS-appropriate access and put only ordinary editable
|
|
35
|
+
fields in `guards.updatable`.
|
|
36
|
+
- Give workflow-managed status/state fields a default, map them to the named
|
|
37
|
+
transitions/actions in `guards.protected`, and never also list them in
|
|
38
|
+
`updatable` or `createable`. The CMS changes those fields through action
|
|
39
|
+
controls, not a direct input.
|
|
40
|
+
|
|
41
|
+
`guards` shape the fields inside an allowed operation; they do not grant CRUD
|
|
42
|
+
access or create a missing route.
|
|
43
|
+
|
|
20
44
|
## Cell Types
|
|
21
45
|
|
|
22
46
|
Each column type gets a specialized editor:
|
|
@@ -35,15 +59,25 @@ A Yes/No dropdown. Click to toggle between the two values.
|
|
|
35
59
|
|
|
36
60
|
### FK Typeahead
|
|
37
61
|
|
|
38
|
-
Foreign key columns
|
|
62
|
+
Foreign key columns with an emitted `fkTarget` get a typeahead dropdown with server-side search:
|
|
39
63
|
|
|
40
64
|
- **Debounced search** — Queries are debounced at 200ms to avoid flooding the API
|
|
41
|
-
- **Server-side filtering** — Sends `?search
|
|
65
|
+
- **Server-side filtering** — Sends `?search=` only when the target collection or named default view supports search
|
|
42
66
|
- **Keyboard navigation** — Arrow keys to navigate options, Enter to select, Escape to close
|
|
43
|
-
- **Auto-loads initial options** — Opens with the first
|
|
67
|
+
- **Auto-loads initial options** — Opens with the first 10 matching records when search is supported, or the first 50 records when it is not
|
|
44
68
|
- **Display labels** — Shows the target table's display column value (e.g., "John Smith" instead of `usr_abc123`)
|
|
45
69
|
|
|
46
|
-
The FK target table
|
|
70
|
+
The FK target table comes from schema-registry metadata. Declare feature-table
|
|
71
|
+
relationships with `.references(() => target.id)` so the compiler emits a
|
|
72
|
+
reliable `fkTarget`; a name ending in `Id` is not enough to establish the
|
|
73
|
+
relationship. For example, `sessionId` can resolve through its parent-table
|
|
74
|
+
column metadata and search the `sessions` target table.
|
|
75
|
+
|
|
76
|
+
For a target with named views, the editor uses only an authored default view
|
|
77
|
+
that the current role can access. That projection must contain the target
|
|
78
|
+
primary key and `displayColumn`; there is no bare-list fallback. If the
|
|
79
|
+
effective `query.searchable` list is empty, the editor shows the first 50
|
|
80
|
+
options with a read-only search box and sends no `?search` request.
|
|
47
81
|
|
|
48
82
|
### Enum / Select
|
|
49
83
|
|
|
@@ -5,7 +5,7 @@ The CMS record detail page groups fields into collapsible sections. By default,
|
|
|
5
5
|
There are two layers:
|
|
6
6
|
|
|
7
7
|
1. **Code-defined layouts** — developers configure named layouts in the table config
|
|
8
|
-
2. **
|
|
8
|
+
2. **Custom layouts** — end-users create and save record layouts through the CMS table settings
|
|
9
9
|
|
|
10
10
|
## Code-Defined Layouts
|
|
11
11
|
|
|
@@ -75,41 +75,42 @@ When a table has multiple named layouts, a dropdown appears in the record detail
|
|
|
75
75
|
|
|
76
76
|
If only one layout is defined, it's used automatically without showing a dropdown.
|
|
77
77
|
|
|
78
|
-
##
|
|
78
|
+
## Custom Record Layouts
|
|
79
79
|
|
|
80
80
|
End-users can create their own record layouts via the CMS UI. These are stored in the database and can be shared with other organization members.
|
|
81
81
|
|
|
82
|
-
### Creating a
|
|
82
|
+
### Creating a Layout
|
|
83
83
|
|
|
84
|
-
1. Open
|
|
85
|
-
2. Click the
|
|
86
|
-
3.
|
|
87
|
-
|
|
84
|
+
1. Open the table
|
|
85
|
+
2. Click the settings cog in the table header
|
|
86
|
+
3. Open **Record layouts** and click **Create**
|
|
87
|
+
4. In the record layout dialog:
|
|
88
|
+
- Name your layout
|
|
88
89
|
- Add sections and assign fields from a dropdown
|
|
89
90
|
- Set columns (1 or 2) and collapsed state per section
|
|
90
91
|
- Optionally share with your organization
|
|
91
|
-
|
|
92
|
+
5. Click **Create layout**
|
|
92
93
|
|
|
93
|
-
The new
|
|
94
|
+
The new layout appears in the record-page layout dropdown alongside code-defined layouts.
|
|
94
95
|
|
|
95
|
-
### Editing and Deleting
|
|
96
|
+
### Editing and Deleting Layouts
|
|
96
97
|
|
|
97
|
-
-
|
|
98
|
-
-
|
|
98
|
+
- Open **Record layouts** from the table header to edit or delete a custom layout
|
|
99
|
+
- Open a record and click **Customize layout** to edit the active custom layout against that record
|
|
99
100
|
- Code-defined layouts cannot be edited or deleted from the CMS
|
|
100
101
|
|
|
101
102
|
### Access Control
|
|
102
103
|
|
|
103
104
|
| Operation | Who Can Do It |
|
|
104
105
|
|-----------|---------------|
|
|
105
|
-
| Create a
|
|
106
|
-
| Edit/delete own
|
|
107
|
-
| Edit/delete any
|
|
108
|
-
| View shared
|
|
106
|
+
| Create a layout | Any member, admin, or owner |
|
|
107
|
+
| Edit/delete own layouts | The creator |
|
|
108
|
+
| Edit/delete any layout | Admins and owners |
|
|
109
|
+
| View shared layouts | All organization members |
|
|
109
110
|
|
|
110
|
-
### Setting Up
|
|
111
|
+
### Setting Up Custom Layout Storage
|
|
111
112
|
|
|
112
|
-
To enable
|
|
113
|
+
To enable custom record layouts, add a `customView` table to your Quickback project:
|
|
113
114
|
|
|
114
115
|
```typescript
|
|
115
116
|
// quickback/features/cms/custom-view.ts
|
|
@@ -164,16 +165,16 @@ export default defineTable(customView, {
|
|
|
164
165
|
});
|
|
165
166
|
```
|
|
166
167
|
|
|
167
|
-
Compile your project to generate the API endpoints. The CMS
|
|
168
|
+
Compile your project to generate the API endpoints. The CMS automatically detects the `customView` table and enables record layout management.
|
|
168
169
|
|
|
169
170
|
## Fallback Behavior
|
|
170
171
|
|
|
171
172
|
| Scenario | Result |
|
|
172
173
|
|----------|--------|
|
|
173
|
-
| No `layouts` config, no custom
|
|
174
|
+
| No `layouts` config, no custom layouts | Auto-grouping by naming heuristics |
|
|
174
175
|
| `layouts` config defined | Uses "default" layout or first available |
|
|
175
176
|
| Multiple layouts | Dropdown for switching, persisted per table |
|
|
176
|
-
| Custom
|
|
177
|
+
| Custom layouts created | Appear in dropdown below code-defined layouts |
|
|
177
178
|
|
|
178
179
|
## Next Steps
|
|
179
180
|
|
|
@@ -53,6 +53,8 @@ interface TableMeta {
|
|
|
53
53
|
guards: GuardsConfig;
|
|
54
54
|
masking: Record<string, MaskingRule>;
|
|
55
55
|
views: Record<string, ViewConfig>;
|
|
56
|
+
defaultView?: string;
|
|
57
|
+
requiresExplicitView?: true;
|
|
56
58
|
validation: Record<string, ValidationRule>;
|
|
57
59
|
actions: ActionMeta[];
|
|
58
60
|
displayColumn?: string;
|
|
@@ -75,6 +77,8 @@ interface TableMeta {
|
|
|
75
77
|
| `guards` | Field-level create/update/immutable/protected rules |
|
|
76
78
|
| `masking` | Per-field masking rules keyed by column name |
|
|
77
79
|
| `views` | Named column projections keyed by view name |
|
|
80
|
+
| `defaultView` | Authored `read.defaultView`, used for initial CMS and FK lookup reads |
|
|
81
|
+
| `requiresExplicitView` | Emitted as `true` when named views exist without a default and the CMS must not issue a bare collection read |
|
|
78
82
|
| `validation` | Per-field validation rules keyed by column name |
|
|
79
83
|
| `actions` | Array of action definitions scoped to this table |
|
|
80
84
|
| `displayColumn` | Column used as human-readable label (auto-detected or explicit) |
|
|
@@ -93,6 +97,7 @@ interface ColumnMeta {
|
|
|
93
97
|
dbName: string;
|
|
94
98
|
type: "text" | "integer" | "real" | "blob";
|
|
95
99
|
mode?: "boolean";
|
|
100
|
+
kind?: string;
|
|
96
101
|
primaryKey: boolean;
|
|
97
102
|
notNull: boolean;
|
|
98
103
|
defaultValue?: string | number | boolean;
|
|
@@ -106,6 +111,7 @@ interface ColumnMeta {
|
|
|
106
111
|
| `dbName` | Snake_case SQL column name |
|
|
107
112
|
| `type` | SQLite storage type |
|
|
108
113
|
| `mode` | When `"boolean"`, an integer column represents true/false |
|
|
114
|
+
| `kind` | q-DSL column kind (`text`, `url`, `int`, `bool`, `uuid`, `timestamp`, `json`, `id`, `enum`, `scope`, `stamp`) — q-authored columns only. The CMS picks the form control from it (`timestamp` → date-time picker, `bool` → checkbox…), so `inputHints` is only needed to override. Absent on raw-Drizzle tables, where `type` is all there is. |
|
|
109
115
|
| `primaryKey` | Whether this column is the primary key |
|
|
110
116
|
| `notNull` | Whether the column has a NOT NULL constraint |
|
|
111
117
|
| `defaultValue` | Static default value (strings, numbers, or booleans) |
|
|
@@ -183,6 +189,7 @@ interface ActionMeta {
|
|
|
183
189
|
roles: string[];
|
|
184
190
|
record?: Record<string, unknown>;
|
|
185
191
|
};
|
|
192
|
+
transition?: ActionTransitionMeta; // record actions with a state machine
|
|
186
193
|
standalone?: boolean;
|
|
187
194
|
path?: string;
|
|
188
195
|
method?: string;
|
|
@@ -191,6 +198,20 @@ interface ActionMeta {
|
|
|
191
198
|
cms?: CmsConfig;
|
|
192
199
|
}
|
|
193
200
|
|
|
201
|
+
/** The state-machine subset of the action's `transition` policy. Write-side
|
|
202
|
+
* keys (stamp, clears, onIllegal) are omitted; a `custom` guard function is
|
|
203
|
+
* replaced by `hasCustomGuard: true`. The CMS hides the action when the
|
|
204
|
+
* record's current state cannot take it — see /ui/admin/actions#transition-state. */
|
|
205
|
+
interface ActionTransitionMeta {
|
|
206
|
+
field?: string | null;
|
|
207
|
+
fromTo?: Record<string, Array<string | number | boolean>>;
|
|
208
|
+
to?: string | number | boolean;
|
|
209
|
+
via?: string;
|
|
210
|
+
guard?: Record<string, string | number | boolean | { null: true } | { notNull: true }>;
|
|
211
|
+
hasCustomGuard?: boolean;
|
|
212
|
+
idempotent?: "noop" | "error";
|
|
213
|
+
}
|
|
214
|
+
|
|
194
215
|
interface CmsConfig {
|
|
195
216
|
label?: string;
|
|
196
217
|
icon?: string;
|
|
@@ -253,13 +274,20 @@ Named column projection with access control:
|
|
|
253
274
|
interface ViewConfig {
|
|
254
275
|
fields: string[];
|
|
255
276
|
access: AccessRule;
|
|
277
|
+
query?: {
|
|
278
|
+
filterable?: string[] | null;
|
|
279
|
+
searchable?: string[];
|
|
280
|
+
sortable?: string[];
|
|
281
|
+
defaultSort?: string;
|
|
282
|
+
};
|
|
256
283
|
}
|
|
257
284
|
```
|
|
258
285
|
|
|
259
286
|
| Field | Description |
|
|
260
287
|
|-------|-------------|
|
|
261
288
|
| `fields` | Array of column names to include in this view |
|
|
262
|
-
| `access` |
|
|
289
|
+
| `access` | Effective role-based access: the view override or inherited table `read.access` |
|
|
290
|
+
| `query` | Effective view query metadata. Explicit named-view allowlists are authoritative. Current registries materialize inherited `searchable` and q-table `filterable` defaults; `searchable: []` disables search, while `filterable: null` preserves raw Drizzle compatibility when no closed allowlist can be derived. |
|
|
263
291
|
|
|
264
292
|
## CmsLayout
|
|
265
293
|
|
|
@@ -324,7 +352,7 @@ interface MaskingRule {
|
|
|
324
352
|
|
|
325
353
|
## ValidationRule
|
|
326
354
|
|
|
327
|
-
Per-field validation constraints:
|
|
355
|
+
Per-field validation constraints, mirrored from the Zod the API enforces on request bodies so the CMS can render the right control and validate before it POSTs:
|
|
328
356
|
|
|
329
357
|
```typescript
|
|
330
358
|
interface ValidationRule {
|
|
@@ -334,9 +362,18 @@ interface ValidationRule {
|
|
|
334
362
|
max?: number;
|
|
335
363
|
enum?: string[];
|
|
336
364
|
email?: boolean;
|
|
365
|
+
url?: boolean;
|
|
337
366
|
}
|
|
338
367
|
```
|
|
339
368
|
|
|
369
|
+
| Rule | Emitted from |
|
|
370
|
+
|------|--------------|
|
|
371
|
+
| `enum` | `q.enum([...])`, or `text(..., { enum: [...] })` in raw Drizzle — the CMS renders a select |
|
|
372
|
+
| `url` | `q.url()` — the CMS renders a `url` input; the API rejects anything `new URL()` can't parse, including `""` |
|
|
373
|
+
| `maxLength` | `q.text({ maxLength })` / `q.url({ maxLength })` |
|
|
374
|
+
|
|
375
|
+
Columns with no constraints have no entry. Optional fields left blank in the CMS form are omitted from the request body rather than sent as `""` — the API accepts an optional field being absent, not empty.
|
|
376
|
+
|
|
340
377
|
| Field | Description |
|
|
341
378
|
|-------|-------------|
|
|
342
379
|
| `minLength` | Minimum string length |
|