@crombolo/schema 0.27.0 → 0.29.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/src/keys.ts ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The keys schema elements get without a key line (story 161), in one place so
3
+ * sync, which assigns them, and the writer, which leaves them out of a file,
4
+ * agree. A built-in's shipped key comes first; otherwise the key is derived
5
+ * from what the element names, so every node and environment computes the
6
+ * same one.
7
+ */
8
+ import { derivedKey } from '@crombolo/core'
9
+ import {
10
+ ALL_SEEDED_DATA_TYPES,
11
+ BUILT_IN_MEDIA_TYPES,
12
+ SYSTEM_CONTENT_TYPES,
13
+ SYSTEM_MEDIA_TYPES,
14
+ SYSTEM_MEMBER_TYPE,
15
+ } from '@crombolo/data'
16
+ import { systemPropertyKeys } from './builtin.ts'
17
+ import type { SchemaTypeKind } from './model.ts'
18
+
19
+ /**
20
+ * The key a file gets for an element with no key line (story 161): a built-in's
21
+ * shipped key, else the one derived from what it names. Every node and every
22
+ * environment computes the same one, which is what lets a file carry none.
23
+ */
24
+ export const typeKeyFor = (kind: SchemaTypeKind, alias: string): string =>
25
+ (kind === 'document'
26
+ ? SYSTEM_CONTENT_TYPES.find((t) => t.alias === alias)?.key
27
+ : kind === 'media'
28
+ ? (SYSTEM_MEDIA_TYPES.find((t) => t.alias === alias)?.key ??
29
+ BUILT_IN_MEDIA_TYPES.find((t) => t.alias === alias)?.key)
30
+ : SYSTEM_MEMBER_TYPE.alias === alias
31
+ ? SYSTEM_MEMBER_TYPE.key
32
+ : undefined) ?? derivedKey('type', kind, alias)
33
+
34
+ export const dataTypeKeyFor = (alias: string): string =>
35
+ ALL_SEEDED_DATA_TYPES.find((d) => d.alias === alias)?.key ?? derivedKey('data-type', alias)
36
+
37
+ /** A property's key with no key line: a built-in type's shipped one, else derived from its type's. */
38
+ export const propertyKeyFor = (
39
+ typeKey: string,
40
+ alias: string,
41
+ shipped: ReadonlyMap<string, string> = new Map(),
42
+ ): string => shipped.get(alias) ?? derivedKey(typeKey, alias)
43
+
44
+ /** The shipped property keys of a built-in content type, by alias; none for anything else. */
45
+ export function shippedPropertyKeys(
46
+ kind: SchemaTypeKind,
47
+ typeAlias: string,
48
+ ): ReadonlyMap<string, string> {
49
+ if (kind === 'document' && SYSTEM_CONTENT_TYPES.some((t) => t.alias === typeAlias))
50
+ return systemPropertyKeys(typeAlias)
51
+ // Umbraco's media types, the system ones and those `crombolo init` writes, keep
52
+ // Umbraco's property keys, so a keyless file and an init-written one agree.
53
+ const media =
54
+ kind === 'media' ? BUILT_IN_MEDIA_TYPES.find((t) => t.alias === typeAlias) : undefined
55
+ return new Map((media?.properties ?? []).map((p) => [p.alias, p.key]))
56
+ }
57
+
58
+ /** Whether a key is the one an element would get without a key line, so a file need not say it. */
59
+ export const isDerived = (key: string | undefined, expected: string): boolean =>
60
+ key === undefined || key.toLowerCase() === expected.toLowerCase()
package/src/model.ts CHANGED
@@ -93,9 +93,52 @@ export interface SchemaDataType {
93
93
  editorUi?: string
94
94
  folder?: string
95
95
  config: Record<string, unknown>
96
+ /** A block editor's blocks as `[[data-type.block]]` tables (story 161). */
97
+ blocks?: SchemaBlock[]
96
98
  since?: string
97
99
  }
98
100
 
101
+ /** One block a block list, block grid or rich-text editor offers (story 161). */
102
+ export interface SchemaBlock {
103
+ /** The element type's alias. */
104
+ element: string
105
+ /** The settings element type's alias. */
106
+ settings?: string
107
+ label?: string
108
+ size?: string
109
+ background?: string
110
+ iconColor?: string
111
+ thumbnail?: string
112
+ /** A group's name; blocks of one group sit together in the picker. */
113
+ group?: string
114
+ /** Grid only. */
115
+ allowAtRoot?: boolean
116
+ allowInAreas?: boolean
117
+ columnSpans?: number[]
118
+ rowSpan?: { min?: number; max?: number }
119
+ areaColumns?: number
120
+ areas?: SchemaBlockArea[]
121
+ }
122
+
123
+ /** An area inside a grid block, and what may be placed in it. */
124
+ export interface SchemaBlockArea {
125
+ alias: string
126
+ columnSpan?: number
127
+ rowSpan?: number
128
+ createLabel?: string
129
+ min?: number
130
+ max?: number
131
+ allow?: SchemaBlockAllowance[]
132
+ }
133
+
134
+ /** An element, or a group of blocks, allowed in an area, with optional limits. */
135
+ export interface SchemaBlockAllowance {
136
+ element?: string
137
+ group?: string
138
+ min?: number
139
+ max?: number
140
+ }
141
+
99
142
  export interface SchemaLanguage {
100
143
  iso: string
101
144
  name: string
package/src/parse.ts CHANGED
@@ -5,6 +5,8 @@
5
5
  */
6
6
  import { SITE_SEARCH_LEVELS, type SiteSearchLevel } from '@crombolo/core'
7
7
  import {
8
+ type SchemaBlock,
9
+ type SchemaBlockAllowance,
8
10
  type SchemaContentType,
9
11
  type SchemaDataType,
10
12
  type SchemaGroup,
@@ -79,8 +81,104 @@ const DATA_TYPE_KEYS = [
79
81
  'editor-ui',
80
82
  'folder',
81
83
  'config',
84
+ 'block',
82
85
  'since',
83
86
  ] as const
87
+
88
+ const BLOCK_KEYS = [
89
+ 'element',
90
+ 'settings',
91
+ 'label',
92
+ 'size',
93
+ 'background',
94
+ 'icon-color',
95
+ 'thumbnail',
96
+ 'group',
97
+ 'allow-at-root',
98
+ 'allow-in-areas',
99
+ 'column-spans',
100
+ 'row-span',
101
+ 'area-columns',
102
+ 'area',
103
+ ] as const
104
+
105
+ const AREA_KEYS = [
106
+ 'alias',
107
+ 'column-span',
108
+ 'row-span',
109
+ 'create-label',
110
+ 'min',
111
+ 'max',
112
+ 'allow',
113
+ ] as const
114
+
115
+ /** `[[data-type.block]]` tables (story 161); undefined when there are none. */
116
+ function parseBlocks(r: Reader, t: Toml, path: string): SchemaBlock[] | undefined {
117
+ if (t.block === undefined) return undefined
118
+ return r.tables(t.block, `${path}.block`).map((b, index) => {
119
+ const at = `${path}.block[${index}]`
120
+ r.unknown(b, BLOCK_KEYS, at)
121
+ const rowSpan =
122
+ b['row-span'] === undefined ? undefined : r.table(b['row-span'], `${at}.row-span`)
123
+ const spans = b['column-spans']
124
+ const block: SchemaBlock = {
125
+ element: r.str(b, 'element', at, true) ?? '',
126
+ settings: r.str(b, 'settings', at),
127
+ label: r.str(b, 'label', at),
128
+ size: r.str(b, 'size', at),
129
+ background: r.str(b, 'background', at),
130
+ iconColor: r.str(b, 'icon-color', at),
131
+ thumbnail: r.str(b, 'thumbnail', at),
132
+ group: r.str(b, 'group', at),
133
+ allowAtRoot:
134
+ b['allow-at-root'] === undefined ? undefined : r.bool(b, 'allow-at-root', at, true),
135
+ allowInAreas:
136
+ b['allow-in-areas'] === undefined ? undefined : r.bool(b, 'allow-in-areas', at, true),
137
+ columnSpans:
138
+ Array.isArray(spans) && spans.every((n) => typeof n === 'number')
139
+ ? (spans as number[])
140
+ : undefined,
141
+ rowSpan: rowSpan
142
+ ? {
143
+ min: r.num(rowSpan, 'min', `${at}.row-span`),
144
+ max: r.num(rowSpan, 'max', `${at}.row-span`),
145
+ }
146
+ : undefined,
147
+ areaColumns: r.num(b, 'area-columns', at),
148
+ areas:
149
+ b.area === undefined
150
+ ? undefined
151
+ : r.tables(b.area, `${at}.area`).map((a, i) => {
152
+ const where = `${at}.area[${i}]`
153
+ r.unknown(a, AREA_KEYS, where)
154
+ const allow = Array.isArray(a.allow)
155
+ ? a.allow.map((entry): SchemaBlockAllowance => {
156
+ if (typeof entry === 'string') return { element: entry }
157
+ const e = r.table(entry, `${where}.allow`) ?? {}
158
+ return {
159
+ element: r.str(e, 'element', `${where}.allow`),
160
+ group: r.str(e, 'group', `${where}.allow`),
161
+ min: r.num(e, 'min', `${where}.allow`),
162
+ max: r.num(e, 'max', `${where}.allow`),
163
+ }
164
+ })
165
+ : undefined
166
+ return {
167
+ alias: r.str(a, 'alias', where, true) ?? '',
168
+ columnSpan: r.num(a, 'column-span', where),
169
+ rowSpan: r.num(a, 'row-span', where),
170
+ createLabel: r.str(a, 'create-label', where),
171
+ min: r.num(a, 'min', where),
172
+ max: r.num(a, 'max', where),
173
+ allow,
174
+ }
175
+ }),
176
+ }
177
+ if (spans !== undefined && block.columnSpans === undefined)
178
+ r.problem(`${at}.column-spans`, 'column-spans is a list of numbers')
179
+ return block
180
+ })
181
+ }
84
182
  const LANGUAGE_KEYS = ['iso', 'name', 'default', 'mandatory', 'fallback'] as const
85
183
 
86
184
  function property(r: Reader, t: Toml, path: string): SchemaProperty {
@@ -253,6 +351,15 @@ export function parseDataType(file: string, source: string): ParseResult<SchemaD
253
351
  config: (config ?? {}) as Record<string, unknown>,
254
352
  since: r.str(t, 'since', path),
255
353
  }
354
+ const blocks = parseBlocks(r, t, path)
355
+ if (blocks) {
356
+ value.blocks = blocks
357
+ if (value.config.blocks !== undefined)
358
+ r.problem(
359
+ `${path}.block`,
360
+ 'give blocks as [[data-type.block]] tables or as config.blocks, not both',
361
+ )
362
+ }
256
363
  return { value: r.problems.length === 0 ? value : undefined, problems: r.problems }
257
364
  }
258
365
 
package/src/presets.ts ADDED
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Data types by preset (story 161): `types new data-type <alias> --editor
3
+ * <preset>` names a common editor and its main options as flags, and gets the
4
+ * data type file the back office would have written, with types named by alias.
5
+ */
6
+ import { RICH_TEXT_CONFIG } from '@crombolo/data'
7
+ import type { SchemaBlock, SchemaDataType } from './model.ts'
8
+ import { nameFor } from './scaffold.ts'
9
+
10
+ /** The options a preset may take, each from a flag of the same name. */
11
+ export interface PresetOptions {
12
+ maxChars?: number
13
+ rows?: number
14
+ min?: number
15
+ max?: number
16
+ step?: number
17
+ defaultOn?: boolean
18
+ label?: string
19
+ withTime?: boolean
20
+ option?: string[]
21
+ multiple?: boolean
22
+ allow?: string[]
23
+ block?: string[]
24
+ columns?: number
25
+ }
26
+
27
+ type Option = keyof PresetOptions
28
+
29
+ interface Preset {
30
+ editor: string
31
+ editorUi: string
32
+ takes: readonly Option[]
33
+ build: (o: PresetOptions) => { config: Record<string, unknown>; blocks?: SchemaBlock[] }
34
+ }
35
+
36
+ const defined = (record: Record<string, unknown>): Record<string, unknown> =>
37
+ Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined))
38
+
39
+ const limit = (o: PresetOptions) =>
40
+ o.min === undefined && o.max === undefined ? undefined : defined({ min: o.min, max: o.max })
41
+
42
+ const blocks = (o: PresetOptions) => o.block?.map((element) => ({ element }))
43
+
44
+ export const DATA_TYPE_PRESETS: Readonly<Record<string, Preset>> = {
45
+ textstring: {
46
+ editor: 'Umbraco.TextBox',
47
+ editorUi: 'Umb.PropertyEditorUi.TextBox',
48
+ takes: ['maxChars'],
49
+ build: (o) => ({ config: defined({ maxChars: o.maxChars }) }),
50
+ },
51
+ textarea: {
52
+ editor: 'Umbraco.TextArea',
53
+ editorUi: 'Umb.PropertyEditorUi.TextArea',
54
+ takes: ['rows', 'maxChars'],
55
+ build: (o) => ({ config: defined({ rows: o.rows, maxChars: o.maxChars }) }),
56
+ },
57
+ 'rich-text': {
58
+ editor: 'Umbraco.RichText',
59
+ editorUi: 'Umb.PropertyEditorUi.Tiptap',
60
+ takes: ['block'],
61
+ build: (o) => ({ config: structuredClone(RICH_TEXT_CONFIG), blocks: blocks(o) }),
62
+ },
63
+ number: {
64
+ editor: 'Umbraco.Integer',
65
+ editorUi: 'Umb.PropertyEditorUi.Integer',
66
+ takes: ['min', 'max', 'step'],
67
+ build: (o) => ({ config: defined({ min: o.min, max: o.max, step: o.step }) }),
68
+ },
69
+ toggle: {
70
+ editor: 'Umbraco.TrueFalse',
71
+ editorUi: 'Umb.PropertyEditorUi.Toggle',
72
+ takes: ['defaultOn', 'label'],
73
+ build: (o) => ({
74
+ config: defined({
75
+ default: o.defaultOn ? true : undefined,
76
+ showLabels: o.label ? true : undefined,
77
+ labelOn: o.label,
78
+ }),
79
+ }),
80
+ },
81
+ date: {
82
+ editor: 'Umbraco.DateTime',
83
+ editorUi: 'Umb.PropertyEditorUi.DatePicker',
84
+ takes: ['withTime'],
85
+ build: (o) => ({ config: { format: o.withTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD' } }),
86
+ },
87
+ dropdown: {
88
+ editor: 'Umbraco.DropDown.Flexible',
89
+ editorUi: 'Umb.PropertyEditorUi.Dropdown',
90
+ takes: ['option', 'multiple'],
91
+ build: (o) => ({ config: { multiple: o.multiple === true, items: o.option ?? [] } }),
92
+ },
93
+ 'content-picker': {
94
+ editor: 'Umbraco.MultiNodeTreePicker',
95
+ editorUi: 'Umb.PropertyEditorUi.ContentPicker',
96
+ takes: ['allow'],
97
+ build: (o) => ({
98
+ config: defined({ startNode: { type: 'content' }, filter: o.allow }),
99
+ }),
100
+ },
101
+ 'media-picker': {
102
+ editor: 'Umbraco.MediaPicker3',
103
+ editorUi: 'Umb.PropertyEditorUi.MediaPicker',
104
+ takes: ['allow', 'multiple', 'min', 'max'],
105
+ build: (o) => ({
106
+ config: defined({
107
+ filter: o.allow,
108
+ multiple: o.multiple === true,
109
+ validationLimit: limit(o) ?? (o.multiple ? undefined : { min: 0, max: 1 }),
110
+ }),
111
+ }),
112
+ },
113
+ 'element-picker': {
114
+ editor: 'Umbraco.ElementPicker',
115
+ editorUi: 'Umb.PropertyEditorUi.ElementPicker',
116
+ takes: ['allow'],
117
+ build: (o) => ({ config: defined({ allowedContentTypes: o.allow }) }),
118
+ },
119
+ 'block-list': {
120
+ editor: 'Umbraco.BlockList',
121
+ editorUi: 'Umb.PropertyEditorUi.BlockList',
122
+ takes: ['block', 'min', 'max'],
123
+ build: (o) => ({ config: defined({ validationLimit: limit(o) }), blocks: blocks(o) }),
124
+ },
125
+ 'block-grid': {
126
+ editor: 'Umbraco.BlockGrid',
127
+ editorUi: 'Umb.PropertyEditorUi.BlockGrid',
128
+ takes: ['block', 'columns'],
129
+ build: (o) => ({ config: { gridColumns: o.columns ?? 12 }, blocks: blocks(o) }),
130
+ },
131
+ }
132
+
133
+ /** `maxChars` → `--max-chars`, for naming a flag in a refusal. */
134
+ export const optionFlag = (option: string): string =>
135
+ `--${option.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`
136
+
137
+ /** Every option some preset takes, for the command's flags. */
138
+ export const PRESET_OPTIONS: readonly Option[] = [
139
+ ...new Set(Object.values(DATA_TYPE_PRESETS).flatMap((p) => p.takes)),
140
+ ]
141
+
142
+ export type PresetResult = { ok: true; dataType: SchemaDataType } | { ok: false; reason: string }
143
+
144
+ /** The data type a preset and its options describe, or why it cannot be built. */
145
+ export function presetDataType(
146
+ alias: string,
147
+ preset: string,
148
+ options: PresetOptions = {},
149
+ name?: string,
150
+ ): PresetResult {
151
+ const chosen = DATA_TYPE_PRESETS[preset]
152
+ if (!chosen)
153
+ return {
154
+ ok: false,
155
+ reason: `unknown editor "${preset}"; one of ${Object.keys(DATA_TYPE_PRESETS).join(', ')}`,
156
+ }
157
+ const extra = (Object.keys(options) as Option[]).filter(
158
+ (option) => options[option] !== undefined && !chosen.takes.includes(option),
159
+ )
160
+ if (extra.length > 0)
161
+ return {
162
+ ok: false,
163
+ reason: `${preset} does not take ${extra.map(optionFlag).join(', ')}`,
164
+ }
165
+ const { config, blocks } = chosen.build(options)
166
+ return {
167
+ ok: true,
168
+ dataType: {
169
+ alias,
170
+ name: name ?? nameFor(alias),
171
+ editor: chosen.editor,
172
+ editorUi: chosen.editorUi,
173
+ config,
174
+ ...(blocks && blocks.length > 0 ? { blocks } : {}),
175
+ },
176
+ }
177
+ }
package/src/scaffold.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * canonical writer turns it into the file, so what the CLI writes is byte for
8
8
  * byte what `types rewrite` would.
9
9
  */
10
+ import type { SchemaForm, SchemaFormField, SchemaWorkflow } from '@crombolo/core'
10
11
  import type { SchemaContentType, SchemaProperty, SchemaTab, SchemaTypeKind } from './model.ts'
11
12
  import { allProperties } from './model.ts'
12
13
 
@@ -33,6 +34,16 @@ export interface NewTypeOptions {
33
34
  template?: boolean
34
35
  /** The tab the scaffolded `title` goes in; absent means no properties at all. */
35
36
  tab?: string
37
+ /** Aliases of the types it is composed of. */
38
+ compose?: string[]
39
+ /** Content types only: the aliases of the types allowed beneath it. */
40
+ allowChildren?: string[]
41
+ variesByCulture?: boolean
42
+ variesBySegment?: boolean
43
+ /** May it be created in the Library; elements always may. */
44
+ library?: boolean
45
+ /** Content types only: its children shown as a list, with this data type. */
46
+ listView?: string
36
47
  }
37
48
 
38
49
  const DEFAULT_ICONS: Record<SchemaTypeKind, string> = {
@@ -41,10 +52,10 @@ const DEFAULT_ICONS: Record<SchemaTypeKind, string> = {
41
52
  member: 'icon-user',
42
53
  }
43
54
 
44
- /** A type as a new site would write it: keys filled in, nothing else assumed. */
55
+ /** A type as a new site would write it: no keys (sync derives them, story 161), nothing else assumed. */
45
56
  export function newType(
46
57
  options: NewTypeOptions,
47
- key: () => string = () => crypto.randomUUID(),
58
+ key: () => string | undefined = () => undefined,
48
59
  ): SchemaContentType {
49
60
  const kind = options.kind ?? 'document'
50
61
  const element = options.element === true
@@ -66,8 +77,8 @@ export function newType(
66
77
  description: element ? undefined : 'Shown as the page heading',
67
78
  type: 'textstring',
68
79
  mandatory: true,
69
- variesByCulture: false,
70
- variesBySegment: false,
80
+ variesByCulture: options.variesByCulture === true,
81
+ variesBySegment: options.variesBySegment === true,
71
82
  labelOnTop: false,
72
83
  },
73
84
  ],
@@ -82,13 +93,14 @@ export function newType(
82
93
  icon: options.icon ?? DEFAULT_ICONS[kind],
83
94
  allowAtRoot: kind === 'document' ? options.allowAtRoot === true : false,
84
95
  isElement: element,
85
- allowInLibrary: element,
86
- variesByCulture: false,
87
- variesBySegment: false,
88
- compositions: [],
89
- allowChildren: [],
96
+ allowInLibrary: element || options.library === true,
97
+ variesByCulture: options.variesByCulture === true,
98
+ variesBySegment: options.variesBySegment === true,
99
+ compositions: options.compose ?? [],
100
+ allowChildren: kind === 'document' ? (options.allowChildren ?? []) : [],
90
101
  components: templated ? [options.alias] : [],
91
102
  defaultComponent: templated ? options.alias : undefined,
103
+ collection: kind === 'document' ? options.listView : undefined,
92
104
  cleanup: { prevent: false },
93
105
  properties: [],
94
106
  tabs,
@@ -118,7 +130,7 @@ export type AddPropertyResult =
118
130
  export function addProperty(
119
131
  type: SchemaContentType,
120
132
  options: AddPropertyOptions,
121
- key: () => string = () => crypto.randomUUID(),
133
+ key: () => string | undefined = () => undefined,
122
134
  ): AddPropertyResult {
123
135
  if (allProperties(type).some((p) => p.alias === options.alias))
124
136
  return { ok: false, reason: `"${type.alias}" already has a property "${options.alias}"` }
@@ -145,6 +157,81 @@ export function addProperty(
145
157
  return { ok: true, type: { ...type, tabs }, tab: wanted, property }
146
158
  }
147
159
 
160
+ const field = (
161
+ alias: string,
162
+ type: string,
163
+ caption: string,
164
+ autocomplete: string,
165
+ ): SchemaFormField => ({
166
+ alias,
167
+ type,
168
+ caption,
169
+ mandatory: true,
170
+ sensitive: false,
171
+ autocomplete,
172
+ values: [],
173
+ accept: [],
174
+ })
175
+
176
+ /** A form to start from (story 161): one page asking for a name and an email address, kept as entries. */
177
+ export function newForm(alias: string, name?: string): SchemaForm {
178
+ return {
179
+ alias,
180
+ name: name ?? nameFor(alias),
181
+ storeEntries: true,
182
+ requiresApproval: false,
183
+ honeypot: true,
184
+ pages: [
185
+ {
186
+ groups: [
187
+ {
188
+ columns: 1,
189
+ fields: [
190
+ field('name', 'shortAnswer', 'Name', 'name'),
191
+ field('email', 'email', 'Email', 'email'),
192
+ ],
193
+ },
194
+ ],
195
+ },
196
+ ],
197
+ workflows: [],
198
+ }
199
+ }
200
+
201
+ export interface NewWorkflowOptions {
202
+ alias: string
203
+ name?: string
204
+ /** The content types it covers, by alias. */
205
+ contentTypes?: string[]
206
+ /** The user groups who approve, by alias; editors when absent. */
207
+ approvers?: string[]
208
+ }
209
+
210
+ /** An approval workflow to start from (story 161): one stage, approved by one of its approvers. */
211
+ export function newWorkflow(options: NewWorkflowOptions): SchemaWorkflow {
212
+ return {
213
+ alias: options.alias,
214
+ name: options.name ?? nameFor(options.alias),
215
+ appliesTo: { branches: [], contentTypes: options.contentTypes ?? [] },
216
+ publishersMaySkip: true,
217
+ onEdit: 'withdraw',
218
+ selfApproval: 'refused',
219
+ comments: 'optional',
220
+ unpublish: false,
221
+ onChange: 'keep',
222
+ stages: [
223
+ {
224
+ alias: 'approval',
225
+ name: 'Approval',
226
+ approvers: options.approvers ?? ['editor'],
227
+ required: 'one',
228
+ next: [],
229
+ sendBack: 'editor',
230
+ },
231
+ ],
232
+ }
233
+ }
234
+
148
235
  /** The view a scaffolded content type points at, if it has not got one yet. */
149
236
  export function viewScaffold(type: SchemaContentType): string {
150
237
  const rendered = allProperties(type)