@quickback-dev/cli 0.16.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +12 -48
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/create.d.ts +20 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +216 -151
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/login.d.ts +4 -2
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +25 -17
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/start.d.ts +20 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +163 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +5 -4
- package/dist/commands/whoami.js.map +1 -1
- package/dist/docs/content.js +42 -42
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/api-client.test.js +15 -0
- package/dist/lib/api-client.test.js.map +1 -1
- package/dist/lib/auth.d.ts +39 -3
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +57 -3
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/drizzle-meta-routing.test.js +16 -3
- package/dist/lib/drizzle-meta-routing.test.js.map +1 -1
- package/dist/lib/file-loader.d.ts +6 -4
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +30 -27
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/file-loader.test.js +16 -7
- package/dist/lib/file-loader.test.js.map +1 -1
- package/dist/skill/docs/changelog.md +429 -1100
- package/dist/skill/docs/compiler/cloud-compiler/cli.md +54 -33
- package/dist/skill/docs/compiler/cloud-compiler/index.md +9 -9
- package/dist/skill/docs/compiler/config/providers.md +87 -0
- package/dist/skill/docs/compiler/config/single-tenant.md +5 -11
- package/dist/skill/docs/compiler/definitions/access.md +43 -57
- package/dist/skill/docs/compiler/definitions/feature.md +7 -11
- package/dist/skill/docs/compiler/definitions/firewall.md +2 -4
- package/dist/skill/docs/compiler/definitions/guards.md +16 -18
- package/dist/skill/docs/compiler/definitions/index.md +10 -14
- package/dist/skill/docs/compiler/definitions/masking.md +6 -6
- package/dist/skill/docs/compiler/definitions/read.md +6 -11
- package/dist/skill/docs/compiler/definitions/schema.md +18 -18
- package/dist/skill/docs/compiler/definitions/views.md +3 -5
- package/dist/skill/docs/compiler/getting-started/full-example.md +6 -8
- package/dist/skill/docs/compiler/getting-started/hand-crafted.md +3 -5
- package/dist/skill/docs/compiler/getting-started/index.md +23 -20
- package/dist/skill/docs/compiler/getting-started/patterns.md +19 -31
- package/dist/skill/docs/compiler/getting-started/template-blog.md +6 -10
- package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +49 -56
- package/dist/skill/docs/compiler/getting-started/template-empty.md +3 -5
- package/dist/skill/docs/compiler/getting-started/templates.md +58 -56
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +29 -23
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +12 -14
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +5 -2
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +5 -7
- package/dist/skill/docs/compiler/troubleshooting.md +10 -0
- package/dist/skill/docs/index.md +9 -0
- package/dist/skill/docs/stack/auth/security.md +69 -0
- package/dist/skill/docs/stack/cms/actions.md +28 -0
- package/dist/skill/docs/stack/cms/connecting.md +2 -2
- package/dist/skill/docs/stack/cms/index.md +2 -2
- package/dist/skill/docs/stack/cms/record-layouts.md +19 -19
- package/dist/skill/docs/stack/cms/schema-format.md +33 -3
- package/dist/skill/docs/stack/cms/schema-registry.md +22 -2
- package/dist/skill/docs/stack/cms/security.md +10 -12
- package/dist/skill/docs/stack/cms/table-views.md +1 -1
- package/dist/skill/docs/stack/index.md +8 -4
- package/dist/skill/docs/stack/realtime/durable-objects.md +46 -5
- package/dist/skill/docs/stack/realtime/index.md +20 -3
- package/dist/skill/docs/stack/realtime/using-realtime.md +8 -6
- package/dist/skill/docs/stack/vector/embeddings.md +7 -6
- package/package.json +1 -1
- package/src/skill/docs/changelog.md +486 -1097
- package/src/skill/docs/compiler/cloud-compiler/cli.md +54 -33
- package/src/skill/docs/compiler/cloud-compiler/index.md +9 -9
- package/src/skill/docs/compiler/config/domains.md +44 -10
- package/src/skill/docs/compiler/config/output.md +1 -1
- package/src/skill/docs/compiler/config/providers.md +87 -0
- package/src/skill/docs/compiler/config/single-tenant.md +5 -11
- package/src/skill/docs/compiler/definitions/access.md +43 -57
- package/src/skill/docs/compiler/definitions/feature.md +7 -11
- package/src/skill/docs/compiler/definitions/firewall.md +2 -4
- package/src/skill/docs/compiler/definitions/guards.md +16 -18
- package/src/skill/docs/compiler/definitions/index.md +10 -14
- package/src/skill/docs/compiler/definitions/masking.md +6 -6
- package/src/skill/docs/compiler/definitions/read.md +6 -11
- package/src/skill/docs/compiler/definitions/schema.md +18 -18
- package/src/skill/docs/compiler/definitions/views.md +3 -5
- package/src/skill/docs/compiler/getting-started/full-example.md +6 -8
- package/src/skill/docs/compiler/getting-started/hand-crafted.md +3 -5
- package/src/skill/docs/compiler/getting-started/index.md +23 -20
- package/src/skill/docs/compiler/getting-started/patterns.md +19 -31
- package/src/skill/docs/compiler/getting-started/template-blog.md +6 -10
- package/src/skill/docs/compiler/getting-started/template-cloudflare.md +49 -56
- package/src/skill/docs/compiler/getting-started/template-empty.md +3 -5
- package/src/skill/docs/compiler/getting-started/templates.md +58 -56
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/batch-operations.md +29 -23
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +12 -14
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +5 -2
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/query-params.md +5 -7
- package/src/skill/docs/compiler/troubleshooting.md +10 -0
- package/src/skill/docs/index.md +9 -0
- package/src/skill/docs/stack/auth/plugins/index.md +74 -0
- package/src/skill/docs/stack/auth/security.md +69 -0
- package/src/skill/docs/stack/cms/actions.md +28 -0
- package/src/skill/docs/stack/cms/connecting.md +2 -2
- package/src/skill/docs/stack/cms/index.md +2 -2
- package/src/skill/docs/stack/cms/record-layouts.md +19 -19
- package/src/skill/docs/stack/cms/schema-format.md +33 -3
- package/src/skill/docs/stack/cms/schema-registry.md +22 -2
- package/src/skill/docs/stack/cms/security.md +10 -12
- package/src/skill/docs/stack/cms/table-views.md +1 -1
- package/src/skill/docs/stack/index.md +8 -4
- package/src/skill/docs/stack/realtime/durable-objects.md +46 -5
- package/src/skill/docs/stack/realtime/index.md +20 -3
- package/src/skill/docs/stack/realtime/using-realtime.md +8 -6
- package/src/skill/docs/stack/vector/embeddings.md +7 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Quickback ships **two parallel realtime primitives**, both backed by Cloudflare Durable Objects:
|
|
4
4
|
|
|
5
|
-
- **`/broadcast/v1/*` — server fan-out.** One DO instance per
|
|
5
|
+
- **`/broadcast/v1/*` — server fan-out.** One DO instance per subscription scope. Postgres-changes events from CRUD routes plus custom broadcast events flow out to every subscriber, with role filtering and per-role field masking applied. Best for "tell every client in this shared scope that something changed." The scope can be an organization, a specific user, or a compiler-resolved resource key like `events:evt_123`. Documented on this page.
|
|
6
6
|
- **`/realtime/<binding>/<room-id>` — bidirectional rooms.** One DO instance per room (per document, per interview, per game). Client↔client messages, presence, and CRDT-friendly state. Use these for collaborative editing. See [PartyServer rooms](/stack/realtime/partyserver-rooms).
|
|
7
7
|
|
|
8
8
|
Both share the same auth model and ride on the same compiled worker; they solve different problems.
|
|
@@ -31,17 +31,18 @@ Both share the same auth model and ride on the same compiled worker; they solve
|
|
|
31
31
|
The Broadcaster Durable Object runs **inline** in your main Quickback worker — no separate worker deployment needed. The API calls the DO directly via its binding (in-process, no network hop).
|
|
32
32
|
|
|
33
33
|
1. **Quickback Worker** — Your compiled API with the Broadcaster DO class exported from the same worker.
|
|
34
|
-
2. **Broadcaster (Durable Object)** — Manages WebSocket connections per
|
|
34
|
+
2. **Broadcaster (Durable Object)** — Manages WebSocket connections per subscription scope. One instance per `scopeKey`, organization, or user lane.
|
|
35
35
|
3. **Browser Clients** — CMS, Account, Admin, and custom frontends connect via WebSocket on the same origin.
|
|
36
36
|
|
|
37
37
|
## Key Features
|
|
38
38
|
|
|
39
39
|
| Feature | Description |
|
|
40
40
|
|---------|-------------|
|
|
41
|
-
|
|
|
41
|
+
| Scope-aware fan-out | Routes by `scopeKey`, `organizationId`, or `userId` |
|
|
42
42
|
| Role-based filtering | Only send events to users with matching roles |
|
|
43
43
|
| Per-role masking | Different users see different field values based on their role |
|
|
44
44
|
| User-specific targeting | Send events to a specific user within an org |
|
|
45
|
+
| Resource-scoped tickets | Reuse authz relationship roles to mint scope-bound ws tickets |
|
|
45
46
|
| Custom broadcasts | Arbitrary events beyond CRUD |
|
|
46
47
|
| Custom namespaces | `defineRealtime()` for type-safe event helpers |
|
|
47
48
|
| Ticket-based auth | HMAC-signed tickets verified at WebSocket upgrade — no HTTP round-trip |
|
|
@@ -66,6 +67,22 @@ export default defineTable(applications, {
|
|
|
66
67
|
|
|
67
68
|
And enable the realtime binding in your database config. The compiler generates the Durable Object class, helper functions, and wrangler bindings — all within your main worker.
|
|
68
69
|
|
|
70
|
+
```typescript
|
|
71
|
+
providers: {
|
|
72
|
+
database: defineDatabase("cloudflare-d1", {
|
|
73
|
+
realtime: {
|
|
74
|
+
wsTicket: {
|
|
75
|
+
role: "attendee",
|
|
76
|
+
requestField: "eventId",
|
|
77
|
+
scopeTable: "events",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
With that config, `/broadcast/v1/ws-ticket` can authenticate the caller, verify the declared authz relationship role against `body.eventId`, and mint a short-lived ticket scoped to the resolved `events:<id>` channel.
|
|
85
|
+
|
|
69
86
|
## Pages
|
|
70
87
|
|
|
71
88
|
- **[Durable Objects Setup](/stack/realtime/durable-objects)** — Broadcaster configuration, wrangler bindings, event formats, masking, and custom namespaces
|
|
@@ -28,18 +28,19 @@ const response = await fetch("/broadcast/v1/ws-ticket", {
|
|
|
28
28
|
Authorization: `Bearer ${sessionToken}`,
|
|
29
29
|
"Content-Type": "application/json",
|
|
30
30
|
},
|
|
31
|
+
body: JSON.stringify({ eventId: "evt_123" }), // optional; used by resource-scoped wsTicket config
|
|
31
32
|
});
|
|
32
33
|
const { wsTicket, expiresIn } = await response.json();
|
|
33
34
|
// expiresIn = 60 (seconds)
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
The ticket is a short-lived (60-second) HMAC-signed token containing your userId,
|
|
37
|
+
The ticket is a short-lived (60-second) HMAC-signed token containing your userId, roles, and the resolved subscription scope.
|
|
37
38
|
|
|
38
39
|
### Step 2: Connect with Ticket
|
|
39
40
|
|
|
40
41
|
```typescript
|
|
41
42
|
const ws = new WebSocket(
|
|
42
|
-
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}
|
|
43
|
+
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}`
|
|
43
44
|
);
|
|
44
45
|
|
|
45
46
|
ws.onopen = () => {
|
|
@@ -148,11 +149,11 @@ Masking is pre-computed per-role (O(roles), not O(subscribers)) for efficiency.
|
|
|
148
149
|
|
|
149
150
|
### User-Specific Events
|
|
150
151
|
|
|
151
|
-
Events can target a specific user
|
|
152
|
+
Events can target a specific user lane. Only that user receives the broadcast — all other connections on the same scope are skipped.
|
|
152
153
|
|
|
153
|
-
###
|
|
154
|
+
### Scope Isolation
|
|
154
155
|
|
|
155
|
-
Each
|
|
156
|
+
Each WebSocket connection is attached to exactly one resolved scope: `scopeKey`, `organizationId`, or `userId`. Users can only subscribe to the scope stamped into their ws ticket, enforced during authentication and ticket minting.
|
|
156
157
|
|
|
157
158
|
## Reconnection
|
|
158
159
|
|
|
@@ -164,11 +165,12 @@ async function connect() {
|
|
|
164
165
|
const res = await fetch("/broadcast/v1/ws-ticket", {
|
|
165
166
|
method: "POST",
|
|
166
167
|
headers: { Authorization: `Bearer ${sessionToken}` },
|
|
168
|
+
body: JSON.stringify({ eventId: "evt_123" }),
|
|
167
169
|
});
|
|
168
170
|
const { wsTicket } = await res.json();
|
|
169
171
|
|
|
170
172
|
const ws = new WebSocket(
|
|
171
|
-
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}
|
|
173
|
+
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}`
|
|
172
174
|
);
|
|
173
175
|
|
|
174
176
|
ws.onclose = () => {
|
|
@@ -22,10 +22,8 @@ export default defineTable(jobs, {
|
|
|
22
22
|
metadata: ['department'], // Metadata for Vectorize index
|
|
23
23
|
},
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
update: { access: { roles: ['recruiter'] } },
|
|
28
|
-
},
|
|
25
|
+
create: { access: { roles: ['recruiter'] } },
|
|
26
|
+
update: { access: { roles: ['recruiter'] } },
|
|
29
27
|
});
|
|
30
28
|
```
|
|
31
29
|
|
|
@@ -94,7 +92,7 @@ onUpdate: ['description', 'title']
|
|
|
94
92
|
|
|
95
93
|
## Generic Embeddings API
|
|
96
94
|
|
|
97
|
-
In addition to automatic embeddings on
|
|
95
|
+
In addition to automatic embeddings on standard resource operations, Quickback generates a generic embeddings API endpoint that allows you to trigger embeddings on arbitrary content.
|
|
98
96
|
|
|
99
97
|
### POST /api/v1/embeddings
|
|
100
98
|
|
|
@@ -290,7 +288,10 @@ export default feature("jobs", {
|
|
|
290
288
|
embedding: q.text().optional(),
|
|
291
289
|
},
|
|
292
290
|
firewall: [{ field: 'organizationId', equals: 'ctx.activeOrgId' }],
|
|
293
|
-
|
|
291
|
+
read: {},
|
|
292
|
+
create: {},
|
|
293
|
+
update: {},
|
|
294
|
+
delete: {},
|
|
294
295
|
});
|
|
295
296
|
```
|
|
296
297
|
|