@voltro/cms 0.80.0 → 0.82.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/CHANGELOG.md +1610 -6
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/extensionManifest-ghuSj4ND.js +2782 -0
- package/dist/index.d.ts +3658 -158
- package/dist/index.js +3783 -246
- package/dist/web.d.ts +1447 -26
- package/dist/web.js +2 -2
- package/package.json +5 -4
- package/dist/ContentForm-DUW_rb_m.js +0 -278
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { Row } from '@voltro/database';
|
|
2
3
|
import { Schema as Schema_2 } from 'effect';
|
|
3
4
|
|
|
5
|
+
/** A document's address in every language it has its own variant in. */
|
|
6
|
+
export declare const alternatesOf: (trees: ReadonlyArray<LocalizedTree>, documentId: string) => ReadonlyArray<PageAlternate>;
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* Compute every `derivedFrom` field from its source value. Returns a NEW
|
|
6
10
|
* row — the input is not mutated. A caller-provided value for a derived
|
|
@@ -9,10 +13,134 @@ import { Schema as Schema_2 } from 'effect';
|
|
|
9
13
|
* declaration order against the progressively-updated row, so a derived
|
|
10
14
|
* field may source another, earlier-declared derived field.
|
|
11
15
|
*/
|
|
12
|
-
export declare const applyDerivations: (type: Pick<ContentType, "fields" | "derivedFields"
|
|
16
|
+
export declare const applyDerivations: (type: Pick<ContentType, "fields" | "derivedFields"> & Partial<Pick<ContentType, "taxonomy">>, row: Readonly<Record<string, unknown>>) => Record<string, unknown>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The source values with each unit's target in place — what a translation
|
|
20
|
+
* draft saves. A unit without a target keeps the source text; an id that
|
|
21
|
+
* names no text in the source is ignored (see `missing` from `matchUnits`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyTranslation: (fields: Readonly<Record<string, FieldSchema>>, source: Readonly<Record<string, unknown>>, units: ReadonlyArray<TranslationUnit>) => Record<string, unknown>;
|
|
24
|
+
|
|
25
|
+
export declare interface Audience {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** Raise it when the rule changes meaning; a variant records the version it was written for. */
|
|
28
|
+
readonly version: number;
|
|
29
|
+
readonly displayName: string;
|
|
30
|
+
readonly rule: AudienceRule;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A rule: every condition given must hold. */
|
|
34
|
+
export declare interface AudienceRule {
|
|
35
|
+
/** The preferred language starts with one of these (`de` matches `de-AT`). */
|
|
36
|
+
readonly languages?: ReadonlyArray<string>;
|
|
37
|
+
/** The request comes from one of these countries. */
|
|
38
|
+
readonly countries?: ReadonlyArray<string>;
|
|
39
|
+
/** The reader has (true) or has not (false) been here before. */
|
|
40
|
+
readonly returning?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** What the server knows about the request, declared — nothing else is consulted. */
|
|
44
|
+
export declare interface AudienceSignals {
|
|
45
|
+
/** Accept-Language, in order of preference (`de-AT`, `de`, `en`). */
|
|
46
|
+
readonly languages?: ReadonlyArray<string>;
|
|
47
|
+
/** ISO 3166-1 alpha-2, from a proxy the app trusts to set it. */
|
|
48
|
+
readonly country?: string | null;
|
|
49
|
+
/** The reader allowed being recognised, and was here before. */
|
|
50
|
+
readonly returning?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Which fields carry a type's availability. Validated by `defineContentType`. */
|
|
54
|
+
declare interface AvailabilityConfig {
|
|
55
|
+
/** A date or datetime field: usable up to (excluding) this moment. */
|
|
56
|
+
readonly until?: string;
|
|
57
|
+
/** A boolean field: `true` withdraws the document at once. */
|
|
58
|
+
readonly blocked?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Arrange one variant per document into a tree. `entries` holds at most one
|
|
63
|
+
* entry per `documentId` (the first one wins). A node without a segment is
|
|
64
|
+
* not routable and counts as an orphan, and so does everything below it.
|
|
65
|
+
*/
|
|
66
|
+
export declare const buildTree: (entries: ReadonlyArray<TreeEntry>, config: TreeConfig) => CmsTree;
|
|
67
|
+
|
|
68
|
+
/** The declared fields whose values differ between `before` and `after`, in declaration order. */
|
|
69
|
+
export declare const changedFields: (fields: Readonly<Record<string, unknown>>, before: Readonly<Record<string, unknown>>, after: Readonly<Record<string, unknown>>) => ReadonlyArray<string>;
|
|
70
|
+
|
|
71
|
+
/** Throws when a declaration cannot work: fields missing or of the wrong kind, a component the field does not allow. */
|
|
72
|
+
export declare const checkTemplates: (name: string, fields: Readonly<Record<string, FieldSchema>>, config: TemplatesConfig) => void;
|
|
73
|
+
|
|
74
|
+
export declare interface CmsExtensionManifest {
|
|
75
|
+
/** Lowercase letters, digits and dashes: `reading-time`. */
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
/** `major.minor.patch`. */
|
|
79
|
+
readonly version: string;
|
|
80
|
+
readonly publisher: string;
|
|
81
|
+
readonly capabilities: ReadonlyArray<ExtensionCapability>;
|
|
82
|
+
readonly slots: ReadonlyArray<ExtensionSlot>;
|
|
83
|
+
/** With the `fieldWidget` slot: the fields it shows beside (field names of the content types). */
|
|
84
|
+
readonly fields?: ReadonlyArray<string>;
|
|
85
|
+
/** What an admin can set for it (the `settings` slot): each setting's key, kind, bounds and default. */
|
|
86
|
+
readonly settings?: ReadonlyArray<ExtensionSetting>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A built tree: every routable node, depth-first, siblings in order. */
|
|
90
|
+
export declare interface CmsTree {
|
|
91
|
+
readonly nodes: ReadonlyArray<TreeNode>;
|
|
92
|
+
/**
|
|
93
|
+
* Documents whose chain never reaches the root — the parent is not
|
|
94
|
+
* published in any locale the reader accepts, or the parents form a
|
|
95
|
+
* cycle. They are not routable; they are never hung under the root.
|
|
96
|
+
*/
|
|
97
|
+
readonly orphans: ReadonlyArray<string>;
|
|
98
|
+
}
|
|
13
99
|
|
|
14
100
|
/** Everything the write pipeline can fail with on the typed channel. */
|
|
15
|
-
export declare type CmsWriteError = ContentValidationFailed | ContentNotFound | ContentIdConflict;
|
|
101
|
+
export declare type CmsWriteError = ContentValidationFailed | ContentNotFound | ContentIdConflict | RevisionMismatch;
|
|
102
|
+
|
|
103
|
+
/** Order of two `major.minor.patch` versions: negative, 0 or positive. */
|
|
104
|
+
export declare const compareVersions: (a: string, b: string) => number;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A component editors compose pages from (ADR-CMS-015): a stable `id`, a
|
|
108
|
+
* display name and typed props. The frontend renders it; the CMS validates
|
|
109
|
+
* and stores instances of it. `fingerprint` changes whenever the prop contract
|
|
110
|
+
* does, so a stored instance can tell which definition it was written against.
|
|
111
|
+
*/
|
|
112
|
+
export declare interface ComponentDefinition {
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly displayName: string;
|
|
115
|
+
readonly props: Readonly<Record<string, FieldSchema>>;
|
|
116
|
+
readonly fingerprint: string;
|
|
117
|
+
/** The consent purpose a reader must grant before this component's props reach them (`gateConsent`). */
|
|
118
|
+
readonly consent?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** One placed component in a `components` field, as stored. */
|
|
122
|
+
export declare interface ComponentInstance {
|
|
123
|
+
/** Stable across saves, reorders and translations of the same placement. */
|
|
124
|
+
readonly instanceId: string;
|
|
125
|
+
readonly componentId: string;
|
|
126
|
+
/** The definition's fingerprint when this instance was last saved. */
|
|
127
|
+
readonly fingerprint: string;
|
|
128
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** A reader's choices: purpose id → the version they allowed. */
|
|
132
|
+
export declare type ConsentChoices = Readonly<Record<string, number>>;
|
|
133
|
+
|
|
134
|
+
/** Something a reader can allow or refuse. */
|
|
135
|
+
export declare interface ConsentPurpose {
|
|
136
|
+
readonly id: string;
|
|
137
|
+
/** Raise it when what the reader agrees to changes. */
|
|
138
|
+
readonly version: number;
|
|
139
|
+
readonly displayName: string;
|
|
140
|
+
readonly description: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare const CONTENT_FORM_STRINGS: ContentFormStrings;
|
|
16
144
|
|
|
17
145
|
/**
|
|
18
146
|
* Auto-generated content form. Renders one labelled widget per field,
|
|
@@ -25,15 +153,142 @@ export declare interface ContentFormProps {
|
|
|
25
153
|
readonly contentType: ContentFormType;
|
|
26
154
|
readonly value: ContentValue;
|
|
27
155
|
readonly onChange: (next: ContentValue) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Override the widget of one field by its name — a select for a string
|
|
158
|
+
* field only some values make sense in. Wins over `widgets`.
|
|
159
|
+
*/
|
|
160
|
+
readonly fieldWidgets?: Readonly<Record<string, Widget>>;
|
|
28
161
|
/** Override the widget for one or more editor hints (e.g. a TipTap richText). */
|
|
29
162
|
readonly widgets?: Partial<Record<EditorHint, Widget>>;
|
|
163
|
+
/**
|
|
164
|
+
* Renders a control that picks one document of a type — how the rich-text
|
|
165
|
+
* editor inserts an image asset or a link target. Without it, rich text
|
|
166
|
+
* offers neither.
|
|
167
|
+
*/
|
|
168
|
+
readonly renderPicker?: RichDocumentPicker;
|
|
169
|
+
/**
|
|
170
|
+
* Renders beside one field, after its control — what the app keeps about
|
|
171
|
+
* that field (its comments, a hint, who is editing it). `null` renders
|
|
172
|
+
* nothing. Called once per field on every render.
|
|
173
|
+
*/
|
|
174
|
+
readonly renderFieldAside?: (name: string) => ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Renders inside one block of a rich-text field (the built-in editor), after
|
|
177
|
+
* its actions: `blockId` is the block's stable id, `label` its legend.
|
|
178
|
+
*/
|
|
179
|
+
readonly renderBlockAside?: (field: string, blockId: string, label: string) => ReactNode;
|
|
180
|
+
/**
|
|
181
|
+
* The label a person reads for a field, instead of its name in code: `path`
|
|
182
|
+
* is the field's name (`title`), or for a component's prop the component id
|
|
183
|
+
* and the prop (`hero.heading`). `undefined` keeps the name. An app answers
|
|
184
|
+
* from its message catalog, so the labels follow the editor's language.
|
|
185
|
+
*/
|
|
186
|
+
readonly fieldLabel?: (path: string) => string | undefined;
|
|
187
|
+
/** The words of the form's own controls (block and component actions, the
|
|
188
|
+
* block editor); English by default. Pass the editor's language. */
|
|
189
|
+
readonly strings?: ContentFormStringsInput;
|
|
190
|
+
/** How rich text's paragraphs and headings are edited — see `RichDocumentEditorProps.surface`. */
|
|
191
|
+
readonly richTextSurface?: 'markup' | 'visual';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export declare interface ContentFormStrings {
|
|
195
|
+
/** A block's kind, in its legend (`Paragraph 2`) and the "add" picker. */
|
|
196
|
+
readonly blockNames: Readonly<Record<RichBlock['type'], string>>;
|
|
197
|
+
readonly moveUp: string;
|
|
198
|
+
readonly moveDown: string;
|
|
199
|
+
readonly remove: string;
|
|
200
|
+
/** The accessible names of the three actions, naming what they act on (`Paragraph 2`). */
|
|
201
|
+
readonly moveUpLabel: (label: string) => string;
|
|
202
|
+
readonly moveDownLabel: (label: string) => string;
|
|
203
|
+
readonly removeLabel: (label: string) => string;
|
|
204
|
+
readonly add: string;
|
|
205
|
+
readonly addBlock: string;
|
|
206
|
+
readonly addComponent: string;
|
|
207
|
+
readonly unknownComponent: (componentId: string) => string;
|
|
208
|
+
readonly level: string;
|
|
209
|
+
readonly numbered: string;
|
|
210
|
+
/** A nested depth of a list numbered on its own (`depth` 2: the lists one level in). */
|
|
211
|
+
readonly numberedAt: (depth: number) => string;
|
|
212
|
+
readonly headerRow: string;
|
|
213
|
+
readonly image: string;
|
|
214
|
+
readonly caption: string;
|
|
215
|
+
readonly text: string;
|
|
216
|
+
readonly listItems: string;
|
|
217
|
+
readonly tableRows: string;
|
|
218
|
+
readonly linkTo: string;
|
|
219
|
+
readonly linkText: string;
|
|
220
|
+
readonly insertLink: string;
|
|
221
|
+
/** A list field's entry, in its legend: the field's label and the position (`Categories 2`). */
|
|
222
|
+
readonly item: (label: string, position: number) => string;
|
|
223
|
+
/** The button adding an entry to a list field. */
|
|
224
|
+
readonly addItem: string;
|
|
225
|
+
/** The accessible names of the mark buttons of visual text editing. */
|
|
226
|
+
readonly bold: string;
|
|
227
|
+
readonly italic: string;
|
|
228
|
+
readonly underline: string;
|
|
30
229
|
}
|
|
31
230
|
|
|
231
|
+
/** The defaults with an app's words over them. */
|
|
232
|
+
export declare const contentFormStrings: (strings?: ContentFormStringsInput) => ContentFormStrings;
|
|
233
|
+
|
|
234
|
+
/** What an app passes: any of the words, and any of the block names. */
|
|
235
|
+
export declare type ContentFormStringsInput = Partial<Omit<ContentFormStrings, 'blockNames'>> & {
|
|
236
|
+
readonly blockNames?: Partial<ContentFormStrings['blockNames']>;
|
|
237
|
+
};
|
|
238
|
+
|
|
32
239
|
/** The content-type shape ContentForm reads (structural — avoids a value import). */
|
|
33
240
|
export declare interface ContentFormType {
|
|
34
241
|
readonly fields: Readonly<Record<string, FieldSchema>>;
|
|
35
242
|
}
|
|
36
243
|
|
|
244
|
+
export declare interface ContentfulImportOptions {
|
|
245
|
+
/** The document an entry id became, or null. */
|
|
246
|
+
readonly resolveEntry?: (entryId: string) => string | null;
|
|
247
|
+
/** The image asset document an asset id became, or null. */
|
|
248
|
+
readonly resolveAsset?: (assetId: string) => string | null;
|
|
249
|
+
readonly newId?: () => string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export declare interface ContentfulImportResult {
|
|
253
|
+
readonly document: RichDocument;
|
|
254
|
+
readonly findings: ReadonlyArray<HtmlImportFinding>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** A node of Contentful's rich-text document, as the export writes it. */
|
|
258
|
+
export declare interface ContentfulNode {
|
|
259
|
+
readonly nodeType: string;
|
|
260
|
+
readonly value?: string;
|
|
261
|
+
readonly marks?: ReadonlyArray<{
|
|
262
|
+
readonly type: string;
|
|
263
|
+
}>;
|
|
264
|
+
readonly data?: {
|
|
265
|
+
readonly uri?: string;
|
|
266
|
+
readonly target?: {
|
|
267
|
+
readonly sys?: {
|
|
268
|
+
readonly id?: string;
|
|
269
|
+
readonly linkType?: string;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
readonly content?: ReadonlyArray<ContentfulNode>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A published document had this address and is no longer live — taken down
|
|
278
|
+
* or archived, with no live page at the address now. A site answers it with
|
|
279
|
+
* 410 Gone rather than 404, so the address is dropped rather than retried.
|
|
280
|
+
*/
|
|
281
|
+
export declare class ContentGone extends ContentGone_base {
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare const ContentGone_base: Schema_2.TaggedErrorClass<ContentGone, "ContentGone", {
|
|
285
|
+
readonly _tag: Schema_2.tag<"ContentGone">;
|
|
286
|
+
} & {
|
|
287
|
+
contentType: typeof Schema_2.String;
|
|
288
|
+
/** The address asked for. */
|
|
289
|
+
path: typeof Schema_2.String;
|
|
290
|
+
}>;
|
|
291
|
+
|
|
37
292
|
/**
|
|
38
293
|
* Raised by `saveDraft` when the caller supplies an explicit `id` that
|
|
39
294
|
* already exists OUTSIDE the caller's scope (another tenant's row).
|
|
@@ -64,8 +319,10 @@ declare const ContentNotFound_base: Schema_2.TaggedErrorClass<ContentNotFound, "
|
|
|
64
319
|
} & {
|
|
65
320
|
contentType: typeof Schema_2.String;
|
|
66
321
|
id: typeof Schema_2.String;
|
|
67
|
-
/** Which lifecycle table the id was looked up in
|
|
68
|
-
|
|
322
|
+
/** Which lifecycle table the id was looked up in (`revision`: the
|
|
323
|
+
* revision to publish is not one of this variant's; `share`: a preview
|
|
324
|
+
* share of the caller's). */
|
|
325
|
+
stage: Schema_2.Literal<["draft", "published", "revision", "share"]>;
|
|
69
326
|
}>;
|
|
70
327
|
|
|
71
328
|
/** A registered content type. */
|
|
@@ -76,9 +333,31 @@ declare interface ContentType {
|
|
|
76
333
|
readonly fields: Readonly<Record<string, FieldSchema>>;
|
|
77
334
|
readonly list?: ListConfig;
|
|
78
335
|
readonly idPrefix?: string;
|
|
79
|
-
/** Declared ISR revalidations fired
|
|
336
|
+
/** Declared ISR revalidations fired by `revalidateContent` — see
|
|
80
337
|
* `ContentTypeSpec.revalidate`. */
|
|
81
338
|
readonly revalidate?: ContentTypeSpec['revalidate'];
|
|
339
|
+
/** How the documents form a tree — see `ContentTypeSpec.tree`. */
|
|
340
|
+
readonly tree?: TreeConfig;
|
|
341
|
+
/** The field a document outside a tree is addressed by — see `ContentTypeSpec.address`. */
|
|
342
|
+
readonly address?: string;
|
|
343
|
+
/** Whether publishing needs an approved revision — see `ContentTypeSpec.review`. */
|
|
344
|
+
readonly review?: {
|
|
345
|
+
readonly required: boolean | 'workspace';
|
|
346
|
+
};
|
|
347
|
+
/** When documents may be used — see `ContentTypeSpec.availability`. */
|
|
348
|
+
readonly availability?: AvailabilityConfig;
|
|
349
|
+
/** The review cycle — see `ContentTypeSpec.lifecycle`. */
|
|
350
|
+
readonly lifecycle?: LifecycleConfig;
|
|
351
|
+
/** Templates and their rules — see `ContentTypeSpec.templates`. */
|
|
352
|
+
readonly templates?: TemplatesConfig;
|
|
353
|
+
/** Whether publishes land in the change feed — see `ContentTypeSpec.changeFeed`. */
|
|
354
|
+
readonly changeFeed?: boolean;
|
|
355
|
+
/** What makes a document findable — see `ContentTypeSpec.search`. */
|
|
356
|
+
readonly search?: SearchConfig;
|
|
357
|
+
/** What its documents are checked for — see `ContentTypeSpec.quality`. */
|
|
358
|
+
readonly quality?: ReadonlyArray<QualityRule>;
|
|
359
|
+
/** The vocabulary of a list field — see `ContentTypeSpec.taxonomy`. */
|
|
360
|
+
readonly taxonomy?: TaxonomyConfig;
|
|
82
361
|
/** Field names whose value is computed-on-save (derivedFrom). */
|
|
83
362
|
readonly derivedFields: ReadonlyArray<string>;
|
|
84
363
|
/** Field names marked unique-per-tenant (composite `(tenantId, field)` UNIQUE). */
|
|
@@ -94,11 +373,86 @@ declare interface ContentTypeSpec {
|
|
|
94
373
|
readonly list?: ListConfig;
|
|
95
374
|
/** Override the TypeID prefix for awkward plurals / long names. */
|
|
96
375
|
readonly idPrefix?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Arrange this type's documents in a tree (pages under pages): `parent` is
|
|
378
|
+
* an optional `Schema.Reference` to this same type, `order` an optional
|
|
379
|
+
* number field ordering siblings, `segment` the string field that forms the
|
|
380
|
+
* path (the slug). Read it with `cms.tree` / `cms.route`.
|
|
381
|
+
*/
|
|
382
|
+
readonly tree?: TreeConfig;
|
|
383
|
+
/**
|
|
384
|
+
* For a type outside a tree whose documents have an address of their own
|
|
385
|
+
* (a blog post's slug): the string field that is it. Every publish records
|
|
386
|
+
* it, and a changed address leaves a redirect to the document — as moving a
|
|
387
|
+
* page in a tree does. Read it with `redirectTarget(store, type, path, scope)`.
|
|
388
|
+
*/
|
|
389
|
+
readonly address?: string;
|
|
390
|
+
/**
|
|
391
|
+
* `required: true` publishes only revisions another editor approved
|
|
392
|
+
* (`approveReview`) — for every path that publishes: single, release,
|
|
393
|
+
* rollback, schedule. Register `cmsReviewsTable` when set. `'workspace'`:
|
|
394
|
+
* each workspace decides (team.ts `setReviewRequired`, or a blueprint's
|
|
395
|
+
* `team.reviewRequired`) — register `cmsTeamTable` too.
|
|
396
|
+
*/
|
|
397
|
+
readonly review?: {
|
|
398
|
+
readonly required: boolean | 'workspace';
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* When this type's documents may be used (`until`: a date/datetime field,
|
|
402
|
+
* `blocked`: a boolean field). Publishing one records it; publishing
|
|
403
|
+
* anything referencing a blocked or expired one is refused
|
|
404
|
+
* (`ReferenceUnavailable`), and readers can leave it out
|
|
405
|
+
* (`unavailableAmong`). Register `cmsAvailabilityTable` when set.
|
|
406
|
+
*/
|
|
407
|
+
readonly availability?: AvailabilityConfig;
|
|
408
|
+
/**
|
|
409
|
+
* How often a published document is checked again: its first publish sets
|
|
410
|
+
* a review date `reviewEveryDays` ahead, `recertify` moves it on. Register
|
|
411
|
+
* `cmsStewardshipTable` (it also holds each document's owner).
|
|
412
|
+
*/
|
|
413
|
+
readonly lifecycle?: LifecycleConfig;
|
|
414
|
+
/**
|
|
415
|
+
* Templates a new document can start from, and the rules a document built
|
|
416
|
+
* from one keeps on every save (required components, the first one, at
|
|
417
|
+
* most N of one). `field` stores the template id.
|
|
418
|
+
*/
|
|
419
|
+
readonly templates?: TemplatesConfig;
|
|
420
|
+
/**
|
|
421
|
+
* Append every publish and take-down of this type to the change feed
|
|
422
|
+
* (`cms_changes`, read with `readChanges`), in the same transaction. Register
|
|
423
|
+
* `cmsChangesTable` when set.
|
|
424
|
+
*/
|
|
425
|
+
readonly changeFeed?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Make this type findable (`searchContent`): every save and publish writes
|
|
428
|
+
* the variant's text to `cms_search` in the same transaction — `title`
|
|
429
|
+
* ranked first, all other text (strings, rich text, component props) as the
|
|
430
|
+
* body. Register `cmsSearchTable` when set.
|
|
431
|
+
*/
|
|
432
|
+
readonly search?: SearchConfig;
|
|
433
|
+
/**
|
|
434
|
+
* Quality rules (quality.ts): each names the causing field, the words an
|
|
435
|
+
* editor reads, and whether publishing waits for it (`blocking`, default
|
|
436
|
+
* true). A blocking finding is repaired at its field or excepted — one rule,
|
|
437
|
+
* one variant, a reason, an end date, approved by someone else
|
|
438
|
+
* (`requestQualityException` / `decideQualityException`). Register
|
|
439
|
+
* `cmsQualityExceptionsTable` when set.
|
|
440
|
+
*/
|
|
441
|
+
readonly quality?: ReadonlyArray<QualityRule>;
|
|
442
|
+
/**
|
|
443
|
+
* A controlled vocabulary for one `Schema.Array(Schema.String)` field
|
|
444
|
+
* (taxonomy.ts): every save folds case and spacing, maps synonyms to their
|
|
445
|
+
* term and drops repeats; a term outside the vocabulary fails the save
|
|
446
|
+
* (`unknown: 'keep'` keeps it).
|
|
447
|
+
*/
|
|
448
|
+
readonly taxonomy?: TaxonomyConfig;
|
|
97
449
|
/**
|
|
98
450
|
* ISR routes to drop when content of this type is published or
|
|
99
|
-
* unpublished
|
|
100
|
-
* `revalidateTag` (from `@voltro/runtime`) for each entry
|
|
101
|
-
*
|
|
451
|
+
* unpublished. `revalidateContent(type)` calls `revalidatePath` /
|
|
452
|
+
* `revalidateTag` (from `@voltro/runtime`) for each entry, reaching every
|
|
453
|
+
* `voltro start` replica — `publishDue` after its commits, a mutation from
|
|
454
|
+
* a post-commit subscriber on `<type>_published` (the write ops run inside
|
|
455
|
+
* the caller's transaction, so they cannot know when it commits).
|
|
102
456
|
*
|
|
103
457
|
* You DON'T need this on postgres for the plain publish case: a route
|
|
104
458
|
* declaring `cacheInvalidatesOn: ['<type>_published']` is already dropped
|
|
@@ -139,9 +493,9 @@ export declare type ContentValue = Record<string, unknown>;
|
|
|
139
493
|
/**
|
|
140
494
|
* Collect every save-time rule violation for `row` against `type` —
|
|
141
495
|
* required presence, per-kind type checks, `maxLength`, `pattern`,
|
|
142
|
-
* `Literal` value sets, and
|
|
143
|
-
*
|
|
144
|
-
*
|
|
496
|
+
* `Literal` value sets, component instances, and rich documents (their
|
|
497
|
+
* structure, and image / link nodes only where the field names a type for
|
|
498
|
+
* them).
|
|
145
499
|
*
|
|
146
500
|
* Pure and never throws — usable in a browser form ("annotate every
|
|
147
501
|
* invalid field") as well as on the server. `id` is allowed (must be a
|
|
@@ -154,7 +508,22 @@ export declare type ContentValue = Record<string, unknown>;
|
|
|
154
508
|
* that is about to be written — a derived field's rules apply to the
|
|
155
509
|
* derived value, not to a caller value that's about to be overwritten.
|
|
156
510
|
*/
|
|
157
|
-
export declare const contentViolations: (type: Pick<ContentType, "name" | "fields"
|
|
511
|
+
export declare const contentViolations: (type: Pick<ContentType, "name" | "fields"> & Partial<Pick<ContentType, "taxonomy">>, row: Readonly<Record<string, unknown>>) => ReadonlyArray<FieldViolation>;
|
|
512
|
+
|
|
513
|
+
/** Decode character references (`&`, `’`, `—`). */
|
|
514
|
+
export declare const decodeEntities: (text: string) => string;
|
|
515
|
+
|
|
516
|
+
/** Define an audience; a rule with no condition would match everyone and is refused. */
|
|
517
|
+
export declare const defineAudience: (audience: Audience) => Audience;
|
|
518
|
+
|
|
519
|
+
/** Declare a component editors can place in a `Schema.Components` field. */
|
|
520
|
+
export declare const defineComponent: (spec: {
|
|
521
|
+
readonly id: string;
|
|
522
|
+
readonly displayName: string;
|
|
523
|
+
readonly props: Readonly<Record<string, FieldSchema | PipeableField>>;
|
|
524
|
+
/** A consent purpose the reader must grant first — an embed that loads a third party. */
|
|
525
|
+
readonly consent?: string;
|
|
526
|
+
}) => ComponentDefinition;
|
|
158
527
|
|
|
159
528
|
/**
|
|
160
529
|
* Mark a field computed-on-save from another field. The transform runs
|
|
@@ -175,11 +544,195 @@ export declare interface DerivedSpec {
|
|
|
175
544
|
readonly transform: (value: unknown, row: Record<string, unknown>) => unknown;
|
|
176
545
|
}
|
|
177
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Name the change from `before` to `after`, or null when nothing declared
|
|
549
|
+
* changed. A component or block list names the item added, removed, moved or
|
|
550
|
+
* edited; any other field is "edit <field>".
|
|
551
|
+
*/
|
|
552
|
+
export declare const describeEdit: (fields: Readonly<Record<string, FieldSchema>>, before: Readonly<Record<string, unknown>>, after: Readonly<Record<string, unknown>>, words: EditWords) => EditDescription | null;
|
|
553
|
+
|
|
554
|
+
/** One run of a word diff: text both sides share, or text only one side has. */
|
|
555
|
+
export declare interface DiffSegment {
|
|
556
|
+
readonly op: 'same' | 'removed' | 'added';
|
|
557
|
+
readonly text: string;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* The word diff of two texts: the longest common run of words kept as `same`,
|
|
562
|
+
* the rest as `removed` (only before) and `added` (only after), adjacent runs
|
|
563
|
+
* of one kind merged. Two very long texts come back as one removed and one
|
|
564
|
+
* added run.
|
|
565
|
+
*/
|
|
566
|
+
export declare const diffWords: (before: string, after: string) => ReadonlyArray<DiffSegment>;
|
|
567
|
+
|
|
568
|
+
/** What one change did, and a key that tells whether the next change continues it. */
|
|
569
|
+
export declare interface EditDescription {
|
|
570
|
+
readonly label: string;
|
|
571
|
+
/** Changes with the same key in quick succession are one step (typing). */
|
|
572
|
+
readonly key: string;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export declare interface EditHistory {
|
|
576
|
+
/** Oldest first; the last one is undone next. */
|
|
577
|
+
readonly past: ReadonlyArray<EditStep>;
|
|
578
|
+
/** Next first: what redo does. */
|
|
579
|
+
readonly future: ReadonlyArray<EditStep>;
|
|
580
|
+
}
|
|
581
|
+
|
|
178
582
|
/** The widget the editor renders for a field — drives ContentForm. */
|
|
179
|
-
export declare type EditorHint = 'text' | 'textarea' | 'number' | 'boolean' | 'date' | 'datetime' | 'select' | 'richText' | 'media' | 'reference' | 'array' | 'struct';
|
|
583
|
+
export declare type EditorHint = 'text' | 'textarea' | 'number' | 'boolean' | 'date' | 'datetime' | 'select' | 'richText' | 'media' | 'reference' | 'array' | 'struct' | 'components';
|
|
584
|
+
|
|
585
|
+
/** What the editor sends the preview. */
|
|
586
|
+
export declare interface EditorMessage {
|
|
587
|
+
readonly protocol: typeof VISUAL_EDITING_PROTOCOL;
|
|
588
|
+
readonly nonce: string;
|
|
589
|
+
readonly kind: 'values';
|
|
590
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** One step: the form as it was before it, and its name. */
|
|
594
|
+
export declare interface EditStep {
|
|
595
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
596
|
+
readonly label: string;
|
|
597
|
+
readonly key: string;
|
|
598
|
+
readonly at: number;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/** The words a step is named with, in the editor's language. */
|
|
602
|
+
export declare interface EditWords {
|
|
603
|
+
readonly fieldLabel: (name: string) => string;
|
|
604
|
+
readonly componentLabel: (componentId: string) => string;
|
|
605
|
+
readonly blockLabel: (type: RichBlock['type']) => string;
|
|
606
|
+
readonly edit: (what: string) => string;
|
|
607
|
+
readonly add: (what: string) => string;
|
|
608
|
+
readonly remove: (what: string) => string;
|
|
609
|
+
readonly moveUp: (what: string) => string;
|
|
610
|
+
readonly moveDown: (what: string) => string;
|
|
611
|
+
/** Two neighbours that changed places — which of them was moved cannot be told from the result. */
|
|
612
|
+
readonly swap: (first: string, second: string) => string;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/** The tools on for the last step of `chain`, and why each tool is as it is. */
|
|
616
|
+
export declare const effectiveExposure: (input: ExposureInput) => ExposureResult;
|
|
617
|
+
|
|
618
|
+
export declare const EMPTY_EDIT_HISTORY: EditHistory;
|
|
619
|
+
|
|
620
|
+
/** An empty document. */
|
|
621
|
+
export declare const emptyRichDocument: () => RichDocument;
|
|
622
|
+
|
|
623
|
+
export declare interface ExposureInput {
|
|
624
|
+
readonly ceiling: ReadonlyArray<string>;
|
|
625
|
+
readonly defaults: ReadonlyArray<string>;
|
|
626
|
+
/** From the root down to the page. */
|
|
627
|
+
readonly chain: ReadonlyArray<ExposureStep>;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export declare interface ExposureResult {
|
|
631
|
+
/** The tools on here, in the ceiling's order. */
|
|
632
|
+
readonly tools: ReadonlyArray<string>;
|
|
633
|
+
/** Every tool of the ceiling and why it is as it is. */
|
|
634
|
+
readonly explained: ReadonlyArray<ToolExposure>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** One level of the tree: tool names turned on, off, or locked off here. A value that is not a list of names counts as unset. */
|
|
638
|
+
export declare interface ExposureStep {
|
|
639
|
+
readonly on?: unknown;
|
|
640
|
+
readonly off?: unknown;
|
|
641
|
+
readonly locked?: unknown;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/** The places in the editor an extension can show itself. */
|
|
645
|
+
export declare const EXTENSION_SLOTS: readonly ["dashboard", "sidebar", "fieldWidget", "entryTab", "releaseCheck", "assetAction", "settings"];
|
|
646
|
+
|
|
647
|
+
/** An extension reached for a capability it was not granted. */
|
|
648
|
+
export declare class ExtensionAccessDenied extends ExtensionAccessDenied_base {
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
declare const ExtensionAccessDenied_base: Schema_2.TaggedErrorClass<ExtensionAccessDenied, "ExtensionAccessDenied", {
|
|
652
|
+
readonly _tag: Schema_2.tag<"ExtensionAccessDenied">;
|
|
653
|
+
} & {
|
|
654
|
+
extensionId: typeof Schema_2.String;
|
|
655
|
+
capability: typeof Schema_2.String;
|
|
656
|
+
}>;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* What an extension may do; everything else is refused.
|
|
660
|
+
*
|
|
661
|
+
* content:read / content:write — documents, through the CMS, never its tables;
|
|
662
|
+
* egress:<host> — HTTPS requests to exactly that host;
|
|
663
|
+
* secret:<NAME> — that one secret, as the host binds it.
|
|
664
|
+
*
|
|
665
|
+
* Its own data (`data` in the sandbox) needs no capability: it lives in the
|
|
666
|
+
* extension's namespace and leaves with it.
|
|
667
|
+
*/
|
|
668
|
+
export declare type ExtensionCapability = 'content:read' | 'content:write' | `egress:${string}` | `secret:${string}`;
|
|
669
|
+
|
|
670
|
+
/** A manifest on the wire — for a descriptor's input or output. */
|
|
671
|
+
export declare const ExtensionManifestSchema: Schema_2.Struct<{
|
|
672
|
+
id: typeof Schema_2.String;
|
|
673
|
+
name: typeof Schema_2.String;
|
|
674
|
+
version: typeof Schema_2.String;
|
|
675
|
+
publisher: typeof Schema_2.String;
|
|
676
|
+
capabilities: Schema_2.Array$<typeof Schema_2.String>;
|
|
677
|
+
slots: Schema_2.Array$<typeof Schema_2.String>;
|
|
678
|
+
fields: Schema_2.optional<Schema_2.Array$<typeof Schema_2.String>>;
|
|
679
|
+
settings: Schema_2.optional<Schema_2.Array$<Schema_2.Union<[Schema_2.Struct<{
|
|
680
|
+
key: typeof Schema_2.String;
|
|
681
|
+
label: typeof Schema_2.String;
|
|
682
|
+
kind: Schema_2.Literal<["number"]>;
|
|
683
|
+
default: typeof Schema_2.Number;
|
|
684
|
+
min: Schema_2.optional<typeof Schema_2.Number>;
|
|
685
|
+
max: Schema_2.optional<typeof Schema_2.Number>;
|
|
686
|
+
}>, Schema_2.Struct<{
|
|
687
|
+
key: typeof Schema_2.String;
|
|
688
|
+
label: typeof Schema_2.String;
|
|
689
|
+
kind: Schema_2.Literal<["boolean"]>;
|
|
690
|
+
default: typeof Schema_2.Boolean;
|
|
691
|
+
}>, Schema_2.Struct<{
|
|
692
|
+
key: typeof Schema_2.String;
|
|
693
|
+
label: typeof Schema_2.String;
|
|
694
|
+
kind: Schema_2.Literal<["choice"]>;
|
|
695
|
+
default: typeof Schema_2.String;
|
|
696
|
+
options: Schema_2.Array$<typeof Schema_2.String>;
|
|
697
|
+
}>]>>>;
|
|
698
|
+
}>;
|
|
699
|
+
|
|
700
|
+
/** One setting of an extension. A number may have bounds; a choice lists its options. */
|
|
701
|
+
export declare type ExtensionSetting = {
|
|
702
|
+
readonly key: string;
|
|
703
|
+
readonly label: string;
|
|
704
|
+
readonly kind: 'number';
|
|
705
|
+
readonly default: number;
|
|
706
|
+
readonly min?: number;
|
|
707
|
+
readonly max?: number;
|
|
708
|
+
} | {
|
|
709
|
+
readonly key: string;
|
|
710
|
+
readonly label: string;
|
|
711
|
+
readonly kind: 'boolean';
|
|
712
|
+
readonly default: boolean;
|
|
713
|
+
} | {
|
|
714
|
+
readonly key: string;
|
|
715
|
+
readonly label: string;
|
|
716
|
+
readonly kind: 'choice';
|
|
717
|
+
readonly default: string;
|
|
718
|
+
readonly options: ReadonlyArray<string>;
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
export declare type ExtensionSettingValue = number | boolean | string;
|
|
722
|
+
|
|
723
|
+
export declare type ExtensionSlot = (typeof EXTENSION_SLOTS)[number];
|
|
724
|
+
|
|
725
|
+
/** One changed field, as a word diff of its text before and after. */
|
|
726
|
+
export declare interface FieldDiff {
|
|
727
|
+
readonly field: string;
|
|
728
|
+
readonly segments: ReadonlyArray<DiffSegment>;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** How each declared field that changed between `before` and `after` changed, in declaration order. */
|
|
732
|
+
export declare const fieldDiffs: (fields: Readonly<Record<string, unknown>>, before: Readonly<Record<string, unknown>>, after: Readonly<Record<string, unknown>>) => ReadonlyArray<FieldDiff>;
|
|
180
733
|
|
|
181
734
|
/** Discriminator for how a field compiles to a column + serialises. */
|
|
182
|
-
export declare type FieldKind = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'literal' | 'richText' | 'media' | 'reference' | 'array' | 'struct';
|
|
735
|
+
export declare type FieldKind = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'literal' | 'richText' | 'media' | 'reference' | 'array' | 'struct' | 'components';
|
|
183
736
|
|
|
184
737
|
/** A refinement applied through `.pipe(...)`. */
|
|
185
738
|
export declare type FieldRefinement = (field: FieldSchema) => FieldSchema;
|
|
@@ -190,12 +743,20 @@ export declare interface FieldSchema {
|
|
|
190
743
|
readonly editorHint: EditorHint;
|
|
191
744
|
/** When true the field is nullable in the DB + optional in the editor. */
|
|
192
745
|
readonly isOptional: boolean;
|
|
746
|
+
/**
|
|
747
|
+
* Set by `.requiredToPublish()`: a draft may leave it empty; publishing
|
|
748
|
+
* needs it (`publishViolations`, checked by every publish). Implies
|
|
749
|
+
* `isOptional` — the column is nullable.
|
|
750
|
+
*/
|
|
751
|
+
readonly publishRequired?: boolean;
|
|
193
752
|
/** Max string length — drives textarea-vs-input + save-time validation. */
|
|
194
753
|
readonly maxLength?: number;
|
|
195
754
|
/** Source-form regex (string) for save-time validation. */
|
|
196
755
|
readonly pattern?: string;
|
|
197
756
|
/** Closed value set for `literal` fields → `<select>` + CHECK constraint. */
|
|
198
757
|
readonly literals?: ReadonlyArray<string>;
|
|
758
|
+
/** A `number` field that takes fractions (a `real` column); without it a number is whole. */
|
|
759
|
+
readonly fraction?: boolean;
|
|
199
760
|
/**
|
|
200
761
|
* When true, the field is unique PER TENANT — the derived tables carry a
|
|
201
762
|
* composite `(tenantId, <field>)` DB UNIQUE constraint (see contentType.ts).
|
|
@@ -210,10 +771,29 @@ export declare interface FieldSchema {
|
|
|
210
771
|
readonly element?: FieldSchema;
|
|
211
772
|
/** Nested field map for `struct` fields. */
|
|
212
773
|
readonly struct?: Readonly<Record<string, FieldSchema>>;
|
|
774
|
+
/** The components a `components` field may hold, in the order editors see them. */
|
|
775
|
+
readonly components?: ReadonlyArray<ComponentDefinition>;
|
|
213
776
|
/** Computed-on-save derivation (set via `derivedFrom`). */
|
|
214
777
|
readonly derived?: DerivedSpec;
|
|
215
778
|
}
|
|
216
779
|
|
|
780
|
+
/** One value a field held, from the revision that introduced it. */
|
|
781
|
+
export declare interface FieldVersion {
|
|
782
|
+
readonly value: unknown;
|
|
783
|
+
readonly revisionId: string;
|
|
784
|
+
readonly number: number;
|
|
785
|
+
readonly createdAt: unknown;
|
|
786
|
+
readonly createdBy: unknown;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* The versions of one field across a document's revisions, newest first: a
|
|
791
|
+
* new entry wherever the value changed. For an image asset's `file` it is the
|
|
792
|
+
* file history — a revision that only fixed the alt text adds no version.
|
|
793
|
+
* `revisions` are `cms_revisions` rows (e.g. from `listRevisions`), in any order.
|
|
794
|
+
*/
|
|
795
|
+
export declare const fieldVersions: (revisions: ReadonlyArray<Readonly<Record<string, unknown>>>, field: string) => ReadonlyArray<FieldVersion>;
|
|
796
|
+
|
|
217
797
|
/** One save-time rule violation, addressed to a field path. */
|
|
218
798
|
export declare interface FieldViolation {
|
|
219
799
|
/** Dotted/indexed field path, e.g. `title`, `meta.ogTitle`, `tags[2]`. */
|
|
@@ -223,6 +803,111 @@ export declare interface FieldViolation {
|
|
|
223
803
|
readonly message: string;
|
|
224
804
|
}
|
|
225
805
|
|
|
806
|
+
/**
|
|
807
|
+
* The part of a `ContentForm` a path names — a field's container, or one
|
|
808
|
+
* placed component of a components field — or null.
|
|
809
|
+
*/
|
|
810
|
+
export declare const formPartOf: (form: ParentNode, path: string) => Element | null;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* The values with every component that needs an ungranted purpose replaced
|
|
814
|
+
* by a {@link WithheldInstance}. Values without such components come back
|
|
815
|
+
* unchanged. Apply it wherever content leaves for a reader.
|
|
816
|
+
*/
|
|
817
|
+
export declare const gateConsent: (type: {
|
|
818
|
+
readonly fields: Readonly<Record<string, FieldSchema>>;
|
|
819
|
+
}, values: Readonly<Record<string, unknown>>, granted: ReadonlySet<string>) => Record<string, unknown>;
|
|
820
|
+
|
|
821
|
+
/** The purposes whose current version the reader allowed. */
|
|
822
|
+
export declare const grantedPurposes: (purposes: ReadonlyArray<ConsentPurpose>, choices: ConsentChoices) => ReadonlySet<string>;
|
|
823
|
+
|
|
824
|
+
/** Whether every character of text in `[start, end)` carries `mark` (links never do). */
|
|
825
|
+
export declare const hasMark: (content: ReadonlyArray<RichInline>, start: number, end: number, mark: RichMark) => boolean;
|
|
826
|
+
|
|
827
|
+
export declare interface HtmlImportFinding {
|
|
828
|
+
readonly kind: 'unsupportedTag' | 'externalLink' | 'image';
|
|
829
|
+
/** The tag, the link's address or the image's source. */
|
|
830
|
+
readonly detail: string;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export declare interface HtmlImportOptions {
|
|
834
|
+
/** The document an address points to, or null when it is not one of ours. */
|
|
835
|
+
readonly resolveLink?: (href: string) => string | null;
|
|
836
|
+
/** The image asset document an image source became (an import that brought the file in), or null. */
|
|
837
|
+
readonly resolveImage?: (src: string) => string | null;
|
|
838
|
+
/** Block ids; defaults to a counter, so a test reads stable ids. */
|
|
839
|
+
readonly newId?: () => string;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export declare interface HtmlImportResult {
|
|
843
|
+
readonly document: RichDocument;
|
|
844
|
+
readonly findings: ReadonlyArray<HtmlImportFinding>;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** Where an inherited value came from. */
|
|
848
|
+
export declare interface Inherited {
|
|
849
|
+
/** The value; undefined when neither the page nor an ancestor sets it. */
|
|
850
|
+
readonly value: unknown;
|
|
851
|
+
/** The document that set it: the page itself, an ancestor, or null for none. */
|
|
852
|
+
readonly from: string | null;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* The value of an inherited field for `node`: its own when set, else the
|
|
857
|
+
* nearest ancestor's in `tree` (the same locale's variants the tree was built
|
|
858
|
+
* from). Pass `{ ancestorsOnly: true }` for what the page would show without
|
|
859
|
+
* its own value — the "reset to inherited" preview.
|
|
860
|
+
*/
|
|
861
|
+
export declare const inheritedValue: (tree: CmsTree, node: TreeNode, field: string, options?: {
|
|
862
|
+
readonly ancestorsOnly?: boolean;
|
|
863
|
+
}) => Inherited;
|
|
864
|
+
|
|
865
|
+
/** How one inherited field may be set. */
|
|
866
|
+
export declare interface InheritRule {
|
|
867
|
+
/** No page may set the field; saving one that does is refused (`locked`). */
|
|
868
|
+
readonly locked?: boolean;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/** The minimal DOM a surface is read from (a browser element, or jsdom's). */
|
|
872
|
+
export declare interface InlineDomNode {
|
|
873
|
+
readonly nodeType: number;
|
|
874
|
+
readonly nodeName: string;
|
|
875
|
+
readonly textContent: string | null;
|
|
876
|
+
readonly childNodes: ArrayLike<InlineDomNode>;
|
|
877
|
+
getAttribute?(name: string): string | null;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Read a surface's DOM back into a run: text, `strong`/`b` as bold, `em`/`i` as
|
|
882
|
+
* italic, `a[data-target]` as a link to that document, `br` as a line break.
|
|
883
|
+
* Anything else a browser or a paste put there contributes its text only.
|
|
884
|
+
*/
|
|
885
|
+
export declare const inlineFromDom: (root: InlineDomNode) => ReadonlyArray<RichInline>;
|
|
886
|
+
|
|
887
|
+
/** A run as the HTML a visual surface shows: `strong`, `em`, `u`, `a[data-target]`, escaped text. */
|
|
888
|
+
export declare const inlineHtml: (content: ReadonlyArray<RichInline>) => string;
|
|
889
|
+
|
|
890
|
+
/** Inline nodes back to the editor's markup (the inverse of `parseInlineMarkup`). */
|
|
891
|
+
export declare const inlineMarkupOf: (content: ReadonlyArray<RichInline>) => string;
|
|
892
|
+
|
|
893
|
+
/** The plain text of a run. */
|
|
894
|
+
export declare const inlineText: (content: ReadonlyArray<RichInline>) => string;
|
|
895
|
+
|
|
896
|
+
/** Whether `value` is a capability an extension can ask for. */
|
|
897
|
+
export declare const isExtensionCapability: (value: string) => value is ExtensionCapability;
|
|
898
|
+
|
|
899
|
+
/** Whether `zone` is an IANA zone this runtime knows. */
|
|
900
|
+
export declare const isKnownZone: (zone: string) => boolean;
|
|
901
|
+
|
|
902
|
+
/** Accept-Language → languages in order of preference (quality factors honoured). */
|
|
903
|
+
export declare const languagesOf: (acceptLanguage: string | undefined) => ReadonlyArray<string>;
|
|
904
|
+
|
|
905
|
+
/** How often a type's documents are checked again, declared on the type. */
|
|
906
|
+
declare interface LifecycleConfig {
|
|
907
|
+
/** Days from a publish or a recertification to the next review. */
|
|
908
|
+
readonly reviewEveryDays: number;
|
|
909
|
+
}
|
|
910
|
+
|
|
226
911
|
/**
|
|
227
912
|
* List-view configuration for the consuming editor/template: which
|
|
228
913
|
* columns its list page shows and the default sort. Validated by
|
|
@@ -238,28 +923,510 @@ declare interface ListConfig {
|
|
|
238
923
|
};
|
|
239
924
|
}
|
|
240
925
|
|
|
926
|
+
/** Whether a (nested) list is numbered. */
|
|
927
|
+
export declare type ListKind = 'ordered' | 'unordered';
|
|
928
|
+
|
|
929
|
+
/** Whether the list's items at `depth` (0: the top) are numbered. */
|
|
930
|
+
export declare const listNumberedAt: (block: {
|
|
931
|
+
readonly ordered: boolean;
|
|
932
|
+
readonly sublists?: ReadonlyArray<ListKind>;
|
|
933
|
+
}, depth: number) => boolean;
|
|
934
|
+
|
|
935
|
+
/** One language's published page tree. */
|
|
936
|
+
export declare interface LocalizedTree {
|
|
937
|
+
readonly locale: string;
|
|
938
|
+
readonly tree: CmsTree;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/** What is wrong with a manifest; empty when nothing is. */
|
|
942
|
+
export declare const manifestProblems: (manifest: CmsExtensionManifest) => ReadonlyArray<string>;
|
|
943
|
+
|
|
944
|
+
/** Whether the request's signals meet the rule. */
|
|
945
|
+
export declare const matchesAudience: (rule: AudienceRule, signals: AudienceSignals) => boolean;
|
|
946
|
+
|
|
947
|
+
/** How a returned file's units line up with the source's: translated, left as source, unknown, and missing. */
|
|
948
|
+
export declare const matchUnits: (source: ReadonlyArray<TranslationUnit>, returned: ReadonlyArray<TranslationUnit>) => {
|
|
949
|
+
readonly translated: number;
|
|
950
|
+
readonly untranslated: number;
|
|
951
|
+
readonly unknown: ReadonlyArray<string>;
|
|
952
|
+
readonly missing: ReadonlyArray<string>;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
/** The deepest a list item may sit (0 is the top). */
|
|
956
|
+
export declare const MAX_LIST_LEVEL = 3;
|
|
957
|
+
|
|
958
|
+
export declare const MAX_OCCURRENCES = 100;
|
|
959
|
+
|
|
241
960
|
/** Cap a string field's length. Past `value` the editor renders a textarea. */
|
|
242
961
|
export declare const maxLength: (value: number) => FieldRefinement;
|
|
243
962
|
|
|
963
|
+
/** Adjacent text runs with the same marks become one; empty text runs go. */
|
|
964
|
+
export declare const mergeInline: (content: ReadonlyArray<RichInline>) => ReadonlyArray<RichInline>;
|
|
965
|
+
|
|
966
|
+
/** `list` with the entry at `from` moved to `to` (clamped); the same list when nothing moves. */
|
|
967
|
+
export declare const moveEntry: <T>(list: ReadonlyArray<T>, from: number, to: number) => ReadonlyArray<T>;
|
|
968
|
+
|
|
969
|
+
/** A fresh block id. */
|
|
970
|
+
export declare const newBlockId: () => string;
|
|
971
|
+
|
|
972
|
+
/** The capabilities `requested` asks for beyond `granted` — what needs a new consent. */
|
|
973
|
+
export declare const newCapabilities: (granted: ReadonlyArray<ExtensionCapability>, requested: ReadonlyArray<ExtensionCapability>) => ReadonlyArray<ExtensionCapability>;
|
|
974
|
+
|
|
975
|
+
/** A nonce for one editing session (unguessable; 128 bits). */
|
|
976
|
+
export declare const newVisualNonce: () => string;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* The canonical form of a stored value: a plain string becomes paragraphs (a
|
|
980
|
+
* blank line starts a new one), a document keeps its blocks and gets an id on
|
|
981
|
+
* every block that lacks one, anything else is returned as is for the
|
|
982
|
+
* validator to reject.
|
|
983
|
+
*/
|
|
984
|
+
export declare const normalizeRichDocument: (value: unknown) => unknown;
|
|
985
|
+
|
|
986
|
+
/** The vocabulary's terms for `input`, in first-seen order, and what it does not know. */
|
|
987
|
+
export declare const normalizeTerms: (config: Pick<TaxonomyConfig, "terms">, input: ReadonlyArray<unknown>) => {
|
|
988
|
+
readonly terms: ReadonlyArray<string>;
|
|
989
|
+
readonly unknown: ReadonlyArray<string>;
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
export declare interface Occurrence {
|
|
993
|
+
/** Its position in the series, from 0 (counting excepted ones). */
|
|
994
|
+
readonly index: number;
|
|
995
|
+
/** The local wall time it was meant for. */
|
|
996
|
+
readonly local: string;
|
|
997
|
+
readonly startsAt: Date;
|
|
998
|
+
readonly endsAt: Date;
|
|
999
|
+
/** `gap`: the wall time did not exist, moved after it; `fold`: it existed twice, the first; `clamped`: the month had no such day. */
|
|
1000
|
+
readonly adjusted?: 'gap' | 'fold' | 'clamped';
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/** The occurrences of a rule, in order; throws `RangeError` for a rule with problems. */
|
|
1004
|
+
export declare const occurrencesOf: (rule: RecurrenceRule) => ReadonlyArray<Occurrence>;
|
|
1005
|
+
|
|
1006
|
+
/** Where a document lives in one language. */
|
|
1007
|
+
export declare interface PageAlternate {
|
|
1008
|
+
readonly locale: string;
|
|
1009
|
+
readonly path: string;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/** One template a content type offers. */
|
|
1013
|
+
export declare interface PageTemplate {
|
|
1014
|
+
/** Stable id, stored on the document. */
|
|
1015
|
+
readonly id: string;
|
|
1016
|
+
readonly displayName: string;
|
|
1017
|
+
/** Field values a new document starts with (e.g. a layout). */
|
|
1018
|
+
readonly values?: Readonly<Record<string, unknown>>;
|
|
1019
|
+
/** The components a new document starts with, in order. */
|
|
1020
|
+
readonly sections?: ReadonlyArray<{
|
|
1021
|
+
readonly component: ComponentDefinition;
|
|
1022
|
+
readonly props?: Readonly<Record<string, unknown>>;
|
|
1023
|
+
}>;
|
|
1024
|
+
/** Components the document must always hold at least once. */
|
|
1025
|
+
readonly required?: ReadonlyArray<ComponentDefinition>;
|
|
1026
|
+
/** The component that must come first. */
|
|
1027
|
+
readonly first?: ComponentDefinition;
|
|
1028
|
+
/** The most of one component the document may hold. */
|
|
1029
|
+
readonly max?: ReadonlyArray<{
|
|
1030
|
+
readonly component: ComponentDefinition;
|
|
1031
|
+
readonly count: number;
|
|
1032
|
+
}>;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/** Parse the editor's inline markup into inline nodes. Unclosed markers stay text. */
|
|
1036
|
+
export declare const parseInlineMarkup: (input: string) => ReadonlyArray<RichInline>;
|
|
1037
|
+
|
|
1038
|
+
/** `sections.2` → `{ field: 'sections', index: 2 }`; `title` → `{ field: 'title' }`. */
|
|
1039
|
+
export declare const parseSourcePath: (path: string) => {
|
|
1040
|
+
readonly field: string;
|
|
1041
|
+
readonly index?: number;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
/** Read an XLIFF 2.x file with one `<file>`: languages, notes and each unit's source and target. */
|
|
1045
|
+
export declare const parseXliff: (xml: string) => XliffExchange;
|
|
1046
|
+
|
|
244
1047
|
/** Constrain a string field to a regex (source form, validated on save). */
|
|
245
1048
|
export declare const pattern: (re: RegExp) => FieldRefinement;
|
|
246
1049
|
|
|
1050
|
+
/** The first variant whose audience matches, or null for the original. Variants naming an unknown audience never match. */
|
|
1051
|
+
export declare const pickVariant: <V extends {
|
|
1052
|
+
readonly audience: string;
|
|
1053
|
+
}>(variants: ReadonlyArray<V>, audiences: ReadonlyArray<Audience>, signals: AudienceSignals) => V | null;
|
|
1054
|
+
|
|
247
1055
|
export declare interface PipeableField extends FieldSchema {
|
|
248
1056
|
readonly isOptional: boolean;
|
|
249
1057
|
pipe(...refinements: ReadonlyArray<FieldRefinement>): PipeableField;
|
|
250
1058
|
/** Mark the field optional → nullable column + non-required editor input. */
|
|
251
1059
|
optional(): PipeableField;
|
|
1060
|
+
/**
|
|
1061
|
+
* Let a draft be saved without it, and refuse to publish until it is set —
|
|
1062
|
+
* an image uploaded in bulk before anyone wrote its alt text. The column is
|
|
1063
|
+
* nullable, like `optional()`.
|
|
1064
|
+
*/
|
|
1065
|
+
requiredToPublish(): PipeableField;
|
|
252
1066
|
}
|
|
253
1067
|
|
|
1068
|
+
/** The document's text, one line per block — for excerpts and search. */
|
|
1069
|
+
export declare const plainTextOf: (doc: RichDocument) => string;
|
|
1070
|
+
|
|
1071
|
+
/** What the preview sends the editor. `path` is a field (`title`) or a component (`sections.2`). */
|
|
1072
|
+
export declare type PreviewMessage = {
|
|
1073
|
+
readonly protocol: typeof VISUAL_EDITING_PROTOCOL;
|
|
1074
|
+
readonly nonce: string;
|
|
1075
|
+
readonly kind: 'ready';
|
|
1076
|
+
} | {
|
|
1077
|
+
readonly protocol: typeof VISUAL_EDITING_PROTOCOL;
|
|
1078
|
+
readonly nonce: string;
|
|
1079
|
+
readonly kind: 'select';
|
|
1080
|
+
readonly path: string;
|
|
1081
|
+
} | {
|
|
1082
|
+
readonly protocol: typeof VISUAL_EDITING_PROTOCOL;
|
|
1083
|
+
readonly nonce: string;
|
|
1084
|
+
readonly kind: 'move';
|
|
1085
|
+
readonly path: string;
|
|
1086
|
+
readonly to: number;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
254
1089
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
|
|
258
|
-
|
|
1090
|
+
* Raised by `createPreviewShare` when the requested expiry is not in the
|
|
1091
|
+
* future or lies beyond the longest a preview link may live.
|
|
1092
|
+
*/
|
|
1093
|
+
export declare class PreviewShareRejected extends PreviewShareRejected_base {
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
declare const PreviewShareRejected_base: Schema_2.TaggedErrorClass<PreviewShareRejected, "PreviewShareRejected", {
|
|
1097
|
+
readonly _tag: Schema_2.tag<"PreviewShareRejected">;
|
|
1098
|
+
} & {
|
|
1099
|
+
reason: Schema_2.Literal<["expiryInPast", "expiryTooFar"]>;
|
|
1100
|
+
}>;
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* What stops these values from being published: every `requiredToPublish()`
|
|
1104
|
+
* field that is empty (absent, null, or a blank string). Browser-safe, so an
|
|
1105
|
+
* editor can say so before the publish is refused.
|
|
1106
|
+
*/
|
|
1107
|
+
export declare const publishViolations: (type: Pick<ContentType, "fields">, values: Readonly<Record<string, unknown>>) => ReadonlyArray<FieldViolation>;
|
|
1108
|
+
|
|
1109
|
+
/** The purposes the components of `type` need, for a banner to ask about. */
|
|
1110
|
+
export declare const purposesUsedBy: (type: {
|
|
1111
|
+
readonly fields: Readonly<Record<string, FieldSchema>>;
|
|
1112
|
+
}) => ReadonlySet<string>;
|
|
1113
|
+
|
|
1114
|
+
/** One quality check of a type — see `ContentTypeSpec.quality`. */
|
|
1115
|
+
declare interface QualityRule {
|
|
1116
|
+
/** Stable id (letters, digits, `.`, `-`), unique in the type — exceptions name it. */
|
|
1117
|
+
readonly id: string;
|
|
1118
|
+
/** The field that causes the finding and where it is repaired. */
|
|
1119
|
+
readonly field: string;
|
|
1120
|
+
/** What is wrong, in the editor's words. */
|
|
1121
|
+
readonly message: string;
|
|
1122
|
+
/** Whether publishing waits for a repair or an approved exception. Default true. */
|
|
1123
|
+
readonly blocking?: boolean;
|
|
1124
|
+
/** True when the values have the finding. Pure. */
|
|
1125
|
+
readonly check: (values: Readonly<Record<string, unknown>>) => boolean;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Raised when a create would take a tenant past a limit its app set — more
|
|
1130
|
+
* documents, keys or environments than it may hold. Nothing was written;
|
|
1131
|
+
* `used` is what the tenant holds now.
|
|
1132
|
+
*/
|
|
1133
|
+
export declare class QuotaExceeded extends QuotaExceeded_base {
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
declare const QuotaExceeded_base: Schema_2.TaggedErrorClass<QuotaExceeded, "QuotaExceeded", {
|
|
1137
|
+
readonly _tag: Schema_2.tag<"QuotaExceeded">;
|
|
1138
|
+
} & {
|
|
1139
|
+
quota: typeof Schema_2.String;
|
|
1140
|
+
limit: typeof Schema_2.Number;
|
|
1141
|
+
used: typeof Schema_2.Number;
|
|
1142
|
+
}>;
|
|
1143
|
+
|
|
1144
|
+
/** The editor's message, or null for anything else. */
|
|
1145
|
+
export declare const readEditorMessage: (event: VisualMessageEvent, session: VisualSession) => EditorMessage | null;
|
|
1146
|
+
|
|
1147
|
+
/** The preview's message, or null for anything else (another origin, another session, another shape). */
|
|
1148
|
+
export declare const readPreviewMessage: (event: VisualMessageEvent, session: VisualSession) => PreviewMessage | null;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Record a change: `before` is the form as it was. A change with the same key
|
|
1152
|
+
* within `mergeMs` of the last step continues it (typing is one step). The
|
|
1153
|
+
* redo branch goes; at most `limit` steps are kept.
|
|
1154
|
+
*/
|
|
1155
|
+
export declare const recordEdit: (history: EditHistory, before: Readonly<Record<string, unknown>>, edit: EditDescription, at: number, options?: {
|
|
1156
|
+
readonly mergeMs?: number;
|
|
1157
|
+
readonly limit?: number;
|
|
1158
|
+
}) => EditHistory;
|
|
1159
|
+
|
|
1160
|
+
export declare type RecurrenceEvery = 'day' | 'week' | 'month';
|
|
1161
|
+
|
|
1162
|
+
/** What is wrong with a rule, in words; empty when it can be scheduled. */
|
|
1163
|
+
export declare const recurrenceProblems: (rule: RecurrenceRule) => ReadonlyArray<string>;
|
|
1164
|
+
|
|
1165
|
+
export declare interface RecurrenceRule {
|
|
1166
|
+
/** The first occurrence, as a local wall time: `YYYY-MM-DDTHH:mm`. */
|
|
1167
|
+
readonly start: string;
|
|
1168
|
+
/** The IANA zone the wall time is in (`Europe/Berlin`). */
|
|
1169
|
+
readonly zone: string;
|
|
1170
|
+
readonly every: RecurrenceEvery;
|
|
1171
|
+
/** Every how many days / weeks / months (default 1). */
|
|
1172
|
+
readonly interval?: number;
|
|
1173
|
+
/** How many positions the series has (1–100); an excepted one is left out. */
|
|
1174
|
+
readonly count: number;
|
|
1175
|
+
/** How long each occurrence is live, in minutes; shorter than one step. */
|
|
1176
|
+
readonly durationMinutes: number;
|
|
1177
|
+
/** Local dates (`YYYY-MM-DD`) that are left out. */
|
|
1178
|
+
readonly except?: ReadonlyArray<string>;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/** Redo the step undone last; null when there is nothing to redo. */
|
|
1182
|
+
export declare const redoEdit: (history: EditHistory, current: Readonly<Record<string, unknown>>) => {
|
|
1183
|
+
readonly history: EditHistory;
|
|
1184
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
1185
|
+
readonly label: string;
|
|
1186
|
+
} | null;
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Raised when a revision references documents that may not be used — blocked
|
|
1190
|
+
* or past their availability — naming each and where it is referenced.
|
|
1191
|
+
*/
|
|
1192
|
+
export declare class ReferenceUnavailable extends ReferenceUnavailable_base {
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
declare const ReferenceUnavailable_base: Schema_2.TaggedErrorClass<ReferenceUnavailable, "ReferenceUnavailable", {
|
|
1196
|
+
readonly _tag: Schema_2.tag<"ReferenceUnavailable">;
|
|
1197
|
+
} & {
|
|
1198
|
+
contentType: typeof Schema_2.String;
|
|
1199
|
+
id: typeof Schema_2.String;
|
|
1200
|
+
targets: Schema_2.Array$<Schema_2.Struct<{
|
|
1201
|
+
path: typeof Schema_2.String;
|
|
1202
|
+
contentType: typeof Schema_2.String;
|
|
1203
|
+
documentId: typeof Schema_2.String;
|
|
1204
|
+
reason: Schema_2.Literal<["blocked", "expired"]>;
|
|
1205
|
+
}>>;
|
|
1206
|
+
}>;
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Raised when a release is asked to change in a state that does not allow it:
|
|
1210
|
+
* adding to or scheduling a release that is no longer a draft, publishing one
|
|
1211
|
+
* that is already published or failed, rolling back one that is not published.
|
|
1212
|
+
*/
|
|
1213
|
+
export declare class ReleaseNotEditable extends ReleaseNotEditable_base {
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
declare const ReleaseNotEditable_base: Schema_2.TaggedErrorClass<ReleaseNotEditable, "ReleaseNotEditable", {
|
|
1217
|
+
readonly _tag: Schema_2.tag<"ReleaseNotEditable">;
|
|
1218
|
+
} & {
|
|
1219
|
+
id: typeof Schema_2.String;
|
|
1220
|
+
status: typeof Schema_2.String;
|
|
1221
|
+
}>;
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Replace the text in `[start, end)` with `text` (a paste, a typed line
|
|
1225
|
+
* break). It takes the marks of the first character it replaces, or — where
|
|
1226
|
+
* nothing is selected — of the character before it.
|
|
1227
|
+
*/
|
|
1228
|
+
export declare const replaceText: (content: ReadonlyArray<RichInline>, start: number, end: number, text: string) => ReadonlyArray<RichInline>;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Raised when a revision of a content type that requires review is published
|
|
1232
|
+
* without an approval of exactly that revision.
|
|
1233
|
+
*/
|
|
1234
|
+
export declare class ReviewRequired extends ReviewRequired_base {
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
declare const ReviewRequired_base: Schema_2.TaggedErrorClass<ReviewRequired, "ReviewRequired", {
|
|
1238
|
+
readonly _tag: Schema_2.tag<"ReviewRequired">;
|
|
1239
|
+
} & {
|
|
1240
|
+
contentType: typeof Schema_2.String;
|
|
1241
|
+
id: typeof Schema_2.String;
|
|
1242
|
+
revisionId: typeof Schema_2.String;
|
|
1243
|
+
}>;
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Raised by the review steps when the step does not fit the variant's review:
|
|
1247
|
+
* nothing is in review, or the approver is the person who asked for it.
|
|
1248
|
+
*/
|
|
1249
|
+
export declare class ReviewStepRefused extends ReviewStepRefused_base {
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
declare const ReviewStepRefused_base: Schema_2.TaggedErrorClass<ReviewStepRefused, "ReviewStepRefused", {
|
|
1253
|
+
readonly _tag: Schema_2.tag<"ReviewStepRefused">;
|
|
1254
|
+
} & {
|
|
1255
|
+
contentType: typeof Schema_2.String;
|
|
1256
|
+
id: typeof Schema_2.String;
|
|
1257
|
+
reason: Schema_2.Literal<["notInReview", "selfApproval"]>;
|
|
1258
|
+
}>;
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Raised by `publish` when the caller pinned a revision (`{ revisionId }`)
|
|
1262
|
+
* and the draft has moved on to another one — publishing would release
|
|
1263
|
+
* content that was not the reviewed revision.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare class RevisionMismatch extends RevisionMismatch_base {
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
declare const RevisionMismatch_base: Schema_2.TaggedErrorClass<RevisionMismatch, "RevisionMismatch", {
|
|
1269
|
+
readonly _tag: Schema_2.tag<"RevisionMismatch">;
|
|
1270
|
+
} & {
|
|
1271
|
+
contentType: typeof Schema_2.String;
|
|
1272
|
+
id: typeof Schema_2.String;
|
|
1273
|
+
expected: typeof Schema_2.String;
|
|
1274
|
+
actual: typeof Schema_2.String;
|
|
1275
|
+
}>;
|
|
1276
|
+
|
|
1277
|
+
/** A top-level block. `id` is stable across edits, moves and translations. */
|
|
1278
|
+
export declare type RichBlock = {
|
|
1279
|
+
readonly id: string;
|
|
1280
|
+
readonly type: 'paragraph';
|
|
1281
|
+
readonly content: ReadonlyArray<RichInline>;
|
|
1282
|
+
} | {
|
|
1283
|
+
readonly id: string;
|
|
1284
|
+
readonly type: 'heading';
|
|
1285
|
+
readonly level: 2 | 3;
|
|
1286
|
+
readonly content: ReadonlyArray<RichInline>;
|
|
1287
|
+
} | {
|
|
1288
|
+
readonly id: string;
|
|
1289
|
+
readonly type: 'list';
|
|
1290
|
+
readonly ordered: boolean;
|
|
1291
|
+
readonly items: ReadonlyArray<ReadonlyArray<RichInline>>;
|
|
1292
|
+
/** How deep each item sits (0 at the top, at most `MAX_LIST_LEVEL`), one per item; absent: all at the top.
|
|
1293
|
+
* An item is at most one level deeper than the one before it. */
|
|
1294
|
+
readonly levels?: ReadonlyArray<number>;
|
|
1295
|
+
/** The kind of the lists nested in it, by depth — index 0 for the lists one level in. Absent (or
|
|
1296
|
+
* shorter than the depth): numbered like the list itself. At most `MAX_LIST_LEVEL` entries. */
|
|
1297
|
+
readonly sublists?: ReadonlyArray<ListKind>;
|
|
1298
|
+
} | {
|
|
1299
|
+
readonly id: string;
|
|
1300
|
+
readonly type: 'table';
|
|
1301
|
+
/** True when the first row holds the column headers. */
|
|
1302
|
+
readonly header: boolean;
|
|
1303
|
+
readonly rows: ReadonlyArray<ReadonlyArray<ReadonlyArray<RichInline>>>;
|
|
1304
|
+
}
|
|
1305
|
+
/** An image asset (by its documentId) with an optional caption. */
|
|
1306
|
+
| {
|
|
1307
|
+
readonly id: string;
|
|
1308
|
+
readonly type: 'image';
|
|
1309
|
+
readonly asset: string;
|
|
1310
|
+
readonly caption?: string;
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
/** A rich document. */
|
|
1314
|
+
export declare interface RichDocument {
|
|
1315
|
+
readonly type: 'doc';
|
|
1316
|
+
readonly blocks: ReadonlyArray<RichBlock>;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
export declare const RichDocumentEditor: (props: RichDocumentEditorProps) => ReactNode;
|
|
1320
|
+
|
|
1321
|
+
export declare interface RichDocumentEditorProps extends WidgetProps {
|
|
1322
|
+
readonly renderPicker?: RichDocumentPicker;
|
|
1323
|
+
/** Renders inside one block's group, after its actions — its comments, say.
|
|
1324
|
+
* `blockId` is the block's stable id (it survives moves and new revisions);
|
|
1325
|
+
* `label` names it as its legend does (`Paragraph 2`). */
|
|
1326
|
+
readonly renderBlockAside?: (blockId: string, label: string) => ReactNode;
|
|
1327
|
+
/** The words of the controls; English by default (see `ContentFormStrings`). */
|
|
1328
|
+
readonly strings?: ContentFormStringsInput;
|
|
1329
|
+
/**
|
|
1330
|
+
* How a paragraph's or a heading's text is edited: `markup` (default) is a
|
|
1331
|
+
* text area with the small inline syntax; `visual` edits it as it looks —
|
|
1332
|
+
* bold as bold, links as links — with Bold and Italic buttons. Lists and
|
|
1333
|
+
* tables keep their lines either way.
|
|
1334
|
+
*/
|
|
1335
|
+
readonly surface?: 'markup' | 'visual';
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/** Translate a Contentful rich-text document, and say what could not be translated. */
|
|
1339
|
+
export declare const richDocumentFromContentful: (root: ContentfulNode | null | undefined, options?: ContentfulImportOptions) => ContentfulImportResult;
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Translate HTML into a rich document, and say what could not be translated.
|
|
1343
|
+
* Links resolve through `resolveLink`; everything else is text or a finding.
|
|
1344
|
+
*/
|
|
1345
|
+
export declare const richDocumentFromHtml: (html: string, options?: HtmlImportOptions) => HtmlImportResult;
|
|
1346
|
+
|
|
1347
|
+
/** Renders a control that picks one document of `type`. */
|
|
1348
|
+
export declare type RichDocumentPicker = (props: {
|
|
1349
|
+
readonly id: string;
|
|
1350
|
+
readonly type: string;
|
|
1351
|
+
readonly value: string;
|
|
1352
|
+
readonly onChange: (documentId: string) => void;
|
|
1353
|
+
}) => ReactNode;
|
|
1354
|
+
|
|
1355
|
+
/** One problem with a rich document, at a path below the field. */
|
|
1356
|
+
export declare interface RichDocumentProblem {
|
|
1357
|
+
readonly path: string;
|
|
1358
|
+
readonly rule: string;
|
|
1359
|
+
readonly message: string;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
/** Everything wrong with `value` as a rich document under `options`. */
|
|
1363
|
+
export declare const richDocumentProblems: (path: string, value: unknown, options: RichTextOptions) => ReadonlyArray<RichDocumentProblem>;
|
|
1364
|
+
|
|
1365
|
+
/** A document reference found in a rich document. */
|
|
1366
|
+
export declare interface RichDocumentReference {
|
|
1367
|
+
readonly path: string;
|
|
1368
|
+
readonly targetType: string;
|
|
1369
|
+
readonly targetDocumentId: string;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
/** Every image and link reference in a (valid) document, with its path. */
|
|
1373
|
+
export declare const richDocumentReferences: (path: string, doc: RichDocument, options: RichTextOptions) => ReadonlyArray<RichDocumentReference>;
|
|
1374
|
+
|
|
1375
|
+
/** The document's blocks, in order. Renders nothing for a value that is not a rich document. */
|
|
1376
|
+
export declare const RichDocumentView: ({ document, hrefOf, renderImage }: RichDocumentViewProps) => ReactNode;
|
|
1377
|
+
|
|
1378
|
+
export declare interface RichDocumentViewProps {
|
|
1379
|
+
/** A stored `Schema.RichText()` value (a plain string renders as paragraphs). */
|
|
1380
|
+
readonly document: unknown;
|
|
1381
|
+
/** The address of a linked document, or undefined when it has none (not live). */
|
|
1382
|
+
readonly hrefOf?: (documentId: string) => string | undefined;
|
|
1383
|
+
/** Render an image block; without it, images are left out. */
|
|
1384
|
+
readonly renderImage?: (block: {
|
|
1385
|
+
readonly asset: string;
|
|
1386
|
+
readonly caption?: string;
|
|
1387
|
+
}) => ReactNode;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/** A run of text inside a block. */
|
|
1391
|
+
export declare type RichInline = {
|
|
1392
|
+
readonly type: 'text';
|
|
1393
|
+
readonly text: string;
|
|
1394
|
+
readonly marks?: ReadonlyArray<RichMark>;
|
|
1395
|
+
}
|
|
1396
|
+
/** A link to a document (by its documentId) — the site resolves its address. */
|
|
1397
|
+
| {
|
|
1398
|
+
readonly type: 'link';
|
|
1399
|
+
readonly target: string;
|
|
1400
|
+
readonly text: string;
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
/** An inline mark. */
|
|
1404
|
+
export declare type RichMark = 'bold' | 'italic' | 'underline';
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* Which resources a rich-text field may hold: `images` names the content type
|
|
1408
|
+
* an image block references (an asset type), `links` the type a link
|
|
1409
|
+
* references (a page type). Unset → that node is not allowed.
|
|
259
1410
|
*/
|
|
260
1411
|
export declare interface RichTextOptions {
|
|
261
|
-
readonly
|
|
262
|
-
readonly
|
|
1412
|
+
readonly images?: string;
|
|
1413
|
+
readonly links?: string;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
export declare const RichTextSurface: (props: RichTextSurfaceProps) => ReactNode;
|
|
1417
|
+
|
|
1418
|
+
export declare interface RichTextSurfaceProps {
|
|
1419
|
+
readonly id: string;
|
|
1420
|
+
/** The id of the element naming the text box (its label). */
|
|
1421
|
+
readonly labelledBy: string;
|
|
1422
|
+
readonly content: ReadonlyArray<RichInline>;
|
|
1423
|
+
readonly onChange: (content: ReadonlyArray<RichInline>) => void;
|
|
1424
|
+
/** The words of the mark buttons, and their accessible names. */
|
|
1425
|
+
readonly words: {
|
|
1426
|
+
readonly bold: string;
|
|
1427
|
+
readonly italic: string;
|
|
1428
|
+
readonly underline: string;
|
|
1429
|
+
};
|
|
263
1430
|
}
|
|
264
1431
|
|
|
265
1432
|
/**
|
|
@@ -272,7 +1439,10 @@ export declare const Schema: {
|
|
|
272
1439
|
/** Single-line text. `.pipe(maxLength(N>120))` switches it to a textarea. */
|
|
273
1440
|
readonly String: PipeableField;
|
|
274
1441
|
/** Numeric input. */
|
|
1442
|
+
/** A whole number (an integer column); a fraction is refused on save. */
|
|
275
1443
|
readonly Number: PipeableField;
|
|
1444
|
+
/** A number with a fractional part (a `real` column), e.g. a focal point's 0.25. */
|
|
1445
|
+
readonly Fraction: PipeableField;
|
|
276
1446
|
/** Toggle. */
|
|
277
1447
|
readonly Boolean: PipeableField;
|
|
278
1448
|
/** Date-only picker. */
|
|
@@ -285,10 +1455,12 @@ export declare const Schema: {
|
|
|
285
1455
|
/** Closed value set → `<select>` widget + a CHECK constraint. */
|
|
286
1456
|
readonly Literal: (values_0: string, ...values: string[]) => PipeableField;
|
|
287
1457
|
/**
|
|
288
|
-
* Rich text, stored as a
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
1458
|
+
* Rich text, stored as a `RichDocument` (see richDocument.ts): blocks with
|
|
1459
|
+
* stable ids — paragraph, heading, list, table, image — and inline text
|
|
1460
|
+
* with marks and links. `images` / `links` name the content types an image
|
|
1461
|
+
* block and a link reference; unset, that node is refused at save time. A
|
|
1462
|
+
* plain string is saved as paragraphs. The editor widget is
|
|
1463
|
+
* `RichDocumentEditor`.
|
|
292
1464
|
*/
|
|
293
1465
|
readonly RichText: (options?: RichTextOptions) => PipeableField;
|
|
294
1466
|
/**
|
|
@@ -305,11 +1477,184 @@ export declare const Schema: {
|
|
|
305
1477
|
readonly Array: (element: FieldSchema) => PipeableField;
|
|
306
1478
|
/** Nested object. Stored as a JSON document. */
|
|
307
1479
|
readonly Struct: (fields: Readonly<Record<string, FieldSchema>>) => PipeableField;
|
|
1480
|
+
/**
|
|
1481
|
+
* An ordered list of placed components (ADR-CMS-015), stored as a JSON array
|
|
1482
|
+
* of `ComponentInstance`. Only the listed definitions may be placed; each
|
|
1483
|
+
* instance's props are validated against its definition on save.
|
|
1484
|
+
*/
|
|
1485
|
+
readonly Components: (definitions: ReadonlyArray<ComponentDefinition>) => PipeableField;
|
|
308
1486
|
};
|
|
309
1487
|
|
|
310
|
-
/**
|
|
1488
|
+
/** What makes a type findable. */
|
|
1489
|
+
declare interface SearchConfig {
|
|
1490
|
+
/** The string field ranked first — usually the title. */
|
|
1491
|
+
readonly title: string;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
/** What is wrong with values for a manifest's settings; empty when nothing is. Unknown keys are refused. */
|
|
1495
|
+
export declare const settingsProblems: (manifest: CmsExtensionManifest, values: Readonly<Record<string, unknown>>) => ReadonlyArray<string>;
|
|
1496
|
+
|
|
1497
|
+
/** The settings with their defaults filled in, dropping keys the manifest no longer has. */
|
|
1498
|
+
export declare const settingsWithDefaults: (manifest: CmsExtensionManifest, stored: Readonly<Record<string, unknown>>) => Readonly<Record<string, ExtensionSettingValue>>;
|
|
1499
|
+
|
|
1500
|
+
export declare interface SitemapUrl extends PageAlternate {
|
|
1501
|
+
readonly documentId: string;
|
|
1502
|
+
/** ISO date of the variant's last change, when known. */
|
|
1503
|
+
readonly lastmod: string | null;
|
|
1504
|
+
/** The document in every language it has its own variant in, this one included. */
|
|
1505
|
+
readonly alternates: ReadonlyArray<PageAlternate>;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
/**
|
|
1509
|
+
* Every page the sitemap lists: each language's own variants (never a
|
|
1510
|
+
* fallback), those `include` accepts (leave out pages not for search
|
|
1511
|
+
* engines), with their alternates.
|
|
1512
|
+
*/
|
|
1513
|
+
export declare const sitemapUrls: (trees: ReadonlyArray<LocalizedTree>, include?: (node: TreeNode) => boolean) => ReadonlyArray<SitemapUrl>;
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* The sitemap document. `href(locale, path)` makes a page's absolute URL;
|
|
1517
|
+
* `xDefault` names the language an unmatched reader gets.
|
|
1518
|
+
*/
|
|
1519
|
+
export declare const sitemapXml: (urls: ReadonlyArray<SitemapUrl>, href: (locale: string, path: string) => string, xDefault?: string) => string;
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* The canonical slug helper: lowercase, letters with accents folded to their
|
|
1523
|
+
* base letter (umlauts spelled out, `ß` as `ss`), hyphenate, strip every
|
|
1524
|
+
* other non-url character.
|
|
1525
|
+
*/
|
|
311
1526
|
export declare const slugify: (value: unknown) => string;
|
|
312
1527
|
|
|
1528
|
+
/** Mark an element of the preview with the field path it renders. */
|
|
1529
|
+
export declare const sourceAttributes: (path: string) => {
|
|
1530
|
+
readonly "data-cms-source": string;
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1533
|
+
/** The field path behind a clicked element of the preview, or null. */
|
|
1534
|
+
export declare const sourcePathOf: (target: unknown) => string | null;
|
|
1535
|
+
|
|
1536
|
+
/** A type's taxonomy — see `ContentTypeSpec.taxonomy`. */
|
|
1537
|
+
export declare interface TaxonomyConfig {
|
|
1538
|
+
/** A declared `Schema.Array(Schema.String)` field. */
|
|
1539
|
+
readonly field: string;
|
|
1540
|
+
readonly terms: ReadonlyArray<VocabularyTerm>;
|
|
1541
|
+
/** A term outside the vocabulary: `refuse` (default) fails the save, `keep` keeps it as typed. */
|
|
1542
|
+
readonly unknown?: 'refuse' | 'keep';
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/** The value a save stores: the normalised terms, then the unknown ones (refused by validation unless kept). */
|
|
1546
|
+
export declare const taxonomyValue: (config: Pick<TaxonomyConfig, "terms">, input: ReadonlyArray<unknown>) => ReadonlyArray<string>;
|
|
1547
|
+
|
|
1548
|
+
/** The template a row names, if any (undefined for none, null for an unknown id). */
|
|
1549
|
+
export declare const templateOf: (type: Typed, row: Readonly<Record<string, unknown>>) => PageTemplate | null | undefined;
|
|
1550
|
+
|
|
1551
|
+
/** Declared on a content type as `templates`. */
|
|
1552
|
+
export declare interface TemplatesConfig {
|
|
1553
|
+
/** An optional string field that stores the template's id. */
|
|
1554
|
+
readonly field: string;
|
|
1555
|
+
/** The `Schema.Components` field the rules apply to. */
|
|
1556
|
+
readonly components: string;
|
|
1557
|
+
readonly list: ReadonlyArray<PageTemplate>;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* The values a new document built from `templateId` starts with: the
|
|
1562
|
+
* template's id, its preset values and its components (the save stamps each
|
|
1563
|
+
* component's instance id). Null for an unknown template.
|
|
1564
|
+
*/
|
|
1565
|
+
export declare const templateValues: (type: Typed, templateId: string) => Record<string, unknown> | null;
|
|
1566
|
+
|
|
1567
|
+
/** Where a row breaks the rules of the template it names. Empty when it keeps them. */
|
|
1568
|
+
export declare const templateViolations: (type: Typed, row: Readonly<Record<string, unknown>>) => ReadonlyArray<FieldViolation>;
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* Put `mark` on the text in `[start, end)`, or take it off when all of it
|
|
1572
|
+
* already carries it. Text runs are split at the edges; a link is left as it
|
|
1573
|
+
* is (a link carries no marks).
|
|
1574
|
+
*/
|
|
1575
|
+
export declare const toggleMark: (content: ReadonlyArray<RichInline>, start: number, end: number, mark: RichMark) => ReadonlyArray<RichInline>;
|
|
1576
|
+
|
|
1577
|
+
export declare interface ToolExposure {
|
|
1578
|
+
readonly tool: string;
|
|
1579
|
+
readonly state: 'on' | 'off' | 'locked';
|
|
1580
|
+
/** The step of the chain that decided it; null for the site's default. */
|
|
1581
|
+
readonly decidedAt: number | null;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/** An XLIFF 2.1 core document for one file. */
|
|
1585
|
+
export declare const toXliff: (exchange: XliffExchange) => string;
|
|
1586
|
+
|
|
1587
|
+
export declare interface TranslationUnit {
|
|
1588
|
+
/** Where the text lives: `title`, `body/<blockId>`, `body/<blockId>/<item>`,
|
|
1589
|
+
* `body/<blockId>/<row>.<cell>`, `body/<blockId>/caption`,
|
|
1590
|
+
* `sections/<instanceId>/<prop>`. */
|
|
1591
|
+
readonly id: string;
|
|
1592
|
+
readonly source: string;
|
|
1593
|
+
/** The translation, when there is one. */
|
|
1594
|
+
readonly target?: string;
|
|
1595
|
+
/** XLIFF segment state. */
|
|
1596
|
+
readonly state?: 'initial' | 'translated' | 'reviewed' | 'final';
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
/** The translatable text of a document's values, one unit per piece, in field order. Empty text is left out. */
|
|
1600
|
+
export declare const translationUnits: (fields: Readonly<Record<string, FieldSchema>>, values: Readonly<Record<string, unknown>>, prefix?: string) => ReadonlyArray<TranslationUnit>;
|
|
1601
|
+
|
|
1602
|
+
/** How a content type forms a tree. Validated by `defineContentType`. */
|
|
1603
|
+
export declare interface TreeConfig {
|
|
1604
|
+
/** An optional `Schema.Reference(<this type>)` field: the parent document. */
|
|
1605
|
+
readonly parent: string;
|
|
1606
|
+
/** An optional number field ordering siblings (ascending; unset sorts last). */
|
|
1607
|
+
readonly order?: string;
|
|
1608
|
+
/** The string field that is this node's path segment — usually the slug. */
|
|
1609
|
+
readonly segment: string;
|
|
1610
|
+
/**
|
|
1611
|
+
* Optional fields a page takes from the nearest ancestor that sets them
|
|
1612
|
+
* (a header, a footer): read with {@link inheritedValue}. `locked: true`
|
|
1613
|
+
* means no page may set it — only whatever the app supplies above the
|
|
1614
|
+
* tree (a site default).
|
|
1615
|
+
*/
|
|
1616
|
+
readonly inherit?: Readonly<Record<string, InheritRule>>;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
/** One published variant offered to {@link buildTree}. */
|
|
1620
|
+
export declare interface TreeEntry {
|
|
1621
|
+
readonly row: Row;
|
|
1622
|
+
readonly locale: string;
|
|
1623
|
+
readonly fallback: boolean;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/** One published document placed in the tree. */
|
|
1627
|
+
export declare interface TreeNode {
|
|
1628
|
+
readonly documentId: string;
|
|
1629
|
+
/** The parent's documentId; null at the root. */
|
|
1630
|
+
readonly parent: string | null;
|
|
1631
|
+
/** 0 at the root. */
|
|
1632
|
+
readonly depth: number;
|
|
1633
|
+
/** The segments from the root down to this node. */
|
|
1634
|
+
readonly segments: ReadonlyArray<string>;
|
|
1635
|
+
/** `segments` joined with `/`. */
|
|
1636
|
+
readonly path: string;
|
|
1637
|
+
/** The published variant that answers for this document. */
|
|
1638
|
+
readonly row: Row;
|
|
1639
|
+
/** The locale of `row`. */
|
|
1640
|
+
readonly locale: string;
|
|
1641
|
+
/** True when `row` is a fallback locale's variant. */
|
|
1642
|
+
readonly fallback: boolean;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
declare type Typed = {
|
|
1646
|
+
readonly name: string;
|
|
1647
|
+
readonly fields: Readonly<Record<string, FieldSchema>>;
|
|
1648
|
+
readonly templates?: TemplatesConfig;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
/** Undo the last step: the form to show, and the history after it; null when there is nothing to undo. */
|
|
1652
|
+
export declare const undoEdit: (history: EditHistory, current: Readonly<Record<string, unknown>>) => {
|
|
1653
|
+
readonly history: EditHistory;
|
|
1654
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
1655
|
+
readonly label: string;
|
|
1656
|
+
} | null;
|
|
1657
|
+
|
|
313
1658
|
/**
|
|
314
1659
|
* Mark a string field unique PER TENANT. The derived `<type>_drafts` +
|
|
315
1660
|
* `<type>_published` tables get a real composite `(tenantId, <field>)`
|
|
@@ -320,13 +1665,51 @@ export declare const slugify: (value: unknown) => string;
|
|
|
320
1665
|
*/
|
|
321
1666
|
export declare const unique: () => FieldRefinement;
|
|
322
1667
|
|
|
1668
|
+
/** A stable fingerprint of the units' ids and source text — the import checks the source has not changed since. */
|
|
1669
|
+
export declare const unitsHash: (units: ReadonlyArray<TranslationUnit>) => string;
|
|
1670
|
+
|
|
323
1671
|
/**
|
|
324
1672
|
* Validate a row against a content type's save-time rules. Throws
|
|
325
1673
|
* `ContentValidationFailed` carrying EVERY violation (per-field detail)
|
|
326
1674
|
* when any rule breaks; returns nothing on success. The throwing face of
|
|
327
1675
|
* `contentViolations` — `saveDraft` calls this after derivation.
|
|
328
1676
|
*/
|
|
329
|
-
export declare const validateContent: (type: Pick<ContentType, "name" | "fields"
|
|
1677
|
+
export declare const validateContent: (type: Pick<ContentType, "name" | "fields"> & Partial<Pick<ContentType, "taxonomy">>, row: Readonly<Record<string, unknown>>) => void;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* A field's value as the text a person compares: a rich document's text (one
|
|
1681
|
+
* line per block), a component list one line per component with its text
|
|
1682
|
+
* props, a date as its ISO time, anything else structured as compact JSON.
|
|
1683
|
+
*/
|
|
1684
|
+
export declare const valueText: (value: unknown) => string;
|
|
1685
|
+
|
|
1686
|
+
export declare const VISUAL_EDITING_PROTOCOL = "voltro.cms.visual/1";
|
|
1687
|
+
|
|
1688
|
+
/** A message for the other side of `session`. */
|
|
1689
|
+
export declare const visualMessage: <M extends {
|
|
1690
|
+
readonly kind: string;
|
|
1691
|
+
}>(session: VisualSession, message: M) => M & {
|
|
1692
|
+
protocol: typeof VISUAL_EDITING_PROTOCOL;
|
|
1693
|
+
nonce: string;
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1696
|
+
/** A message event as far as these checks read it. */
|
|
1697
|
+
export declare interface VisualMessageEvent {
|
|
1698
|
+
readonly origin: string;
|
|
1699
|
+
readonly data: unknown;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/** Who may talk: the one origin, with the nonce of this session. */
|
|
1703
|
+
export declare interface VisualSession {
|
|
1704
|
+
readonly origin: string;
|
|
1705
|
+
readonly nonce: string;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
/** One term and the spellings that mean it. */
|
|
1709
|
+
export declare interface VocabularyTerm {
|
|
1710
|
+
readonly term: string;
|
|
1711
|
+
readonly synonyms?: ReadonlyArray<string>;
|
|
1712
|
+
}
|
|
330
1713
|
|
|
331
1714
|
export declare type Widget = (props: WidgetProps) => ReactNode;
|
|
332
1715
|
|
|
@@ -335,10 +1718,48 @@ export declare const widgetFor: (hint: EditorHint, overrides?: Partial<Record<Ed
|
|
|
335
1718
|
|
|
336
1719
|
/** Props for a single field widget. */
|
|
337
1720
|
export declare interface WidgetProps {
|
|
1721
|
+
/** The control's element id — the field's `<label>` points at it, so a
|
|
1722
|
+
* widget that renders its own control must put it on that control. */
|
|
1723
|
+
readonly id: string;
|
|
338
1724
|
readonly name: string;
|
|
339
1725
|
readonly field: FieldSchema;
|
|
340
1726
|
readonly value: unknown;
|
|
341
1727
|
readonly onChange: (value: unknown) => void;
|
|
342
1728
|
}
|
|
343
1729
|
|
|
1730
|
+
/** A component withheld for want of consent: which purpose would release it. */
|
|
1731
|
+
export declare interface WithheldInstance {
|
|
1732
|
+
readonly instanceId: string;
|
|
1733
|
+
readonly componentId: string;
|
|
1734
|
+
readonly consentRequired: string;
|
|
1735
|
+
readonly props: Readonly<Record<string, never>>;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
export declare interface XliffExchange {
|
|
1739
|
+
readonly srcLang: string;
|
|
1740
|
+
readonly trgLang: string;
|
|
1741
|
+
/** The `<file id>` — which document and revision this is. */
|
|
1742
|
+
readonly fileId: string;
|
|
1743
|
+
/** `<note category>` → text: what the importer checks (source hash, type, revision). */
|
|
1744
|
+
readonly notes: Readonly<Record<string, string>>;
|
|
1745
|
+
readonly units: ReadonlyArray<TranslationUnit>;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/** An XLIFF file that cannot be read, or would be unsafe to. */
|
|
1749
|
+
export declare class XliffInvalid extends Error {
|
|
1750
|
+
readonly reason: string;
|
|
1751
|
+
readonly _tag = "XliffInvalid";
|
|
1752
|
+
constructor(reason: string);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* The instant a local wall time means in `zone`. A wall time in a gap moves
|
|
1757
|
+
* to the first moment after it (`gap`); one in a fold takes the earlier of
|
|
1758
|
+
* its two instants (`fold`).
|
|
1759
|
+
*/
|
|
1760
|
+
export declare const zonedInstant: (local: string, zone: string) => {
|
|
1761
|
+
readonly instant: Date;
|
|
1762
|
+
readonly adjusted?: "gap" | "fold";
|
|
1763
|
+
};
|
|
1764
|
+
|
|
344
1765
|
export { }
|