@crombolo/schema 0.9.1 → 0.11.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/schema",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "Schema-as-code for crombolo: TOML document, media and member type definitions.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@crombolo/core": "0.9.1",
32
- "@crombolo/data": "0.9.1"
31
+ "@crombolo/core": "0.11.0",
32
+ "@crombolo/data": "0.11.0"
33
33
  }
34
34
  }
package/src/check.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The pre-upgrade check: what would this change do to the data, and what does
3
3
  * it need? One function behind `crombolo upgrade check` and `crombolo schema
4
- * check`. Read-only. docs/10-packaging-and-upgrades.md, "Three kinds of finding".
4
+ * check`. Read-only. docs/packaging-and-upgrades.md, "Three kinds of finding".
5
5
  */
6
6
  import type { ContentTypeAggregate, PropertyTypeModel } from '@crombolo/core'
7
7
  import { DEFAULT_BACKOFFICE_PATH } from '@crombolo/core'
package/src/export.ts CHANGED
@@ -67,6 +67,7 @@ function toSchemaProperty(p: PropertyTypeModel, ctx: ExportContext): SchemaPrope
67
67
  if (p.memberCanView) property.memberCanView = true
68
68
  if (p.memberCanEdit) property.memberCanEdit = true
69
69
  if (p.isSensitive) property.sensitive = true
70
+ if (p.searchable === false) property.searchable = false
70
71
  return property
71
72
  }
72
73
 
package/src/forms.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * The form model, and the closed set of field types it may use.
3
3
  *
4
4
  * A form definition is structure, so it is a file like every other type
5
- * (`docs/18-forms.md`). Field types are an internal registry rather than an
5
+ * (`docs/forms.md`). Field types are an internal registry rather than an
6
6
  * extension point: the TOML vocabulary, the validator, the renderer and the
7
7
  * entry value shape all have to agree, and freezing that contract before
8
8
  * anything has stressed it would be a promise made too early.
package/src/model.ts CHANGED
@@ -2,7 +2,7 @@ import type { SchemaForm } from '@crombolo/core'
2
2
 
3
3
  /**
4
4
  * The schema-as-code model: what a site's `schema/*.toml` files describe.
5
- * The shapes mirror the TOML vocabulary in docs/09-schema-as-code.md, with
5
+ * The shapes mirror the TOML vocabulary in docs/schema-as-code.md, with
6
6
  * defaults applied, so the rest of the system never sees a missing key.
7
7
  */
8
8
  export interface SchemaProperty {
@@ -26,6 +26,8 @@ export interface SchemaProperty {
26
26
  memberCanEdit?: boolean
27
27
  /** Member types only: hidden from users without sensitive-data access. */
28
28
  sensitive?: boolean
29
+ /** False keeps the property's values out of backoffice search; searchable when absent. */
30
+ searchable?: boolean
29
31
  /** Fills existing content when a required property is added to a type with pages. */
30
32
  default?: unknown
31
33
  since?: string
@@ -108,7 +110,7 @@ export interface SchemaSet {
108
110
  memberTypes?: SchemaContentType[]
109
111
  dataTypes: SchemaDataType[]
110
112
  languages: SchemaLanguage[]
111
- /** `schema/forms/*.toml` — form definitions; see `docs/18-forms.md`. */
113
+ /** `schema/forms/*.toml` — form definitions; see `docs/forms.md`. */
112
114
  forms?: SchemaForm[]
113
115
  }
114
116
 
package/src/parse.ts CHANGED
@@ -21,6 +21,7 @@ const PROPERTY_KEYS = [
21
21
  'member-can-view',
22
22
  'member-can-edit',
23
23
  'sensitive',
24
+ 'searchable',
24
25
  'key',
25
26
  'alias',
26
27
  'name',
@@ -101,6 +102,7 @@ function property(r: Reader, t: Toml, path: string): SchemaProperty {
101
102
  ? { memberCanEdit: r.bool(t, 'member-can-edit', path, false) }
102
103
  : {}),
103
104
  ...(t.sensitive !== undefined ? { sensitive: r.bool(t, 'sensitive', path, false) } : {}),
105
+ ...(t.searchable !== undefined ? { searchable: r.bool(t, 'searchable', path, true) } : {}),
104
106
  default: t.default,
105
107
  since: r.str(t, 'since', path),
106
108
  }
package/src/sync.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Files → database. Version-gated, locked, and never destructive: removal is
3
3
  * retirement, and a type with content refuses to disappear. The algorithm and
4
- * the multi-node rules are in docs/09-schema-as-code.md, "Synchronisation".
4
+ * the multi-node rules are in docs/schema-as-code.md, "Synchronisation".
5
5
  */
6
6
  import { type ContentTypeAggregate, ObjectTypes, type PropertyTypeModel } from '@crombolo/core'
7
7
  import {
@@ -418,6 +418,7 @@ export async function syncSchema(
418
418
  memberCanView: p.memberCanView === true,
419
419
  memberCanEdit: p.memberCanEdit === true,
420
420
  isSensitive: p.sensitive === true,
421
+ searchable: p.searchable !== false,
421
422
  }
422
423
  }
423
424
  // Groups have no key in the file; they match an existing group of the same name.
package/src/write.ts CHANGED
@@ -65,6 +65,7 @@ function writeProperty(out: string[], header: string, p: SchemaProperty): void {
65
65
  line(out, 'member-can-view', true, p.memberCanView === true)
66
66
  line(out, 'member-can-edit', true, p.memberCanEdit === true)
67
67
  line(out, 'sensitive', true, p.sensitive === true)
68
+ line(out, 'searchable', false, p.searchable === false)
68
69
  line(out, 'default', p.default)
69
70
  line(out, 'since', p.since)
70
71
  }