mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 12:57:49 +00:00
fix build errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
import { Platform, type Service } from './references';
|
||||
import { Platform, type ServiceValue } from './references';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export type SDKMethod = {
|
||||
@@ -65,6 +65,9 @@ export const ModelType = {
|
||||
GRAPHQL: 'GraphQL'
|
||||
} as const;
|
||||
|
||||
type ModelTypeType = keyof typeof ModelType;
|
||||
type ModelTypeValue = (typeof ModelType)[ModelTypeType];
|
||||
|
||||
function getExamples(version: string) {
|
||||
switch (version) {
|
||||
case '0.15.x':
|
||||
@@ -217,7 +220,7 @@ export async function getApi(version: string, platform: string): Promise<OpenAPI
|
||||
isServer ? 'server' : isClient ? 'client' : 'console'
|
||||
}.json`;
|
||||
|
||||
return specs[target]();
|
||||
return specs[target]() as unknown as OpenAPIV3.Document;
|
||||
}
|
||||
|
||||
const descriptions = import.meta.glob(
|
||||
@@ -228,14 +231,14 @@ const descriptions = import.meta.glob(
|
||||
}
|
||||
);
|
||||
|
||||
export async function getDescription(service: string): Promise<string> {
|
||||
export async function getDescription(service: string) {
|
||||
const target = `/src/routes/docs/references/[version]/[platform]/[service]/descriptions/${service}.md`;
|
||||
|
||||
if (!(target in descriptions)) {
|
||||
throw new Error('Missing service description');
|
||||
}
|
||||
|
||||
return descriptions[target]();
|
||||
return descriptions[target]() as unknown as string;
|
||||
}
|
||||
|
||||
export async function getService(
|
||||
@@ -244,7 +247,7 @@ export async function getService(
|
||||
service: string
|
||||
): Promise<{
|
||||
service: {
|
||||
name: Service;
|
||||
name: ServiceValue;
|
||||
description: string;
|
||||
};
|
||||
methods: SDKMethod[];
|
||||
@@ -262,7 +265,7 @@ export async function getService(
|
||||
|
||||
const data: Awaited<ReturnType<typeof getService>> = {
|
||||
service: {
|
||||
name: service as Service,
|
||||
name: service as ServiceValue,
|
||||
description: await getDescription(service)
|
||||
},
|
||||
methods: []
|
||||
@@ -324,7 +327,7 @@ export async function getService(
|
||||
continue;
|
||||
}
|
||||
|
||||
const demo = await examples[path]();
|
||||
const demo = (await examples[path]()) as unknown as string;
|
||||
|
||||
data.methods.push({
|
||||
id: operation['x-appwrite'].method,
|
||||
@@ -370,7 +373,7 @@ export function resolveReference(
|
||||
export const generateExample = (
|
||||
schema: OpenAPIV3.SchemaObject,
|
||||
api: OpenAPIV3.Document<object>,
|
||||
modelType: ModelType = ModelType.REST
|
||||
modelType: ModelTypeValue = ModelType.REST
|
||||
): object => {
|
||||
const properties = Object.keys(schema.properties ?? {}).map((key) => {
|
||||
const name = key;
|
||||
|
||||
Reference in New Issue
Block a user