mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 12:57:48 +00:00
fix build errors
This commit is contained in:
@@ -33,6 +33,9 @@ export const Service = {
|
|||||||
Users: 'users'
|
Users: 'users'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export type ServiceType = typeof Service;
|
||||||
|
export type ServiceValue = (typeof Service)[keyof typeof Service];
|
||||||
|
|
||||||
export const Platform = {
|
export const Platform = {
|
||||||
ClientWeb: 'client-web',
|
ClientWeb: 'client-web',
|
||||||
ClientFlutter: 'client-flutter',
|
ClientFlutter: 'client-flutter',
|
||||||
@@ -57,6 +60,9 @@ export const Platform = {
|
|||||||
ServerRest: 'server-rest'
|
ServerRest: 'server-rest'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
type PlatformType = typeof Platform;
|
||||||
|
export type Platform = (typeof Platform)[keyof typeof Platform];
|
||||||
|
|
||||||
export const Framework = {
|
export const Framework = {
|
||||||
NextJs: 'Next.js',
|
NextJs: 'Next.js',
|
||||||
SvelteKit: 'SvelteKit',
|
SvelteKit: 'SvelteKit',
|
||||||
@@ -126,7 +132,7 @@ export const platformMap: Record<Language | string, string> = {
|
|||||||
go: 'Go'
|
go: 'Go'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const serviceMap: Record<Service, string> = {
|
export const serviceMap: Record<ServiceValue, string> = {
|
||||||
[Service.Account]: 'Account',
|
[Service.Account]: 'Account',
|
||||||
[Service.Avatars]: 'Avatars',
|
[Service.Avatars]: 'Avatars',
|
||||||
[Service.Databases]: 'Databases',
|
[Service.Databases]: 'Databases',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { OpenAPIV3 } from 'openapi-types';
|
import { OpenAPIV3 } from 'openapi-types';
|
||||||
import { Platform, type Service } from './references';
|
import { Platform, type ServiceValue } from './references';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
export type SDKMethod = {
|
export type SDKMethod = {
|
||||||
@@ -65,6 +65,9 @@ export const ModelType = {
|
|||||||
GRAPHQL: 'GraphQL'
|
GRAPHQL: 'GraphQL'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
type ModelTypeType = keyof typeof ModelType;
|
||||||
|
type ModelTypeValue = (typeof ModelType)[ModelTypeType];
|
||||||
|
|
||||||
function getExamples(version: string) {
|
function getExamples(version: string) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case '0.15.x':
|
case '0.15.x':
|
||||||
@@ -217,7 +220,7 @@ export async function getApi(version: string, platform: string): Promise<OpenAPI
|
|||||||
isServer ? 'server' : isClient ? 'client' : 'console'
|
isServer ? 'server' : isClient ? 'client' : 'console'
|
||||||
}.json`;
|
}.json`;
|
||||||
|
|
||||||
return specs[target]();
|
return specs[target]() as unknown as OpenAPIV3.Document;
|
||||||
}
|
}
|
||||||
|
|
||||||
const descriptions = import.meta.glob(
|
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`;
|
const target = `/src/routes/docs/references/[version]/[platform]/[service]/descriptions/${service}.md`;
|
||||||
|
|
||||||
if (!(target in descriptions)) {
|
if (!(target in descriptions)) {
|
||||||
throw new Error('Missing service description');
|
throw new Error('Missing service description');
|
||||||
}
|
}
|
||||||
|
|
||||||
return descriptions[target]();
|
return descriptions[target]() as unknown as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getService(
|
export async function getService(
|
||||||
@@ -244,7 +247,7 @@ export async function getService(
|
|||||||
service: string
|
service: string
|
||||||
): Promise<{
|
): Promise<{
|
||||||
service: {
|
service: {
|
||||||
name: Service;
|
name: ServiceValue;
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
methods: SDKMethod[];
|
methods: SDKMethod[];
|
||||||
@@ -262,7 +265,7 @@ export async function getService(
|
|||||||
|
|
||||||
const data: Awaited<ReturnType<typeof getService>> = {
|
const data: Awaited<ReturnType<typeof getService>> = {
|
||||||
service: {
|
service: {
|
||||||
name: service as Service,
|
name: service as ServiceValue,
|
||||||
description: await getDescription(service)
|
description: await getDescription(service)
|
||||||
},
|
},
|
||||||
methods: []
|
methods: []
|
||||||
@@ -324,7 +327,7 @@ export async function getService(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const demo = await examples[path]();
|
const demo = (await examples[path]()) as unknown as string;
|
||||||
|
|
||||||
data.methods.push({
|
data.methods.push({
|
||||||
id: operation['x-appwrite'].method,
|
id: operation['x-appwrite'].method,
|
||||||
@@ -370,7 +373,7 @@ export function resolveReference(
|
|||||||
export const generateExample = (
|
export const generateExample = (
|
||||||
schema: OpenAPIV3.SchemaObject,
|
schema: OpenAPIV3.SchemaObject,
|
||||||
api: OpenAPIV3.Document<object>,
|
api: OpenAPIV3.Document<object>,
|
||||||
modelType: ModelType = ModelType.REST
|
modelType: ModelTypeValue = ModelType.REST
|
||||||
): object => {
|
): object => {
|
||||||
const properties = Object.keys(schema.properties ?? {}).map((key) => {
|
const properties = Object.keys(schema.properties ?? {}).map((key) => {
|
||||||
const name = key;
|
const name = key;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import MainFooter from '../../lib/components/MainFooter.svelte';
|
import MainFooter from '../../lib/components/MainFooter.svelte';
|
||||||
import Copy from './Copy.svelte';
|
import Copy from './Copy.svelte';
|
||||||
|
|
||||||
const title: 'Assets' + TITLE_SUFFIX;
|
const title: string = 'Assets' + TITLE_SUFFIX;
|
||||||
const description =
|
const description =
|
||||||
"This page features Appwrite's key brand assets including the logotype, colors, product visuals, and practical guidelines for their usage.";
|
"This page features Appwrite's key brand assets including the logotype, colors, product visuals, and practical guidelines for their usage.";
|
||||||
const ogImage = DEFAULT_HOST + '/images/open-graph/website.png';
|
const ogImage = DEFAULT_HOST + '/images/open-graph/website.png';
|
||||||
@@ -22,15 +22,20 @@
|
|||||||
COLORS: 'Brand colors',
|
COLORS: 'Brand colors',
|
||||||
VISUALS: 'Product visuals',
|
VISUALS: 'Product visuals',
|
||||||
CONTACT: 'Contact us'
|
CONTACT: 'Contact us'
|
||||||
} as const
|
} as const;
|
||||||
|
|
||||||
const getSectionId = (section: Section) => section.toLowerCase().replace(/\s/g, '-');
|
type SectionType = typeof Section;
|
||||||
|
|
||||||
let selectedMap: Map<Section, boolean> = new Map(
|
// To get the type of the values (union of string literals)
|
||||||
|
type SectionValues = SectionType[keyof SectionType];
|
||||||
|
|
||||||
|
const getSectionId = (section: SectionValues) => section.toLowerCase().replace(/\s/g, '-');
|
||||||
|
|
||||||
|
let selectedMap: Map<SectionValues, boolean> = new Map(
|
||||||
Object.values(Section).map((section) => [section, false])
|
Object.values(Section).map((section) => [section, false])
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleVisibility = (section: Section) => {
|
const handleVisibility = (section: SectionValues) => {
|
||||||
return (e: CustomEvent<boolean>) => {
|
return (e: CustomEvent<boolean>) => {
|
||||||
selectedMap.set(section, e.detail);
|
selectedMap.set(section, e.detail);
|
||||||
selectedMap = selectedMap;
|
selectedMap = selectedMap;
|
||||||
|
|||||||
Reference in New Issue
Block a user