@localess/schema 4.0.3-dev.20261004130007 → 4.0.3-dev.20261004140136

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/SKILL.md CHANGED
@@ -81,7 +81,7 @@ Everything below is `export type` — importable with `import type { ... } from
81
81
  | Authoring (from `define.ts`) | `EnumDefinition` (result of `defineEnum`), `ComponentDefinition` (result of `defineSchema`), `SchemaDefinition` (`ComponentDefinition \| EnumDefinition`), `LocalessSchemaConfig` (`{ schemas: readonly SchemaDefinition[] }` — what `validate`/`toSchemaExport` accept), `SchemaFieldInput` (a field as authored: `source`/`schemas` accept by-value refs), `EnumDefinitionInput`, `ComponentDefinitionInput` |
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
- | 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` |
84
+ | Wire model (re-exported from `@localess/model`) | `SchemaType`, `SchemaFieldKind`, `AssetFileType`, `SchemaEnumValue`, `SchemaFieldBase`, `SchemaFieldTranslatable`, `TranslatableSchemaFieldKind`, `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
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`
package/dist/define.d.ts CHANGED
@@ -26,12 +26,12 @@ type FieldInputOf<F> = F extends {
26
26
  readonly source: string | EnumDefinition;
27
27
  } : F extends {
28
28
  kind: 'SCHEMA' | 'SCHEMAS';
29
- } ? Omit<DeepReadonly<F>, 'schemas' | 'translatable'> & {
29
+ } ? Omit<DeepReadonly<F>, 'schemas'> & {
30
30
  readonly schemas: readonly (string | ComponentDefinition)[];
31
31
  readonly translatable?: never;
32
32
  } : F extends {
33
33
  kind: 'REFERENCE' | 'REFERENCES';
34
- } ? Omit<DeepReadonly<F>, 'translatable'> & {
34
+ } ? DeepReadonly<F> & {
35
35
  readonly translatable?: never;
36
36
  } : DeepReadonly<F>;
37
37
  /**
package/dist/index.js CHANGED
@@ -151,12 +151,22 @@ var RESERVED_SCHEMA_IDS = [
151
151
  "Content"
152
152
  ];
153
153
  var RESERVED_FIELD_NAMES = ["_id", "_schema"];
154
- var UNTRANSLATABLE_FIELD_KINDS = [
155
- "REFERENCE",
156
- "REFERENCES",
157
- "SCHEMA",
158
- "SCHEMAS"
159
- ];
154
+ var TRANSLATABLE_FIELD_KINDS = {
155
+ TEXT: true,
156
+ TEXTAREA: true,
157
+ RICH_TEXT: true,
158
+ MARKDOWN: true,
159
+ NUMBER: true,
160
+ COLOR: true,
161
+ DATE: true,
162
+ DATETIME: true,
163
+ BOOLEAN: true,
164
+ OPTION: true,
165
+ OPTIONS: true,
166
+ LINK: true,
167
+ ASSET: true,
168
+ ASSETS: true
169
+ };
160
170
  /**
161
171
  * Validate a schema config against the Localess authoring rules (ID/name patterns, reserved
162
172
  * names, length limits, reference resolution). Non-throwing; `ok` is false only when at least
@@ -195,7 +205,7 @@ function validate(config) {
195
205
  if (field.displayName && field.displayName.length > 30) error("field/display-name-too-long", fieldPath, "Field displayName exceeds 30 characters");
196
206
  if (field.description && field.description.length > 250) error("field/description-too-long", fieldPath, "Field description exceeds 250 characters");
197
207
  if (field.defaultValue && field.defaultValue.length > 250) error("field/default-value-too-long", fieldPath, "Field defaultValue exceeds 250 characters");
198
- if (field.translatable && UNTRANSLATABLE_FIELD_KINDS.includes(field.kind)) error("field/translatable-unsupported", fieldPath, `${field.kind} fields cannot be translatable; the Studio editor never translates them`);
208
+ if ("translatable" in field && field.translatable && !(field.kind in TRANSLATABLE_FIELD_KINDS)) error("field/translatable-unsupported", fieldPath, `${field.kind} fields cannot be translatable; the Studio editor never translates them`);
199
209
  if (field.kind === "OPTION" || field.kind === "OPTIONS") {
200
210
  const source = byId.get(field.source);
201
211
  if (!source) error("field/unresolved-source", fieldPath, `source '${field.source}' does not resolve to a schema in the config`);
package/dist/index.mjs CHANGED
@@ -150,12 +150,22 @@ var RESERVED_SCHEMA_IDS = [
150
150
  "Content"
151
151
  ];
152
152
  var RESERVED_FIELD_NAMES = ["_id", "_schema"];
153
- var UNTRANSLATABLE_FIELD_KINDS = [
154
- "REFERENCE",
155
- "REFERENCES",
156
- "SCHEMA",
157
- "SCHEMAS"
158
- ];
153
+ var TRANSLATABLE_FIELD_KINDS = {
154
+ TEXT: true,
155
+ TEXTAREA: true,
156
+ RICH_TEXT: true,
157
+ MARKDOWN: true,
158
+ NUMBER: true,
159
+ COLOR: true,
160
+ DATE: true,
161
+ DATETIME: true,
162
+ BOOLEAN: true,
163
+ OPTION: true,
164
+ OPTIONS: true,
165
+ LINK: true,
166
+ ASSET: true,
167
+ ASSETS: true
168
+ };
159
169
  /**
160
170
  * Validate a schema config against the Localess authoring rules (ID/name patterns, reserved
161
171
  * names, length limits, reference resolution). Non-throwing; `ok` is false only when at least
@@ -194,7 +204,7 @@ function validate(config) {
194
204
  if (field.displayName && field.displayName.length > 30) error("field/display-name-too-long", fieldPath, "Field displayName exceeds 30 characters");
195
205
  if (field.description && field.description.length > 250) error("field/description-too-long", fieldPath, "Field description exceeds 250 characters");
196
206
  if (field.defaultValue && field.defaultValue.length > 250) error("field/default-value-too-long", fieldPath, "Field defaultValue exceeds 250 characters");
197
- if (field.translatable && UNTRANSLATABLE_FIELD_KINDS.includes(field.kind)) error("field/translatable-unsupported", fieldPath, `${field.kind} fields cannot be translatable; the Studio editor never translates them`);
207
+ if ("translatable" in field && field.translatable && !(field.kind in TRANSLATABLE_FIELD_KINDS)) error("field/translatable-unsupported", fieldPath, `${field.kind} fields cannot be translatable; the Studio editor never translates them`);
198
208
  if (field.kind === "OPTION" || field.kind === "OPTIONS") {
199
209
  const source = byId.get(field.source);
200
210
  if (!source) error("field/unresolved-source", fieldPath, `source '${field.source}' does not resolve to a schema in the config`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/schema",
3
- "version": "4.0.3-dev.20261004130007",
3
+ "version": "4.0.3-dev.20261004140136",
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.3-dev.20261004130007"
46
+ "@localess/model": "4.0.3-dev.20261004140136"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^24",