@quickback-dev/cli 0.10.16 → 0.10.20
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.map +1 -1
- package/dist/commands/compile.js +40 -2
- package/dist/commands/compile.js.map +1 -1
- package/dist/docs/content.js +6 -6
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/skill/SKILL.md +142 -1051
- package/dist/skill/agents/quickback-specialist/AGENT.md +36 -0
- package/dist/skill/docs/changelog.md +1192 -0
- package/dist/skill/docs/compiler/claude-code-skill.md +312 -0
- package/dist/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
- package/dist/skill/docs/compiler/cloud-compiler/cli.md +307 -0
- package/dist/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
- package/dist/skill/docs/compiler/cloud-compiler/index.md +65 -0
- package/dist/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
- package/dist/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
- package/dist/skill/docs/compiler/config/agents.md +144 -0
- package/dist/skill/docs/compiler/config/auth.md +109 -0
- package/dist/skill/docs/compiler/config/bindings.md +176 -0
- package/dist/skill/docs/compiler/config/domains.md +149 -0
- package/dist/skill/docs/compiler/config/index.md +419 -0
- package/dist/skill/docs/compiler/config/output.md +338 -0
- package/dist/skill/docs/compiler/config/providers.md +248 -0
- package/dist/skill/docs/compiler/config/security.md +255 -0
- package/dist/skill/docs/compiler/config/single-tenant.md +128 -0
- package/dist/skill/docs/compiler/config/variables.md +157 -0
- package/dist/skill/docs/compiler/definitions/access.md +445 -0
- package/dist/skill/docs/compiler/definitions/actions.md +884 -0
- package/dist/skill/docs/compiler/definitions/concepts.md +52 -0
- package/dist/skill/docs/compiler/definitions/feature.md +164 -0
- package/dist/skill/docs/compiler/definitions/firewall.md +285 -0
- package/dist/skill/docs/compiler/definitions/guards.md +241 -0
- package/dist/skill/docs/compiler/definitions/index.md +219 -0
- package/dist/skill/docs/compiler/definitions/masking.md +241 -0
- package/dist/skill/docs/compiler/definitions/read.md +220 -0
- package/dist/skill/docs/compiler/definitions/schema.md +697 -0
- package/dist/skill/docs/compiler/definitions/validation.md +35 -0
- package/dist/skill/docs/compiler/definitions/views.md +292 -0
- package/dist/skill/docs/compiler/getting-started/claude-code.md +126 -0
- package/dist/skill/docs/compiler/getting-started/full-example.md +431 -0
- package/dist/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
- package/dist/skill/docs/compiler/getting-started/index.md +192 -0
- package/dist/skill/docs/compiler/getting-started/patterns.md +225 -0
- package/dist/skill/docs/compiler/getting-started/template-blog.md +280 -0
- package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
- package/dist/skill/docs/compiler/getting-started/template-empty.md +112 -0
- package/dist/skill/docs/compiler/getting-started/templates.md +111 -0
- package/dist/skill/docs/compiler/index.md +85 -0
- package/dist/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
- package/dist/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
- package/dist/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
- package/dist/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
- package/dist/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
- package/dist/skill/docs/compiler/targets/hono-api/index.md +37 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
- package/dist/skill/docs/compiler/targets/index.md +47 -0
- package/dist/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
- package/dist/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
- package/dist/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
- package/dist/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
- package/dist/skill/docs/compiler/troubleshooting.md +120 -0
- package/dist/skill/docs/index.md +77 -0
- package/dist/skill/docs/stack/account-ui/customization.md +378 -0
- package/dist/skill/docs/stack/account-ui/environment-variables.md +325 -0
- package/dist/skill/docs/stack/account-ui/features/admin.md +76 -0
- package/dist/skill/docs/stack/account-ui/features/api-keys.md +22 -0
- package/dist/skill/docs/stack/account-ui/features/avatars.md +37 -0
- package/dist/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
- package/dist/skill/docs/stack/account-ui/features/index.md +291 -0
- package/dist/skill/docs/stack/account-ui/features/organizations.md +29 -0
- package/dist/skill/docs/stack/account-ui/features/passkeys.md +31 -0
- package/dist/skill/docs/stack/account-ui/features/passwordless.md +28 -0
- package/dist/skill/docs/stack/account-ui/features/sessions.md +20 -0
- package/dist/skill/docs/stack/account-ui/hooks.md +209 -0
- package/dist/skill/docs/stack/account-ui/index.md +147 -0
- package/dist/skill/docs/stack/account-ui/library-usage.md +257 -0
- package/dist/skill/docs/stack/account-ui/standalone.md +149 -0
- package/dist/skill/docs/stack/account-ui/with-quickback.md +160 -0
- package/dist/skill/docs/stack/account-ui/worker.md +362 -0
- package/dist/skill/docs/stack/auth/api-keys.md +15 -0
- package/dist/skill/docs/stack/auth/device-auth.md +14 -0
- package/dist/skill/docs/stack/auth/index.md +64 -0
- package/dist/skill/docs/stack/auth/jwt-optimization.md +245 -0
- package/dist/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
- package/dist/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
- package/dist/skill/docs/stack/auth/plugins/index.md +228 -0
- package/dist/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
- package/dist/skill/docs/stack/auth/security.md +455 -0
- package/dist/skill/docs/stack/auth/using-auth.md +39 -0
- package/dist/skill/docs/stack/cms/actions.md +199 -0
- package/dist/skill/docs/stack/cms/components.md +479 -0
- package/dist/skill/docs/stack/cms/connecting.md +199 -0
- package/dist/skill/docs/stack/cms/dashboard.md +39 -0
- package/dist/skill/docs/stack/cms/index.md +158 -0
- package/dist/skill/docs/stack/cms/inline-editing.md +136 -0
- package/dist/skill/docs/stack/cms/pages.md +275 -0
- package/dist/skill/docs/stack/cms/record-layouts.md +151 -0
- package/dist/skill/docs/stack/cms/schema-format.md +437 -0
- package/dist/skill/docs/stack/cms/schema-registry.md +200 -0
- package/dist/skill/docs/stack/cms/security.md +203 -0
- package/dist/skill/docs/stack/cms/table-views.md +142 -0
- package/dist/skill/docs/stack/index.md +65 -0
- package/dist/skill/docs/stack/queues/handlers.md +317 -0
- package/dist/skill/docs/stack/queues/index.md +56 -0
- package/dist/skill/docs/stack/queues/using-queues.md +192 -0
- package/dist/skill/docs/stack/realtime/durable-objects.md +488 -0
- package/dist/skill/docs/stack/realtime/index.md +67 -0
- package/dist/skill/docs/stack/realtime/using-realtime.md +211 -0
- package/dist/skill/docs/stack/storage/index.md +17 -0
- package/dist/skill/docs/stack/storage/kv.md +204 -0
- package/dist/skill/docs/stack/storage/r2.md +232 -0
- package/dist/skill/docs/stack/storage/using-kv.md +70 -0
- package/dist/skill/docs/stack/storage/using-r2.md +55 -0
- package/dist/skill/docs/stack/vector/embeddings.md +554 -0
- package/dist/skill/docs/stack/vector/index.md +44 -0
- package/dist/skill/docs/stack/vector/using-embeddings.md +186 -0
- package/dist/skill/docs/stack/webhooks/inbound.md +186 -0
- package/dist/skill/docs/stack/webhooks/index.md +36 -0
- package/dist/skill/docs/stack/webhooks/outbound.md +281 -0
- package/package.json +1 -1
- package/src/skill/SKILL.md +142 -1051
- package/src/skill/agents/quickback-specialist/AGENT.md +36 -0
- package/src/skill/docs/changelog.md +1192 -0
- package/src/skill/docs/compiler/claude-code-skill.md +312 -0
- package/src/skill/docs/compiler/cloud-compiler/authentication.md +63 -0
- package/src/skill/docs/compiler/cloud-compiler/cli.md +307 -0
- package/src/skill/docs/compiler/cloud-compiler/endpoints.md +78 -0
- package/src/skill/docs/compiler/cloud-compiler/index.md +65 -0
- package/src/skill/docs/compiler/cloud-compiler/local-compiler.md +115 -0
- package/src/skill/docs/compiler/cloud-compiler/troubleshooting.md +76 -0
- package/src/skill/docs/compiler/config/agents.md +144 -0
- package/src/skill/docs/compiler/config/auth.md +109 -0
- package/src/skill/docs/compiler/config/bindings.md +176 -0
- package/src/skill/docs/compiler/config/domains.md +149 -0
- package/src/skill/docs/compiler/config/index.md +419 -0
- package/src/skill/docs/compiler/config/output.md +338 -0
- package/src/skill/docs/compiler/config/providers.md +248 -0
- package/src/skill/docs/compiler/config/security.md +255 -0
- package/src/skill/docs/compiler/config/single-tenant.md +128 -0
- package/src/skill/docs/compiler/config/variables.md +157 -0
- package/src/skill/docs/compiler/definitions/access.md +445 -0
- package/src/skill/docs/compiler/definitions/actions.md +884 -0
- package/src/skill/docs/compiler/definitions/concepts.md +52 -0
- package/src/skill/docs/compiler/definitions/feature.md +164 -0
- package/src/skill/docs/compiler/definitions/firewall.md +285 -0
- package/src/skill/docs/compiler/definitions/guards.md +241 -0
- package/src/skill/docs/compiler/definitions/index.md +219 -0
- package/src/skill/docs/compiler/definitions/masking.md +241 -0
- package/src/skill/docs/compiler/definitions/read.md +220 -0
- package/src/skill/docs/compiler/definitions/schema.md +697 -0
- package/src/skill/docs/compiler/definitions/validation.md +35 -0
- package/src/skill/docs/compiler/definitions/views.md +292 -0
- package/src/skill/docs/compiler/getting-started/claude-code.md +126 -0
- package/src/skill/docs/compiler/getting-started/full-example.md +431 -0
- package/src/skill/docs/compiler/getting-started/hand-crafted.md +178 -0
- package/src/skill/docs/compiler/getting-started/index.md +192 -0
- package/src/skill/docs/compiler/getting-started/patterns.md +225 -0
- package/src/skill/docs/compiler/getting-started/template-blog.md +280 -0
- package/src/skill/docs/compiler/getting-started/template-cloudflare.md +260 -0
- package/src/skill/docs/compiler/getting-started/template-empty.md +112 -0
- package/src/skill/docs/compiler/getting-started/templates.md +111 -0
- package/src/skill/docs/compiler/index.md +85 -0
- package/src/skill/docs/compiler/targets/hono-api/cloudflare.md +94 -0
- package/src/skill/docs/compiler/targets/hono-api/database/d1.md +246 -0
- package/src/skill/docs/compiler/targets/hono-api/database/index.md +16 -0
- package/src/skill/docs/compiler/targets/hono-api/database/neon.md +144 -0
- package/src/skill/docs/compiler/targets/hono-api/database/using-d1.md +39 -0
- package/src/skill/docs/compiler/targets/hono-api/index.md +37 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/actions-api.md +323 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +357 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/caching.md +105 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +652 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/errors.md +224 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/index.md +37 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +203 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +199 -0
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +161 -0
- package/src/skill/docs/compiler/targets/index.md +47 -0
- package/src/skill/docs/compiler/targets/supabase-rls/index.md +55 -0
- package/src/skill/docs/compiler/targets/supabase-rls/limitations.md +48 -0
- package/src/skill/docs/compiler/targets/supabase-rls/mappings.md +99 -0
- package/src/skill/docs/compiler/targets/supabase-rls/setup.md +88 -0
- package/src/skill/docs/compiler/troubleshooting.md +120 -0
- package/src/skill/docs/index.md +77 -0
- package/src/skill/docs/stack/account-ui/customization.md +378 -0
- package/src/skill/docs/stack/account-ui/environment-variables.md +325 -0
- package/src/skill/docs/stack/account-ui/features/admin.md +76 -0
- package/src/skill/docs/stack/account-ui/features/api-keys.md +22 -0
- package/src/skill/docs/stack/account-ui/features/avatars.md +37 -0
- package/src/skill/docs/stack/account-ui/features/cli-authorize.md +21 -0
- package/src/skill/docs/stack/account-ui/features/index.md +291 -0
- package/src/skill/docs/stack/account-ui/features/organizations.md +29 -0
- package/src/skill/docs/stack/account-ui/features/passkeys.md +31 -0
- package/src/skill/docs/stack/account-ui/features/passwordless.md +28 -0
- package/src/skill/docs/stack/account-ui/features/sessions.md +20 -0
- package/src/skill/docs/stack/account-ui/hooks.md +209 -0
- package/src/skill/docs/stack/account-ui/index.md +147 -0
- package/src/skill/docs/stack/account-ui/library-usage.md +257 -0
- package/src/skill/docs/stack/account-ui/standalone.md +149 -0
- package/src/skill/docs/stack/account-ui/with-quickback.md +160 -0
- package/src/skill/docs/stack/account-ui/worker.md +362 -0
- package/src/skill/docs/stack/auth/api-keys.md +15 -0
- package/src/skill/docs/stack/auth/device-auth.md +14 -0
- package/src/skill/docs/stack/auth/index.md +64 -0
- package/src/skill/docs/stack/auth/jwt-optimization.md +245 -0
- package/src/skill/docs/stack/auth/plugins/aws-ses.md +127 -0
- package/src/skill/docs/stack/auth/plugins/combo-auth.md +74 -0
- package/src/skill/docs/stack/auth/plugins/index.md +228 -0
- package/src/skill/docs/stack/auth/plugins/upgrade-anonymous.md +155 -0
- package/src/skill/docs/stack/auth/security.md +455 -0
- package/src/skill/docs/stack/auth/using-auth.md +39 -0
- package/src/skill/docs/stack/cms/actions.md +199 -0
- package/src/skill/docs/stack/cms/components.md +479 -0
- package/src/skill/docs/stack/cms/connecting.md +199 -0
- package/src/skill/docs/stack/cms/dashboard.md +39 -0
- package/src/skill/docs/stack/cms/index.md +158 -0
- package/src/skill/docs/stack/cms/inline-editing.md +136 -0
- package/src/skill/docs/stack/cms/pages.md +275 -0
- package/src/skill/docs/stack/cms/record-layouts.md +151 -0
- package/src/skill/docs/stack/cms/schema-format.md +437 -0
- package/src/skill/docs/stack/cms/schema-registry.md +200 -0
- package/src/skill/docs/stack/cms/security.md +203 -0
- package/src/skill/docs/stack/cms/table-views.md +142 -0
- package/src/skill/docs/stack/index.md +65 -0
- package/src/skill/docs/stack/queues/handlers.md +317 -0
- package/src/skill/docs/stack/queues/index.md +56 -0
- package/src/skill/docs/stack/queues/using-queues.md +192 -0
- package/src/skill/docs/stack/realtime/durable-objects.md +488 -0
- package/src/skill/docs/stack/realtime/index.md +67 -0
- package/src/skill/docs/stack/realtime/using-realtime.md +211 -0
- package/src/skill/docs/stack/storage/index.md +17 -0
- package/src/skill/docs/stack/storage/kv.md +204 -0
- package/src/skill/docs/stack/storage/r2.md +232 -0
- package/src/skill/docs/stack/storage/using-kv.md +70 -0
- package/src/skill/docs/stack/storage/using-r2.md +55 -0
- package/src/skill/docs/stack/vector/embeddings.md +554 -0
- package/src/skill/docs/stack/vector/index.md +44 -0
- package/src/skill/docs/stack/vector/using-embeddings.md +186 -0
- package/src/skill/docs/stack/webhooks/inbound.md +186 -0
- package/src/skill/docs/stack/webhooks/index.md +36 -0
- package/src/skill/docs/stack/webhooks/outbound.md +281 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Views API
|
|
2
|
+
|
|
3
|
+
Views provide named column projections that limit which fields are returned in API responses. Each view can have its own access control, and all security pillars (firewall, masking) still apply.
|
|
4
|
+
|
|
5
|
+
## Endpoints
|
|
6
|
+
|
|
7
|
+
Views are dispatched two equivalent ways:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
GET /api/v1/{resource}?view={view-name} # Query-string dispatch
|
|
11
|
+
GET /api/v1/{resource}/views/{view-name} # Explicit path
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Both forms are emitted automatically and behave identically.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
Given this definition (views live under [`read.views`](/compiler/definitions/read#views-under-read-views)):
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
export default defineTable(candidates, {
|
|
22
|
+
read: {
|
|
23
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter', 'interviewer'] },
|
|
24
|
+
views: {
|
|
25
|
+
pipeline: {
|
|
26
|
+
fields: ['id', 'name', 'source'],
|
|
27
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter', 'interviewer'] },
|
|
28
|
+
},
|
|
29
|
+
full: {
|
|
30
|
+
fields: ['id', 'name', 'email', 'phone', 'resumeUrl', 'source'],
|
|
31
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter'] },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
// ...
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Request
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Query-string form
|
|
43
|
+
curl '/api/v1/candidates?view=pipeline' \
|
|
44
|
+
-H "Authorization: Bearer <token>"
|
|
45
|
+
|
|
46
|
+
# Path form (equivalent)
|
|
47
|
+
curl /api/v1/candidates/views/pipeline \
|
|
48
|
+
-H "Authorization: Bearer <token>"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Response
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"data": [
|
|
56
|
+
{ "id": "cand_001", "name": "Alice Johnson", "source": "LinkedIn" },
|
|
57
|
+
{ "id": "cand_002", "name": "Bob Martinez", "source": "referral" }
|
|
58
|
+
],
|
|
59
|
+
"view": "pipeline",
|
|
60
|
+
"fields": ["id", "name", "source"],
|
|
61
|
+
"pagination": {
|
|
62
|
+
"limit": 50,
|
|
63
|
+
"offset": 0,
|
|
64
|
+
"count": 2
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Only the fields specified in the view definition are returned. Requesting the `full` view with an `interviewer` role returns 403.
|
|
70
|
+
|
|
71
|
+
## Query Parameters
|
|
72
|
+
|
|
73
|
+
Views support the same query parameters as the list endpoint:
|
|
74
|
+
|
|
75
|
+
| Parameter | Description | Default |
|
|
76
|
+
|-----------|-------------|---------|
|
|
77
|
+
| `limit` | Number of records to return (1–100) | `50` |
|
|
78
|
+
| `offset` | Number of records to skip | `0` |
|
|
79
|
+
| `sort` | Field to sort by | `createdAt` |
|
|
80
|
+
| `order` | Sort direction (`asc` or `desc`) | `desc` |
|
|
81
|
+
| `{field}` | Filter by exact value | — |
|
|
82
|
+
| `{field}.gt` | Greater than | — |
|
|
83
|
+
| `{field}.gte` | Greater than or equal | — |
|
|
84
|
+
| `{field}.lt` | Less than | — |
|
|
85
|
+
| `{field}.lte` | Less than or equal | — |
|
|
86
|
+
| `{field}.ne` | Not equal | — |
|
|
87
|
+
| `{field}.like` | Pattern match (SQL LIKE) | — |
|
|
88
|
+
| `{field}.in` | Match any value in comma-separated list | — |
|
|
89
|
+
|
|
90
|
+
### Examples
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Paginated with sorting
|
|
94
|
+
GET /api/v1/candidates/views/pipeline?limit=10&offset=0&sort=name&order=asc
|
|
95
|
+
|
|
96
|
+
# With filters
|
|
97
|
+
GET /api/v1/candidates/views/pipeline?source=referral&name.like=%25Johnson%25
|
|
98
|
+
|
|
99
|
+
# Combined
|
|
100
|
+
GET /api/v1/candidates/views/pipeline?source.in=LinkedIn,referral&sort=name&order=asc&limit=25
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Security
|
|
104
|
+
|
|
105
|
+
All security pillars apply to view endpoints:
|
|
106
|
+
|
|
107
|
+
1. **Authentication** — Required (401 if missing)
|
|
108
|
+
2. **Firewall** — Organization/user isolation applied to all results. Only records the user owns or has access to are returned.
|
|
109
|
+
3. **Access** — Per-view role check. Each view can require different roles.
|
|
110
|
+
4. **Masking** — Applied to all returned fields. If a masked field is in the view's field list, the masking rules still apply based on the user's role.
|
|
111
|
+
|
|
112
|
+
### Access Control Per View
|
|
113
|
+
|
|
114
|
+
Different views can require different permission levels:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
read: {
|
|
118
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter', 'interviewer'] },
|
|
119
|
+
views: {
|
|
120
|
+
// Available to all org members including interviewers
|
|
121
|
+
pipeline: {
|
|
122
|
+
fields: ['id', 'name', 'source'],
|
|
123
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter', 'interviewer'] },
|
|
124
|
+
},
|
|
125
|
+
// Restricted view with contact details
|
|
126
|
+
full: {
|
|
127
|
+
fields: ['id', 'name', 'email', 'phone', 'resumeUrl', 'source'],
|
|
128
|
+
access: { roles: ['owner', 'hiring-manager', 'recruiter'] },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
An `interviewer` requesting the `full` view receives:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"error": "Insufficient permissions",
|
|
139
|
+
"layer": "access",
|
|
140
|
+
"code": "ACCESS_ROLE_REQUIRED",
|
|
141
|
+
"details": { "required": ["hiring-manager", "recruiter"], "current": ["interviewer"] }
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Masking in Views
|
|
146
|
+
|
|
147
|
+
Masking is applied after field projection. If your masking config hides `phone` from interviewers:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
masking: {
|
|
151
|
+
phone: { type: 'phone', show: { roles: ['hiring-manager', 'recruiter'] } },
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
An `interviewer` requesting a view that includes `phone` will see the masked value (e.g., `***-***-5678`), while a `recruiter` sees the full value.
|
|
156
|
+
|
|
157
|
+
## See Also
|
|
158
|
+
|
|
159
|
+
- [Defining Views](/compiler/definitions/views) — How to configure views in defineTable
|
|
160
|
+
- [Query Parameters](/compiler/targets/hono-api/using-the-api/query-params) — Full query parameter reference
|
|
161
|
+
- [Access Control](/compiler/definitions/access) — Role-based access configuration
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Compile Targets
|
|
2
|
+
|
|
3
|
+
The Quickback Compiler reads a single set of definitions — schema, firewall, access, guards, masking, views, actions — and emits production output for the target you choose.
|
|
4
|
+
|
|
5
|
+
## The two targets
|
|
6
|
+
|
|
7
|
+
### [Quickback for Hono API](/compiler/targets/hono-api)
|
|
8
|
+
|
|
9
|
+
Generates a complete Hono application: routes, middleware, types, OpenAPI spec, MCP server. Pair with **Cloudflare D1** for SQLite-at-the-edge or **Neon** for full PostgreSQL with database-level RLS.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
providers: {
|
|
13
|
+
runtime: defineRuntime('cloudflare'),
|
|
14
|
+
database: defineDatabase('cloudflare-d1'),
|
|
15
|
+
auth: defineAuth('better-auth'),
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use this target when you want Quickback to generate the entire API surface, not just security policies.
|
|
20
|
+
|
|
21
|
+
### [Quickback for Supabase](/compiler/targets/supabase-rls)
|
|
22
|
+
|
|
23
|
+
Generates PostgreSQL Row Level Security policies for Supabase. Keep Supabase Auth, Storage, and Realtime — Quickback adds the security layer beneath your application code.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
providers: {
|
|
27
|
+
runtime: defineRuntime('supabase'),
|
|
28
|
+
database: defineDatabase('supabase'),
|
|
29
|
+
auth: defineAuth('supabase-auth'),
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use this target when you're already on Supabase and want a typed DSL for RLS.
|
|
34
|
+
|
|
35
|
+
## At a glance
|
|
36
|
+
|
|
37
|
+
| | Hono API | Supabase RLS |
|
|
38
|
+
|---|----------|--------------|
|
|
39
|
+
| What's generated | Routes, middleware, types, OpenAPI, MCP, RLS (Neon only) | RLS policies + helper functions only |
|
|
40
|
+
| Database | Cloudflare D1 or Neon Postgres | Supabase Postgres |
|
|
41
|
+
| Auth | Better Auth | Supabase Auth |
|
|
42
|
+
| Application code | Compiler-generated | You write your own |
|
|
43
|
+
| Deployment | `wrangler deploy` (or any Hono runtime) | `supabase db push` |
|
|
44
|
+
|
|
45
|
+
## The shared core
|
|
46
|
+
|
|
47
|
+
Whichever target you pick, the input is the same. See [Definitions](/compiler/definitions) for the DSL that powers both.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Quickback for Supabase RLS
|
|
2
|
+
|
|
3
|
+
**Quickback for Supabase RLS** compiles the same `defineTable()` definitions into PostgreSQL Row Level Security policies for Supabase. You keep Supabase Auth, Storage, and Realtime — Quickback adds the database-level security layer.
|
|
4
|
+
|
|
5
|
+
## Who this is for
|
|
6
|
+
|
|
7
|
+
You're already on Supabase (or want to be) and you want:
|
|
8
|
+
|
|
9
|
+
- **Database-level security** — RLS policies enforced even if a service role key leaks
|
|
10
|
+
- **A type-safe DSL** — write security rules in TypeScript, compile to SQL
|
|
11
|
+
- **One source of truth** — the same `firewall` and `access` config that powers a Quickback Hono API also generates RLS policies
|
|
12
|
+
|
|
13
|
+
What you don't get from this target: generated API routes, batch endpoints, OpenAPI spec, MCP server. Those live with [Quickback for Hono API](/compiler/targets/hono-api). For Supabase you bring your own application code (PostgREST, Edge Functions, or your own server) and the RLS policies enforce security beneath it.
|
|
14
|
+
|
|
15
|
+
## What compiles to RLS
|
|
16
|
+
|
|
17
|
+
| Definition | Compiles to |
|
|
18
|
+
|------------|-------------|
|
|
19
|
+
| `defineTable({ schema })` | `CREATE TABLE` + Drizzle schema |
|
|
20
|
+
| `firewall: [...]` | `FOR ALL USING` policies (data isolation) |
|
|
21
|
+
| `access.roles: [...]` | `FOR SELECT/INSERT/UPDATE/DELETE USING` policies (role checks) |
|
|
22
|
+
| `defineActions()` | **Not compiled** — implement in Edge Functions or your app |
|
|
23
|
+
| `views` | **Not compiled** — use Postgres views or column lists |
|
|
24
|
+
| `masking` | **Not compiled** — runtime concern, handle in app code |
|
|
25
|
+
| `guards` | **Not compiled** — runtime concern, handle in app code |
|
|
26
|
+
|
|
27
|
+
See [Mappings](/compiler/targets/supabase-rls/mappings) for full examples and [Limitations](/compiler/targets/supabase-rls/limitations) for what to handle in app code.
|
|
28
|
+
|
|
29
|
+
## Quick start
|
|
30
|
+
|
|
31
|
+
```typescript title="quickback/quickback.config.ts"
|
|
32
|
+
import { defineConfig, defineRuntime, defineDatabase, defineAuth } from "@quickback/compiler";
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
name: "my-app",
|
|
36
|
+
providers: {
|
|
37
|
+
runtime: defineRuntime("supabase"),
|
|
38
|
+
database: defineDatabase("supabase"),
|
|
39
|
+
auth: defineAuth("supabase-auth"),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
quickback compile
|
|
46
|
+
supabase db push
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The compiler emits RLS migrations under `supabase/migrations/`. See [Setup](/compiler/targets/supabase-rls/setup) for the full flow.
|
|
50
|
+
|
|
51
|
+
## In this section
|
|
52
|
+
|
|
53
|
+
- **[Setup](/compiler/targets/supabase-rls/setup)** — Configure the target, compile, apply migrations
|
|
54
|
+
- **[Mappings](/compiler/targets/supabase-rls/mappings)** — Which definitions become which RLS policies
|
|
55
|
+
- **[Limitations](/compiler/targets/supabase-rls/limitations)** — What doesn't compile and how to handle it
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Limitations
|
|
2
|
+
|
|
3
|
+
The Supabase target compiles **schema, firewall, and access** to RLS. The other Quickback primitives are runtime concerns that RLS can't express. This page lists what doesn't compile and where to handle it.
|
|
4
|
+
|
|
5
|
+
## Actions
|
|
6
|
+
|
|
7
|
+
`defineActions()` describes custom endpoints with input validation, role checks, and side effects. RLS only governs row access, not arbitrary procedures.
|
|
8
|
+
|
|
9
|
+
**Where to handle them:**
|
|
10
|
+
|
|
11
|
+
- **Supabase Edge Functions** — port the action body to a TypeScript Deno function. Role checks happen in the function; the underlying database mutations still pass through your RLS policies.
|
|
12
|
+
- **Postgres functions** — for simple state transitions, write a `CREATE FUNCTION` and call it via `supabase.rpc()`. Use `SECURITY INVOKER` (the default) so RLS still applies.
|
|
13
|
+
- **Your application server** — any backend you already run can host the action, with the JWT forwarded to Supabase for the underlying writes.
|
|
14
|
+
|
|
15
|
+
## Views
|
|
16
|
+
|
|
17
|
+
Quickback `views` define column-level projections per role (e.g. "members see name + email; admins also see salary"). RLS gates rows, not columns.
|
|
18
|
+
|
|
19
|
+
**Where to handle them:**
|
|
20
|
+
|
|
21
|
+
- **Postgres views** — `CREATE VIEW` with `SELECT` lists matching each Quickback view. Apply RLS to the view or the underlying table.
|
|
22
|
+
- **Column lists in queries** — pass the projection at the application layer: `supabase.from('users').select('id, name, email')`.
|
|
23
|
+
- **Column-level grants** — `GRANT SELECT (col1, col2) ON table TO role` for fine-grained server-side restriction.
|
|
24
|
+
|
|
25
|
+
## Masking
|
|
26
|
+
|
|
27
|
+
Masking redacts sensitive fields per role at response time (email → `j***@example.com`, SSN → `***-**-1234`). This is purely a runtime transformation — the data is in the row, RLS just decides whether the row is returned.
|
|
28
|
+
|
|
29
|
+
**Where to handle it:**
|
|
30
|
+
|
|
31
|
+
- **Edge Functions or your server** — apply the mask in the layer that serializes the response.
|
|
32
|
+
- **Postgres functions** — for SQL-driven masking, write a wrapper view or function that applies the mask conditionally on `auth.jwt() ->> 'role'`.
|
|
33
|
+
|
|
34
|
+
## Guards
|
|
35
|
+
|
|
36
|
+
`guards` block field modifications based on row state, role, or external context (e.g. "members can change `notes` but not `status`; only admins can set `archived`"). Some of this can be expressed with RLS `WITH CHECK`, but the full Quickback guard model is richer than RLS supports.
|
|
37
|
+
|
|
38
|
+
**Where to handle them:**
|
|
39
|
+
|
|
40
|
+
- **`WITH CHECK` clauses** — simple field-level guards (e.g. "only admins can set `archived = true`") can sometimes be expressed via more granular `FOR UPDATE` policies.
|
|
41
|
+
- **Triggers** — `BEFORE UPDATE` triggers can `RAISE EXCEPTION` if a guarded field is modified by a non-eligible role.
|
|
42
|
+
- **Edge Functions / app server** — for anything stateful or context-dependent, validate guards in the layer that issues the update.
|
|
43
|
+
|
|
44
|
+
## Generated API routes, batch ops, OpenAPI, MCP
|
|
45
|
+
|
|
46
|
+
These are Hono-target features. The Supabase target doesn't generate application code — your app talks to Supabase directly (PostgREST, Edge Functions, or your own server).
|
|
47
|
+
|
|
48
|
+
If you want generated routes alongside RLS, consider compiling to the [Hono target with Neon](/compiler/targets/hono-api/database/neon), which gives you both the generated API and database-level RLS.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Mappings
|
|
2
|
+
|
|
3
|
+
This page shows how each Quickback primitive maps to RLS policy SQL. The same `firewall` and `access` config used by the [Hono target](/compiler/targets/hono-api) generates these policies — no Supabase-specific re-authoring required.
|
|
4
|
+
|
|
5
|
+
## Schema → Tables
|
|
6
|
+
|
|
7
|
+
`defineTable({ schema })` compiles to a Drizzle PostgreSQL schema and a `CREATE TABLE` statement. RLS is enabled on the table by default:
|
|
8
|
+
|
|
9
|
+
```sql
|
|
10
|
+
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Firewall → `FOR ALL USING`
|
|
14
|
+
|
|
15
|
+
Firewall rules isolate data by tenant or owner. They become a single `FOR ALL USING` policy applied to every operation.
|
|
16
|
+
|
|
17
|
+
**Org-scoped:**
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
firewall: [
|
|
21
|
+
{ field: 'organizationId', equals: 'ctx.activeOrgId' },
|
|
22
|
+
]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```sql
|
|
26
|
+
CREATE POLICY "projects_firewall" ON projects FOR ALL
|
|
27
|
+
USING (organization_id = public.get_active_org_id());
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**User-scoped:**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
firewall: [
|
|
34
|
+
{ field: 'userId', equals: 'ctx.userId' },
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```sql
|
|
39
|
+
CREATE POLICY "preferences_firewall" ON preferences FOR ALL
|
|
40
|
+
USING (user_id = auth.uid());
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Access → `FOR SELECT/INSERT/UPDATE/DELETE USING`
|
|
44
|
+
|
|
45
|
+
Access rules layer role-based checks on top of the firewall. Each operation gets its own policy.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
access: {
|
|
49
|
+
roles: ['admin', 'member'],
|
|
50
|
+
list: { roles: ['admin', 'member'] },
|
|
51
|
+
create: { roles: ['admin'] },
|
|
52
|
+
update: { roles: ['admin'] },
|
|
53
|
+
delete: { roles: ['admin'] },
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```sql
|
|
58
|
+
CREATE POLICY "projects_select" ON projects FOR SELECT
|
|
59
|
+
USING (
|
|
60
|
+
organization_id = public.get_active_org_id()
|
|
61
|
+
AND public.has_any_role(ARRAY['admin', 'member'])
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
CREATE POLICY "projects_insert" ON projects FOR INSERT
|
|
65
|
+
WITH CHECK (
|
|
66
|
+
organization_id = public.get_active_org_id()
|
|
67
|
+
AND public.has_any_role(ARRAY['admin'])
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Defense in depth — anon deny
|
|
72
|
+
|
|
73
|
+
Every generated table gets an explicit deny policy for the `anon` role:
|
|
74
|
+
|
|
75
|
+
```sql
|
|
76
|
+
CREATE POLICY "projects_deny_anon" ON projects FOR ALL
|
|
77
|
+
TO anon
|
|
78
|
+
USING (false);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Unauthenticated requests are blocked at the database level even if a policy elsewhere is misconfigured.
|
|
82
|
+
|
|
83
|
+
## Helper functions
|
|
84
|
+
|
|
85
|
+
Quickback emits a set of helper functions in `0100_create_rls_helpers.sql` that the policies reference:
|
|
86
|
+
|
|
87
|
+
| Function | Purpose |
|
|
88
|
+
|----------|---------|
|
|
89
|
+
| `get_active_org_id()` | Returns the user's active organization from `user_sessions` |
|
|
90
|
+
| `has_any_role(roles[])` | Checks if the user has any of the listed roles in the active org |
|
|
91
|
+
| `has_org_role(role)` | Checks for a single specific role |
|
|
92
|
+
| `is_org_member()` | Checks org membership |
|
|
93
|
+
| `get_user_role()` | Returns the user's role in the active org |
|
|
94
|
+
|
|
95
|
+
These are used by the generated policies but you can also call them from views, triggers, or stored procedures.
|
|
96
|
+
|
|
97
|
+
## What does not compile
|
|
98
|
+
|
|
99
|
+
`defineActions()`, `views`, `masking`, and runtime `guards` do **not** become RLS — see [Limitations](/compiler/targets/supabase-rls/limitations).
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- A Supabase project (free tier is fine for development)
|
|
6
|
+
- The Supabase CLI installed: `npm install -g supabase`
|
|
7
|
+
- A Quickback project (`quickback create` or existing)
|
|
8
|
+
|
|
9
|
+
## 1. Configure the target
|
|
10
|
+
|
|
11
|
+
```typescript title="quickback/quickback.config.ts"
|
|
12
|
+
import { defineConfig, defineRuntime, defineDatabase, defineAuth } from "@quickback/compiler";
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
name: "my-app",
|
|
16
|
+
providers: {
|
|
17
|
+
runtime: defineRuntime("supabase"),
|
|
18
|
+
database: defineDatabase("supabase"),
|
|
19
|
+
auth: defineAuth("supabase-auth"),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The `supabase-auth` provider tells Quickback to emit RLS policies that reference `auth.uid()` — Supabase's built-in JWT claim function — rather than the Better Auth equivalents used by the Neon target.
|
|
25
|
+
|
|
26
|
+
## 2. Compile
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
quickback compile
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This generates:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
supabase/
|
|
36
|
+
├── migrations/
|
|
37
|
+
│ ├── 0100_create_rls_helpers.sql # get_active_org_id(), has_any_role(), etc.
|
|
38
|
+
│ ├── 0101_create_rls_policies.sql # Per-table SELECT/INSERT/UPDATE/DELETE policies
|
|
39
|
+
│ └── 0102_create_audit_triggers.sql # Optional audit logging
|
|
40
|
+
src/
|
|
41
|
+
├── db/
|
|
42
|
+
│ └── schema.ts # Drizzle schema (typed access from your app)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 3. Apply migrations
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
supabase db push
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Supabase applies the migrations to your remote project. RLS is enabled on every generated table and the deny-anon policy is installed.
|
|
52
|
+
|
|
53
|
+
## 4. Use from your app
|
|
54
|
+
|
|
55
|
+
Quickback for Supabase doesn't generate API routes. Your application code (PostgREST, Edge Functions, your own server) talks to Supabase as normal — the RLS policies are enforced beneath it.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { createClient } from '@supabase/supabase-js';
|
|
59
|
+
|
|
60
|
+
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
|
|
61
|
+
global: { headers: { Authorization: `Bearer ${userJwt}` } },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// RLS policies generated by Quickback enforce row-level access
|
|
65
|
+
const { data } = await supabase.from('projects').select('*');
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Updating the schema
|
|
69
|
+
|
|
70
|
+
Edit your `defineTable()` files, recompile, and push:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
quickback compile
|
|
74
|
+
supabase db push
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The compiler diffs against the previous compilation and emits a new migration only for what changed.
|
|
78
|
+
|
|
79
|
+
## Comparison with the Neon target
|
|
80
|
+
|
|
81
|
+
| | Supabase | Neon |
|
|
82
|
+
|---|----------|------|
|
|
83
|
+
| Auth function | `auth.uid()` | `auth.user_id()` |
|
|
84
|
+
| Auth provider | Supabase Auth | Better Auth + Neon Authorize |
|
|
85
|
+
| Users table | `auth.users` | `public.users` |
|
|
86
|
+
| API code generated | No | Yes (Hono routes) |
|
|
87
|
+
|
|
88
|
+
Both targets emit RLS policies. The difference is who issues the JWTs and where the application logic lives.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Common issues and their solutions. For cloud compiler specific issues, see [Cloud Compiler Troubleshooting](/compiler/cloud-compiler/troubleshooting).
|
|
4
|
+
|
|
5
|
+
## Compilation Issues
|
|
6
|
+
|
|
7
|
+
### "Feature must use defineTable()"
|
|
8
|
+
|
|
9
|
+
Your table file is missing the default export:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// Wrong — no default export
|
|
13
|
+
export const applications = sqliteTable("applications", { ... });
|
|
14
|
+
|
|
15
|
+
// Correct — add defineTable default export
|
|
16
|
+
export const applications = sqliteTable("applications", { ... });
|
|
17
|
+
export default defineTable(applications, { ... });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### "File exports multiple tables with defineTable"
|
|
21
|
+
|
|
22
|
+
A single file can export multiple Drizzle tables, but only ONE can have a `defineTable()` default export. Split tables into separate files:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
quickback/features/applications/
|
|
26
|
+
├── applications.ts # defineTable(applications, { ... })
|
|
27
|
+
└── candidates.ts # defineTable(candidates, { ... })
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Missing fields in generated API
|
|
31
|
+
|
|
32
|
+
If a field exists in your schema but doesn't appear in API responses:
|
|
33
|
+
|
|
34
|
+
1. **Guards:** Check that the field is in `createable` (for POST) or `updatable` (for PATCH). Fields not listed are silently stripped.
|
|
35
|
+
2. **Views:** If using views, the field must be in the view's `fields` array.
|
|
36
|
+
3. **Masking:** The field may be present but masked (showing `[REDACTED]` or `***`). Check your masking config.
|
|
37
|
+
|
|
38
|
+
### "organizationId" not auto-detected
|
|
39
|
+
|
|
40
|
+
The firewall auto-detects `organizationId` and `ownerId` columns by name. If your column uses a different name, declare the firewall explicitly:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
firewall: [
|
|
44
|
+
{ field: 'orgId', equals: 'ctx.activeOrgId' },
|
|
45
|
+
]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or use `q.scope()` and override the SQL name:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
columns: {
|
|
52
|
+
orgId: q.scope('organization', { sqlName: 'org_id' }),
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Migration Issues
|
|
57
|
+
|
|
58
|
+
### Columns persist after removal from schema
|
|
59
|
+
|
|
60
|
+
Quickback (via Drizzle) does **not** generate DROP COLUMN migrations. If you remove a column from your schema, the database column will remain as an orphaned column. SQLite handles this gracefully — the column won't appear in API responses since Drizzle only selects defined columns.
|
|
61
|
+
|
|
62
|
+
To clean up, you'd need to manually create a migration.
|
|
63
|
+
|
|
64
|
+
### Drizzle rename prompts in CI
|
|
65
|
+
|
|
66
|
+
If compilation fails with `drizzle-kit requested interactive rename input`, add explicit rename hints in your config. See [Drizzle rename prompts](/compiler/cloud-compiler/troubleshooting#drizzle-rename-prompts-in-ciheadless-compile).
|
|
67
|
+
|
|
68
|
+
## Runtime Issues
|
|
69
|
+
|
|
70
|
+
### 401 on all requests
|
|
71
|
+
|
|
72
|
+
1. **Missing auth:** Ensure your request includes `Authorization: Bearer <token>` or the session cookie
|
|
73
|
+
2. **Expired session:** Sessions last 7 days by default. Re-authenticate.
|
|
74
|
+
3. **Wrong auth URL:** Check that `BETTER_AUTH_URL` matches your deployment URL
|
|
75
|
+
|
|
76
|
+
### 403 Forbidden
|
|
77
|
+
|
|
78
|
+
1. **Wrong role:** Check the `access` config for the endpoint — your role may not be listed
|
|
79
|
+
2. **Wrong org:** You may be in a different organization than the record's `organizationId`
|
|
80
|
+
3. **Firewall hiding:** If `errorMode: 'hide'` is set, firewall violations return 404 instead of 403
|
|
81
|
+
|
|
82
|
+
### 400 Bad Request on create/update
|
|
83
|
+
|
|
84
|
+
1. **Guard violation:** You're sending a field not in `createable` or `updatable`. Check the error's `details.fields`.
|
|
85
|
+
2. **Missing required field:** A `.notNull()` column without a default is missing from your request body.
|
|
86
|
+
3. **Immutable field:** You're trying to update a field marked as `immutable`.
|
|
87
|
+
|
|
88
|
+
### Records missing from list
|
|
89
|
+
|
|
90
|
+
Records may be filtered by:
|
|
91
|
+
1. **Firewall:** Only records matching your organization (and optionally owner) are returned
|
|
92
|
+
2. **Soft delete:** Soft-deleted records are automatically excluded
|
|
93
|
+
3. **Access conditions:** Record-level conditions may filter results
|
|
94
|
+
|
|
95
|
+
### Recovering a previous `src/` tree
|
|
96
|
+
|
|
97
|
+
The CLI archives the previous `src/` tree to `quickback/.archives/src-<ISO-timestamp>/` before each compile (most recent 3 retained). If a generator regression silently dropped a file you depended on, restore it from the latest archive:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ls quickback/.archives/
|
|
101
|
+
# src-2026-04-27T16-31-02-014/ ← latest
|
|
102
|
+
# src-2026-04-27T16-29-44-882/
|
|
103
|
+
# src-2026-04-27T16-12-19-301/
|
|
104
|
+
|
|
105
|
+
# Restore the whole tree (back-out a bad compile):
|
|
106
|
+
rm -rf src
|
|
107
|
+
cp -R quickback/.archives/src-2026-04-27T16-31-02-014 src
|
|
108
|
+
|
|
109
|
+
# …or grep for what disappeared:
|
|
110
|
+
grep -r "missingExportName" quickback/.archives/src-2026-04-27T16-31-02-014/
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Anything in `src/` not produced by the latest compile is removed on every compile — see [CLI → Compile Definitions](/compiler/cloud-compiler/cli#compile-definitions) for the full contract.
|
|
114
|
+
|
|
115
|
+
## See Also
|
|
116
|
+
|
|
117
|
+
- [Cloud Compiler Troubleshooting](/compiler/cloud-compiler/troubleshooting) — CLI and authentication issues
|
|
118
|
+
- [Errors](/compiler/targets/hono-api/using-the-api/errors) — Complete error code reference
|
|
119
|
+
- [Firewall](/compiler/definitions/firewall) — Data isolation configuration
|
|
120
|
+
- [Guards](/compiler/definitions/guards) — Field modification rules
|