@quickback-dev/cli 0.70.15 → 0.70.19
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/index.js +1 -1
- package/dist/skill/docs/api/typescript.md +3 -1
- package/dist/skill/docs/configure/domains.md +16 -0
- package/dist/skill/docs/define/bundles.md +6 -1
- package/dist/skill/docs/platform/realtime/named-invalidations.md +11 -1
- package/package.json +1 -1
- package/src/skill/docs/api/typescript.md +3 -1
- package/src/skill/docs/configure/domains.md +16 -0
- package/src/skill/docs/define/bundles.md +6 -1
- package/src/skill/docs/platform/realtime/named-invalidations.md +11 -1
package/dist/index.js
CHANGED
|
@@ -376,7 +376,9 @@ the WebSocket for you: it mints a [ws-ticket](/platform/realtime/using-realtime)
|
|
|
376
376
|
through the same auth lane (a fresh one for every reconnect — tickets live 60
|
|
377
377
|
seconds), shares one socket between subscribers with the same `ticket` body,
|
|
378
378
|
reconnects two seconds after a drop, and closes when the last subscriber
|
|
379
|
-
unsubscribes.
|
|
379
|
+
unsubscribes. A ticket refused with 401, 403 or 429 (a session mid-refresh,
|
|
380
|
+
a rate limit) is retried with backoff from two seconds up to thirty; any
|
|
381
|
+
other 4xx is final. Frames are CloudEvents envelopes — switch on `qbframe`.
|
|
380
382
|
|
|
381
383
|
```typescript
|
|
382
384
|
const unsubscribe = api.realtime.subscribe((frame) => {
|
|
@@ -85,6 +85,22 @@ Set `domain` to the host where **everything is available** on a single origin:
|
|
|
85
85
|
> Earlier compilers inferred this host as `quickback.{baseDomain}` from the first declared hostname, which emitted a `custom_domain` route in a zone the deploying account might not own and failed `wrangler deploy` after the upload. Only declared hostnames are emitted now.
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
### A host another Worker owns
|
|
89
|
+
|
|
90
|
+
`domain` also emits a `custom_domain` route for itself. Whichever Worker deploys last takes a custom domain, so if a separate front-door Worker owns that host (a static app that service-binds to this API, say), a routine deploy of the API moves the host to the API. Set `domainRoute: false` to keep `domain` as the unified origin everywhere it is used (trusted origins, SPA baked URLs, CSP, cookie inference, named-environment aliases) while binding nothing:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
export default defineConfig({
|
|
94
|
+
domain: "intrio.app", // the front door's host
|
|
95
|
+
domainRoute: false, // the API never claims it
|
|
96
|
+
providers: {
|
|
97
|
+
runtime: { name: "cloudflare", config: { routes: [{ pattern: "api.intrio.app", custom_domain: true }] } },
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
With named environments, a `domainRoute: false` host is not a generated source, so no target has to claim it under `domains`.
|
|
103
|
+
|
|
88
104
|
## Configuration
|
|
89
105
|
|
|
90
106
|
```typescript title="quickback/quickback.config.ts"
|
|
@@ -148,4 +148,9 @@ must pass the same complete-input-schema check as other actions.
|
|
|
148
148
|
(`success`, `etag`, `notModified`, `sections`).
|
|
149
149
|
- **A bundle must never widen read access**: its `access.roles` must be a
|
|
150
150
|
subset of every list section table's `read.access` roles — a violation is
|
|
151
|
-
a compile error, not a warning.
|
|
151
|
+
a compile error, not a warning. Both sides are compared after lowering:
|
|
152
|
+
`admin+` through `auth.roleHierarchy` and declared `authz.roles` aliases
|
|
153
|
+
through their members, so `["projectAccess"]` and
|
|
154
|
+
`["member", "admin", "owner"]` are the same people. A declared role with a
|
|
155
|
+
relationship or `userRole` arm is not a set; the check skips it with a
|
|
156
|
+
warning.
|
|
@@ -59,7 +59,15 @@ export const selectedEvent = defineRealtimeDelivery({
|
|
|
59
59
|
});
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
`target` is either a **scope room** (`scopeKeyFrom: "events:{eventId}"` — the `{...}` columns resolve from the invalidation payload/meta) or the **account lane** (`{ organizationId, userIdFrom }`). Fail-closed: if a template column can't be resolved at runtime, the frame goes to **nobody** — never a full-room fan-out.
|
|
62
|
+
`target` is either a **scope room** (`scopeKeyFrom: "events:{eventId}"` — the `{...}` columns resolve from the invalidation payload/meta) or the **account lane** (`{ organizationId, userIdFrom }`). Account-lane values are references or literals: `ctx.activeOrgId` / `ctx.userId` resolve from the acting request, `payload.<key>` / `meta.<key>` from the invalidation call, anything else is a literal id (`userIdFrom` also accepts a bare key). Fail-closed: if a template column or reference can't be resolved at runtime, the frame goes to **nobody** — never a full-room fan-out.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Everyone in the acting org, addressed one user at a time.
|
|
66
|
+
export const orgMember = defineRealtimeDelivery({
|
|
67
|
+
target: { organizationId: "ctx.activeOrgId", userIdFrom: "payload.userId" },
|
|
68
|
+
access: { roles: ["member", "admin"] },
|
|
69
|
+
});
|
|
70
|
+
```
|
|
63
71
|
|
|
64
72
|
## 3. Recipient narrowing — `defineRealtimeRecipients` (optional)
|
|
65
73
|
|
|
@@ -81,6 +89,8 @@ export const documentWatchers = defineRealtimeDelivery({
|
|
|
81
89
|
});
|
|
82
90
|
```
|
|
83
91
|
|
|
92
|
+
When `recipients` is a reference to a resolver declared elsewhere (`recipients: watchers`), the compiler cannot read its `input` keys, so the resolver receives the variant's declared payload plus `meta` instead of a projection.
|
|
93
|
+
|
|
84
94
|
The resolver gets `{ db, input, recipient }` — the scoped (firewalled) db, the projected `input`, and a `recipient` builder (`recipient.user(id)` / `recipient.scope({ kind, subjectId })`). It sees only what the acting caller could see. Resolved identities beyond a safety cap are truncated with a warning; malformed returns are dropped.
|
|
85
95
|
|
|
86
96
|
## 4. Firing from an action — `invalidates`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quickback-dev/cli",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.19",
|
|
4
4
|
"description": "CLI for Quickback — define your backend in TypeScript, compile to a fully wired Cloudflare Worker (or Bun / Node) with auth, database, migrations, security, CMS, and Account UI.",
|
|
5
5
|
"author": "Kardoe Incorporated <paul@kardoe.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -376,7 +376,9 @@ the WebSocket for you: it mints a [ws-ticket](/platform/realtime/using-realtime)
|
|
|
376
376
|
through the same auth lane (a fresh one for every reconnect — tickets live 60
|
|
377
377
|
seconds), shares one socket between subscribers with the same `ticket` body,
|
|
378
378
|
reconnects two seconds after a drop, and closes when the last subscriber
|
|
379
|
-
unsubscribes.
|
|
379
|
+
unsubscribes. A ticket refused with 401, 403 or 429 (a session mid-refresh,
|
|
380
|
+
a rate limit) is retried with backoff from two seconds up to thirty; any
|
|
381
|
+
other 4xx is final. Frames are CloudEvents envelopes — switch on `qbframe`.
|
|
380
382
|
|
|
381
383
|
```typescript
|
|
382
384
|
const unsubscribe = api.realtime.subscribe((frame) => {
|
|
@@ -85,6 +85,22 @@ Set `domain` to the host where **everything is available** on a single origin:
|
|
|
85
85
|
> Earlier compilers inferred this host as `quickback.{baseDomain}` from the first declared hostname, which emitted a `custom_domain` route in a zone the deploying account might not own and failed `wrangler deploy` after the upload. Only declared hostnames are emitted now.
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
### A host another Worker owns
|
|
89
|
+
|
|
90
|
+
`domain` also emits a `custom_domain` route for itself. Whichever Worker deploys last takes a custom domain, so if a separate front-door Worker owns that host (a static app that service-binds to this API, say), a routine deploy of the API moves the host to the API. Set `domainRoute: false` to keep `domain` as the unified origin everywhere it is used (trusted origins, SPA baked URLs, CSP, cookie inference, named-environment aliases) while binding nothing:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
export default defineConfig({
|
|
94
|
+
domain: "intrio.app", // the front door's host
|
|
95
|
+
domainRoute: false, // the API never claims it
|
|
96
|
+
providers: {
|
|
97
|
+
runtime: { name: "cloudflare", config: { routes: [{ pattern: "api.intrio.app", custom_domain: true }] } },
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
With named environments, a `domainRoute: false` host is not a generated source, so no target has to claim it under `domains`.
|
|
103
|
+
|
|
88
104
|
## Configuration
|
|
89
105
|
|
|
90
106
|
```typescript title="quickback/quickback.config.ts"
|
|
@@ -148,4 +148,9 @@ must pass the same complete-input-schema check as other actions.
|
|
|
148
148
|
(`success`, `etag`, `notModified`, `sections`).
|
|
149
149
|
- **A bundle must never widen read access**: its `access.roles` must be a
|
|
150
150
|
subset of every list section table's `read.access` roles — a violation is
|
|
151
|
-
a compile error, not a warning.
|
|
151
|
+
a compile error, not a warning. Both sides are compared after lowering:
|
|
152
|
+
`admin+` through `auth.roleHierarchy` and declared `authz.roles` aliases
|
|
153
|
+
through their members, so `["projectAccess"]` and
|
|
154
|
+
`["member", "admin", "owner"]` are the same people. A declared role with a
|
|
155
|
+
relationship or `userRole` arm is not a set; the check skips it with a
|
|
156
|
+
warning.
|
|
@@ -59,7 +59,15 @@ export const selectedEvent = defineRealtimeDelivery({
|
|
|
59
59
|
});
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
`target` is either a **scope room** (`scopeKeyFrom: "events:{eventId}"` — the `{...}` columns resolve from the invalidation payload/meta) or the **account lane** (`{ organizationId, userIdFrom }`). Fail-closed: if a template column can't be resolved at runtime, the frame goes to **nobody** — never a full-room fan-out.
|
|
62
|
+
`target` is either a **scope room** (`scopeKeyFrom: "events:{eventId}"` — the `{...}` columns resolve from the invalidation payload/meta) or the **account lane** (`{ organizationId, userIdFrom }`). Account-lane values are references or literals: `ctx.activeOrgId` / `ctx.userId` resolve from the acting request, `payload.<key>` / `meta.<key>` from the invalidation call, anything else is a literal id (`userIdFrom` also accepts a bare key). Fail-closed: if a template column or reference can't be resolved at runtime, the frame goes to **nobody** — never a full-room fan-out.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Everyone in the acting org, addressed one user at a time.
|
|
66
|
+
export const orgMember = defineRealtimeDelivery({
|
|
67
|
+
target: { organizationId: "ctx.activeOrgId", userIdFrom: "payload.userId" },
|
|
68
|
+
access: { roles: ["member", "admin"] },
|
|
69
|
+
});
|
|
70
|
+
```
|
|
63
71
|
|
|
64
72
|
## 3. Recipient narrowing — `defineRealtimeRecipients` (optional)
|
|
65
73
|
|
|
@@ -81,6 +89,8 @@ export const documentWatchers = defineRealtimeDelivery({
|
|
|
81
89
|
});
|
|
82
90
|
```
|
|
83
91
|
|
|
92
|
+
When `recipients` is a reference to a resolver declared elsewhere (`recipients: watchers`), the compiler cannot read its `input` keys, so the resolver receives the variant's declared payload plus `meta` instead of a projection.
|
|
93
|
+
|
|
84
94
|
The resolver gets `{ db, input, recipient }` — the scoped (firewalled) db, the projected `input`, and a `recipient` builder (`recipient.user(id)` / `recipient.scope({ kind, subjectId })`). It sees only what the acting caller could see. Resolved identities beyond a safety cap are truncated with a warning; malformed returns are dropped.
|
|
85
95
|
|
|
86
96
|
## 4. Firing from an action — `invalidates`
|