@oblax/cms 0.0.0-stage → 2.1.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/dist/cms-module.d.ts +57 -0
- package/dist/cms-module.d.ts.map +1 -0
- package/dist/cms-module.js +56 -0
- package/dist/cms-module.js.map +1 -0
- package/dist/content-types.d.ts +36 -0
- package/dist/content-types.d.ts.map +1 -0
- package/dist/content-types.js +69 -0
- package/dist/content-types.js.map +1 -0
- package/dist/entries.d.ts +84 -0
- package/dist/entries.d.ts.map +1 -0
- package/dist/entries.js +170 -0
- package/dist/entries.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/navigations.d.ts +49 -0
- package/dist/navigations.d.ts.map +1 -0
- package/dist/navigations.js +79 -0
- package/dist/navigations.js.map +1 -0
- package/dist/public.d.ts +57 -0
- package/dist/public.d.ts.map +1 -0
- package/dist/public.js +106 -0
- package/dist/public.js.map +1 -0
- package/dist/redirects.d.ts +31 -0
- package/dist/redirects.d.ts.map +1 -0
- package/dist/redirects.js +51 -0
- package/dist/redirects.js.map +1 -0
- package/dist/references.d.ts +18 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +20 -0
- package/dist/references.js.map +1 -0
- package/dist/sections.d.ts +32 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.js +51 -0
- package/dist/sections.js.map +1 -0
- package/dist/settings.d.ts +22 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +28 -0
- package/dist/settings.js.map +1 -0
- package/dist/terms.d.ts +40 -0
- package/dist/terms.d.ts.map +1 -0
- package/dist/terms.js +74 -0
- package/dist/terms.js.map +1 -0
- package/dist/types.d.ts +789 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vocabularies.d.ts +32 -0
- package/dist/vocabularies.d.ts.map +1 -0
- package/dist/vocabularies.js +45 -0
- package/dist/vocabularies.js.map +1 -0
- package/package.json +48 -3
- package/README.md +0 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import type { FilterOp, ListFilter, ListQuery } from '@oblax/core';
|
|
2
|
+
export type { FilterOp, ListFilter, ListQuery };
|
|
3
|
+
export interface CmsConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Base URL that file paths in public reads are made absolute against, e.g.
|
|
6
|
+
* your CDN: `https://cdn.example.com`. Sent as the `X-Oblax-Files-Base`
|
|
7
|
+
* header on every `cms.public` call. Left out, file paths stay relative.
|
|
8
|
+
*/
|
|
9
|
+
filesBase?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Fields every stored CMS record carries. Timestamps are RFC 3339 strings. */
|
|
12
|
+
export interface CmsRecord {
|
|
13
|
+
id: string;
|
|
14
|
+
_created?: string;
|
|
15
|
+
_modified?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A list response: the items and how many there are (in total, for paged lists). */
|
|
18
|
+
export interface CmsList<T> {
|
|
19
|
+
data: T[];
|
|
20
|
+
count: number;
|
|
21
|
+
}
|
|
22
|
+
/** One page of a list read by cursor. Pass `next` as `after` for the next page; it's absent on the last page. */
|
|
23
|
+
export interface CmsCursorList<T> {
|
|
24
|
+
data: T[];
|
|
25
|
+
next?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Text by locale: `{ en: 'Blog', de: 'Blog' }`. */
|
|
28
|
+
export type Localized = Record<string, string>;
|
|
29
|
+
/** Free-form JSON document (custom fields). */
|
|
30
|
+
export type JsonObject = Record<string, unknown>;
|
|
31
|
+
/** A custom-field rule (content type fields, navigation item fields, term fields). */
|
|
32
|
+
export interface FieldRule {
|
|
33
|
+
/** The value's place in the document, e.g. `ingredients.$.name`. */
|
|
34
|
+
path: string;
|
|
35
|
+
type: 'string' | 'text' | 'int' | 'number' | 'bool' | 'date' | 'datetime' | 'duration' | 'list' | 'map' | 'object' | 'ref';
|
|
36
|
+
required?: boolean;
|
|
37
|
+
nullable?: boolean;
|
|
38
|
+
/** Validator tags, e.g. `min=1,max=50`. */
|
|
39
|
+
rules?: string;
|
|
40
|
+
/** What a `ref` points at: `file`, `cms.entry`, `cms.term:<vocabulary>`. */
|
|
41
|
+
target?: string;
|
|
42
|
+
}
|
|
43
|
+
export type ContentTypeKind = 'page' | 'article' | 'item' | 'single';
|
|
44
|
+
/** How a vocabulary is used by a content type's entries. */
|
|
45
|
+
export interface VocabularyUsage {
|
|
46
|
+
/** Entries need a term of the vocabulary to be submitted or published. */
|
|
47
|
+
required?: boolean;
|
|
48
|
+
/** How many terms an entry takes; `max: 0` is no limit, `1` a single choice. */
|
|
49
|
+
min?: number;
|
|
50
|
+
max?: number;
|
|
51
|
+
/** Copy the terms to every translation. On unless `false`. */
|
|
52
|
+
shared?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface ContentType extends CmsRecord {
|
|
55
|
+
code: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
kind: ContentTypeKind;
|
|
59
|
+
/** The built-in `page` and `article` types can't be deleted. */
|
|
60
|
+
builtin: boolean;
|
|
61
|
+
body: 'off' | 'optional' | 'required';
|
|
62
|
+
body_formats: string[];
|
|
63
|
+
fields: FieldRule[];
|
|
64
|
+
/** Top-level fields copied to every translation on save. */
|
|
65
|
+
shared_paths: string[];
|
|
66
|
+
/** Section ids an article type's entries may be in; empty allows every section. */
|
|
67
|
+
sections: string[];
|
|
68
|
+
/** Vocabulary settings by vocabulary code. */
|
|
69
|
+
vocabularies: Record<string, VocabularyUsage>;
|
|
70
|
+
review: 'off' | 'required';
|
|
71
|
+
/** Who approves when review is required: users with `approver_roles`, or callers outside REST (flux, workflows). */
|
|
72
|
+
approval: 'roles' | 'outside';
|
|
73
|
+
approver_roles: string[];
|
|
74
|
+
allow_self_approval: boolean;
|
|
75
|
+
review_bypass_roles: string[];
|
|
76
|
+
}
|
|
77
|
+
export interface ContentTypeInput {
|
|
78
|
+
name?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
body?: ContentType['body'];
|
|
81
|
+
bodyFormats?: string[];
|
|
82
|
+
fields?: FieldRule[];
|
|
83
|
+
sharedPaths?: string[];
|
|
84
|
+
sections?: string[];
|
|
85
|
+
vocabularies?: Record<string, VocabularyUsage>;
|
|
86
|
+
review?: ContentType['review'];
|
|
87
|
+
approval?: ContentType['approval'];
|
|
88
|
+
approverRoles?: string[];
|
|
89
|
+
allowSelfApproval?: boolean;
|
|
90
|
+
reviewBypassRoles?: string[];
|
|
91
|
+
}
|
|
92
|
+
export interface CreateContentTypeParams extends ContentTypeInput {
|
|
93
|
+
/** How the API names the type. Can't change once created. */
|
|
94
|
+
code: string;
|
|
95
|
+
name: string;
|
|
96
|
+
/** Can't change once created. */
|
|
97
|
+
kind: ContentTypeKind;
|
|
98
|
+
}
|
|
99
|
+
/** Settings left out keep their values. */
|
|
100
|
+
export interface UpdateContentTypeParams extends ContentTypeInput {
|
|
101
|
+
code: string;
|
|
102
|
+
}
|
|
103
|
+
export interface CodeParams {
|
|
104
|
+
code: string;
|
|
105
|
+
}
|
|
106
|
+
/** What `types.reindex()` queued. */
|
|
107
|
+
export interface QueuedJob {
|
|
108
|
+
job: 'reindex' | string;
|
|
109
|
+
/** The content type's code. */
|
|
110
|
+
type: string;
|
|
111
|
+
}
|
|
112
|
+
export type SectionSort = 'newest' | 'oldest' | 'title';
|
|
113
|
+
export interface Section extends CmsRecord {
|
|
114
|
+
code: string;
|
|
115
|
+
name: Localized;
|
|
116
|
+
/** By locale: `{ en: '/blog', de: '/blogg' }`. */
|
|
117
|
+
base_paths: Localized;
|
|
118
|
+
/** Article path after the base path, from `{slug}`, `{yyyy}`, `{mm}`, `{dd}`, `{id}`: e.g. `{yyyy}/{slug}`. */
|
|
119
|
+
pattern: string;
|
|
120
|
+
default_sort: SectionSort;
|
|
121
|
+
page_size: number;
|
|
122
|
+
}
|
|
123
|
+
export interface SectionInput {
|
|
124
|
+
name?: Localized;
|
|
125
|
+
basePaths?: Localized;
|
|
126
|
+
pattern?: string;
|
|
127
|
+
defaultSort?: SectionSort;
|
|
128
|
+
pageSize?: number;
|
|
129
|
+
}
|
|
130
|
+
export interface CreateSectionParams extends SectionInput {
|
|
131
|
+
code: string;
|
|
132
|
+
}
|
|
133
|
+
/** Names and base paths given replace the old ones whole; other settings left out keep their values. */
|
|
134
|
+
export interface UpdateSectionParams extends SectionInput {
|
|
135
|
+
code: string;
|
|
136
|
+
}
|
|
137
|
+
export interface CmsSettings {
|
|
138
|
+
/** Entry id of each locale's home page. */
|
|
139
|
+
home_pages: Localized;
|
|
140
|
+
/** Paths the frontends own (`/api`, `/account`); content can't use them or paths under them. */
|
|
141
|
+
reserved_paths: string[];
|
|
142
|
+
_modified?: string;
|
|
143
|
+
}
|
|
144
|
+
/** Replaces the settings whole. */
|
|
145
|
+
export interface UpdateSettingsParams {
|
|
146
|
+
homePages: Localized;
|
|
147
|
+
reservedPaths: string[];
|
|
148
|
+
}
|
|
149
|
+
export type EntryStatus = 'draft' | 'published' | 'changed' | 'unpublished';
|
|
150
|
+
export type EntryReviewState = 'none' | 'pending' | 'rejected';
|
|
151
|
+
export interface EntrySeo {
|
|
152
|
+
title?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
canonical?: string;
|
|
155
|
+
image_file_id?: string;
|
|
156
|
+
noindex?: boolean;
|
|
157
|
+
}
|
|
158
|
+
/** The CMS's copy of a file, as entries show it. */
|
|
159
|
+
export interface CmsFile extends CmsRecord {
|
|
160
|
+
path: string;
|
|
161
|
+
type: string;
|
|
162
|
+
width: number;
|
|
163
|
+
height: number;
|
|
164
|
+
alt?: Localized;
|
|
165
|
+
caption?: Localized;
|
|
166
|
+
credit?: string;
|
|
167
|
+
focal_x?: number;
|
|
168
|
+
focal_y?: number;
|
|
169
|
+
public: boolean;
|
|
170
|
+
}
|
|
171
|
+
/** The CMS's copy of an identity person, as entries show it. */
|
|
172
|
+
export interface CmsAuthor extends CmsRecord {
|
|
173
|
+
first_name: string;
|
|
174
|
+
last_name: string;
|
|
175
|
+
avatar?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Term ids by vocabulary code, the first being the primary term. On save, an
|
|
179
|
+
* open vocabulary also takes `{ name: 'kubernetes' }`, which creates the term.
|
|
180
|
+
*/
|
|
181
|
+
export type EntryTerms = Record<string, Array<string | {
|
|
182
|
+
name: string;
|
|
183
|
+
}>>;
|
|
184
|
+
/** The editable content of an entry. */
|
|
185
|
+
export interface EntryContent {
|
|
186
|
+
title: string;
|
|
187
|
+
excerpt: string;
|
|
188
|
+
body: string;
|
|
189
|
+
body_format: string;
|
|
190
|
+
/** Custom fields, checked against the type's rules. */
|
|
191
|
+
fields: JsonObject | null;
|
|
192
|
+
cover_file_id: string;
|
|
193
|
+
seo: EntrySeo;
|
|
194
|
+
/** Identity person ids, in the order readers see them. */
|
|
195
|
+
author_ids: string[];
|
|
196
|
+
terms?: Record<string, string[]>;
|
|
197
|
+
}
|
|
198
|
+
/** An entry's working copy, with the state of its live copy. */
|
|
199
|
+
export interface Entry extends CmsRecord, EntryContent {
|
|
200
|
+
type_id: string;
|
|
201
|
+
/** The type's code. */
|
|
202
|
+
type: string;
|
|
203
|
+
locale: string;
|
|
204
|
+
translation_group_id: string;
|
|
205
|
+
section_id: string;
|
|
206
|
+
parent_id: string;
|
|
207
|
+
depth: number;
|
|
208
|
+
slug: string;
|
|
209
|
+
path: string;
|
|
210
|
+
published_at: string | null;
|
|
211
|
+
updated_at: string | null;
|
|
212
|
+
content_hash: string;
|
|
213
|
+
review: EntryReviewState;
|
|
214
|
+
review_revision_id: string;
|
|
215
|
+
scheduled_revision_id: string;
|
|
216
|
+
publish_at: string | null;
|
|
217
|
+
unpublish_at: string | null;
|
|
218
|
+
schedule_errors: unknown;
|
|
219
|
+
review_publish_at: string | null;
|
|
220
|
+
/** The working copy was edited after it was scheduled. */
|
|
221
|
+
schedule_changed: boolean;
|
|
222
|
+
cover?: CmsFile;
|
|
223
|
+
authors: CmsAuthor[];
|
|
224
|
+
status: EntryStatus;
|
|
225
|
+
live_path?: string;
|
|
226
|
+
body_html?: string;
|
|
227
|
+
revision_id?: string;
|
|
228
|
+
}
|
|
229
|
+
/** Entry content and placement, as sent on create and update. */
|
|
230
|
+
export interface EntryInput {
|
|
231
|
+
title?: string;
|
|
232
|
+
excerpt?: string;
|
|
233
|
+
body?: string;
|
|
234
|
+
bodyFormat?: string;
|
|
235
|
+
fields?: JsonObject;
|
|
236
|
+
coverFileId?: string;
|
|
237
|
+
seo?: EntrySeo;
|
|
238
|
+
authorIds?: string[];
|
|
239
|
+
terms?: EntryTerms;
|
|
240
|
+
sectionId?: string;
|
|
241
|
+
parentId?: string;
|
|
242
|
+
slug?: string;
|
|
243
|
+
/** First publish date; can be set by hand for imports. */
|
|
244
|
+
publishedAt?: string;
|
|
245
|
+
}
|
|
246
|
+
export interface CreateEntryParams extends EntryInput {
|
|
247
|
+
/** The content type's code. */
|
|
248
|
+
type: string;
|
|
249
|
+
/** Defaults to the project's language. */
|
|
250
|
+
locale?: string;
|
|
251
|
+
title: string;
|
|
252
|
+
/** Submit for review right away. A failed submit leaves the entry created. */
|
|
253
|
+
submit?: boolean;
|
|
254
|
+
/** Review note, with `submit`. */
|
|
255
|
+
note?: string;
|
|
256
|
+
/** Proposed publish date, with `submit`. */
|
|
257
|
+
publishAt?: string;
|
|
258
|
+
}
|
|
259
|
+
/** Content left out keeps its values. */
|
|
260
|
+
export interface UpdateEntryParams extends EntryInput {
|
|
261
|
+
id: string;
|
|
262
|
+
/** The `_modified` the editor loaded; a newer stored one fails with 409. */
|
|
263
|
+
modified: string;
|
|
264
|
+
/** Write an autosave revision (only the newest 50 are kept). */
|
|
265
|
+
autosave?: boolean;
|
|
266
|
+
/** Revision note, up to 1000 characters. */
|
|
267
|
+
note?: string;
|
|
268
|
+
}
|
|
269
|
+
export interface ListEntriesParams extends ListQuery {
|
|
270
|
+
}
|
|
271
|
+
export interface EntryIdParams {
|
|
272
|
+
id: string;
|
|
273
|
+
}
|
|
274
|
+
export interface DeleteEntryParams {
|
|
275
|
+
id: string;
|
|
276
|
+
/** The live path answers 410 Gone instead of 404. */
|
|
277
|
+
gone?: boolean;
|
|
278
|
+
}
|
|
279
|
+
/** A navigation item that links to a record. */
|
|
280
|
+
export interface NavigationUse {
|
|
281
|
+
navigation_id: string;
|
|
282
|
+
code: string;
|
|
283
|
+
name: string;
|
|
284
|
+
item_id: string;
|
|
285
|
+
via: 'direct' | 'children' | 'latest';
|
|
286
|
+
}
|
|
287
|
+
/** An entry copy that points at a record. */
|
|
288
|
+
export interface ReferenceUse {
|
|
289
|
+
entry_id: string;
|
|
290
|
+
/** The entry's type code. */
|
|
291
|
+
type: string;
|
|
292
|
+
locale: string;
|
|
293
|
+
title: string;
|
|
294
|
+
/** `true` for the live copy, `false` for the working copy. */
|
|
295
|
+
live: boolean;
|
|
296
|
+
/** `body`, `cover_file_id`, `seo.image_file_id`, `author_ids` or `fields.<path>`. */
|
|
297
|
+
place: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* What deleting an entry reports when other content links to it. Readers no
|
|
301
|
+
* longer see those navigation items; those entries fail their next save
|
|
302
|
+
* until the link goes.
|
|
303
|
+
*/
|
|
304
|
+
export interface DeleteEntryResult {
|
|
305
|
+
linked_from: NavigationUse[];
|
|
306
|
+
referenced_by: ReferenceUse[];
|
|
307
|
+
}
|
|
308
|
+
export interface UnpublishEntryParams {
|
|
309
|
+
id: string;
|
|
310
|
+
/** The live path answers 410 Gone instead of 404. */
|
|
311
|
+
gone?: boolean;
|
|
312
|
+
}
|
|
313
|
+
export interface TranslateEntryParams {
|
|
314
|
+
id: string;
|
|
315
|
+
locale: string;
|
|
316
|
+
/** Defaults to the source entry's title. */
|
|
317
|
+
title?: string;
|
|
318
|
+
}
|
|
319
|
+
export interface RestoreEntryParams {
|
|
320
|
+
id: string;
|
|
321
|
+
revisionId: string;
|
|
322
|
+
/** The `_modified` the editor loaded. */
|
|
323
|
+
modified: string;
|
|
324
|
+
}
|
|
325
|
+
export interface PreviewToken {
|
|
326
|
+
/** Pass as `preview` to `cms.public` reads. Valid for 30 minutes. */
|
|
327
|
+
token: string;
|
|
328
|
+
entry_id: string;
|
|
329
|
+
created_by?: string;
|
|
330
|
+
expires_at: string;
|
|
331
|
+
}
|
|
332
|
+
/** Either date may be left out, not both. Replaces the last schedule. */
|
|
333
|
+
export interface ScheduleEntryParams {
|
|
334
|
+
id: string;
|
|
335
|
+
publishAt?: string;
|
|
336
|
+
unpublishAt?: string;
|
|
337
|
+
}
|
|
338
|
+
export interface SubmitEntryParams {
|
|
339
|
+
id: string;
|
|
340
|
+
note?: string;
|
|
341
|
+
publishAt?: string;
|
|
342
|
+
}
|
|
343
|
+
export interface ApproveEntryParams {
|
|
344
|
+
id: string;
|
|
345
|
+
/** The revision the reviewer looked at. */
|
|
346
|
+
revisionId: string;
|
|
347
|
+
note?: string;
|
|
348
|
+
/** Defaults to the date the author proposed. */
|
|
349
|
+
publishAt?: string;
|
|
350
|
+
}
|
|
351
|
+
export interface RejectEntryParams {
|
|
352
|
+
id: string;
|
|
353
|
+
revisionId: string;
|
|
354
|
+
note?: string;
|
|
355
|
+
}
|
|
356
|
+
export type RevisionKind = 'autosave' | 'manual' | 'submitted' | 'scheduled' | 'published';
|
|
357
|
+
export interface Revision extends CmsRecord {
|
|
358
|
+
entry_id: string;
|
|
359
|
+
kind: RevisionKind;
|
|
360
|
+
/** The entry's content as saved; left out of lists. */
|
|
361
|
+
content?: EntryContent;
|
|
362
|
+
author_id: string;
|
|
363
|
+
note: string;
|
|
364
|
+
}
|
|
365
|
+
export interface ListRevisionsParams {
|
|
366
|
+
/** The entry's id. */
|
|
367
|
+
id: string;
|
|
368
|
+
limit?: number;
|
|
369
|
+
/** Revision id to page from (newest first). */
|
|
370
|
+
before?: string;
|
|
371
|
+
}
|
|
372
|
+
export interface RevisionIdParams {
|
|
373
|
+
/** The entry's id. */
|
|
374
|
+
id: string;
|
|
375
|
+
revisionId: string;
|
|
376
|
+
}
|
|
377
|
+
export interface ListReferencesParams {
|
|
378
|
+
kind: 'file' | 'entry' | 'term' | 'author';
|
|
379
|
+
/** The record's id. */
|
|
380
|
+
id: string;
|
|
381
|
+
}
|
|
382
|
+
export type RedirectTarget = 'path' | 'entry' | 'url' | 'term';
|
|
383
|
+
export interface Redirect extends CmsRecord {
|
|
384
|
+
/** Empty for every locale. */
|
|
385
|
+
locale: string;
|
|
386
|
+
from: string;
|
|
387
|
+
to_kind: RedirectTarget;
|
|
388
|
+
/** A path, a record id or a URL, by `to_kind`. */
|
|
389
|
+
to: string;
|
|
390
|
+
/** HTTP status, e.g. 301 or 302. */
|
|
391
|
+
status: number;
|
|
392
|
+
source: 'auto' | 'manual';
|
|
393
|
+
note: string;
|
|
394
|
+
}
|
|
395
|
+
export interface RedirectInput {
|
|
396
|
+
/** Empty or left out for every locale. */
|
|
397
|
+
locale?: string;
|
|
398
|
+
from: string;
|
|
399
|
+
toKind: RedirectTarget;
|
|
400
|
+
to: string;
|
|
401
|
+
status?: number;
|
|
402
|
+
note?: string;
|
|
403
|
+
}
|
|
404
|
+
export interface CreateRedirectParams extends RedirectInput {
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Replaces the redirect whole, so every field is required: one left out
|
|
408
|
+
* would be reset (status to 301, locale to every locale, note cleared).
|
|
409
|
+
*/
|
|
410
|
+
export interface UpdateRedirectParams extends Required<RedirectInput> {
|
|
411
|
+
id: string;
|
|
412
|
+
}
|
|
413
|
+
export interface ListRedirectsParams extends ListQuery {
|
|
414
|
+
}
|
|
415
|
+
export interface IdParams {
|
|
416
|
+
id: string;
|
|
417
|
+
}
|
|
418
|
+
export interface VocabularySettings {
|
|
419
|
+
/** Levels a tree has at most; a flat vocabulary has one. */
|
|
420
|
+
max_depth: number;
|
|
421
|
+
/** Open vocabularies take new terms while entries are tagged. */
|
|
422
|
+
open: boolean;
|
|
423
|
+
/** Each term's URL: `/tags/{slug}`, or `/category/{path}` in a tree. Empty means no URLs. */
|
|
424
|
+
pattern: string;
|
|
425
|
+
term_fields: FieldRule[];
|
|
426
|
+
manage_roles: string[];
|
|
427
|
+
create_roles: string[];
|
|
428
|
+
}
|
|
429
|
+
export interface Vocabulary extends CmsRecord {
|
|
430
|
+
code: string;
|
|
431
|
+
name: Localized;
|
|
432
|
+
shape: 'flat' | 'tree';
|
|
433
|
+
settings: VocabularySettings;
|
|
434
|
+
}
|
|
435
|
+
export interface VocabularyInput {
|
|
436
|
+
name?: Localized;
|
|
437
|
+
shape?: Vocabulary['shape'];
|
|
438
|
+
}
|
|
439
|
+
export interface CreateVocabularyParams extends VocabularyInput {
|
|
440
|
+
code: string;
|
|
441
|
+
/** Settings left out are off or empty. A tree needs `max_depth` (1 or more). */
|
|
442
|
+
settings?: Partial<VocabularySettings>;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Names given replace the old ones whole. Settings, when given, replace the
|
|
446
|
+
* old ones whole too, so send them all (as `get()` returned them): one left
|
|
447
|
+
* out would be cleared, e.g. a missing `pattern` takes the terms' URLs away.
|
|
448
|
+
*/
|
|
449
|
+
export interface UpdateVocabularyParams extends VocabularyInput {
|
|
450
|
+
code: string;
|
|
451
|
+
settings?: VocabularySettings;
|
|
452
|
+
}
|
|
453
|
+
export interface TermLabel {
|
|
454
|
+
name: string;
|
|
455
|
+
/** Made from the name when left out. */
|
|
456
|
+
slug?: string;
|
|
457
|
+
description?: string;
|
|
458
|
+
}
|
|
459
|
+
export interface Term extends CmsRecord {
|
|
460
|
+
vocabulary_id: string;
|
|
461
|
+
/** The vocabulary's code. */
|
|
462
|
+
vocabulary: string;
|
|
463
|
+
parent_id: string;
|
|
464
|
+
depth: number;
|
|
465
|
+
/** Ancestor ids, root first, each followed by `/`. */
|
|
466
|
+
tree_path: string;
|
|
467
|
+
position: number;
|
|
468
|
+
fields: JsonObject | null;
|
|
469
|
+
/** Set on an alias: the term it was merged into. */
|
|
470
|
+
merged_into?: string;
|
|
471
|
+
/** Labels by locale. */
|
|
472
|
+
labels: Record<string, TermLabel>;
|
|
473
|
+
}
|
|
474
|
+
export interface ListTermsParams {
|
|
475
|
+
/** The vocabulary's code. */
|
|
476
|
+
vocabulary: string;
|
|
477
|
+
/** Search names by prefix, in `locale`. */
|
|
478
|
+
q?: string;
|
|
479
|
+
locale?: string;
|
|
480
|
+
/** List a term's children. */
|
|
481
|
+
parent?: string;
|
|
482
|
+
/** Only the terms no entry uses. */
|
|
483
|
+
unused?: boolean;
|
|
484
|
+
/** 100 by default, 1000 at most. */
|
|
485
|
+
limit?: number;
|
|
486
|
+
/** `next` from the previous page. */
|
|
487
|
+
after?: string;
|
|
488
|
+
}
|
|
489
|
+
export interface CreateTermParams {
|
|
490
|
+
/** The vocabulary's code. */
|
|
491
|
+
vocabulary: string;
|
|
492
|
+
labels: Record<string, TermLabel>;
|
|
493
|
+
parentId?: string;
|
|
494
|
+
position?: number;
|
|
495
|
+
fields?: JsonObject;
|
|
496
|
+
}
|
|
497
|
+
/** Labels and fields given replace the old ones whole. Use `move()` to change the parent. */
|
|
498
|
+
export interface UpdateTermParams {
|
|
499
|
+
id: string;
|
|
500
|
+
labels?: Record<string, TermLabel>;
|
|
501
|
+
position?: number;
|
|
502
|
+
fields?: JsonObject;
|
|
503
|
+
}
|
|
504
|
+
export interface MoveTermParams {
|
|
505
|
+
id: string;
|
|
506
|
+
/** Empty or left out for the root. */
|
|
507
|
+
parentId?: string;
|
|
508
|
+
position: number;
|
|
509
|
+
}
|
|
510
|
+
export interface MergeTermParams {
|
|
511
|
+
id: string;
|
|
512
|
+
/** The term this one becomes an alias of. */
|
|
513
|
+
into: string;
|
|
514
|
+
}
|
|
515
|
+
export type NavigationItemKind = 'page' | 'article' | 'section' | 'term' | 'path' | 'external' | 'group' | 'children' | 'latest';
|
|
516
|
+
export type NavigationProblem = 'missing' | 'unpublished' | 'untranslated' | 'no_url' | 'empty';
|
|
517
|
+
export interface NavigationItem {
|
|
518
|
+
/** Given by the server to new items; never changes. */
|
|
519
|
+
id?: string;
|
|
520
|
+
kind: NavigationItemKind;
|
|
521
|
+
/** A record id, a frontend path, or a URL, by `kind`. */
|
|
522
|
+
target?: string;
|
|
523
|
+
/** For built items (`children`, `latest`): `page`, `section` or `term`. */
|
|
524
|
+
target_kind?: string;
|
|
525
|
+
depth?: number;
|
|
526
|
+
limit?: number;
|
|
527
|
+
/** Label by locale; a locale without one takes the target's title. */
|
|
528
|
+
label?: Localized;
|
|
529
|
+
/** Show only in these locales; empty is every locale. */
|
|
530
|
+
locales?: string[];
|
|
531
|
+
audience?: 'everyone' | 'signed_in' | 'signed_out' | 'roles';
|
|
532
|
+
roles?: string[];
|
|
533
|
+
/** Added to the path, without the `#`. */
|
|
534
|
+
fragment?: string;
|
|
535
|
+
/** Added to the path, without the `?`. */
|
|
536
|
+
query?: string;
|
|
537
|
+
new_tab?: boolean;
|
|
538
|
+
rel?: string;
|
|
539
|
+
fields?: JsonObject;
|
|
540
|
+
children?: NavigationItem[];
|
|
541
|
+
/** On editor reads: why readers don't see the item. */
|
|
542
|
+
problem?: NavigationProblem;
|
|
543
|
+
}
|
|
544
|
+
export interface Navigation extends CmsRecord {
|
|
545
|
+
code: string;
|
|
546
|
+
name: string;
|
|
547
|
+
/** The frontend the navigation belongs to. */
|
|
548
|
+
group: string;
|
|
549
|
+
/** Empty serves every locale. */
|
|
550
|
+
locale: string;
|
|
551
|
+
item_fields: FieldRule[];
|
|
552
|
+
items: NavigationItem[];
|
|
553
|
+
missing_translation: 'hide' | 'fallback';
|
|
554
|
+
}
|
|
555
|
+
export interface NavigationInput {
|
|
556
|
+
name: string;
|
|
557
|
+
group?: string;
|
|
558
|
+
locale?: string;
|
|
559
|
+
itemFields?: FieldRule[];
|
|
560
|
+
items: NavigationItem[];
|
|
561
|
+
missingTranslation?: Navigation['missing_translation'];
|
|
562
|
+
}
|
|
563
|
+
export interface CreateNavigationParams extends NavigationInput {
|
|
564
|
+
code: string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Replaces the navigation whole and keeps a version, so every setting is
|
|
568
|
+
* required: one left out would be cleared (e.g. an empty `group` drops the
|
|
569
|
+
* navigation from its frontend). Send back what `get()` returned.
|
|
570
|
+
*/
|
|
571
|
+
export interface UpdateNavigationParams extends Required<NavigationInput> {
|
|
572
|
+
code: string;
|
|
573
|
+
/** The `_modified` the editor loaded. */
|
|
574
|
+
modified: string;
|
|
575
|
+
}
|
|
576
|
+
export interface GetNavigationParams {
|
|
577
|
+
code: string;
|
|
578
|
+
/** Locale the items' problems are worked out in. */
|
|
579
|
+
locale?: string;
|
|
580
|
+
}
|
|
581
|
+
export interface NavigationVersion extends CmsRecord {
|
|
582
|
+
navigation_id: string;
|
|
583
|
+
/** The navigation as saved; left out of lists. */
|
|
584
|
+
content?: Omit<Navigation, keyof CmsRecord | 'code'>;
|
|
585
|
+
author_id: string;
|
|
586
|
+
note: string;
|
|
587
|
+
}
|
|
588
|
+
export interface ListNavigationVersionsParams {
|
|
589
|
+
code: string;
|
|
590
|
+
/** 20 by default, the most kept. */
|
|
591
|
+
limit?: number;
|
|
592
|
+
}
|
|
593
|
+
export interface RestoreNavigationParams {
|
|
594
|
+
code: string;
|
|
595
|
+
versionId: string;
|
|
596
|
+
/** The `_modified` the editor loaded. */
|
|
597
|
+
modified: string;
|
|
598
|
+
}
|
|
599
|
+
export interface PublicFile {
|
|
600
|
+
id: string;
|
|
601
|
+
path: string;
|
|
602
|
+
type?: string;
|
|
603
|
+
width?: number;
|
|
604
|
+
height?: number;
|
|
605
|
+
alt?: string;
|
|
606
|
+
caption?: string;
|
|
607
|
+
credit?: string;
|
|
608
|
+
focal_x?: number;
|
|
609
|
+
focal_y?: number;
|
|
610
|
+
}
|
|
611
|
+
export interface PublicSeo {
|
|
612
|
+
title?: string;
|
|
613
|
+
description?: string;
|
|
614
|
+
canonical?: string;
|
|
615
|
+
image?: PublicFile;
|
|
616
|
+
noindex?: boolean;
|
|
617
|
+
}
|
|
618
|
+
export interface PublicAuthor {
|
|
619
|
+
id: string;
|
|
620
|
+
first_name: string;
|
|
621
|
+
last_name: string;
|
|
622
|
+
avatar?: string;
|
|
623
|
+
}
|
|
624
|
+
export interface PublicTerm {
|
|
625
|
+
id: string;
|
|
626
|
+
vocabulary: string;
|
|
627
|
+
name: string;
|
|
628
|
+
slug: string;
|
|
629
|
+
description?: string;
|
|
630
|
+
path?: string;
|
|
631
|
+
parent_id?: string;
|
|
632
|
+
position: number;
|
|
633
|
+
fields?: JsonObject;
|
|
634
|
+
/** Live entries in the locale, with `counts: true`. */
|
|
635
|
+
count?: number;
|
|
636
|
+
/** Nested terms, with `tree: true`. */
|
|
637
|
+
children?: PublicTerm[];
|
|
638
|
+
}
|
|
639
|
+
export interface PublicEntry {
|
|
640
|
+
id: string;
|
|
641
|
+
type: string;
|
|
642
|
+
locale?: string;
|
|
643
|
+
translation_group_id?: string;
|
|
644
|
+
path?: string;
|
|
645
|
+
section_id?: string;
|
|
646
|
+
parent_id?: string;
|
|
647
|
+
title?: string;
|
|
648
|
+
excerpt?: string;
|
|
649
|
+
body_html?: string;
|
|
650
|
+
fields?: JsonObject;
|
|
651
|
+
cover?: PublicFile;
|
|
652
|
+
seo?: PublicSeo;
|
|
653
|
+
authors?: PublicAuthor[];
|
|
654
|
+
terms?: Record<string, PublicTerm[]>;
|
|
655
|
+
published_at?: string;
|
|
656
|
+
updated_at?: string;
|
|
657
|
+
}
|
|
658
|
+
export interface PublicSection {
|
|
659
|
+
id: string;
|
|
660
|
+
code: string;
|
|
661
|
+
name: string;
|
|
662
|
+
path: string;
|
|
663
|
+
default_sort: SectionSort;
|
|
664
|
+
page_size: number;
|
|
665
|
+
}
|
|
666
|
+
export interface Alternate {
|
|
667
|
+
locale: string;
|
|
668
|
+
path: string;
|
|
669
|
+
}
|
|
670
|
+
export interface Breadcrumb {
|
|
671
|
+
label: string;
|
|
672
|
+
path: string;
|
|
673
|
+
}
|
|
674
|
+
/** What lives at a path. */
|
|
675
|
+
export interface Resolved {
|
|
676
|
+
kind: 'entry' | 'section' | 'term' | 'redirect' | 'gone';
|
|
677
|
+
locale: string;
|
|
678
|
+
canonical?: string;
|
|
679
|
+
/** For a redirect: the HTTP status to answer with. */
|
|
680
|
+
status?: number;
|
|
681
|
+
/** For a redirect: where to. */
|
|
682
|
+
location?: string;
|
|
683
|
+
entry?: PublicEntry;
|
|
684
|
+
section?: PublicSection;
|
|
685
|
+
term?: PublicTerm;
|
|
686
|
+
alternates?: Alternate[];
|
|
687
|
+
breadcrumbs?: Breadcrumb[];
|
|
688
|
+
}
|
|
689
|
+
/** A page of a public list. Pass `next` as `cursor` for the next page; it's absent on the last page. */
|
|
690
|
+
export interface PublicPage<T> {
|
|
691
|
+
items: T[];
|
|
692
|
+
next?: string;
|
|
693
|
+
}
|
|
694
|
+
export interface PublicRoute {
|
|
695
|
+
path: string;
|
|
696
|
+
kind: string;
|
|
697
|
+
id: string;
|
|
698
|
+
modified?: string;
|
|
699
|
+
alternates?: Alternate[];
|
|
700
|
+
}
|
|
701
|
+
export interface PublicNavItem {
|
|
702
|
+
id: string;
|
|
703
|
+
kind: NavigationItemKind;
|
|
704
|
+
label: string;
|
|
705
|
+
path?: string;
|
|
706
|
+
url?: string;
|
|
707
|
+
/** How the frontend marks the item active for the current path. */
|
|
708
|
+
match?: 'exact' | 'prefix';
|
|
709
|
+
new_tab?: boolean;
|
|
710
|
+
rel?: string;
|
|
711
|
+
fields?: JsonObject;
|
|
712
|
+
children?: PublicNavItem[];
|
|
713
|
+
audience?: string;
|
|
714
|
+
roles?: string[];
|
|
715
|
+
}
|
|
716
|
+
export interface PublicNavigation {
|
|
717
|
+
code: string;
|
|
718
|
+
name: string;
|
|
719
|
+
group?: string;
|
|
720
|
+
locale: string;
|
|
721
|
+
items: PublicNavItem[];
|
|
722
|
+
}
|
|
723
|
+
/** Options every public read takes. */
|
|
724
|
+
export interface PublicReadOptions {
|
|
725
|
+
locale?: string;
|
|
726
|
+
/** A token from `entries.preview()`, to read the working copy. */
|
|
727
|
+
preview?: string;
|
|
728
|
+
}
|
|
729
|
+
export interface ResolveParams extends PublicReadOptions {
|
|
730
|
+
path: string;
|
|
731
|
+
/** `false` leaves out entry bodies and fields. */
|
|
732
|
+
full?: boolean;
|
|
733
|
+
}
|
|
734
|
+
export interface PublicRoutesParams {
|
|
735
|
+
locale?: string;
|
|
736
|
+
cursor?: string;
|
|
737
|
+
/** 100 by default, 1000 at most. */
|
|
738
|
+
limit?: number;
|
|
739
|
+
}
|
|
740
|
+
export interface PublicEntriesParams extends PublicReadOptions {
|
|
741
|
+
/** Content type code. */
|
|
742
|
+
type?: string;
|
|
743
|
+
/** Section code; sorts and pages its own way. */
|
|
744
|
+
section?: string;
|
|
745
|
+
/** Term id; in a tree, includes everything under it unless `direct`. */
|
|
746
|
+
term?: string;
|
|
747
|
+
direct?: boolean;
|
|
748
|
+
full?: boolean;
|
|
749
|
+
cursor?: string;
|
|
750
|
+
limit?: number;
|
|
751
|
+
/**
|
|
752
|
+
* Filters on terms (`field: 'terms.<vocabulary>'`) and, with `type`, on
|
|
753
|
+
* custom fields (`field: 'fields.<path>'`).
|
|
754
|
+
*/
|
|
755
|
+
filters?: ListFilter[];
|
|
756
|
+
}
|
|
757
|
+
export interface PublicEntryParams extends PublicReadOptions {
|
|
758
|
+
id: string;
|
|
759
|
+
full?: boolean;
|
|
760
|
+
}
|
|
761
|
+
export interface PublicTermsParams {
|
|
762
|
+
/** The vocabulary's code. */
|
|
763
|
+
vocabulary: string;
|
|
764
|
+
locale?: string;
|
|
765
|
+
parent?: string;
|
|
766
|
+
/** All terms at once, nested under their parents. */
|
|
767
|
+
tree?: boolean;
|
|
768
|
+
/** Add each term's live entry count in the locale. */
|
|
769
|
+
counts?: boolean;
|
|
770
|
+
cursor?: string;
|
|
771
|
+
limit?: number;
|
|
772
|
+
}
|
|
773
|
+
export interface PublicTermParams {
|
|
774
|
+
id: string;
|
|
775
|
+
locale?: string;
|
|
776
|
+
}
|
|
777
|
+
export interface PublicNavigationsParams {
|
|
778
|
+
/** The frontend's group. */
|
|
779
|
+
group: string;
|
|
780
|
+
locale?: string;
|
|
781
|
+
/** Cut the trees at this depth; 0 keeps them whole (max 4). */
|
|
782
|
+
depth?: number;
|
|
783
|
+
}
|
|
784
|
+
export interface PublicNavigationParams {
|
|
785
|
+
code: string;
|
|
786
|
+
locale?: string;
|
|
787
|
+
depth?: number;
|
|
788
|
+
}
|
|
789
|
+
//# sourceMappingURL=types.d.ts.map
|