@paragraphcms/client 1.6.0 → 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/LICENSE +21 -0
- package/README.md +41 -498
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +77 -52
- package/dist/types.d.ts +96 -97
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ParagraphApiError, ParagraphClientError, } from "./errors.js";
|
|
2
2
|
import { RequestRateLimiter } from "./rate-limiter.js";
|
|
3
|
-
const
|
|
3
|
+
const API_BASE_URL = "https://api.paragraphcms.com/v1";
|
|
4
4
|
const DEFAULT_REQUESTS_PER_SECOND = 5;
|
|
5
5
|
const DEFAULT_RATE_LIMIT_RETRIES = 2;
|
|
6
6
|
const DEFAULT_RATE_LIMIT_RETRY_DELAY_MS = 1000;
|
|
7
7
|
const LOOKUP_PAGE_SIZE = 100;
|
|
8
|
+
const PRESERVED_TRANSFORM_KEYS = new Set([
|
|
9
|
+
"content",
|
|
10
|
+
"editorNode",
|
|
11
|
+
"fields",
|
|
12
|
+
]);
|
|
8
13
|
function resolveFetchImplementation(customFetch) {
|
|
9
14
|
const fetchImpl = customFetch ?? globalThis.fetch;
|
|
10
15
|
if (typeof fetchImpl !== "function") {
|
|
@@ -15,26 +20,48 @@ function resolveFetchImplementation(customFetch) {
|
|
|
15
20
|
}
|
|
16
21
|
return fetchImpl;
|
|
17
22
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
throw new ParagraphClientError("`baseUrl` cannot be empty.");
|
|
22
|
-
}
|
|
23
|
-
const url = new URL(trimmed);
|
|
24
|
-
const normalizedPath = url.pathname.replace(/\/+$/, "");
|
|
25
|
-
if (normalizedPath === "" || normalizedPath === "/") {
|
|
26
|
-
url.pathname = "/v1";
|
|
23
|
+
function isPlainObject(value) {
|
|
24
|
+
if (typeof value !== "object" || value === null) {
|
|
25
|
+
return false;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const prototype = Object.getPrototypeOf(value);
|
|
28
|
+
return prototype === Object.prototype || prototype === null;
|
|
29
|
+
}
|
|
30
|
+
function toCamelCaseKey(key) {
|
|
31
|
+
return key.replace(/_([a-z])/g, (_match, letter) => letter.toUpperCase());
|
|
32
|
+
}
|
|
33
|
+
function transformKeysDeep(value, transformKey) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
return value.map((item) => transformKeysDeep(item, transformKey));
|
|
36
|
+
}
|
|
37
|
+
if (!isPlainObject(value)) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
const transformed = {};
|
|
41
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
42
|
+
const transformedKey = transformKey(key);
|
|
43
|
+
if (PRESERVED_TRANSFORM_KEYS.has(transformedKey)) {
|
|
44
|
+
transformed[transformedKey] = nestedValue;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
transformed[transformedKey] = transformKeysDeep(nestedValue, transformKey);
|
|
30
48
|
}
|
|
31
|
-
return
|
|
49
|
+
return transformed;
|
|
50
|
+
}
|
|
51
|
+
function toApiPayload(value) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function toSdkPayload(value) {
|
|
55
|
+
return transformKeysDeep(value, toCamelCaseKey);
|
|
32
56
|
}
|
|
33
|
-
function buildUrl(
|
|
57
|
+
function buildUrl(path, query) {
|
|
34
58
|
const normalizedPath = path ? `/${path.replace(/^\/+/, "")}` : "";
|
|
35
|
-
const url = new URL(`${
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
const url = new URL(`${API_BASE_URL}${normalizedPath}`);
|
|
60
|
+
const apiQuery = query
|
|
61
|
+
? toApiPayload(query)
|
|
62
|
+
: undefined;
|
|
63
|
+
if (apiQuery) {
|
|
64
|
+
for (const [key, rawValue] of Object.entries(apiQuery)) {
|
|
38
65
|
if (rawValue === undefined || rawValue === null) {
|
|
39
66
|
continue;
|
|
40
67
|
}
|
|
@@ -215,11 +242,11 @@ function toBlobPart(file) {
|
|
|
215
242
|
}
|
|
216
243
|
function buildUploadFilePart(input) {
|
|
217
244
|
const source = toBlobPart(input.file);
|
|
218
|
-
const fileName = input.
|
|
245
|
+
const fileName = input.fileName ??
|
|
219
246
|
(typeof File !== "undefined" && input.file instanceof File
|
|
220
247
|
? input.file.name
|
|
221
248
|
: "upload.bin");
|
|
222
|
-
const contentType = input.
|
|
249
|
+
const contentType = input.contentType ??
|
|
223
250
|
("type" in source.value &&
|
|
224
251
|
typeof source.value.type === "string" &&
|
|
225
252
|
source.value.type.length > 0
|
|
@@ -265,7 +292,7 @@ function createUploadFormData(input) {
|
|
|
265
292
|
else {
|
|
266
293
|
formData.append("file", filePart.value);
|
|
267
294
|
}
|
|
268
|
-
formData.append("
|
|
295
|
+
formData.append("pageId", input.pageId);
|
|
269
296
|
if (input.alt !== undefined && input.alt !== null) {
|
|
270
297
|
formData.append("alt", input.alt);
|
|
271
298
|
}
|
|
@@ -273,7 +300,6 @@ function createUploadFormData(input) {
|
|
|
273
300
|
}
|
|
274
301
|
export class Client {
|
|
275
302
|
apiKey;
|
|
276
|
-
baseUrl;
|
|
277
303
|
fetchImpl;
|
|
278
304
|
defaultHeaders;
|
|
279
305
|
timeoutMs;
|
|
@@ -312,6 +338,7 @@ export class Client {
|
|
|
312
338
|
}),
|
|
313
339
|
};
|
|
314
340
|
page = {
|
|
341
|
+
list: (query, options) => this.pages.list(query, options),
|
|
315
342
|
get: (pageId, query, options) => this.pages.get(pageId, query, options),
|
|
316
343
|
getBySlug: (slug, options) => this.pages.getBySlug(slug, options),
|
|
317
344
|
};
|
|
@@ -361,7 +388,7 @@ export class Client {
|
|
|
361
388
|
options,
|
|
362
389
|
}),
|
|
363
390
|
get: (memberId, options) => this.findListItem("/members", (member) => member.id === memberId, options, {
|
|
364
|
-
code: "
|
|
391
|
+
code: "memberNotFound",
|
|
365
392
|
message: "Member not found.",
|
|
366
393
|
details: { memberId },
|
|
367
394
|
}),
|
|
@@ -372,7 +399,7 @@ export class Client {
|
|
|
372
399
|
options,
|
|
373
400
|
}),
|
|
374
401
|
get: (authorId, options) => this.findListItem("/authors", (author) => author.id === authorId, options, {
|
|
375
|
-
code: "
|
|
402
|
+
code: "authorNotFound",
|
|
376
403
|
message: "Author not found.",
|
|
377
404
|
details: { authorId },
|
|
378
405
|
}),
|
|
@@ -383,7 +410,7 @@ export class Client {
|
|
|
383
410
|
options,
|
|
384
411
|
}),
|
|
385
412
|
get: (reviewerId, options) => this.findListItem("/reviewers", (reviewer) => reviewer.id === reviewerId, options, {
|
|
386
|
-
code: "
|
|
413
|
+
code: "reviewerNotFound",
|
|
387
414
|
message: "Reviewer not found.",
|
|
388
415
|
details: { reviewerId },
|
|
389
416
|
}),
|
|
@@ -461,7 +488,7 @@ export class Client {
|
|
|
461
488
|
options,
|
|
462
489
|
}),
|
|
463
490
|
get: (code, options) => this.findArrayItem("/locales", (locale) => locale.code === code, options, {
|
|
464
|
-
code: "
|
|
491
|
+
code: "localeNotFound",
|
|
465
492
|
message: "Locale not found.",
|
|
466
493
|
details: { code },
|
|
467
494
|
}),
|
|
@@ -488,11 +515,15 @@ export class Client {
|
|
|
488
515
|
}),
|
|
489
516
|
};
|
|
490
517
|
constructor(options) {
|
|
491
|
-
if (
|
|
518
|
+
if ("baseUrl" in options ||
|
|
519
|
+
"apiUrl" in options) {
|
|
520
|
+
throw new ParagraphClientError("`baseUrl` and `apiUrl` are not supported. The client always uses the official Paragraph CMS API endpoint.");
|
|
521
|
+
}
|
|
522
|
+
if (typeof options.apiKey !== "string" ||
|
|
523
|
+
!options.apiKey.trim()) {
|
|
492
524
|
throw new ParagraphClientError("`apiKey` is required.");
|
|
493
525
|
}
|
|
494
526
|
this.apiKey = options.apiKey.trim();
|
|
495
|
-
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
496
527
|
this.fetchImpl = resolveFetchImplementation(options.fetch);
|
|
497
528
|
this.defaultHeaders = new Headers(options.headers);
|
|
498
529
|
this.timeoutMs = options.timeoutMs;
|
|
@@ -510,13 +541,13 @@ export class Client {
|
|
|
510
541
|
});
|
|
511
542
|
if (pageListQuery.limit !== undefined ||
|
|
512
543
|
pageListQuery.page !== undefined ||
|
|
513
|
-
!response.meta.
|
|
544
|
+
!response.meta.hasNextPage) {
|
|
514
545
|
return response;
|
|
515
546
|
}
|
|
516
547
|
const items = [...response.data];
|
|
517
548
|
let nextPage = response.meta.page + 1;
|
|
518
549
|
let lastMeta = response.meta;
|
|
519
|
-
while (lastMeta.
|
|
550
|
+
while (lastMeta.hasNextPage) {
|
|
520
551
|
const nextResponse = await this.requestList("GET", "/pages", {
|
|
521
552
|
query: {
|
|
522
553
|
...pageListQuery,
|
|
@@ -534,25 +565,19 @@ export class Client {
|
|
|
534
565
|
meta: {
|
|
535
566
|
page: 1,
|
|
536
567
|
limit: items.length,
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
568
|
+
totalItems: items.length,
|
|
569
|
+
totalPages: items.length > 0 ? 1 : 0,
|
|
570
|
+
hasNextPage: false,
|
|
571
|
+
hasPrevPage: false,
|
|
541
572
|
},
|
|
542
573
|
};
|
|
543
574
|
}
|
|
544
575
|
createPageListQuery(query) {
|
|
545
|
-
const
|
|
546
|
-
if (query?.collection !== undefined &&
|
|
547
|
-
query?.collection_id !== undefined &&
|
|
548
|
-
query.collection !== query.collection_id) {
|
|
549
|
-
throw new ParagraphClientError("`collection` and `collection_id` must match when both are provided.");
|
|
550
|
-
}
|
|
576
|
+
const { requiredSlug, ...restQuery } = query ?? {};
|
|
551
577
|
return {
|
|
552
|
-
...
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
include_content: query?.include_content ?? false,
|
|
578
|
+
...restQuery,
|
|
579
|
+
includeContent: restQuery.includeContent ?? false,
|
|
580
|
+
...(requiredSlug === true ? { requiredSlug: true } : {}),
|
|
556
581
|
};
|
|
557
582
|
}
|
|
558
583
|
requestData(method, path, config) {
|
|
@@ -564,7 +589,7 @@ export class Client {
|
|
|
564
589
|
async getPageBySlug(slug, options) {
|
|
565
590
|
const query = this.createPageListQuery({ slug });
|
|
566
591
|
const page = await this.findListItem("/pages", (item) => item.slug === slug, options, {
|
|
567
|
-
code: "
|
|
592
|
+
code: "pageNotFound",
|
|
568
593
|
message: "Page not found.",
|
|
569
594
|
details: { slug },
|
|
570
595
|
}, query);
|
|
@@ -585,7 +610,7 @@ export class Client {
|
|
|
585
610
|
if (match) {
|
|
586
611
|
return match;
|
|
587
612
|
}
|
|
588
|
-
if (!response.meta.
|
|
613
|
+
if (!response.meta.hasNextPage) {
|
|
589
614
|
break;
|
|
590
615
|
}
|
|
591
616
|
page += 1;
|
|
@@ -621,11 +646,11 @@ export class Client {
|
|
|
621
646
|
code: config.code,
|
|
622
647
|
message: config.message,
|
|
623
648
|
details: config.details,
|
|
624
|
-
request: createRequestDescriptor(method, buildUrl(
|
|
649
|
+
request: createRequestDescriptor(method, buildUrl(path, config.query)),
|
|
625
650
|
});
|
|
626
651
|
}
|
|
627
652
|
requestJson(method, path, config) {
|
|
628
|
-
const url = buildUrl(
|
|
653
|
+
const url = buildUrl(path, config?.query);
|
|
629
654
|
const request = createRequestDescriptor(method, url);
|
|
630
655
|
const headers = new Headers(this.defaultHeaders);
|
|
631
656
|
const timeoutMs = config?.options?.timeoutMs ?? this.timeoutMs;
|
|
@@ -644,7 +669,7 @@ export class Client {
|
|
|
644
669
|
if (!headers.has("content-type")) {
|
|
645
670
|
headers.set("content-type", "application/json");
|
|
646
671
|
}
|
|
647
|
-
body = JSON.stringify(config.body);
|
|
672
|
+
body = JSON.stringify(toApiPayload(config.body));
|
|
648
673
|
}
|
|
649
674
|
const optionHeaders = new Headers(config?.options?.headers);
|
|
650
675
|
for (const [key, value] of optionHeaders.entries()) {
|
|
@@ -667,24 +692,24 @@ export class Client {
|
|
|
667
692
|
}));
|
|
668
693
|
const payload = await parseResponse(response);
|
|
669
694
|
if (response.ok) {
|
|
670
|
-
return payload;
|
|
695
|
+
return toSdkPayload(payload);
|
|
671
696
|
}
|
|
672
697
|
const responseHeaders = new Headers(response.headers);
|
|
673
698
|
const apiError = isApiErrorPayload(payload)
|
|
674
699
|
? new ParagraphApiError({
|
|
700
|
+
body: toSdkPayload(payload),
|
|
675
701
|
status: response.status,
|
|
676
702
|
code: payload.error.code,
|
|
677
703
|
message: payload.error.message,
|
|
678
|
-
details: payload.error.details,
|
|
704
|
+
details: toSdkPayload(payload.error.details),
|
|
679
705
|
headers: responseHeaders,
|
|
680
706
|
request,
|
|
681
|
-
body: payload,
|
|
682
707
|
})
|
|
683
708
|
: new ParagraphApiError({
|
|
684
709
|
status: response.status,
|
|
685
710
|
code: response.status === 401
|
|
686
711
|
? "unauthorized"
|
|
687
|
-
: "
|
|
712
|
+
: "requestFailed",
|
|
688
713
|
message: typeof payload === "string" && payload.length > 0
|
|
689
714
|
? payload
|
|
690
715
|
: response.statusText || "Request failed.",
|
package/dist/types.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export type Uploadable = File | Blob | ArrayBuffer | ArrayBufferView;
|
|
|
10
10
|
export interface PaginationMeta {
|
|
11
11
|
page: number;
|
|
12
12
|
limit: number;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
totalItems: number;
|
|
14
|
+
totalPages: number;
|
|
15
|
+
hasNextPage: boolean;
|
|
16
|
+
hasPrevPage: boolean;
|
|
17
17
|
}
|
|
18
18
|
export interface ListResponse<T> {
|
|
19
19
|
data: T[];
|
|
@@ -21,11 +21,11 @@ export interface ListResponse<T> {
|
|
|
21
21
|
}
|
|
22
22
|
export interface ApiInfo {
|
|
23
23
|
version: string;
|
|
24
|
-
|
|
24
|
+
openapiUrl: string;
|
|
25
25
|
authentication: {
|
|
26
|
-
type: "
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
type: "apiKey";
|
|
27
|
+
supportedHeaders: ["x-api-key", "authorization"];
|
|
28
|
+
authorizationFormat: "Bearer <api-key>";
|
|
29
29
|
};
|
|
30
30
|
resources: string[];
|
|
31
31
|
}
|
|
@@ -49,7 +49,6 @@ export interface RequestOptions {
|
|
|
49
49
|
}
|
|
50
50
|
export interface ClientOptions {
|
|
51
51
|
apiKey: string;
|
|
52
|
-
baseUrl?: string;
|
|
53
52
|
fetch?: typeof globalThis.fetch;
|
|
54
53
|
headers?: HeadersInit;
|
|
55
54
|
timeoutMs?: number;
|
|
@@ -64,12 +63,12 @@ export interface ListQuery {
|
|
|
64
63
|
}
|
|
65
64
|
export interface Member {
|
|
66
65
|
id: string;
|
|
67
|
-
|
|
66
|
+
userId: string;
|
|
68
67
|
role: string;
|
|
69
68
|
name: string | null;
|
|
70
69
|
email: string | null;
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
imageUrl: string | null;
|
|
71
|
+
createdAt: string | null;
|
|
73
72
|
}
|
|
74
73
|
export interface Status {
|
|
75
74
|
id: string;
|
|
@@ -78,8 +77,8 @@ export interface Status {
|
|
|
78
77
|
type: StatusType;
|
|
79
78
|
description: string | null;
|
|
80
79
|
order: number;
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
createdAt: string | null;
|
|
81
|
+
updatedAt: string | null;
|
|
83
82
|
}
|
|
84
83
|
export interface Label {
|
|
85
84
|
id: string;
|
|
@@ -87,8 +86,8 @@ export interface Label {
|
|
|
87
86
|
color: string;
|
|
88
87
|
description: string | null;
|
|
89
88
|
order: number;
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
createdAt: string | null;
|
|
90
|
+
lastAppliedAt: string | null;
|
|
92
91
|
}
|
|
93
92
|
export interface DataModelField {
|
|
94
93
|
id: string;
|
|
@@ -104,57 +103,57 @@ export interface DataModelSummary {
|
|
|
104
103
|
}
|
|
105
104
|
export interface DataModel extends DataModelSummary {
|
|
106
105
|
fields: DataModelField[];
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
createdAt: string | null;
|
|
107
|
+
updatedAt: string | null;
|
|
109
108
|
}
|
|
110
109
|
export interface CollectionSummary {
|
|
111
110
|
id: string;
|
|
112
111
|
name: string;
|
|
113
112
|
description: string | null;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
defaultDataModelId: string | null;
|
|
114
|
+
teamIds: string[];
|
|
115
|
+
pageCount: number;
|
|
116
|
+
lastModifiedAt: string | null;
|
|
118
117
|
}
|
|
119
118
|
export interface Collection extends CollectionSummary {
|
|
120
|
-
|
|
119
|
+
defaultDataModel: DataModel | null;
|
|
121
120
|
}
|
|
122
121
|
export interface PageTranslation {
|
|
123
122
|
id: string;
|
|
124
123
|
title: string;
|
|
125
124
|
language: string;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
deletedAt: string | null;
|
|
126
|
+
createdAt: string | null;
|
|
127
|
+
updatedAt: string | null;
|
|
128
|
+
isCurrent: boolean;
|
|
130
129
|
}
|
|
131
130
|
export interface PageSummary {
|
|
132
131
|
id: string;
|
|
133
132
|
title: string;
|
|
134
133
|
slug: string | null;
|
|
135
134
|
language: string;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
contentFormat?: PageContentFormat;
|
|
136
|
+
heroUrl: string | null;
|
|
137
|
+
collectionId: string | null;
|
|
139
138
|
collection: Collection | null;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
translationGroupId: string;
|
|
140
|
+
dataModelId: string | null;
|
|
141
|
+
dataModel: DataModel | null;
|
|
142
|
+
statusId: string | null;
|
|
144
143
|
status: Status | null;
|
|
145
|
-
|
|
144
|
+
authorId: string | null;
|
|
146
145
|
author: Member | null;
|
|
147
|
-
|
|
146
|
+
reviewerId: string | null;
|
|
148
147
|
reviewer: Member | null;
|
|
149
148
|
labels: Label[];
|
|
150
149
|
fields: Record<string, unknown>;
|
|
151
150
|
content?: PageContent;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
metaName: string | null;
|
|
152
|
+
metaDescription: string | null;
|
|
153
|
+
publishedAt: string | null;
|
|
154
|
+
deletedAt: string | null;
|
|
155
|
+
createdAt: string | null;
|
|
156
|
+
updatedAt: string | null;
|
|
158
157
|
}
|
|
159
158
|
export interface Page extends PageSummary {
|
|
160
159
|
content: PageContent;
|
|
@@ -162,30 +161,30 @@ export interface Page extends PageSummary {
|
|
|
162
161
|
}
|
|
163
162
|
export interface Media {
|
|
164
163
|
id: string;
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
pageId: string | null;
|
|
165
|
+
fileName: string;
|
|
167
166
|
alt: string | null;
|
|
168
|
-
|
|
167
|
+
mimeType: string;
|
|
169
168
|
size: number;
|
|
170
169
|
width: number | null;
|
|
171
170
|
height: number | null;
|
|
172
171
|
url: string;
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
createdAt: string | null;
|
|
173
|
+
updatedAt: string | null;
|
|
175
174
|
}
|
|
176
175
|
export interface MediaReferencePage {
|
|
177
176
|
id: string;
|
|
178
177
|
title: string;
|
|
179
178
|
slug: string | null;
|
|
180
179
|
language: string | null;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
translationGroupId: string | null;
|
|
181
|
+
updatedAt: string | null;
|
|
182
|
+
isUnassigned: boolean;
|
|
184
183
|
}
|
|
185
184
|
export interface MediaDetail extends Media {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
referencePageCount: number;
|
|
186
|
+
lastModifiedAt: string | null;
|
|
187
|
+
referencePages: MediaReferencePage[];
|
|
189
188
|
}
|
|
190
189
|
export interface Locale {
|
|
191
190
|
id: string;
|
|
@@ -206,7 +205,7 @@ export interface CollectionMutationResult {
|
|
|
206
205
|
export interface MediaUploadResult {
|
|
207
206
|
message: string;
|
|
208
207
|
media: Media;
|
|
209
|
-
|
|
208
|
+
editorNode: EditorNode;
|
|
210
209
|
}
|
|
211
210
|
export interface MediaMutationResult {
|
|
212
211
|
message: string;
|
|
@@ -215,7 +214,7 @@ export interface MediaMutationResult {
|
|
|
215
214
|
export interface MediaDeleteResult {
|
|
216
215
|
id: string;
|
|
217
216
|
deleted: boolean;
|
|
218
|
-
|
|
217
|
+
deletedCount: number;
|
|
219
218
|
message: string;
|
|
220
219
|
}
|
|
221
220
|
export interface StatusMutationResult {
|
|
@@ -228,7 +227,7 @@ export interface LabelMutationResult {
|
|
|
228
227
|
}
|
|
229
228
|
export interface DataModelMutationResult {
|
|
230
229
|
message: string;
|
|
231
|
-
|
|
230
|
+
dataModel: DataModel;
|
|
232
231
|
}
|
|
233
232
|
export interface LocaleMutationResult {
|
|
234
233
|
message: string;
|
|
@@ -240,11 +239,11 @@ export interface LocaleMutationResult {
|
|
|
240
239
|
}
|
|
241
240
|
export interface AiMetaNameResult {
|
|
242
241
|
message: string;
|
|
243
|
-
|
|
242
|
+
metaName: string;
|
|
244
243
|
}
|
|
245
244
|
export interface AiMetaDescriptionResult {
|
|
246
245
|
message: string;
|
|
247
|
-
|
|
246
|
+
metaDescription: string;
|
|
248
247
|
}
|
|
249
248
|
export interface AiContentResult {
|
|
250
249
|
message: string;
|
|
@@ -269,7 +268,7 @@ export interface PageRestoreResult {
|
|
|
269
268
|
}
|
|
270
269
|
export interface PermanentDeleteResult {
|
|
271
270
|
id: string;
|
|
272
|
-
|
|
271
|
+
permanentlyDeleted: boolean;
|
|
273
272
|
message: string;
|
|
274
273
|
}
|
|
275
274
|
export interface ReorderResult {
|
|
@@ -277,46 +276,46 @@ export interface ReorderResult {
|
|
|
277
276
|
message: string;
|
|
278
277
|
}
|
|
279
278
|
export interface PageListQuery extends ListQuery {
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
includeContent?: boolean;
|
|
280
|
+
collectionId?: string;
|
|
282
281
|
deleted?: DeletedFilter;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
reviewer_id?: string;
|
|
282
|
+
withoutCollection?: boolean;
|
|
283
|
+
dataModelId?: string;
|
|
284
|
+
statusId?: string;
|
|
285
|
+
statusType?: StatusType;
|
|
286
|
+
authorId?: string;
|
|
287
|
+
reviewerId?: string;
|
|
290
288
|
language?: string;
|
|
291
|
-
|
|
289
|
+
translationGroupId?: string;
|
|
292
290
|
slug?: string;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
requiredSlug?: boolean;
|
|
292
|
+
labelIds?: string[];
|
|
293
|
+
updatedAfter?: string;
|
|
294
|
+
updatedBefore?: string;
|
|
295
|
+
publishedAfter?: string;
|
|
296
|
+
publishedBefore?: string;
|
|
298
297
|
published?: boolean;
|
|
299
298
|
}
|
|
300
299
|
export interface GetPageQuery {
|
|
301
|
-
|
|
300
|
+
includeDeleted?: boolean;
|
|
302
301
|
}
|
|
303
302
|
export interface CreatePageRequest {
|
|
304
303
|
title?: string;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
heroUrl?: string | null;
|
|
305
|
+
collectionId?: string | null;
|
|
306
|
+
dataModelId?: string | null;
|
|
308
307
|
language?: string;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
308
|
+
statusId?: string | null;
|
|
309
|
+
authorId?: string | null;
|
|
310
|
+
reviewerId?: string | null;
|
|
311
|
+
publishedAt?: string | null;
|
|
312
|
+
contentFormat?: PageContentFormat;
|
|
314
313
|
content?: PageContent;
|
|
315
314
|
fields?: Record<string, unknown>;
|
|
316
315
|
slug?: string | null;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
metaName?: string | null;
|
|
317
|
+
metaDescription?: string | null;
|
|
318
|
+
labelIds?: string[];
|
|
320
319
|
}
|
|
321
320
|
export type UpdatePageRequest = CreatePageRequest;
|
|
322
321
|
export interface CreatePageTranslationRequest {
|
|
@@ -325,28 +324,28 @@ export interface CreatePageTranslationRequest {
|
|
|
325
324
|
model?: string;
|
|
326
325
|
}
|
|
327
326
|
export interface CollectionListQuery extends ListQuery {
|
|
328
|
-
|
|
327
|
+
defaultDataModelId?: string;
|
|
329
328
|
}
|
|
330
329
|
export interface CreateCollectionRequest {
|
|
331
330
|
name: string;
|
|
332
331
|
description?: string | null;
|
|
333
|
-
|
|
334
|
-
|
|
332
|
+
defaultDataModelId?: string | null;
|
|
333
|
+
teamIds?: string[];
|
|
335
334
|
}
|
|
336
335
|
export type UpdateCollectionRequest = Partial<CreateCollectionRequest>;
|
|
337
336
|
export interface MediaListQuery extends ListQuery {
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
pageId?: string;
|
|
338
|
+
mimeType?: string;
|
|
340
339
|
}
|
|
341
340
|
export interface UploadMediaRequest {
|
|
342
341
|
file: Uploadable;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
fileName?: string;
|
|
343
|
+
contentType?: string;
|
|
344
|
+
pageId: string;
|
|
346
345
|
alt?: string | null;
|
|
347
346
|
}
|
|
348
347
|
export interface UpdateMediaRequest {
|
|
349
|
-
|
|
348
|
+
fileName?: string;
|
|
350
349
|
alt?: string | null;
|
|
351
350
|
}
|
|
352
351
|
export interface MemberListQuery extends ListQuery {
|
|
@@ -364,7 +363,7 @@ export interface CreateStatusRequest {
|
|
|
364
363
|
export type UpdateStatusRequest = Partial<CreateStatusRequest>;
|
|
365
364
|
export interface ReorderStatusesRequest {
|
|
366
365
|
type: StatusType;
|
|
367
|
-
|
|
366
|
+
statusIds: string[];
|
|
368
367
|
}
|
|
369
368
|
export interface CreateLabelRequest {
|
|
370
369
|
name: string;
|
|
@@ -375,7 +374,7 @@ export type UpdateLabelRequest = Partial<CreateLabelRequest>;
|
|
|
375
374
|
export interface LabelListQuery extends ListQuery {
|
|
376
375
|
}
|
|
377
376
|
export interface ReorderLabelsRequest {
|
|
378
|
-
|
|
377
|
+
labelIds: string[];
|
|
379
378
|
}
|
|
380
379
|
export interface DataModelListQuery extends ListQuery {
|
|
381
380
|
}
|