@localess/schema 4.0.2-dev.20260929183905 → 4.0.2-dev.20260930092045
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 +2 -2
- package/SKILL.md +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -131,13 +131,13 @@ export type ContentData = InferContentData<typeof config>;
|
|
|
131
131
|
export type PageContent = InferContent<typeof Page, typeof config>;
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
`PageContent` now has `title
|
|
134
|
+
`PageContent` now has `title?: string`, `buttons?: ButtonContent[]`, and `type: 'primary' | 'secondary'` on each button — the enum narrowed to a literal union, resolved through the nesting. Change `minLength` in the schema and nothing breaks; rename a field and every call site fails to compile.
|
|
135
135
|
|
|
136
136
|
Use it with the client:
|
|
137
137
|
|
|
138
138
|
```ts
|
|
139
139
|
const content = await client.getContentBySlug<PageContent>('home', { locale: 'en' });
|
|
140
|
-
content.data.buttons[0].type; // 'primary' | 'secondary'
|
|
140
|
+
content.data.buttons?.[0].type; // 'primary' | 'secondary' | undefined
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
`InferEnum<typeof ButtonType>` gives you the value union on its own.
|
package/SKILL.md
CHANGED
|
@@ -82,7 +82,7 @@ Everything below is `export type` — importable with `import type { ... } from
|
|
|
82
82
|
| Inference (from `infer.ts`) | `InferContentData`, `InferContent`, `InferEnum` |
|
|
83
83
|
| Validation (from `validate.ts`) | `ValidationIssue` (`{ severity: 'error' \| 'warning'; code; path; message }`), `ValidationResult` (`{ ok; issues }`) |
|
|
84
84
|
| Wire model (re-exported from `@localess/model`) | `SchemaType`, `SchemaFieldKind`, `AssetFileType`, `SchemaEnumValue`, `SchemaFieldBase`, `SchemaField`, the 18 per-kind interfaces (`SchemaFieldText`, `SchemaFieldTextarea`, `SchemaFieldRichText`, `SchemaFieldMarkdown`, `SchemaFieldNumber`, `SchemaFieldColor`, `SchemaFieldDate`, `SchemaFieldDateTime`, `SchemaFieldBoolean`, `SchemaFieldOption`, `SchemaFieldOptions`, `SchemaFieldLink`, `SchemaFieldReference`, `SchemaFieldReferences`, `SchemaFieldAsset`, `SchemaFieldAssets`, `SchemaFieldSchema`, `SchemaFieldSchemas`), `SchemaComponentExport`, `SchemaEnumExport`, `SchemaExport` |
|
|
85
|
-
| Content values (re-exported from `@localess/model`) | `ContentAsset`, `ContentLink`, `ContentReference`, `ContentRichText` |
|
|
85
|
+
| Content values (re-exported from `@localess/model`) | `ContentAsset`, `ContentLink`, `ContentReference`, `ContentRichText` — plus every other `@localess/model` type (`Content`, `Locale`, `Space`, `Translations`, …), since `src/index.ts` ends with `export * from '@localess/model'` |
|
|
86
86
|
|
|
87
87
|
## `defineField`
|
|
88
88
|
|
|
@@ -178,7 +178,7 @@ schema in the config is checked, not just the first. Rules and their `code`:
|
|
|
178
178
|
| `field/schema-ref-is-enum` | ...and that schema must be `ROOT` or `NODE`, not `ENUM`. |
|
|
179
179
|
|
|
180
180
|
`validate` does not check for stray properties from the wrong field kind —
|
|
181
|
-
use `defineField` for that (
|
|
181
|
+
use `defineField` for that (above). Duplicate field names and duplicate
|
|
182
182
|
schema ids are not validation issues either: `defineSchema`/`defineConfig`
|
|
183
183
|
throw on them as programming errors.
|
|
184
184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localess/schema",
|
|
3
|
-
"version": "4.0.2-dev.
|
|
3
|
+
"version": "4.0.2-dev.20260930092045",
|
|
4
4
|
"description": "Programmatic schema definitions for Localess with TypeScript content type inference.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localess",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@localess/model": "4.0.2-dev.
|
|
46
|
+
"@localess/model": "4.0.2-dev.20260930092045"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^24",
|