Update to latest version of the GitBook API (#3002)

This commit is contained in:
Samy Pessé
2025-03-19 20:11:44 +01:00
committed by GitHub
parent a84b06bb19
commit bcf877841b
9 changed files with 20 additions and 16 deletions
+2 -2
View File
@@ -253,7 +253,7 @@
},
"overrides": {
"@codemirror/state": "6.4.1",
"@gitbook/api": "0.99.0",
"@gitbook/api": "0.101.0",
"react": "18.3.1",
"react-dom": "18.3.1",
},
@@ -604,7 +604,7 @@
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@6.6.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "6.6.0" } }, "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg=="],
"@gitbook/api": ["@gitbook/api@0.99.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-qaHNCKul6rp0wqKRQ/2/2+X8mNEmy5ZK4vWuZoI9eL306TTqFBWD4DSTHz0WV6X24FVe3HF7qy/mVRd4ja2I2A=="],
"@gitbook/api": ["@gitbook/api@0.101.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-DX8CyoXCRyqXW738G9Ik9Pq97L1RjFdVCGxska9tFkrn1+bf60mwpt+6669wrRdlBxb1t2Ru4DsGuUksxCKDag=="],
"@gitbook/cache-do": ["@gitbook/cache-do@workspace:packages/cache-do"],
+1 -1
View File
@@ -12,7 +12,7 @@
"@codemirror/state": "6.4.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"@gitbook/api": "0.99.0"
"@gitbook/api": "0.101.0"
},
"private": true,
"scripts": {
-1
View File
@@ -382,7 +382,6 @@ async function getComputedDocument(
const api = await apiClient(input);
const res = await api.spaces.getComputedDocument(params.spaceId, {
source: params.source,
// @ts-expect-error - seed is not typed yet, but will be in the next version of the API
seed: params.seed,
});
return res.data;
+1 -2
View File
@@ -15,13 +15,12 @@ export async function getPageDocument(
dataFetcher.getDocument({ spaceId: space.id, documentId: page.documentId })
);
}
if (page.computed) {
if ('computed' in page && page.computed) {
return getDataOrNull(
dataFetcher.getComputedDocument({
organizationId: space.organization,
spaceId: space.id,
source: page.computed,
// @ts-expect-error - computedSeed is not typed yet, but will be in the next version of the API
seed: page.computedSeed,
})
);
@@ -66,7 +66,9 @@ export async function CustomizationRootLayout(props: {
sidebarStyles.list && `sidebar-list-${sidebarStyles.list}`,
'links' in customization.styling && `links-${customization.styling.links}`,
fontNotoColorEmoji.variable,
fonts[customization.styling.font].variable,
typeof customization.styling.font === 'string'
? fonts[customization.styling.font].variable
: '',
ibmPlexMono.variable
)}
>
-1
View File
@@ -740,7 +740,6 @@ export const getComputedDocument = cache({
spaceId,
{
source,
// @ts-expect-error - seed is not typed yet, but will be in the next version of the API
seed,
},
{},
+3 -1
View File
@@ -550,12 +550,14 @@ async function lookupSiteOrSpaceInMultiIdMode(
};
}
const basePath = normalizePathname(basePathParts.join('/'));
return {
// In multi-id mode, complete is always considered true because there is no URL to resolve
...(decoded.kind === 'site' ? { ...decoded, complete: true } : decoded),
changeRequest: changeRequestId,
revision: revisionId,
basePath: normalizePathname(basePathParts.join('/')),
siteBasePath: basePath,
basePath,
pathname: normalizePathname(pathSegments.join('/')),
apiToken,
apiEndpoint,
+4 -1
View File
@@ -59,7 +59,10 @@ export async function serveOGImage(baseContext: GitBookSiteContext, params: Page
: page.description
: '';
const fontFamily = googleFontsMap[customization.styling.font] ?? 'Inter';
const fontFamily =
(typeof customization.styling.font === 'string'
? googleFontsMap[customization.styling.font]
: null) ?? 'Inter';
const regularText = pageDescription;
const boldText = `${contentTitle}${pageTitle}`;
@@ -31,8 +31,8 @@ describe('#resolveOpenAPIOperation', () => {
],
operation: {
tags: ['pet'],
summary: 'Update an existing pet',
description: 'Update an existing pet by Id',
summary: 'Update an existing pet.',
description: 'Update an existing pet by Id.',
requestBody: {
content: {
'application/json': {
@@ -61,8 +61,8 @@ describe('#resolveOpenAPIOperation', () => {
],
operation: {
tags: ['pet'],
summary: 'Update an existing pet',
description: 'Update an existing pet by Id',
summary: 'Update an existing pet.',
description: 'Update an existing pet by Id.',
requestBody: {
content: {
'application/json': {
@@ -159,8 +159,8 @@ describe('#resolveOpenAPIOperation', () => {
],
operation: {
tags: ['pet'],
summary: 'Update an existing pet',
description: 'Update an existing pet by Id',
summary: 'Update an existing pet.',
description: 'Update an existing pet by Id.',
requestBody: {
content: {
'application/json': {