create-warlock 5.7.0 → 5.8.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/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@clack/prompts": "^0.7.0",
14
14
  "@mongez/copper": "^2.1.2",
15
- "@warlock.js/fs": "5.7.0",
15
+ "@warlock.js/fs": "5.8.0",
16
16
  "@mongez/reinforcements": "^4.0.1",
17
17
  "cross-spawn": "^7.0.3",
18
18
  "rimraf": "^6.0.1",
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=22.13"
23
23
  },
24
- "version": "5.7.0",
24
+ "version": "5.8.0",
25
25
  "type": "module",
26
26
  "main": "./esm/index.mjs",
27
27
  "module": "./esm/index.mjs",
@@ -99,3 +99,23 @@ suffixes, and JSDoc on the public surface. The bar is senior-level clean code, n
99
99
  explicitly asked.
100
100
  - When you are unsure how a package or feature works, **stop and read its skill**
101
101
  rather than guessing from other files or the web.
102
+
103
+ ## Schema & model conventions (read before writing a model or schema)
104
+
105
+ Three things that trip everyone up on a fresh app:
106
+
107
+ - **Seal fields are REQUIRED by default.** `v.string()` is already required —
108
+ omitting `.required()` does NOT make a field optional. Use `.optional()` to
109
+ make one optional. `.required()` still exists (it lets you set a custom "this
110
+ field is required" message), but it is redundant on a plain field, so the
111
+ generated code and these docs don't use it.
112
+ - **Declare server-set foreign keys on the MODEL schema.** A controller that
113
+ sets a column the client doesn't send (e.g. `authorId: request.user.id`) must
114
+ still have that column declared on the model's seal schema
115
+ (`authorId: v.number()`), or `Model.create()` rejects it as an unknown key.
116
+ The client-facing request schema and the model schema are separate, so this
117
+ does not let a client send the FK.
118
+ - **Read model data with `get()` / `toJSON()`, never `model.field`.** A model
119
+ instance does not expose its columns as direct properties — `post.title` is
120
+ `undefined` at runtime and a type error. Use `post.get("title")`, or
121
+ `post.toJSON()` in a page loader (resources are the serialization gate).