@metaobjectsdev/sdk 0.20.5 → 0.20.6-rc.1
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.
|
@@ -313,8 +313,8 @@ Canonical form for common field needs — reach for these before inventing anyth
|
|
|
313
313
|
| Long / unbounded text | bare `field.string` | add `@maxLength` only when you want `varchar(N)` |
|
|
314
314
|
| Nested structured value | `field.object` | `@objectRef` + `@storage` |
|
|
315
315
|
| Open JSON bag (no fixed shape) | `field.string` + `@dbColumnType: jsonb` | logical type stays string; column is jsonb |
|
|
316
|
-
| URL / URI | `field.uri` | native `URI`/`Uri`; `text` column;
|
|
317
|
-
| IP address | `field.inet` | native IP type; Postgres `inet` column |
|
|
316
|
+
| URL / URI | `field.uri` | native `URI`/`Uri`; `text` column; strict absolute-URI validation (add `@lenient: true` to store any string) — a real native type + behavior, so a subtype (not a validated string) |
|
|
317
|
+
| IP address | `field.inet` | native IP type; Postgres `inet` column; strict IPv4/IPv6-literal validation (add `@lenient: true` for a plain-string `text` column) |
|
|
318
318
|
| Validated plain string (email / hostname) | `field.string` + `@stringFormat` | `@stringFormat: email` or `@stringFormat: hostname` — idiomatic per-port validation; don't hand-write the `validator.regex` |
|
|
319
319
|
|
|
320
320
|
**UUID columns are `field.uuid` — `field.string` + `@dbColumnType: uuid` is a forbidden smell.**
|
|
@@ -352,6 +352,24 @@ lives in `field.timestamp` (instant by default) + the `@localTime` naive opt-out
|
|
|
352
352
|
{ "field.timestamp": { "name": "opensAt", "@localTime": true } }
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
+
**URIs / IPs — strict by default, `@lenient` to store any string (#234).** `field.uri` is a
|
|
356
|
+
strict **absolute, scheme-bearing URI** (`https://a.com`, `mailto:a@b`; a scheme-less
|
|
357
|
+
`example.com` or a bare `/path` is rejected) and `field.inet` is a strict **IPv4/IPv6 literal**
|
|
358
|
+
(no hostnames, no CIDR). When a field must hold a *not-necessarily-well-formed* value — an
|
|
359
|
+
LLM-emitted citation URL, a user-supplied host that might be a name — add **`@lenient: true`**:
|
|
360
|
+
codegen then binds a plain string (no URL/IP validator) and a `field.inet @lenient` uses a plain
|
|
361
|
+
`text` column instead of the native `inet` type (so a value the native column would reject at
|
|
362
|
+
INSERT round-trips unchanged). Strict is the default; `@lenient` is the deliberate opt-out (never
|
|
363
|
+
default-true — the same shape as `@localTime`). **Toggling `@lenient` on an existing `field.inet`
|
|
364
|
+
is schema-affecting** (`inet` ⇄ `text`), so it shows up as an `ALTER` on the next `meta migrate`.
|
|
365
|
+
|
|
366
|
+
```json
|
|
367
|
+
{ "field.uri": { "name": "homepage" } } // strict — must be an absolute URL
|
|
368
|
+
{ "field.uri": { "name": "citationUrl", "@lenient": true } } // any string (LLM-emitted, may be malformed)
|
|
369
|
+
{ "field.inet": { "name": "sourceIp" } } // strict — IPv4/IPv6 literal only
|
|
370
|
+
{ "field.inet": { "name": "reportedHost", "@lenient": true } } // any string; text column
|
|
371
|
+
```
|
|
372
|
+
|
|
355
373
|
**`@autoSet` — let the runtime stamp created/updated times; never hand-set them.**
|
|
356
374
|
`@autoSet` is registered on the temporal subtypes (`field.date` / `field.time` /
|
|
357
375
|
`field.timestamp`) and takes **`onCreate`** (stamp on insert) or **`onUpdate`**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/sdk",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.6-rc.1",
|
|
4
4
|
"description": "Workspace helpers and agent-docs utilities for MetaObjects projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@metaobjectsdev/metadata": "0.20.
|
|
59
|
+
"@metaobjectsdev/metadata": "0.20.6-rc.1",
|
|
60
60
|
"zod": "^3.23.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|