@quickback-dev/cli 0.66.18 → 0.66.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.
Files changed (32) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/compiler-stubs.d.ts +29 -8
  3. package/dist/lib/compiler-stubs.d.ts.map +1 -1
  4. package/dist/lib/compiler-stubs.js +29 -16
  5. package/dist/lib/compiler-stubs.js.map +1 -1
  6. package/dist/skill/SKILL.md +18 -0
  7. package/dist/skill/docs/api/actions.md +1 -1
  8. package/dist/skill/docs/api/query-params.md +4 -1
  9. package/dist/skill/docs/api/typescript.md +2 -1
  10. package/dist/skill/docs/define/actions/defining.md +1 -0
  11. package/dist/skill/docs/define/actions/index.md +17 -2
  12. package/dist/skill/docs/define/actions/record-and-standalone.md +43 -0
  13. package/dist/skill/docs/define/actions/scoped-db.md +6 -0
  14. package/dist/skill/docs/define/changesets.md +24 -4
  15. package/dist/skill/docs/define/escape-hatches.md +2 -2
  16. package/dist/skill/docs/define/firewall.md +1 -1
  17. package/dist/skill/docs/define/schema.md +271 -6
  18. package/dist/skill/docs/platform/webhooks/inbound.md +20 -7
  19. package/package.json +1 -1
  20. package/src/skill/SKILL.md +18 -0
  21. package/src/skill/docs/api/actions.md +1 -1
  22. package/src/skill/docs/api/query-params.md +4 -1
  23. package/src/skill/docs/api/typescript.md +2 -1
  24. package/src/skill/docs/define/actions/defining.md +1 -0
  25. package/src/skill/docs/define/actions/index.md +17 -2
  26. package/src/skill/docs/define/actions/record-and-standalone.md +43 -0
  27. package/src/skill/docs/define/actions/scoped-db.md +6 -0
  28. package/src/skill/docs/define/changesets.md +24 -4
  29. package/src/skill/docs/define/escape-hatches.md +2 -2
  30. package/src/skill/docs/define/firewall.md +1 -1
  31. package/src/skill/docs/define/schema.md +271 -6
  32. package/src/skill/docs/platform/webhooks/inbound.md +20 -7
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import pc from "picocolors";
12
12
  // Version injected at build time by scripts/inject-version.ts
13
- const CLI_VERSION = "0.66.18";
13
+ const CLI_VERSION = "0.66.20";
14
14
  function getPackageVersion() {
15
15
  return CLI_VERSION;
16
16
  }
@@ -51,20 +51,40 @@ export declare const defineResource: <TSchema>(schema: TSchema, config: Record<s
51
51
  export declare const defineActions: <TSchema>(schema: TSchema, config: Record<string, unknown>) => Record<string, unknown> & {
52
52
  __schema: TSchema;
53
53
  };
54
+ /**
55
+ * Stub for the `q` schema DSL. Returns chainable column builders and a `table`
56
+ * function that collects columns into a placeholder object. The CLI never
57
+ * evaluates feature source files during `compile` — it only reads them — so
58
+ * this stub exists solely for quickback.config.ts evaluation, where users
59
+ * may import `q` from `@quickback/compiler` alongside `defineTable`.
60
+ */
61
+ declare function makeQColumn(): Record<string, unknown>;
54
62
  export declare const q: {
55
63
  table: <T extends Record<string, unknown>>(name: string, columns: T, _opts?: unknown) => {
56
64
  __quickbackTable: boolean;
57
65
  name: string;
58
66
  columns: T;
59
67
  };
60
- text: (_name?: string) => Record<string, unknown>;
61
- int: (_name?: string) => Record<string, unknown>;
62
- bool: (_name?: string) => Record<string, unknown>;
63
- uuid: (_name?: string) => Record<string, unknown>;
64
- timestamp: (_name?: string) => Record<string, unknown>;
65
- json: (_zod?: unknown, _name?: string) => Record<string, unknown>;
66
- enum: (_values: readonly string[], _name?: string) => Record<string, unknown>;
67
- id: () => Record<string, unknown>;
68
+ feature: (definition: unknown) => unknown;
69
+ text: typeof makeQColumn;
70
+ url: typeof makeQColumn;
71
+ int: typeof makeQColumn;
72
+ bigint: typeof makeQColumn;
73
+ smallint: typeof makeQColumn;
74
+ decimal: typeof makeQColumn;
75
+ date: typeof makeQColumn;
76
+ bool: typeof makeQColumn;
77
+ uuid: typeof makeQColumn;
78
+ timestamp: typeof makeQColumn;
79
+ json: typeof makeQColumn;
80
+ id: typeof makeQColumn;
81
+ enum: typeof makeQColumn;
82
+ scope: typeof makeQColumn;
83
+ stamp: typeof makeQColumn;
84
+ vaultRef: typeof makeQColumn;
85
+ audit: () => {};
86
+ softDelete: () => {};
87
+ indexes: () => {};
68
88
  };
69
89
  /**
70
90
  * Stub for defineAction - returns a curried function that returns the config
@@ -92,4 +112,5 @@ export declare class TransitionLostError extends Error {
92
112
  readonly attemptedTo: string;
93
113
  constructor(field: string, expectedFrom: string, attemptedTo: string);
94
114
  }
115
+ export {};
95
116
  //# sourceMappingURL=compiler-stubs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-stubs.d.ts","sourceRoot":"","sources":["../../src/lib/compiler-stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,eAAO,MAAM,YAAY,kEAAoC,CAAC;AAC9D,+EAA+E;AAC/E,eAAO,MAAM,UAAU,kEAAoC,CAAC;AAC5D,mCAAmC;AACnC,eAAO,MAAM,WAAW,kEAAoC,CAAC;AAC7D,sCAAsC;AACtC,eAAO,MAAM,cAAc,kEAAoC,CAAC;AAChE,kCAAkC;AAClC,eAAO,MAAM,WAAW,kEAAoC,CAAC;AAC7D,qCAAqC;AACrC,eAAO,MAAM,cAAc,kEAAoC,CAAC;AAChE,uCAAuC;AACvC,eAAO,MAAM,eAAe,kEAAoC,CAAC;AACjE,4CAA4C;AAC5C,eAAO,MAAM,UAAU,kEAAoC,CAAC;AAE5D,eAAO,MAAM,aAAa,SAzBlB,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAuBb,CAAC;AACtC,eAAO,MAAM,cAAc,SA1BnB,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAwBZ,CAAC;AACvC,eAAO,MAAM,UAAU,SA3Bf,MA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,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAOrE"}
@@ -55,30 +55,43 @@ export const defineActions = withSchema;
55
55
  * may import `q` from `@quickback/compiler` alongside `defineTable`.
56
56
  */
57
57
  function makeQColumn() {
58
- const col = {
59
- required: () => col,
60
- optional: () => col,
61
- default: (_v) => col,
62
- unique: () => col,
63
- index: () => col,
64
- references: (_ref, _opts) => col,
65
- };
58
+ const col = {};
59
+ for (const modifier of [
60
+ 'required', 'optional', 'default', 'defaultNow', 'unique', 'check', 'index', 'array',
61
+ 'references', 'filterable', 'searchable', 'encrypted', 'sealed',
62
+ ]) {
63
+ col[modifier] = () => col;
64
+ }
66
65
  return col;
67
66
  }
67
+ // Keys must match the compiler's `q` exactly — `compiler-stub-q-drift.test.ts`
68
+ // in apps/compiler fails when a builder is added there and not here.
68
69
  export const q = {
69
70
  table: (name, columns, _opts) => ({
70
71
  __quickbackTable: true,
71
72
  name,
72
73
  columns,
73
74
  }),
74
- text: (_name) => makeQColumn(),
75
- int: (_name) => makeQColumn(),
76
- bool: (_name) => makeQColumn(),
77
- uuid: (_name) => makeQColumn(),
78
- timestamp: (_name) => makeQColumn(),
79
- json: (_zod, _name) => makeQColumn(),
80
- enum: (_values, _name) => makeQColumn(),
81
- id: () => makeQColumn(),
75
+ feature: (identity),
76
+ text: makeQColumn,
77
+ url: makeQColumn,
78
+ int: makeQColumn,
79
+ bigint: makeQColumn,
80
+ smallint: makeQColumn,
81
+ decimal: makeQColumn,
82
+ date: makeQColumn,
83
+ bool: makeQColumn,
84
+ uuid: makeQColumn,
85
+ timestamp: makeQColumn,
86
+ json: makeQColumn,
87
+ id: makeQColumn,
88
+ enum: makeQColumn,
89
+ scope: makeQColumn,
90
+ stamp: makeQColumn,
91
+ vaultRef: makeQColumn,
92
+ audit: () => ({}),
93
+ softDelete: () => ({}),
94
+ indexes: () => ({}),
82
95
  };
83
96
  /**
84
97
  * Stub for defineAction - returns a curried function that returns the config
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-stubs.js","sourceRoot":"","sources":["../../src/lib/compiler-stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,QAAQ,GAAG,CAAI,UAAa,EAAK,EAAE,CAAC,UAAU,CAAC;AAErD,MAAM,QAAQ,GAAG,CACf,IAAY,EACZ,MAAgC,EACmB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;AAEzF,MAAM,UAAU,GAAG,CACjB,MAAe,EACf,MAA+B,EACkB,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAA,QAAiC,CAAA,CAAC;AAC9D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAA,QAAiC,CAAA,CAAC;AAC5D,mCAAmC;AACnC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAA,QAAiC,CAAA,CAAC;AAC7D,sCAAsC;AACtC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAA,QAAiC,CAAA,CAAC;AAChE,kCAAkC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAA,QAAiC,CAAA,CAAC;AAC7D,qCAAqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAA,QAAiC,CAAA,CAAC;AAChE,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAA,QAAiC,CAAA,CAAC;AACjE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAA,QAAiC,CAAA,CAAC;AAE5D,MAAM,CAAC,MAAM,aAA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;IACjB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,CAAC,MAA+B,EAAE,EAAE,CAAC,MAAM,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,OAAO,CAA2B;IAE3C,YACE,OAAe,EACf,IAAY,EACZ,aAAqB,GAAG,EACxB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,KAAK,CAAS;IACd,YAAY,CAAS;IACrB,WAAW,CAAS;IAE7B,YAAY,KAAa,EAAE,YAAoB,EAAE,WAAmB;QAClE,KAAK,CAAC,oBAAoB,KAAK,kBAAkB,YAAY,mCAAmC,WAAW,GAAG,CAAC,CAAC;QAChH,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF"}
@@ -264,9 +264,27 @@ The action context's `db` is a Drizzle wrapper that:
264
264
  - **Does** route soft-delete `delete()` calls to a `deletedAt` / `deletedBy` UPDATE.
265
265
  - **Does** auto-populate scope columns on `insert`: any `q.scope()` column (and firewall-declared org/owner/team columns) is filled from ctx — `organizationId` ← `ctx.activeOrgId`, `ownerId` ← `ctx.userId`, etc. Audit fields (`createdAt`/`createdBy`/`modifiedAt`/`modifiedBy`) are hard-stamped by the audit wrapper; caller-supplied values for them are dropped.
266
266
  - **Does NOT** fill ordinary business columns — anything that isn't a scope or audit column is exactly what you pass to `.values({...})`.
267
+ - **Refuses** Drizzle's relational API (`db.query.<table>.findFirst/findMany`, `with:`) — it can't be firewalled, so it's a compile error. Use `db.select()` joins.
267
268
 
268
269
  For unscoped writes (cross-tenant support, platform admin), use the `unsafe:` object form on the action — it forces an audit reason and gates on platform admin role.
269
270
 
271
+ ## Relationships between tables
272
+
273
+ There is no Drizzle `relations()` in feature code — never author or generate it. Relationships are:
274
+
275
+ | Shape | Declare |
276
+ |---|---|
277
+ | Belongs-to (post → author) | `authorId: q.text().required().references(() => users.id)` — DB constraint, `Id` type brand, CMS typeahead + labels. Cross-feature target: `import users from "../users/users"`. |
278
+ | Embed the parent on reads | `read: { include: ["authorId"] }` → `GET /posts?include=authorId` (top-level `included` map, depth 1, target's access/firewall/masking apply) |
279
+ | Owned children (order → line items) | `owns: { lineItems: { table: "orderLineItems", fk: "orderId" } }` — atomic nested writes via changesets |
280
+ | Embed owned children on reads | `read: { include: ["lineItems"] }` → `GET /orders/:id?include=lineItems` |
281
+ | Non-owned has-many (user → posts) | FK on the child only; clients call `GET /posts?userId=…` (or `defineBundle` for many lists in one trip). No inline embed. |
282
+ | Value object with no identity (address) | `q.json()` |
283
+
284
+ Never `.references()` a Better Auth id (`userId`, `organizationId`, `memberId`) — auth rows live in `AUTH_DB`. `include` targets must have role-only `read.access` (record-aware targets are a compile error), so don't add every FK by reflex.
285
+
286
+ Details: `quickback docs define/schema` (References), `quickback docs define/read` (Aggregate Reads), `quickback docs define/changesets`.
287
+
270
288
  ## Error handling in actions
271
289
 
272
290
  To return a clean 4xx from an action, throw `ActionError` — the route handler catches it by name and returns `{ error, code, details }` with your status:
@@ -243,7 +243,7 @@ export default defineAction({
243
243
  access: { roles: ['PUBLIC'] },
244
244
  unsafe: {
245
245
  reason: 'Inbound mail webhook — tenant derived from mailbox record',
246
- targetScope: 'organization',
246
+ crossTenant: false, // the default (true) requires a sysadmin session — an anonymous webhook would 403
247
247
  },
248
248
  input: z.object({ mailboxId: z.string(), body: z.string() }),
249
249
  async execute({ unsafeDb, input }) {
@@ -133,7 +133,10 @@ When the multi-sort format is detected (comma or `-` prefix), the `order` parame
133
133
 
134
134
  A client-supplied `?sort=` naming an unknown column — or one outside a view's
135
135
  `query.sortable` — returns `400`, for the same reason unknown filters do: rows
136
- would come back in some other order that reads as the requested one. A view's
136
+ would come back in some other order that reads as the requested one. Array
137
+ columns, and `q.decimal()` columns on D1 (stored as `TEXT`, so they would sort
138
+ as strings), are never sortable — see
139
+ [Decimals, dates, 64-bit integers, and arrays](/define/schema#decimals-dates-64-bit-integers-and-arrays). A view's
137
140
  own `defaultSort` fallback is config, not caller input, and is never rejected.
138
141
 
139
142
  ## Field Selection
@@ -44,7 +44,8 @@ Each resource table exposes:
44
44
 
45
45
  Column types follow the wire, not the storage: `q.bool()` and
46
46
  `integer(..., { mode: "boolean" })` are `boolean`, `integer(..., { mode: "timestamp" })`
47
- and `q.timestamp()` are ISO `string`, `q.json()` is `unknown`, enum columns
47
+ and `q.timestamp()` are ISO `string`, `q.json()` is `unknown` unless it is given a
48
+ [value schema](/define/schema#typed-json-columns), enum columns
48
49
  are literal unions, and nullable columns add `| null`.
49
50
 
50
51
  Primary and foreign keys are branded by default. That makes accidentally passing a candidate ID where a job ID is required a TypeScript error, while both values remain ordinary strings or numbers at runtime.
@@ -220,6 +220,7 @@ namespace parameters.
220
220
  |--------|----------|-------------|
221
221
  | `description` | Yes | Human-readable description of the action |
222
222
  | `input` | Yes | Zod schema for request validation |
223
+ | `query` | No | Non-GET only. An inline `z.object({...})` of query-string parameters, validated apart from the JSON body and passed to `execute` as `query`. See [Query parameters on non-GET actions](/define/actions/record-and-standalone#query-parameters-on-non-get-actions) |
223
224
  | `output` | No | Portable Zod schema for the JSON success response. Generates action output types and constrains `execute`'s result. |
224
225
  | `access` | Yes | Access control (roles, record conditions, or function) |
225
226
  | `execute` | Yes | Inline async arrow function (`async (ctx) => { … }`) |
@@ -166,10 +166,25 @@ Fail-closed, one rule:
166
166
  The compile fails if the named action is missing, bound to a different table,
167
167
  the wrong shape (create needs a standalone `path:` equal to the collection URL;
168
168
  update/delete need a record-based action with no `path:`), declares a
169
- conflicting `method`, is already mapped to another verb, or the table also
170
- declares `owns` (changeset dispatch lives on the stock handler). `read.action`
169
+ conflicting `method`, or is already mapped to another verb. `read.action`
171
170
  is not supported.
172
171
 
172
+ ### Mapping a verb on an `owns` root
173
+
174
+ A table that declares [`owns`](/define/changesets) can map `create` or `update`
175
+ too. The action is then the only write path for that verb:
176
+
177
+ - A request to that verb with `Content-Type: application/vnd.quickback.changeset+json`
178
+ gets a `415`. It doesn't bypass the action, and the action's `input` doesn't
179
+ silently drop the child ops.
180
+ - OpenAPI documents only `application/json` for that operation. The unmapped
181
+ verb keeps its changeset lane.
182
+ - The changeset engine is still generated, so the action can take child
183
+ changes in its own `input` and delegate the aggregate write to
184
+ [`apply<Singular>Changeset`](/define/changesets#calling-it-from-authored-code)
185
+ (set `singular:` on the root if the default name reads wrong).
186
+ The root's crud access, guards and firewall still run inside it.
187
+
173
188
  ## The rest of this section
174
189
 
175
190
  - **[Defining actions](/define/actions/defining)** — the action file, its configuration options, protected fields, and refs
@@ -420,3 +420,46 @@ imply "this writes data" — it's the right method whenever the request body is
420
420
  load-bearing. Use the response shape (`responseType: "json"`, or just the data
421
421
  your handler returns) to convey read semantics; HTTP method choice is about
422
422
  input transport, not action intent.
423
+
424
+ ### Query parameters on non-GET actions
425
+
426
+ A POST, PUT, PATCH or DELETE action can take query-string parameters as well as
427
+ its JSON body. Declare them with `query:`. They are validated apart from
428
+ `input` and passed to `execute` as `query`. This also works when the body is a
429
+ bare array:
430
+
431
+ ```typescript
432
+ // features/journal-entries/actions/bulkCreate.ts — POST /bulk/journal-entries?expand=lines
433
+ import { z } from "zod";
434
+ import { defineAction } from "../.quickback/define-action";
435
+
436
+ export default defineAction({
437
+ description: "Create journal entries in bulk; ?expand=lines includes their lines.",
438
+ method: "POST",
439
+ path: "/bulk/journal-entries",
440
+ input: z.array(z.object({ memo: z.string().optional() })),
441
+ query: z.object({
442
+ expand: z.enum(["lines"]).optional(),
443
+ limit: z.coerce.number().int().max(100).optional(),
444
+ }),
445
+ access: { roles: ["admin"] },
446
+ async execute({ input, query }) {
447
+ // query is { expand?: "lines", limit?: number } — fully typed.
448
+ return { count: input.length, expand: query.expand ?? null };
449
+ },
450
+ });
451
+ ```
452
+
453
+ Each property is documented as an `in: query` parameter in `openapi.json`, so
454
+ it also shows up in `api-types.gen.ts`, in `quickback.gen.ts` as
455
+ `actions.<name>.Query`, and on the MCP tool. A bad value is a `400`, the same
456
+ as a bad body.
457
+
458
+ Rules, all checked at compile time:
459
+
460
+ - `query` must be an inline `z.object({...})` built from `z` and literals. The compiler converts it to JSON Schema itself.
461
+ - Not on GET actions. Their `input` already comes from the query string.
462
+ - Not together with `bulkVariant`.
463
+
464
+ Query values arrive as strings, and repeated keys become arrays. Use
465
+ `z.coerce.number()` / `z.coerce.boolean()` for typed primitives.
@@ -10,6 +10,12 @@ the same generated `WHERE` clause the table's CRUD routes use:
10
10
  | `SELECT` | the table's firewall (org / owner / team / scope / `via:` arms) AND soft-delete filter |
11
11
  | `UPDATE` / `DELETE` | the same firewall `WHERE`, AND-merged with yours |
12
12
  | `INSERT` | every required claim column the firewall binds (e.g. `organizationId` from `ctx.activeOrgId`), overwriting any value you passed |
13
+ | `INSERT … onConflictDoUpdate` | the firewall AND-merged into `setWhere` — a conflict with a row the caller can't update (another tenant's id) is a no-op, never an overwrite |
14
+
15
+ The firewall is set on the builder when you call `.from()` / `.set()` /
16
+ `.delete()`, so every executor gets it: `await`, `.all()`, `.get()`,
17
+ `.values()`, `.run()`, `.execute()`, `.prepare()`, and the builder embedded as
18
+ a subquery (`inArray(col, db.select(...).from(t))`).
13
19
 
14
20
  It is not a guess from column names. `any:` groups, `optional` arms, scope
15
21
  (`ctx.scope.*`) and `via:` relationship arms, the null-claim deny, the
@@ -121,9 +121,9 @@ to `"v2"` only if you also want the `/api/v2` prefix.
121
121
  id — an unresolvable parent lid is a pointer-carrying **400**, never a
122
122
  silent re-parent onto the root.
123
123
  - `Prefer: return=minimal` omits `root` from the response. v1 representation
124
- is **root-row-only** (re-read through the root's masking) — nested aggregate
125
- reads are the phase-2 `?include=` reader; use [`defineView`
126
- includes](/define/read) today.
124
+ is **root-row-only** (re-read through the root's masking) — read the
125
+ aggregate back with `?include=<ownsRelation>` (see [read → Aggregate
126
+ Reads](/define/read#aggregate-reads)).
127
127
 
128
128
  ### Headers
129
129
 
@@ -430,7 +430,22 @@ it; `meta.transactional` reports the actual guarantee (same contract as
430
430
  The engine is exported per root as `apply<Singular>Changeset` — the seam
431
431
  authored actions delegate through when they still need residue logic
432
432
  (preconditions, server-side transforms, notifications) around the aggregate
433
- write:
433
+ write.
434
+
435
+ `<Singular>` comes from the table name with a trailing `s` dropped, so
436
+ `projects` gives `applyProjectChangeset`. For a name that rule gets wrong,
437
+ declare `singular:` on the root to add a correctly named export:
438
+
439
+ ```ts
440
+ // journalEntries would otherwise only export applyJournalEntrieChangeset
441
+ singular: "journalEntry", // adds applyJournalEntryChangeset
442
+ owns: { /* ... */ },
443
+ ```
444
+
445
+ The default name is still exported, so existing imports keep working.
446
+ `singular` must be camelCase, and it's a compile error on a table that doesn't
447
+ declare `owns`.
448
+
434
449
 
435
450
  {/* doc-compile: skip — the fence imports `../projects.changeset`, a module the compiler only generates for a root that declares `owns`, which this fence does not carry, so the import cannot resolve. `description` / `input` / `access` are elided to `// ...` on purpose — the point is the delegation seam. */}
436
451
  ```ts title="quickback/features/projects/actions/importBoard.ts"
@@ -450,6 +465,11 @@ export default defineAction({
450
465
  });
451
466
  ```
452
467
 
468
+ This is also how a root that maps `create.action` or `update.action` writes its
469
+ children: the mapped verb has no changeset media type of its own (it answers
470
+ `415`), so its action delegates here. See
471
+ [Mapping a verb on an `owns` root](/define/actions#mapping-a-verb-on-an-owns-root).
472
+
453
473
  **There is no trusted mode.** The auth assertion, cross-tenant guard, and the
454
474
  root's own pre-record access gate are the helper's first statements — an
455
475
  authored action whose action-level access is looser than the root's crud
@@ -5,10 +5,10 @@
5
5
  compiled to Drizzle. It turns
6
6
 
7
7
  ```
8
- feature(name, { columns, indexes, unique, ...rest })
8
+ feature(name, { columns, indexes, unique, check, ...rest })
9
9
  ```
10
10
 
11
- into `q.table(name, columns, { indexes, unique })` plus `defineTable(name, rest)`,
11
+ into `q.table(name, columns, { indexes, unique, check })` plus `defineTable(name, rest)`,
12
12
  passing every other key through verbatim. Both forms produce byte-identical output.
13
13
 
14
14
  `defineTable()` is **not deprecated**. It is the layer underneath, and it is what you
@@ -529,7 +529,7 @@ Every generated write handler — `POST /`, `POST /batch`, `PATCH /:id`, `PATCH
529
529
  }
530
530
  ```
531
531
 
532
- This closes a cross-tenant injection vector: even if an attacker knows a foreign tenant's row ID, they cannot attach a child record to it — at creation or by repointing an existing row later — and they cannot trigger a cross-tenant cascade delete. The check uses the target table's `buildXFirewallConditions(ctx)` helper, so it honors whatever firewall predicates the target declared (organization, owner, team, custom). FKs to tables with `{ exception: true }` get a plain existence check (still verifies the row exists, doesn't tenant-scope it).
532
+ This closes a cross-tenant injection vector: even if an attacker knows a foreign tenant's row ID, they cannot attach a child record to it — at creation or by repointing an existing row later — and they cannot trigger a cross-tenant cascade delete. The check uses the target table's `buildXFirewallConditions(ctx)` helper, so it honors whatever firewall predicates the target declared (organization, owner, team, custom). FKs to tables with `{ exception: true }` get a plain existence check (still verifies the row exists, doesn't tenant-scope it). A [self-reference](/define/schema#self-references) (`parentId: q.text().references('self')`) is checked against the table's own firewall the same way.
533
533
 
534
534
  The check runs after guards but before the write, so it appears as `layer: "validation"` in error responses. Status code is `400`, not `404` — returning `404` would leak existence of out-of-scope rows.
535
535